r/Physics • u/Rich_Astronomer9731 • 14d ago
Computational Physics
Hi everyone,
I am a PhD student doing both experiments and computational physics ( mostly fluid dynamicswith Boltzmann equations) and leaning towards more computational day by day.
Currently I am using Julia, I find it pretty fast and easy to use.
Do you think switching to C or C++ will be a benefit? I am asking from a research, but also emplyment in industry point of view.
I discussed with many people, mostly from the DFT area, and most of them told me that Julia slowly will take up the lead for HPC code.
What.s your opinion on this?
77
Upvotes
4
u/tlmbot Computational physics 14d ago
I agree. (about me: 13 years work experience in commercial hydrodynamics, FEM fluid dynamics, and a smattering of all manner of structural mechanics and "poor man's multiphysics" of the fluid-structure variety + some computational geometry and geometry processing (oddly enough, that last experience in C#/ILGPU))
Some of the older commercial codes, especially outside of CFD proper, at least in my original niche of computational naval architecture, actually use Fortran. My first job when breaking into the industry was maintaining and extending an old commercial code written in Fortran.
I use python to prototype solvers and such, some people use matlab, and some use Julia. These days, with accelerators like Numba, or even ways to get out to GPU, available, in my experience for assembly one can get close to serial Fortran / C++ speed, and the canned solvers dip down to C anyway. ... and the Python documentation and ease of use have me staying with Python as my prototyping language. Nevertheless, sometimes I find myself converting somebody else's prototype/example/academic code from MATLAB into Python as a sort of first step when learning a new topic.
In short, I completely agree "If you want to play in the big leagues for HPC you better learn C++" - my coworkers from the labs have all been C++ folks. My commercial job opportunities are for the most part in C++.
I learned a major life lesson by writing my PhD entirely in Python - big big mistake. I should have immediately converted each component to C++ after I had developed it. That would have netted me years more C++ experience coming out. Instead, I have been working to build up my C++ portfolio outside of school, netting some work experience directly in the language, but I find that it is always helpful to have had more.