void ebamriTransport(const AMRParameters& a_params,
                     const ProblemDomain& a_coarsestDomain)
{

  // begin define INS solver
  CH_TIMERS("ebamriTransport_driver");
  CH_TIMER("define_ebamrnosubcycle_solver", t3);
  CH_TIMER("init_ebamrnosubcycle_solver",   t4);
  CH_TIMER("run ebamrnosubcycle_solver",   t5);

  // read inputs
  ParmParse pp;

  int flowDir;
  pp.get("flow_dir", flowDir);
  Vector<int> nCells;
  pp.getarr("n_cell",  nCells,0,SpaceDim);

  Real jet1inflowVel;
  pp.get("jet1_inflow_vel", jet1inflowVel);

  int idoJet2;
  pp.get("do_jet2", idoJet2);
  bool doJet2 = idoJet2==1;

  Real jet2inflowVel;
  pp.get("jet2_inflow_vel", jet2inflowVel);

  Real viscosity = 0.0;
  pp.get("viscosity", viscosity);

  int idoSlipWalls;
  pp.get("do_slip_walls", idoSlipWalls);
  bool doSlip = idoSlipWalls==1;
  IntVect doSlipWallsLo = idoSlipWalls*IntVect::Unit;
  IntVect doSlipWallsHi = idoSlipWalls*IntVect::Unit;
  Vector<int> slipWallsLo,slipWallsHi;
  if(doSlip)
    {
      pp.getarr("do_slip_walls_hi",slipWallsHi,0,SpaceDim);
      pp.getarr("do_slip_walls_lo",slipWallsLo,0,SpaceDim);
      for (int idir = 0; idir < SpaceDim; idir++)
        {
          doSlipWallsHi[idir] = slipWallsHi[idir];
          doSlipWallsLo[idir] = slipWallsLo[idir];
        }
    }

  int orderEBBC = 1;
  pp.query("order_ebbc", orderEBBC);

  bool doJet1PoiseInflow = false;
  pp.query("jet1_poiseuille_inflow", doJet1PoiseInflow);

  bool doJet2PoiseInflow = false;
  pp.query("jet2_poiseuille_inflow", doJet2PoiseInflow);

  bool initPoiseData = false;
  pp.query("poiseuille_init", initPoiseData);
  if(initPoiseData)  
  pout() << "Doing Poiseuille initialization" << endl;

  RefCountedPtr<PoiseuilleInflowBCValue> jet1PoiseBCValue;//make this BaseBCValue if also doing constant values
  RefCountedPtr<PoiseuilleInflowBCValue> jet2PoiseBCValue;

//  if(doPoiseInflow)
//    {
//      pout() << "Doing Poiseuille inflow" << endl;
      RealVect jet1centerPt, tubeAxis;
      Real jet1tubeRadius;
      Vector<Real> jet1centerPtVect, tubeAxisVect;
      pp.get("jet1_poise_profile_radius", jet1tubeRadius);
      pp.getarr("jet1_poise_profile_center_pt",  jet1centerPtVect,0,SpaceDim);
      pp.getarr("poise_profile_axis",       tubeAxisVect,0,SpaceDim);
      for (int idir = 0; idir < SpaceDim; idir++)
        {
          jet1centerPt[idir] = jet1centerPtVect[idir];
          tubeAxis[idir] = tubeAxisVect[idir];
        }

      Real maxVelFactor;//= 1.5 for planar geometry, = 2.0 for cylindrical
      pp.get("poise_maxvel_factor", maxVelFactor);
      Real jet1maxVel = maxVelFactor*jet1inflowVel;

      jet1PoiseBCValue = RefCountedPtr<PoiseuilleInflowBCValue>(new PoiseuilleInflowBCValue(jet1centerPt,tubeAxis,jet1tubeRadius,jet1maxVel,flowDir));
//    }

      RealVect jet2centerPt;
      Real jet2tubeRadius;
      Vector<Real> jet2centerPtVect;
      pp.get("jet2_poise_profile_radius", jet2tubeRadius);
      pp.getarr("jet2_poise_profile_center_pt",  jet2centerPtVect,0,SpaceDim);
      for (int idir = 0; idir < SpaceDim; idir++)
        {
          jet2centerPt[idir] = jet2centerPtVect[idir];
        }

      Real jet2maxVel = maxVelFactor*jet2inflowVel;

      jet2PoiseBCValue = RefCountedPtr<PoiseuilleInflowBCValue>(new PoiseuilleInflowBCValue(jet2centerPt,tubeAxis,jet2tubeRadius,jet2maxVel,flowDir));

  InflowOutflowIBCFactory ibc(flowDir,
                              doJet2,
                              jet1inflowVel,
                              jet2inflowVel,
                              orderEBBC,
                              doSlipWallsHi,
                              doSlipWallsLo,
                              doJet1PoiseInflow,
                              doJet2PoiseInflow,
                              initPoiseData,
                              jet1PoiseBCValue,
                              jet2PoiseBCValue);

  CH_START(t3);

  EBAMRNoSubcycle kahuna(a_params, ibc, a_coarsestDomain, viscosity);

  CH_STOP(t3);
  
  // end define INS solver

  // begin define transport solver
  
  // 1. setup the ibc  
  Real scalarInflowValue = 0.0;
  pp.get("scalar_inflow_value", scalarInflowValue);
  RefCountedPtr<EBScalarAdvectBCFactory> advectBCFact = 
    RefCountedPtr<EBScalarAdvectBCFactory>
    (new EBScalarAdvectBCFactory(flowDir, scalarInflowValue, jet2PoiseBCValue));

  EBAMRTransportParams transParams;
  // fillTransParams(transParams);

  bool scalSlopeLimiting = true;
  int ilimit;
  pp.get("limit_scal_slope", ilimit);
  scalSlopeLimiting = (ilimit==1);

  Real maxScalVal = 1.0;
  pp.get("max_scal_value", maxScalVal);

  Real minScalVal = 0.0;
  pp.get("min_scal_value", minScalVal);

  bool setScalMaxMin = true;
  int ilimit2;
  pp.get("set_scal_maxmin", ilimit2);
  setScalMaxMin = (ilimit2==1);

  int ifourth, iflatten, iartvisc;
  pp.get("scal_use_fourth_order_slopes", ifourth);
  pp.get("scal_use_flatten", iflatten);
  pp.get("scal_use_art_visc", iartvisc);

  bool useFourthOrderSlopes = (ifourth  == 1);
  bool useFlattening        = (iflatten == 1);
  bool useArtificialVisc    = (iartvisc == 1);

  RefCountedPtr<EBPhysIBCFactory> ibcFact = static_cast<RefCountedPtr<EBPhysIBCFactory> >(advectBCFact);

  RefCountedPtr<EBPatchTransportFactory> patchTransport = 
   RefCountedPtr<EBPatchTransportFactory>
   (new EBPatchTransportFactory(ibcFact, scalSlopeLimiting, maxScalVal, minScalVal, setScalMaxMin, useFourthOrderSlopes, useFlattening, useArtificialVisc));

  // 2. setup transport solver
  EBAMRTransportFactory transSolverFact(transParams, patchTransport, true);  
  // end define transport solver

  kahuna.defineExtraSolver(&transSolverFact);
  

  CH_START(t4);
  if (!pp.contains("restart_file"))
    {
      pout() << "starting fresh AMR run" << endl;
      kahuna.setupForAMRRun();
    }
  else
    {
      std::string restart_file;
      pp.get("restart_file",restart_file);
      pout() << " restarting from file " << restart_file << endl;
      kahuna.setupForRestart(restart_file);
    }
  CH_STOP(t4);

  int maxStep;
  pp.get("max_step", maxStep);

  Real stopTime = 0.0;
  pp.get("max_time",stopTime);

  CH_START(t5);

  Real fixedDt = 0.;
  pp.query("fixed_dt", fixedDt);
  if(fixedDt > 1.e-12)
    {
      kahuna.useFixedDt(fixedDt);
    }

  kahuna.run(stopTime, maxStep);

  CH_STOP(t5);

}
Exemple #2
0
void ebamrieuler(const AMRParameters& a_params,
                 const ProblemDomain& a_coarsestDomain)
{

  CH_TIMERS("ebamrins_driver");
  CH_TIMER("define_ebamrnosubcycle_solver", t3);
  CH_TIMER("init_ebamrnosubcycle_solver",   t4);
  CH_TIMER("run ebamrnosubcycle_solver",   t5);

  // read inputs
  ParmParse pp;

  int flowDir;
  pp.get("flow_dir", flowDir);
  Vector<int> nCells;
  pp.getarr("n_cell",  nCells,0,SpaceDim);

  Real inflowVel;
  pp.get("inflow_vel", inflowVel);

  Real viscosity = 0.0;
  pp.get("viscosity", viscosity);

  int idoSlipWalls;
  pp.get("do_slip_walls", idoSlipWalls);
  bool doSlip = idoSlipWalls==1;
  IntVect doSlipWallsLo = idoSlipWalls*IntVect::Unit;
  IntVect doSlipWallsHi = idoSlipWalls*IntVect::Unit;
  Vector<int> slipWallsLo,slipWallsHi;
  if (doSlip)
    {
      pp.getarr("do_slip_walls_hi",slipWallsHi,0,SpaceDim);
      pp.getarr("do_slip_walls_lo",slipWallsLo,0,SpaceDim);
      for (int idir = 0; idir < SpaceDim; idir++)
        {
          doSlipWallsHi[idir] = slipWallsHi[idir];
          doSlipWallsLo[idir] = slipWallsLo[idir];
        }
    }

  int orderEBBC = 1;
  pp.query("order_ebbc", orderEBBC);

  bool doPoiseInflow = false;
  pp.query("poiseuille_inflow", doPoiseInflow);

  bool initPoiseData = false;
  pp.query("poiseuille_init", initPoiseData);
  if (initPoiseData)  
  pout() << "Doing Poiseuille initialization" << endl;

  RefCountedPtr<PoiseuilleInflowBCValue> poiseBCValue;//make this BaseBCValue if also doing constant values
  if (doPoiseInflow)
    {
      pout() << "Doing Poiseuille inflow" << endl;
      RealVect centerPt, tubeAxis;
      Real tubeRadius;
      Vector<Real> centerPtVect, tubeAxisVect;
      pp.get("poise_profile_radius", tubeRadius);
      pp.getarr("poise_profile_center_pt",  centerPtVect,0,SpaceDim);
      pp.getarr("poise_profile_axis",       tubeAxisVect,0,SpaceDim);
      for (int idir = 0; idir < SpaceDim; idir++)
        {
          centerPt[idir] = centerPtVect[idir];
          tubeAxis[idir] = tubeAxisVect[idir];
        }

      Real maxVelFactor;//= 1.5 for planar geometry, = 2.0 for cylindrical
      pp.get("poise_maxvel_factor", maxVelFactor);
      Real maxVel = maxVelFactor*inflowVel;

      poiseBCValue = RefCountedPtr<PoiseuilleInflowBCValue>(new PoiseuilleInflowBCValue(centerPt,tubeAxis,tubeRadius,maxVel,flowDir));
    }

  bool doWomersleyInflow = false;
  pp.query("womersley_inflow", doWomersleyInflow);

  InflowOutflowIBCFactory ibc(flowDir,
                              inflowVel,
                              orderEBBC,
                              doSlipWallsHi,
                              doSlipWallsLo,
                              doPoiseInflow,
                              initPoiseData,
                              poiseBCValue,
                              doWomersleyInflow);

  CH_START(t3);

  EBAMRNoSubcycle kahuna(a_params, ibc, a_coarsestDomain, viscosity);

  CH_STOP(t3);

  CH_START(t4);
  if (!pp.contains("restart_file"))
    {
      pout() << "starting fresh AMR run" << endl;
      kahuna.setupForAMRRun();
    }
  else
    {
      std::string restart_file;
      pp.get("restart_file",restart_file);
      pout() << " restarting from file " << restart_file << endl;
      kahuna.setupForRestart(restart_file);
    }
  CH_STOP(t4);

  int maxStep;
  pp.get("max_step", maxStep);

  Real stopTime = 0.0;
  pp.get("max_time",stopTime);

  CH_START(t5);

  Real fixedDt = 0.;
  pp.query("fixed_dt", fixedDt);
  if (fixedDt > 1.e-12)
    {
      kahuna.useFixedDt(fixedDt);
    }

  kahuna.run(stopTime, maxStep);

  CH_STOP(t5);

}