I'm a physicist with a CS degree and just started my PhD at a tech company (wanted to do applied research). It deals with large scale finite element simulations.After reviewing their current approach, I think that a radically different method has to be applied (they are using a commercial tool which is very limited). I'd rather base my research on an open source finite element solver and write a program which makes use of it. I'd like to develop this idea in the evenings, because that's the time that best suits me for programming (during the day I prefer reading and maths) and use it at a late stage of my PhD. I'd like to have the option to release my program as open source on my website as a reference, for future personal or even commercial (e.g. consulting) use. How can I make sure that my company doesn't claim the code ownership?I thought that a version control system could help (check out only in the evening). This would document that I programmed not during regular office hours (documented elsewhere). But these data can be easily manufactured. Any other ideas? I want to stress that I'm not interested in selling software and neither is my company.Very interesting responses so far. This clearly helps me. Some remarks:I'm not restrained by my work contract. National law says that the company owns anything I produce during working hours and no special agreement has been made (my employer is not selling software and may be a bit naive on this side). They mostly use software and non of my colleagues is a serious programmer.Secondly, I need to rethink the point raised by @Mark about trade secrets. This is quite serious in the particular industry.Thirdly, I care a lot about no to upset my supervisor/ boss. But, and this is the motivation for this question, I'd like to keep the innovative part of my work a bit separated so I can reuse it or at least demonstrate it as a reference work. 
How can I make sure my evening project code is mine?
open source;licensing;product owner
Don't listen to anyone who says your own time is your own time, just don't tell anyone! because that's incredibly bad advice that is almost certain to land you in trouble, if not at your current job then at some future one.  Not only do employment contracts vary too widely and significantly for any kind of generic advice to be useful, but different countries (including in the EU) or even different states within a single country (US) have different rules regarding how much of your work an employer owns, and even if you think you're on safe ground you can still get sued regardless, depending on how annoyed your employer is.  Who has the deeper pockets for legal fees, you or your employer?  I thought so.  Get permission first and get it in writing, so that your butt is covered should it become an issue later (even years later, with some completely different set of management who suddenly freaks out over what the previous management was totally relaxed about - you can't predict the future!)