Add ANARCHY-DU and refactor `hydro_properties.c`
This MR does two things:
- Adds ANARCHY-DU, a variant of the ANARCHY scheme with higher (default) thermal diffusion but based on Density-Energy SPH
- Re-factors
hydro_properties.c
. The ANARCHY-DU scheme requires different defaults than the ANARCHY-PU and PressureEnergyMorris schemes so I thought it was time to break these defaults out into a file on their own. Each directory insrc/hydro
now has it's ownsrc/hydro/*/hydro_defaults.h
which contains:- Default parameters for AV, and diffusion,
- The
const_viscosity_beta
value is defined here as it differs for thePlanetary
scheme @jkeger - A new constant,
hydro_props_default_viscosity_alpha_feedback_reset
is made available such that particles can have their AV value reset after a feedback event. For constant AV schemes, this is the same as the default artificial viscosity parameter, but for variable schemes this is set to the maximal AV.
This second change allows a number of #ifdef's throughout the code to be removed and provides a solution to #576 (closed).
I also had to re-factor the Default
scheme to get it to compile with these changes as it used a random constant in const.h
that I removed. Now in that scheme the diffusion alpha is a particle-carried property read from SPH:diffusion_alpha
. Also, the documentation was updated for a number of schemes that was still the same as their parent.
I've tested this on the 1D sod for all schemes, and they all compile and pass this (apart from Default
but that never works anyway...)
I know that this MR touches way too many files, but that was unavoidable given that I was refactoring every scheme.
Merge request reports
Activity
added 1 commit
- 8d5f7091 - Added new hydro_defaults.h files to src/Makefile.am
Also, can the constants not used in a given scheme be removed from the headers? For instance the gizmo header does not need the viscosity terms. Or the gadget header does not need the diffusion and variable visosity constants. Makes the whole thing easier to maintain as we don't have unused constants to worry about.
I suppose those changes would be:
For each scheme, rename the
hydro_defaults.h
file tohydro_parameters.h
(?)Add two structs to that file
struct viscosity_global_data { float alpha; ... } struct diffusion_global_data { float alpha; ... }
Add a function for each scheme to
hydro.h
(it may make more sense to keep this inhydro_parameters.h
, but that breaks with e.g. the chemistry convention)static INLINE void hydro_init_backend(struct swift_params* parameter_file, const struct unit_system* us, const struct phys_const* phys_const, struct viscosity_global_data* viscosity, struct diffusion_global_data* diffusion) { ... /* Do the reading from the parameter file here */ ...
Include that struct in
hydro_properties.h
and stick them where the currentviscosity
anddiffusion
structs are.Add to
hydro_properties.c
a call tohydro_init_backend
.Thoughts?
Edited by Josh BorrowJust to clarify, you mean:
-
hydro_parameters.h
contains:-
viscosity_global_data
struct, which is included inside the globalhydro_properties
-
diffusion_global_data
struct, which is included inside the globalhydro_properties
-
viscosity_init
that sets the parameters in theviscosity_global_data
struct -
diffusion_init
that sets the parameters in thediffusion_global_data
struct - Global defaults and other
#ifdef
s
-
-
hydro.h
contains:-
hydro_init_backend
that callsviscosity_init
anddiffusion_init
, which is then itself called insidehydro_properties.c
-
-