@@ -47,8 +47,6 @@ Real Tbot, xtra, ptra, Ttop_tau, Tbot_tau, Trabot_tau;
4747std::string met;
4848bool use_mini, use_mini_ic, use_tra_ic, fix_bot_tra;
4949
50- Real p0 = 1 .e5 ;
51-
5250// 'OH','H2','H2O','H','CO','CO2','O','CH4','C2H2','NH3','N2','HCN', 'He'
5351std::vector<double > vmass = {17.01 , 2.02 , 18.02 , 1.01 , 28.01 , 44.01 , 16 .,
5452 16.05 , 26.04 , 17.04 , 28.02 , 27.03 , 4 .};
@@ -81,7 +79,7 @@ void MeshBlock::UserWorkBeforeOutput(ParameterInput *pin) {
8179 auto temp = get_temp (pimpl->peos , w);
8280 auto pres = get_pres (w);
8381 auto chi = (get_gammad () - 1 .) / get_gammad ();
84- auto theta = temp * pow (p0 / pres, chi);
82+ auto theta = temp * pow (P0 / pres, chi);
8583
8684 auto temp_a = temp.accessor <Real, 3 >();
8785 auto theta_a = theta.accessor <Real, 3 >();
@@ -316,20 +314,25 @@ torch::Tensor setup_moist_adiabatic_profile(std::string infile) {
316314}
317315
318316void MeshBlock::ProblemGenerator (ParameterInput *pin) {
317+ // auto infile = pin->GetString("problem", "config_file");
318+ // auto w = setup_moist_adiabatic_profile(infile)
319+
319320 srand (Globals::my_rank + time (0 ));
320321
321322 // thermodynamic constants
322323 Real gamma = pin->GetReal (" hydro" , " gamma" );
323- auto mud = kintera::species_weights[0 ];
324- auto Rd = kintera::constants::Rgas / mud;
324+ Real Rd = pin->GetReal (" hydro" , " Rd" );
325325 Real cp = gamma / (gamma - 1 .) * Rd;
326+ std::cout << " Rd = " << Rd << " , cp = " << cp << std::endl;
326327
327328 // set up an adiabatic atmosphere
328329 int max_iter = 400 , iter = 0 ;
329330 Real Ttol = pin->GetOrAddReal (" problem" , " init_Ttol" , 0.01 );
330331
331332 // estimate surface temperature and pressure
332333 auto x1min = pcoord->x1f (is);
334+ auto x1max = pcoord->x1f (ie + 1 );
335+
333336 Real Ts = T0 - grav / cp * x1min;
334337 Real Ps = P0 * pow (Ts / T0, cp / Rd);
335338
@@ -340,17 +343,19 @@ void MeshBlock::ProblemGenerator(ParameterInput *pin) {
340343 Real x1 = pcoord->x1v (i);
341344 Real x2 = pcoord->x2v (j);
342345 Real x3 = pcoord->x3v (k);
343- Real temp = Ts - grav * x1 / cp;
344- phydro->w (IPR, k, j, i) = p0 * pow (temp / Ts , cp / Rd);
346+ Real temp = T0 - grav * x1 / cp;
347+ phydro->w (IPR, k, j, i) = P0 * pow (temp / T0 , cp / Rd);
345348 phydro->w (IDN, k, j, i) = phydro->w (IPR, k, j, i) / (Rd * temp);
346- phydro->w (IVX, k, j, i) = phydro-> w (IVY, k, j, i) = 0 . ;
349+ phydro->w (IVX, k, j, i) = 0.001 * ( 1 . * rand () / RAND_MAX - 0.5 ) ;
347350 }
348351
349352 auto temp = get_temp (pimpl->peos , phydro->w );
350353 auto temp_a = temp.accessor <Real, 3 >();
351354
352355 Tbot = temp_a[ks][js][is];
353356
357+ std::cout << " ptra = " << ptra << " Pa" << std::endl;
358+
354359 if (NCHEM > 0 ) {
355360 if (use_mini_ic) {
356361 // minichem initialize conserved variables
0 commit comments