A lot would depend on when in 1940 and your nationality. If from a neutral country, say the USA, with the correct paperwork, prior to the German invasion of France, I would assume you could travel from Germany into France, then to Portugal in not too long a time on standard trains. Though going through Switzerland, would maybe be even quicker, in fact most likely normal train travelling times. I believe a number of Americans were still travelling around Europe, fairly un-hassled. Once France had surrendered, again I believe it would be possible, though perhaps a bit more fraught. Remember the US did not enter the War until December 1941.
Sorry I can't be of more help, good luck with your project.
P.S. you could even travel via Holland and Belgium in the early part of the year. Really it all depended on who you were and where you were from. As for times of trains, you could use the present day train times as a guide, altering them slightly for speed/distance travelled. It depends on how much detail you are going to use.