STEllAR-GROUP / octotiger

Astrophysics program simulating the evolution of star systems based on the fast multipole method on adaptive Octrees
http://octotiger.stellar-group.org/
Boost Software License 1.0
48 stars 18 forks source link

Eos ideal rad #410

Closed shibersag closed 2 years ago

shibersag commented 2 years ago

Addition of a new equation of state (eos) that includes a pressure term from radiation at thermal equilibrium

Fixes issue #402, by incorporating a new eos (other than the currently available IDEAL, and WD eoss) of ideal gas plus radiation in Octo-Tiger, assuming a thermal equilibrium between gas and matter (i.e., both matter and radiation have the same temperature). This new eos is being used when the runtime parameter 'eos' is set to 'ipr' (or 2).

The main change was to add a Newton-Raphson scheme for the computation of the temperature from the internal energy and to derive the pressure and sound speed when needed from this temperature.

As a result of the new pressure term, the dual-energy formalism is not valid anymore and the dual-energy formalism is in fact eliminated when the ipr eos is being used. This has two implications: 1) The tau variable is not used as the entropy tracer and instead is exploited to store the computed temperature. 2) A floor value is needed to avoid negative internal energy values.

The following four runtime parameters was added for the implementation of the ipr eos (default values in brackets): ipr_nr_tol(1.48e-08) - the allowable error in solving the temperature in the Newton-Raphson scheme. ipr_nr_maxiter(50) - the maximal number of iterations allowed for achieving the specified tolerance. ipr_test(false) - whether to test the consistency of the computed thermal quantities in each time step. Enabling it is good for testing but cost in performance. ipr_eint_floor(0.0) - the minimal allowed value for the internal energy. Has to be specified to some small number according to the problem simulated. This replace in some sense the tau_floor runtime parameter which is basically ignored in runs with ipr eos.

--

In addition, unrelated directly to this eos, but useful in the same context of simulating massive stars, this PR also adds the following new runtime parameter to replace the hard-coded 1e-12 value used for the minimal density (floor density) at the SCF stage: scf_rho_floor(1e-12) - scf density floor.

--

Important note: the ipr eos is not used at the SCF stage. At the termination of the SCF, the internal energy is adjusted to match the pressure values calculated according to the SCF, which during the SCF itself are calculated assuming a polytropic relation but at the evolution of the simulation (after the SCF) are calculated according to the ipr eos.

Important note 2: although this new eos has successfully passed some basic tests (like self-consistency of temperature, pressure, internal energy and density), it is not very well tested yet and hence is quite experimental in its current state.

Important note 3: the current implementation works on cpus only. An error message appears when trying to run a simulation with ipr eos on devices.

diehlpk commented 2 years ago

@G-071 and @dmarce1 could you please review this soon, so we can do the new release?