|
|
The work-in-progress implementation (on the `planetary` branch) of allowing different "gas" particles to have different equations of state, as well as the addition of more complex equations of state like iron and rock for planetary simulations such as giant impacts.
|
|
|
To allow different SPH particles to have different equations of state (EOS), as well as the addition of more complex EOS like iron and rock for planetary simulations such as giant impacts.
|
|
|
|
|
|
Also serves as a crude guide to implementing any new hydro scheme or new EoS.
|
|
|
Also serves as a quick guide to implementing any new hydro scheme or new EOS.
|
|
|
|
|
|
Status
|
|
|
------
|
|
|
* General structure implemented but as yet incomplete and untested.
|
|
|
======
|
|
|
|
|
|
New Hydro Scheme
|
|
|
----------------
|
|
|
* Implemented general EOS and hydro structure
|
|
|
* Added Tillotson EOS
|
|
|
* Added Hubbard & MacFarlane (1980) EOS
|
|
|
* (WIP) Added ANEOS
|
|
|
* (WIP) Added SESAME EOS
|
|
|
|
|
|
Create the `Minimal Multi Mat` hydro scheme; a copy of `Minimal` with added bits to allow multiple materials:
|
|
|
* Create `src/hydro/MinimalMultiMat/`, starting with a copy of `Minimal`.
|
|
|
* `src/hydro/MinimalMultiMat/*.h`: Rename the header include guards appropriately.
|
|
|
* `configure.ac`: Add the new `--with-hydro` option `minimal-multi-mat` like the existing ones.
|
|
|
* Similarly, add like the other shemes to: `src/debug.c`, `src/hydro.h`, `src/hydro_io.h`, and `src/part.h`.
|
|
|
Hydro Scheme
|
|
|
============
|
|
|
|
|
|
New Equation(s) of State
|
|
|
------------------------
|
|
|
Create the `Minimal Multi Mat` hydro scheme; a copy of `Minimal` with added bits to allow multiple materials.
|
|
|
|
|
|
Add the Tillotson analytic equation of state with multiple different material parameters to choose from:
|
|
|
* Create `src/equation_of_state/tillotson/`, starting with a copy of `ideal_gas`.
|
|
|
* `configure.ac`: Add the new `--with-equation-of-state` option `tillotson` like the existing ones.
|
|
|
* Simlarly, add like the other EoS options to `src/equation_of_state.h`.
|
|
|
New Scheme
|
|
|
----------
|
|
|
|
|
|
In `src/equation_of_state/tillotson/equation_of_state.h`:
|
|
|
* Modify the header include guard, `eos_print()`, and `eos_print_snapshot()` appropriately.
|
|
|
* For now, set all functions apart from P(rho, u) and c_s(rho, u) to return 0 since we're using minimal SPH to start with.
|
|
|
* Add the Tillotson equations to `gas_pressure_from_internal_energy()` and (NOT DONE YET) `gas_soundspeed_from_internal_energy()`.
|
|
|
* Create the `Til_params` struct to contain the relevant material parameters.
|
|
|
* For each material (iron, granite, and water so far), add a corresponding `Til_params` struct to the `eos_parameters` struct, and define a function e.g. `set_Til_iron()` to set the values.
|
|
|
* `eos_init()`: Call all the setting functions so all the parameters for each material in `eos_parameters` are set, e.g. `set_Til_iron(e->Til_iron);`.
|
|
|
* Create `enum material_id{}` list of material identifier flags to allow for multiple materials...
|
|
|
* Create `src/hydro/MinimalMultiMat/`, starting with a copy of `Minimal`.
|
|
|
* `src/hydro/MinimalMultiMat/*.h`: Rename the header include guards appropriately.
|
|
|
* `configure.ac`: Add the new `--with-hydro` option `minimal-multi-mat` like the existing ones.
|
|
|
* `src/debug.c`, `src/hydro.h`, `src/hydro_io.h`, `src/part.h`: Similarly add like the other hydro schemes.
|
|
|
|
|
|
Multiple Materials
|
|
|
------------------
|
|
|
|
|
|
Add a new integer flag particle property to identify the material of every particle:
|
|
|
* `src/hydro/MinimalMultiMat/hydro_part.h`: add `material_id mat_id;` to the `part` struct, where `enum material_id` is currently defined in `src/equation_of_state/tillotson/equation_of_state.h`.
|
|
|
* `src/hydro/MinimalMultiMat/hydro_part.h`: add `material_id mat_id;` to the `part` struct, where `enum material_id` is defined in `src/equation_of_state/planetary/equation_of_state.h` (see below).
|
|
|
* `src/hydro/MinimalMultiMat/hydro_debug.h`: Add the `p->mat_id` integer to `hydro_debug_particle()`.
|
|
|
* `src/hydro/MinimalMultiMat/hydro_io.h`: Add `mat_id` to `hydro_read_particles()` and `hydro_write_particles()`.
|
|
|
|
|
|
Use the material ID flag with the EoS:
|
|
|
* `src/hydro/MinimalMultiMat/hydro.h`: Add `p->mat_id` as a third argument (after e.g. `denisty` and `u`) to all the equation of state functions, and to the functions themselves in `src/equation_of_state/tillotson/equation_of_state.h`. Here set the type `int` rather than `material_id` for generality.
|
|
|
* `src/equation_of_state/tillotson/equation_of_state.h`: In the EoS functions, declare a new `Til_params *mat` struct pointer then use a switch case to select which material's parameters to point it at and use in the equations.
|
|
|
Use the material ID flag with the EOS:
|
|
|
* `src/hydro/MinimalMultiMat/hydro.h`: Add `p->mat_id` as a third argument (after e.g. `density` and `u`) to all the EOS functions.
|
|
|
|
|
|
|
|
|
Equations of State
|
|
|
==================
|
|
|
|
|
|
Add the `planetary` equation of state option, to contain a variety of EOS types each with various materials to choose from.
|
|
|
|
|
|
New EOS
|
|
|
-------
|
|
|
|
|
|
* Create `src/equation_of_state/planetary/`, starting with a copy of `ideal_gas`.
|
|
|
* `configure.ac`: Add the new `--with-equation-of-state` option `planetary` like the existing ones.
|
|
|
* `src/equation_of_state.h`: Simlarly, add like the other EOS options.
|
|
|
* `src/equation_of_state/planetary/equation_of_state.h`: Modify the header include guard, `eos_print()`, and `eos_print_snapshot()` strings appropriately.
|
|
|
* `src/equation_of_state/planetary/equation_of_state.h`: Add `p->mat_id` as a third argument (after e.g. `density` and `u`) to all the EOS functions (see above).
|
|
|
|
|
|
Multiple Materials
|
|
|
------------------
|
|
|
|
|
|
Each EOS type has its functions defined in its own header file, as well as the different parameters for each material of that type. The main `planetary` header then uses `switch` statements with a particle's `mat_id` to choose which EOS function to call.
|
|
|
|
|
|
In each specific EOS type header, e.g. Tillotson in `src/equation_of_state/planetary/tillotson.h`:
|
|
|
* Define `struct Til_params` to contain all the relevant material parameters for the EOS, such as characteristic energies or table parameters.
|
|
|
* Define a function to set these parameters' values for each specific material, e.g. `INLINE static void set_Til_iron(struct Til_params *mat, int mat_id)` for Tillotson iron. This also sets the material ID when the function is called by `eos_init()` (see below).
|
|
|
* Similarly, define a function to convert the parameter values into internal units, e.g. `INLINE static void convert_units_Til(struct Til_params *mat, const struct unit_system* us)`
|
|
|
* Now define the actual EOS functions, one for each in the main `equation_of_state.h`. Add a prefix to the name, e.g. `Til_` for Tillotson. Instead of taking the `mat_id` flag as the third argument, take (a pointer to) the actual material struct, e.g. `INLINE static float Til_internal_energy_from_entropy(float density, float entropy, struct Til_params *mat)`
|
|
|
|
|
|
In `src/equation_of_state/planetary/equation_of_state.h`:
|
|
|
* `eos_parameters`: Declare the parameter structures for each material of each EOS type, e.g. `struct Til_params Til_iron;`.
|
|
|
* `enum type_id` and `type_factor` assign a base ID for each EOS type.
|
|
|
* `enum material_id` then lists the material ID flags, using the base `type_id * type_factor` value with an extra unit addition for each material of every EOS type.
|
|
|
* `eos_init()`: Call the functions to set the parameter values for each material of each EOS type and convert them to the internal units, e.g. `set_Til_iron(&e->Til_iron, id_Til_iron);` and `convert_units_Til(&e->Til_iron, us);`.
|
|
|
* In each EOS function, use `switch ((int) (mat_id / type_factor))` to select the base EOS type of the material using its `mat_id`.
|
|
|
* For the selected EOS type, e.g. `case type_Til:`, declare a material parameter struct (pointer) of the relevant type, e.g. `struct Til_params *mat_Til;`, then use `switch(mat_id)` to select and point to the right material. e.g. `case id_Til_iron: mat_Til = &eos.Til_iron;`.
|
|
|
* Call the EOS function, passing the input arguments and the material pointer, e.g. `u = Til_internal_energy_from_entropy(density, entropy, mat_Til);`, and return the value.
|
|
|
|
|
|
|
|
|
To Do (Other than all the testing and fixing etc.)
|
|
|
--------------------------------------------------
|
|
|
To Do
|
|
|
=====
|
|
|
|
|
|
* Add more equations of state (most of which will be read from tables).
|
|
|
* Integrate with more/all hydro schemes (careful with EoS that e.g. don't include entropy).
|
|
|
* Integrate with more/all hydro schemes
|
|
|
* (Not any time soon) Try SPH-modifying schemes to improve interactions of different-material particles.
|
|
|
|