After receiving his D. Sc. in physics from Humboldt University of Berlin in Berlin , Germany in 1938 , Peterlin accepted in 1939 the chair as a professor of physics at the University of Ljubljana , where he remained for 22 years .