I'm working on a code that implements smoothed particle hydrodynamics (SPH) method for solving the equations of magnetohydrodynamics (MHD) with self-gravity.
In research papers regarding existing software the authors sometimes mention storing computational values in "code units" as opposed to physical units. Also, some test problems are given with initial conditions without units like "M = 1" (total mass; I'm assuming here that this means 1 [unit-of-mass] in code units).
Specifically, in gravitational hydrodynamics the gravitational constant may be set simply as 1; in MHD the permeability of free space constant can be set as 1.
From my understanding this means that all physical values need to be scaled accordingly to give us the same initial conditions represented in code units.
For example, if we have a sphere of gas of radius R_phys = 1e16 [cm] we would have to scale it to get
R_code = a * R_phys = x [length],
where a
is some constant relating physical units of length and code units.
But this doesn't require any changes in the physical equations, right? We're supposed to simply define the gravitational constant and permeability of free space as unity and all we have to worry about is scaling of all physical values to correctly represent a specific test problem given in physical units? (Oh, and of course, we would need to scale code units back to physical if we want to compare the simulation results with some observational data).
Let's say that I don't care about taking a specific test problem (given in physical units) and I just set the gravitational constant and permeability of free space as unity. Let's say that I set domain range as 1 [length] and total mass as 1 [mass] (which would give certain value of gravitational energy for the gas cloud). And from there I set initial temperature/pressure, strength of magnetic field and angular velocity just by estimating the ratios of corresponding energies to the gravitational energy (to relate it to physical problems with known ranges of those "energy" parameters).
Note: from my understanding, storing physical values in code units is not important since modern compilers can handle operating with values of great range (specifically for my simulations, particle density can be of order $10^{-17}$ g/cm^3 while, say, magnetic field is ~ $10^{-6}$ gauss, etc.); however I'm not sure about this, and overall it would be better to have all values stored in code units.