Skip to content

Commit

Permalink
make Gconst a runtime parameter with a default value
Browse files Browse the repository at this point in the history
  • Loading branch information
Piyush Sharda committed Aug 4, 2023
1 parent b990f17 commit c8ac6fd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/RadhydroSimulation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ template <typename problem_t> class RadhydroSimulation : public AMRSimulation<pr

amrex::Long radiationCellUpdates_ = 0; // total number of radiation cell-updates

amrex::Real Gconst_ = 1.0; // gravitational constant G (code units)
amrex::Real Gconst_ = C::Gconst; // gravitational constant G

// member functions
explicit RadhydroSimulation(amrex::Vector<amrex::BCRec> &BCs_cc, amrex::Vector<amrex::BCRec> &BCs_fc) : AMRSimulation<problem_t>(BCs_cc, BCs_fc)
Expand Down Expand Up @@ -316,6 +316,12 @@ template <typename problem_t> void RadhydroSimulation<problem_t>::readParmParse(
hpp.query("artificial_viscosity_coefficient", artificialViscosityK_);
}

// set gravity runtime parameter
{
amrex::ParmParse hpp("gravity");
hpp.query("Gconst", Gconst_);
}

// set cooling runtime parameters
{
amrex::ParmParse hpp("cooling");
Expand Down
2 changes: 2 additions & 0 deletions tests/StarCluster.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ cfl = 0.2
max_timesteps = 300
stop_time = 0.5 # t_ff = 0.55

gravity.Gconst = 1.0 #gravitational constant

do_reflux = 1
do_subcycle = 0

Expand Down
2 changes: 2 additions & 0 deletions tests/StarCluster_AMR.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ cfl = 0.2
max_timesteps = 10000
stop_time = 0.5 # t_ff = 0.55

gravity.Gconst = 1.0 #gravitational constant

do_reflux = 1
do_subcycle = 0

Expand Down

0 comments on commit c8ac6fd

Please sign in to comment.