Commit 1aa9092e authored by Oliver Zier's avatar Oliver Zier
Browse files

Add new swtich for entropy in ICs

parent e1df7dda
...@@ -109,6 +109,7 @@ DOUBLEPRECISION=1 # if activated and set to 1, use d ...@@ -109,6 +109,7 @@ DOUBLEPRECISION=1 # if activated and set to 1, use d
#---------------------------------------- Output/Input options #---------------------------------------- Output/Input options
INITIAL_CONDITIONS_CONTAIN_ENTROPY
#OUTPUT_VELOCITY_GRADIENT # output velocity gradients #OUTPUT_VELOCITY_GRADIENT # output velocity gradients
#OUTPUT_PRESSURE # output gas pressure #OUTPUT_PRESSURE # output gas pressure
#OUTPUT_ENTROPY # output gas entropy #OUTPUT_ENTROPY # output gas entropy
......
...@@ -598,6 +598,12 @@ formulation. This is only useful if `PRESSURE_ENTROPY_SPH` is used. ...@@ -598,6 +598,12 @@ formulation. This is only useful if `PRESSURE_ENTROPY_SPH` is used.
------- -------
**INITIAL_CONDITIONS_CONTAIN_ENTROPY**
The intial conditions file contains entropy instead of the thermal energy.
------
**GAMMA** = 1.4 **GAMMA** = 1.4
Sets the equation of state index in the ideal gas law that is normally Sets the equation of state index in the ideal gas law that is normally
...@@ -871,7 +877,6 @@ you need to increase `NUMBER_OF_MPI_LISTENERS_PER_NODE`. ...@@ -871,7 +877,6 @@ you need to increase `NUMBER_OF_MPI_LISTENERS_PER_NODE`.
Output/Input options {#io} Output/Input options {#io}
==================== ====================
**POWERSPEC_ON_OUTPUT** **POWERSPEC_ON_OUTPUT**
Creates a power spectrum measurement for every output time, i.e. for Creates a power spectrum measurement for every output time, i.e. for
......
...@@ -97,7 +97,6 @@ struct global_data_all_processes : public parameters ...@@ -97,7 +97,6 @@ struct global_data_all_processes : public parameters
double InitGasU; /**< the same, but converted to thermal energy per unit mass */ double InitGasU; /**< the same, but converted to thermal energy per unit mass */
double MinEgySpec; /**< the minimum allowed temperature expressed as energy per unit mass */ double MinEgySpec; /**< the minimum allowed temperature expressed as energy per unit mass */
int FlagICsContainedEntropy;
/* some force counters */ /* some force counters */
......
...@@ -415,11 +415,14 @@ void snap_io::read_ic(const char *fname) ...@@ -415,11 +415,14 @@ void snap_io::read_ic(const char *fname)
Sp->NumPart += add_numpart; Sp->NumPart += add_numpart;
#endif #endif
All.FlagICsContainedEntropy = 0;
#ifdef GADGET2_HEADER #ifdef GADGET2_HEADER
if(header.flag_entropy_instead_u) #ifndef INITIAL_CONDITIONS_CONTAIN_ENTROPY
All.FlagICsContainedEntropy = 1; if(header.flag_entropy_instead_u) Terminate("Initial condition file contains entropy, but INITIAL_CONDITIONS_CONTAIN_ENTROPY is not set\n");
#else
if(! header.flag_entropy_instead_u)Terminate("Initial condition file contains uthermal, but INITIAL_CONDITIONS_CONTAIN_ENTROPY is set\n");
#endif
#endif #endif
TIMER_STOP(CPU_SNAPSHOT); TIMER_STOP(CPU_SNAPSHOT);
......
...@@ -129,7 +129,6 @@ void sim::init(int RestartSnapNum) ...@@ -129,7 +129,6 @@ void sim::init(int RestartSnapNum)
Mem.myfree(tmp); Mem.myfree(tmp);
All.FlagICsContainedEntropy = 0;
int count = 0; int count = 0;
for(int i = 0; i < Sp.NumPart; i++) for(int i = 0; i < Sp.NumPart; i++)
...@@ -477,15 +476,16 @@ void sim::init(int RestartSnapNum) ...@@ -477,15 +476,16 @@ void sim::init(int RestartSnapNum)
* Once the density has been computed, we can convert to entropy. * Once the density has been computed, we can convert to entropy.
*/ */
#ifdef PRESSURE_ENTROPY_SPH #ifdef PRESSURE_ENTROPY_SPH
if(All.FlagICsContainedEntropy == 0) #ifndef INITIAL_CONDITIONS_CONTAIN_ENTROPY
NgbTree.setup_entropy_to_invgamma(); NgbTree.setup_entropy_to_invgamma();
#endif
#endif #endif
double mass = 0; double mass = 0;
for(int i = 0; i < Sp.NumGas; i++) for(int i = 0; i < Sp.NumGas; i++)
{ {
if(All.FlagICsContainedEntropy == 0) #ifndef INITIAL_CONDITIONS_CONTAIN_ENTROPY
{
if(ThisTask == 0 && i == 0) if(ThisTask == 0 && i == 0)
printf("INIT: Converting u -> entropy\n"); printf("INIT: Converting u -> entropy\n");
...@@ -493,8 +493,8 @@ void sim::init(int RestartSnapNum) ...@@ -493,8 +493,8 @@ void sim::init(int RestartSnapNum)
Sp.SphP[i].Entropy = GAMMA_MINUS1 * Sp.SphP[i].Entropy / pow(Sp.SphP[i].Density * All.cf_a3inv, GAMMA_MINUS1); Sp.SphP[i].Entropy = GAMMA_MINUS1 * Sp.SphP[i].Entropy / pow(Sp.SphP[i].Density * All.cf_a3inv, GAMMA_MINUS1);
#endif #endif
Sp.SphP[i].EntropyPred = Sp.SphP[i].Entropy; Sp.SphP[i].EntropyPred = Sp.SphP[i].Entropy;
}
#endif
/* The predicted entropy values have been already set for all SPH formulation */ /* The predicted entropy values have been already set for all SPH formulation */
/* so it should be ok computing pressure and csound now */ /* so it should be ok computing pressure and csound now */
Sp.SphP[i].set_thermodynamic_variables(); Sp.SphP[i].set_thermodynamic_variables();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment