void AdaptiveTimeSteppingOptions::parse_options(const GetPot& input, const std::string& section)
  {
    // If the user set the target tolerance, for them to set the other values too
    if( input.have_variable(section+"/target_tolerance") )
      {
        if( !input.have_variable(section+"/upper_tolerance") )
          libmesh_error_msg("ERROR: Must specify "+section+"/upper_tolerance for adaptive time stepping!");

        if( !input.have_variable(section+"/max_growth") )
          libmesh_error_msg("ERROR: Must specify "+section+"/max_growth for adaptive time stepping!");
      }

    _target_tolerance = input(section+"/target_tolerance", 0.0 );
    _upper_tolerance = input(section+"/upper_tolerance", 0.0 );
    _max_growth = input(section+"/max_growth", 0.0 );

    // parse component_norm
    const unsigned int n_component_norm =
      input.vector_variable_size(section+"/component_norm");

    for (unsigned int i=0; i != n_component_norm; ++i)
      {
        const std::string current_norm = input(section+"/component_norm", std::string("L2"), i);
        _component_norm.set_type(i, libMesh::Utility::string_to_enum<libMesh::FEMNormType>(current_norm) );
      }
  }
示例#2
0
  ElasticMembraneConstantPressure::ElasticMembraneConstantPressure( const GRINS::PhysicsName& physics_name, const GetPot& input )
    : ElasticMembraneAbstract(physics_name,input),
      _pressure(0.0)
  {
    if( !input.have_variable("Physics/"+physics_name+"/pressure") )
      {
        std::cerr << "Error: Must input pressure for "+physics_name+"." << std::endl
                  << "       Please set Physics/"+physics_name+"/pressure." << std::endl;
        libmesh_error();
      }

    this->set_parameter
      (_pressure, input, "Physics/"+physics_name+"/pressure", _pressure );

    // If the user specified enabled subdomains in this Physics section,
    // that's an error; we're slave to ElasticMembrane.
    if( input.have_variable("Physics/"+PhysicsNaming::elastic_membrane_constant_pressure()+"/enabled_subdomains" ) )
      libmesh_error_msg("ERROR: Cannot specify subdomains for "
                        +PhysicsNaming::elastic_membrane_constant_pressure()
                        +"! Must specify subdomains through "
                        +PhysicsNaming::elastic_membrane()+".");

    this->parse_enabled_subdomains(input,PhysicsNaming::elastic_membrane());

    if( this->_disp_vars.dim() != 3 )
      libmesh_error_msg("ERROR: ElasticMembraneConstantPressure only valid for three dimensions! Make sure you have three components in your Displacement type variable.");
  }
  PressureContinuationSolver::PressureContinuationSolver( const GetPot& input )
    : SteadySolver(input)
  {
    if( !input.have_variable("SolverOptions/PressureContinuation/final_pressure") )
      {
        std::cerr << "Error: Did not find final_pressure value for PressureContinuationSolver" << std::endl
                  << "       Must specify SolverOptions/PressureContinuation/final_pressure" << std::endl;
        libmesh_error();
      }
    libMesh::Real final_pressure_value = input("SolverOptions/PressureContinuation/final_pressure", 0.0);

    libMesh::Real initial_pressure_value = input("SolverOptions/PressureContinuation/initial_pressure", 0.0);



    if( !input.have_variable("SolverOptions/PressureContinuation/n_increments") )
      {
        std::cerr << "Error: Did not find n_increments value for PressureContinuationSolver" << std::endl
                  << "       Must specify SolverOptions/PressureContinuation/n_increments" << std::endl;
        libmesh_error();
      }
    unsigned int n_increments = input("SolverOptions/PressureContinuation/n_increments", 1);

    _pressure_values.resize(n_increments);

    libMesh::Real increment = (final_pressure_value - initial_pressure_value)/n_increments;

    for( unsigned int i = 0; i < n_increments; i++ )
      {
        _pressure_values[i] = (i+1)*increment + initial_pressure_value;
      }

    return;
  }
  ConstantSpecificHeat::ConstantSpecificHeat( const GetPot& input,
                                              const std::string& material )
    : ParameterUser("ConstantSpecificHeat"),
      _cp(0.0)
  {
    // It's an error to have both the old and new version
    MaterialsParsing::duplicate_input_test(input,
                                           "Materials/"+material+"/SpecificHeat/value",
                                           "Materials/SpecificHeat/cp");

    // If we have the "new" version, then parse it
    if( input.have_variable("Materials/"+material+"/SpecificHeat/value") )
      {
        this->set_parameter
          (_cp, input, "Materials/"+material+"/SpecificHeat/value", _cp);
      }
    // If instead we have the old version, use that.
    else if( input.have_variable("Materials/SpecificHeat/cp") )
      {
        MaterialsParsing::dep_input_warning( "Materials/SpecificHeat/cp",
                                             "SpecificHeat/value" );

        this->set_parameter
          (_cp, input, "Materials/SpecificHeat/cp", _cp);
      }
    else
      {
        libmesh_error_msg("ERROR: Could not find valid input for ConstantSpecificHeat! Please set Materials/"+material+"/SpecificHeat/value");
      }
  }
示例#5
0
  bool SolverParsing::is_transient( const GetPot& input )
  {
    // Can't specify both old and new version
    SolverParsing::dup_solver_option_check(input,
                                           "unsteady-solver/transient",
                                           "SolverOptions/TimeStepping/solver_type");

    bool transient = false;

    if( input.have_variable("unsteady-solver/transient") )
      {
        transient = input("unsteady-solver/transient",false);

        std::string warning = "WARNING: unsteady-solver/transient is DEPRECATED!\n";
        warning += "        Please use SolverOptions/TimeStepping/solver_type to specify time stepping solver.\n";
        grins_warning(warning);
      }

    // In the new version, we set the solver type so we just need to
    // check if the variable is present. Solver class will figure
    // out the type.
    if( input.have_variable("SolverOptions/TimeStepping/solver_type") )
      transient = true;

    return transient;
  }
示例#6
0
 void SolverParsing::dup_solver_option_check( const GetPot& input,
                                              const std::string& option1,
                                              const std::string& option2 )
 {
   // Can't specify both old and new version
   if( input.have_variable(option1) && input.have_variable(option2) )
     {
       libmesh_error_msg("ERROR: Cannot specify both "+option1+" and "+option2);
     }
 }
 void AdaptiveTimeSteppingOptions::check_dup_input_style( const GetPot& input ) const
 {
   if( (input.have_variable("unsteady-solver/target_tolerance") &&
        input.have_section("Strategies/AdaptiveTimeStepping/target_tolerance")) ||
       (input.have_variable("unsteady-solver/upper_tolerance") &&
        input.have_section("Strategies/AdaptiveTimeStepping/upper_tolerance")) ||
       (input.have_variable("unsteady-solver/max_growth") &&
        input.have_section("Strategies/AdaptiveTimeStepping/max_growth")) )
     libmesh_error_msg("ERROR: Cannot use both old and new style of options for AdaptiveTimeSteppingOptions!");
 }
示例#8
0
  void HookesLaw::read_input_options(const GetPot& input)
  {
    // We'd better have either Lam\'{e} constants or E and nu
    if( ( !input.have_variable("Physics/HookesLaw/lambda") || 
          !input.have_variable("Physics/HookesLaw/mu") ) &&
        ( !input.have_variable("Physics/HookesLaw/E") || 
          !input.have_variable("Physics/HookesLaw/nu") ) )
      {
        std::cerr << "Error: Must specify either Lame constants lambda and mu or" << std::endl
                  << "       Young's modulus and Poisson's ratio." << std::endl;
        libmesh_error();
      }

    if( input.have_variable("Physics/HookesLaw/lambda") )
      this->set_parameter
        (_lambda, input, "Physics/HookesLaw/lambda", 0.0);
    
    if( input.have_variable("Physics/HookesLaw/mu") )
      this->set_parameter
        (_mu, input, "Physics/HookesLaw/mu", 0.0);
        
    if( input.have_variable("Physics/HookesLaw/E") && 
        input.have_variable("Physics/HookesLaw/nu") )
      {
        // FIXME - we'll need a special accessor to give parameter
        // access to these
        libMesh::Real E  = input("Physics/HookesLaw/E", 0.0);
        libMesh::Real nu = input("Physics/HookesLaw/nu", 0.0);
        _lambda = nu*E/( (1+nu)*(1-2*nu) );
        _mu = E/(2*(1+nu));
      }

    return;
  }
示例#9
0
  AntiochMixture::AntiochMixture( const GetPot& input )
    : AntiochChemistry(input),
      _reaction_set( new Antioch::ReactionSet<libMesh::Real>( (*_antioch_gas.get()) ) ),
      _cea_mixture( new Antioch::CEAThermoMixture<libMesh::Real>( (*_antioch_gas.get()) ) )
  {
    if( !input.have_variable("Physics/Chemistry/chem_file") )
      {
        std::cerr << "Error: Must specify XML chemistry file to use Antioch." << std::endl;
        libmesh_error();
      }

    std::string xml_filename = input( "Physics/Chemistry/chem_file", "DIE!");
    bool verbose_read = input("screen-options/verbose_kinetics_read", false );
      
    Antioch::read_reaction_set_data_xml<libMesh::Real>( xml_filename, verbose_read, *_reaction_set.get() );

    std::string cea_data_filename = input( "Physics/Antioch/cea_data", "default" );
    if( cea_data_filename == std::string("default") )
      cea_data_filename = Antioch::DefaultInstallFilename::thermo_data();

    Antioch::read_cea_mixture_data_ascii( *_cea_mixture.get(), cea_data_filename );

    this->build_stat_mech_ref_correction();

    return;
  }
示例#10
0
  void OldStyleBCBuilder::build_periodic_bc( const GetPot& input,
                                             const std::string& section,
                                             BoundaryID bc_id,
                                             libMesh::DofMap& dof_map )
  {
    std::string wall_input = section+"/periodic_wall_";
    wall_input += StringUtilities::T_to_string<BoundaryID>(bc_id);

    if( input.have_variable(wall_input) )
      {
        libMesh::boundary_id_type invalid_bid =
          std::numeric_limits<libMesh::boundary_id_type>::max();

        libMesh::boundary_id_type slave_id = invalid_bid;
        libMesh::boundary_id_type master_id = invalid_bid;

        if( input.vector_variable_size(wall_input) != 2 )
          libmesh_error_msg("ERROR: "+wall_input+" must have only 2 components!");

        master_id = bc_id;

        if( input(wall_input,invalid_bid,0) == bc_id )
          slave_id = input(wall_input,invalid_bid,1);
        else
          slave_id = input(wall_input,invalid_bid,0);

        std::string offset_input = section+"/periodic_offset_";
        offset_input += StringUtilities::T_to_string<BoundaryID>(bc_id);

        if( !input.have_variable(offset_input) )
          libmesh_error_msg("ERROR: Could not find "+offset_input+"!");

        unsigned int n_comps = input.vector_variable_size(offset_input);

        libMesh::Real invalid_real = std::numeric_limits<libMesh::Real>::max();

        libMesh::RealVectorValue offset_vector;
        for( unsigned int i = 0; i < n_comps; i++ )
          offset_vector(i) = input(offset_input,invalid_real,i);

        this->add_periodic_bc_to_dofmap( master_id, slave_id,
                                         offset_vector, dof_map );
      }
  }
 ConstantPrandtlConductivity::ConstantPrandtlConductivity( const GetPot& input )
   : _Pr( input("Materials/Conductivity/Pr", 0.0) )
 {
   if( !input.have_variable("Materials/Conductivity/Pr") )
     {
       std::cerr << "Error: Must specify Prandtl number for constant_prandtl conductivity model!" << std::endl;
       libmesh_error();
     }
   return;
 }
示例#12
0
  double TimeSteppingParsing::parse_deltat( const GetPot& input )
  {
    double delta_t = 0.0;

    if( input.have_variable("unsteady-solver/deltat") )
      {
        delta_t = input("unsteady-solver/deltat",0.0);

        std::string warning = "WARNING: unsteady-solver/deltat is DEPRECATED!\n";
        warning += "        Please use SolverOptions/TimeStepping/delta_t to set delta_t.\n";
        grins_warning(warning);
      }
    else if( input.have_variable("SolverOptions/TimeStepping/delta_t") )
      delta_t = input("SolverOptions/TimeStepping/delta_t",0.0);
    else
      libmesh_error_msg("ERROR: Could not find valid entry for delta_t!");

    return delta_t;
  }
示例#13
0
  void VelocityPenalty<Mu>::register_postprocessing_vars( const GetPot& input,
                                                          PostProcessedQuantities<libMesh::Real>& postprocessing )
  {
    std::string section = "Physics/"+this->_physics_name+"/output_vars";

    std::string vel_penalty = "vel_penalty";
    if (this->_physics_name == "VelocityPenalty2")
      vel_penalty += '2';

    if (this->_physics_name == "VelocityPenalty3")
      vel_penalty += '3';

    if( input.have_variable(section) )
      {
        unsigned int n_vars = input.vector_variable_size(section);

        for( unsigned int v = 0; v < n_vars; v++ )
          {
            std::string name = input(section,"DIE!",v);

            if( name == std::string("velocity_penalty") )
              {
                _velocity_penalty_x_index =
                  postprocessing.register_quantity( vel_penalty+"_x" );

                _velocity_penalty_y_index =
                  postprocessing.register_quantity( vel_penalty+"_y" );

                _velocity_penalty_z_index =
                  postprocessing.register_quantity( vel_penalty+"_z" );
              }
            else if( name == std::string("velocity_penalty_base") )
              {
                _velocity_penalty_base_x_index =
                  postprocessing.register_quantity( vel_penalty+"_base_x" );

                _velocity_penalty_base_y_index =
                  postprocessing.register_quantity( vel_penalty+"_base_y" );

                _velocity_penalty_base_z_index =
                  postprocessing.register_quantity( vel_penalty+"_base_z" );
              }
            else
              {
                std::cerr << "Error: Invalue output_vars value for "+this->_physics_name << std::endl
                          << "       Found " << name << std::endl
                          << "       Acceptable values are: velocity_penalty" << std::endl
                          << "                              velocity_penalty_base" << std::endl;
                libmesh_error();
              }
          }
      }

    return;
  }
示例#14
0
  ParsedConductivity::ParsedConductivity( const GetPot& input, const std::string& material )
    : ParsedPropertyBase(),
      ParameterUser("ParsedConductivity")
  {
    MaterialsParsing::duplicate_input_test(input,
                                           "Materials/"+material+"/ThermalConductivity/value",
                                           "Materials/Conductivity/k");

    std::string conductivity_function;

    // If we have the new version, we parse that
    if( input.have_variable("Materials/"+material+"/ThermalConductivity/value") )
      {
        this->set_parameter(this->_func, input,
                            "Materials/"+material+"/ThermalConductivity/value",
                            "DIE!");

        conductivity_function = input("Materials/"+material+"/ThermalConductivity/value",std::string("0"));
      }
    // If we have the old DEPRECATED version, use that
    else if( input.have_variable("Materials/Conductivity/k") )
      {
        MaterialsParsing::dep_input_warning( "Materials/Conductivity/k",
                                             "ThermalConductivity/value" );

        this->set_parameter(this->_func, input,
                            "Materials/Conductivity/k",
                            "DIE!");

        conductivity_function = input("Materials/Conductivity/k",std::string("0"));
      }
    // If we don't have either, that's an error
    else
      {
        libmesh_error_msg("Error: Could not find either Materials/"+material+"/ThermalConductivity/value or Materials/Conductivity/k");
      }

    if( !this->check_func_nonzero(conductivity_function) )
      {
        libmesh_error_msg("ERROR: Detected '0' function for ParsedConductivity!");
      }
  }
示例#15
0
  ConstantSpecificHeat::ConstantSpecificHeat( const GetPot& input )
    : _cp( input( "Materials/SpecificHeat/cp", 0.0 ) )
  {
    if( !input.have_variable("Materials/SpecificHeat/cp") )
      {
        std::cerr << "Error: Must specify cp value for constant specific heat model!" << std::endl;
        libmesh_error();
      }

    return;
  }
示例#16
0
ConstantViscosity::ConstantViscosity( const GetPot& input )
    : _mu( input( "Materials/Viscosity/mu", 0.0 ) )
{
    if( !input.have_variable("Materials/Viscosity/mu") )
    {
        std::cerr << "Error: Must specify viscosity value for constant viscosity model!" << std::endl;
        libmesh_error();
    }

    return;
}
  void ElasticMembranePressure<PressureType>::check_subdomain_consistency(const GetPot & input)
  {
    // If the user specified enabled subdomains in this Physics section,
    // that's an error; we're slave to ElasticMembrane.
    if( input.have_variable("Physics/"+PhysicsNaming::elastic_membrane_constant_pressure()+"/enabled_subdomains" ) )
      libmesh_error_msg("ERROR: Cannot specify subdomains for "
                        +PhysicsNaming::elastic_membrane_constant_pressure()
                        +"! Must specify subdomains through "
                        +PhysicsNaming::elastic_membrane()+".");

    this->parse_enabled_subdomains(input,PhysicsNaming::elastic_membrane());
  }
示例#18
0
  std::vector<std::string> SpeciesVariableFactory<VariableType>::parse_var_names( const GetPot& input,
                                                                                  const std::string& var_section )
  {
    // Make sure the prefix is present
    std::string prefix_sec = var_section+"/names";
    if( !input.have_variable(prefix_sec) )
      libmesh_error_msg("ERROR: Could not find input parameter "+prefix_sec+" for species prefix!");

    // Make sure the material is present
    std::string material_sec = var_section+"/material";
    if( !input.have_variable(material_sec) )
      libmesh_error_msg("ERROR: Could not find input parameter "+material_sec+" for species material!");

    this->_prefix = input(prefix_sec,std::string("DIE!"));
    this->_material = input(material_sec,std::string("DIE!"));

    std::vector<std::string> var_names;
    MaterialsParsing::parse_species_varnames(input,this->_material,this->_prefix,var_names);

    return var_names;
  }
示例#19
0
  void testVariables()
  {
    CPPUNIT_ASSERT( input.have_variable("Section1/var1") );
    Real var1 = input("Section1/var1", 1.0);
    CPPUNIT_ASSERT_EQUAL( var1, Real(5));

    CPPUNIT_ASSERT( input.have_variable("Section1/SubSection1/var2") );
    std::string var2 = input("Section1/SubSection1/var2", "DIE!");
    CPPUNIT_ASSERT_EQUAL( var2, std::string("blah") );

    // This variable is commented out in the input file so we shouldn't find it.
    CPPUNIT_ASSERT( !input.have_variable("Section2/var3") );
    int var3 = input("Section2/var3", 314);
    CPPUNIT_ASSERT_EQUAL( var3, 314 );

    CPPUNIT_ASSERT( input.have_variable("Section2/Subsection2/var4") );
    bool var4 = input("Section2/Subsection2/var4", true);
    CPPUNIT_ASSERT_EQUAL( var4, false );

    CPPUNIT_ASSERT( input.have_variable("Section2/Subsection2/Subsection3/var5") );
    Real var5 = input("Section2/Subsection2/Subsection3/var5", 3.1415);
    CPPUNIT_ASSERT_EQUAL( var5, Real(6.02e23));

    CPPUNIT_ASSERT( input.have_variable("Section2/Subsection4/var6") );
    unsigned int var6 = input("Section2/Subsection4/var6", 21);
    CPPUNIT_ASSERT_EQUAL( var6, (unsigned int)42 );

    // We didn't use Section3/unused_var so it should be a UFO
    std::vector<std::string> ufos = input.unidentified_variables();
    CPPUNIT_ASSERT_EQUAL( ufos.size(),  (std::vector<std::string>::size_type)1 );
    CPPUNIT_ASSERT_EQUAL( ufos[0], std::string("Section3/unused_var") );
  }
  DisplacementContinuationSolver::DisplacementContinuationSolver( const GetPot& input )
    : SteadySolver(input),
      _bc_id( input("SolverOptions/DisplacementContinuation/boundary", -1) )
  {
    if( !input.have_variable("SolverOptions/DisplacementContinuation/boundary") )
      {
        std::cerr << "Error: Did not find boundary id for DisplacementContinuationSolver" << std::endl
                  << "       Must specify SolverOptions/DisplacementContinuation/boundary in input." << std::endl;
        libmesh_error();
      }

    if( !input.have_variable("SolverOptions/DisplacementContinuation/final_displacement") )
      {
        std::cerr << "Error: Did not find final_displacement value for DisplacementContinuationSolver" << std::endl
                  << "       Must specify SolverOptions/DisplacementContinuation/final_displacement" << std::endl;
        libmesh_error();
      }
    libMesh::Real disp_value = input("SolverOptions/DisplacementContinuation/final_displacement", 0.0);


    if( !input.have_variable("SolverOptions/DisplacementContinuation/n_increments") )
      {
        std::cerr << "Error: Did not find final_displacement value for DisplacementContinuationSolver" << std::endl
                  << "       Must specify SolverOptions/DisplacementContinuation/n_increments" << std::endl;
        libmesh_error();
      }
    unsigned int n_increments = input("SolverOptions/DisplacementContinuation/n_increments", 1);

    _displacements.resize(n_increments);

    libMesh::Real increment = disp_value/n_increments;

    for( unsigned int i = 0; i < n_increments; i++ )
      {
        _displacements[i] = (i+1)*increment;
      }

    return;
  }
示例#21
0
  ConstantPrandtlConductivity::ConstantPrandtlConductivity( const GetPot& input )
    : ParameterUser("ConstantPrandtlConductivity"),
      _Pr(0.0)
  {
    if( !input.have_variable("Materials/Conductivity/Pr") )
      {
        std::cerr << "Error: Must specify Prandtl number for constant_prandtl conductivity model!" << std::endl;
        libmesh_error();
      }

    this->set_parameter
      (_Pr, input, "Materials/Conductivity/Pr", _Pr);
  }
示例#22
0
  std::string CanteraMixture::parse_mixture( const GetPot& input, const std::string& material )
  {
    std::string mixture;

    if( input.have_variable("Physics/Chemistry/mixture") )
      {
        MaterialsParsing::dep_input_warning("Physics/Chemistry/mixture",
                                            "GasMixture/Cantera/gas_mixture" );

        mixture = input( "Physics/Chemistry/mixture", "DIE!" );
      }
    else if( input.have_variable("Materials/"+material+"/GasMixture/Cantera/gas_mixture") )
      {
        mixture = input("Materials/"+material+"/GasMixture/Cantera/gas_mixture", "DIE!");
      }
    else
      {
        libmesh_error_msg("ERROR: Could not find valid input for Cantera gas_mixture!");
      }

    return mixture;
  }
示例#23
0
  ParsedViscosity::ParsedViscosity( const GetPot& input, const std::string& material )
    : ParameterUser("ParsedViscosity"),
      ViscosityBase()
  {
    this->check_input_consistency(input,material);

    std::string viscosity_function = "0";

    // If we have the new version, we parse that
    if( input.have_variable("Materials/"+material+"/Viscosity/value") )
      {
        this->set_parameter(this->_func, input,
                            "Materials/"+material+"/Viscosity/value",
                            "DIE!");

        viscosity_function = input("Materials/"+material+"/Viscosity/value",std::string("0"));
      }
    // If we have the old DEPRECATED version, use that
    else if( input.have_variable("Materials/Viscosity/mu") )
      {
        this->old_mu_warning();

        this->set_parameter(this->_func, input,
                            "Materials/Viscosity/mu",
                            "DIE!");

        viscosity_function = input("Materials/Viscosity/mu",std::string("0"));
      }
    // If we don't have either, that's an error
    else
      {
        libmesh_error_msg("Error: Could not find either Materials/"+material+"/Viscosity/value or Materials/Viscosity/mu");
      }

    if( !this->check_func_nonzero(viscosity_function) )
      {
        libmesh_error_msg("ERROR: Detected '0' function for ParsedConductivity!");
      }
  }
示例#24
0
  unsigned int TimeSteppingParsing::parse_n_timesteps( const GetPot& input )
  {
    SolverParsing::dup_solver_option_check(input,
                                           "unsteady-solver/n_timesteps",
                                           "SolverOptions/TimeStepping/n_timesteps");

    unsigned int n_timesteps = 0;

    if( input.have_variable("unsteady-solver/n_timesteps") )
      {
        n_timesteps = input("unsteady-solver/n_timesteps",0);

        std::string warning = "WARNING: unsteady-solver/n_timesteps is DEPRECATED!\n";
        warning += "        Please use SolverOptions/TimeStepping/n_timesteps to specify # of timesteps.\n";
        grins_warning(warning);
      }
    else if( input.have_variable("SolverOptions/TimeStepping/n_timesteps") )
      n_timesteps = input("SolverOptions/TimeStepping/n_timesteps",0);
    else
      libmesh_error_msg("ERROR: Could not find valid entry for n_timesteps!");

    return n_timesteps;
  }
  AntiochConstantTransportMixture<Thermo>::AntiochConstantTransportMixture( const GetPot& input )
    : AntiochMixture(input),
      _mu( input("Materials/Viscosity/mu", 0.0) ),
      _conductivity(NULL),
      _diffusivity( new Antioch::ConstantLewisDiffusivity<libMesh::Real>( input("Physics/Antioch/Le", 0.0) ) )
  {
    if( !input.have_variable("Materials/Viscosity/mu") )
      {
        std::cerr << "Error: Must specify viscosity value for constant viscosity model!" << std::endl;
        libmesh_error();
      }

    if( !input.have_variable("Physics/Antioch/Le") )
      {
        std::cerr << "Error: Must provide Lewis number for constant_lewis diffusivity model."
                  << std::endl;
        libmesh_error();
      }

    this->build_conductivity(input);

    return;
  }
示例#26
0
                                                        std::set<std::string>& vars_added ) const
#else
   void MoleFractionsDirichletBCFactory::add_found_vars( const GetPot& input,
                                                         MultiphysicsSystem& /*system*/,
                                                         const std::string& section,
                                                         const std::set<std::string>& /*vars_found*/,
                                                         libMesh::CompositeFunction<libMesh::Number>& /*composite_func*/,
                                                         std::set<std::string>& /*vars_added*/ ) const
#endif
  {
    // Strip out the Variable name from the section
    std::string var_section = extract_var_section(section);

    // This only makes sense for SpeciesMassFractionsVariable in the VariableWarehouse.
    // This call will error out if it's not there.
    const SpeciesMassFractionsVariable& species_fe_var =
      GRINSPrivate::VariableWarehouse::get_variable_subclass<SpeciesMassFractionsVariable>
      (var_section);

    const std::string& material = species_fe_var.material();

    std::string thermochem_input_str = "Materials/"+material+"/GasMixture/thermochemistry_library";

    if( !input.have_variable(thermochem_input_str) )
      libmesh_error_msg("ERROR: Could not find input option "+thermochem_input_str+" !");

    const std::string thermochem_lib = input(thermochem_input_str, std::string("DIE!") );

    if( thermochem_lib == "cantera" )
      {
#ifdef GRINS_HAVE_CANTERA
        this->add_mole_frac_to_mass_frac<CanteraMixture>(input,section,vars_found,material,
                                                         species_fe_var,composite_func,vars_added);
#else
        libmesh_error_msg("Error: Cantera not enabled in this configuration. Reconfigure using --with-cantera option.");
#endif
      }
    else if( thermochem_lib == "antioch" )
      {
#ifdef GRINS_HAVE_ANTIOCH
        this->add_mole_frac_to_mass_frac<AntiochChemistry>(input,section,vars_found,material,
                                                           species_fe_var,composite_func,vars_added);
#else
        libmesh_error_msg("Error: Antioch not enabled in this configuration. Reconfigure using --with-antioch option.");
#endif
      }
    else
      libmesh_error_msg("ERROR: Invalid thermochemistry library "+thermochem_lib+"!");
  }
  ElasticCableRayleighDamping<StressStrainLaw>::ElasticCableRayleighDamping( const PhysicsName& physics_name,
                                                                             const GetPot& input,
                                                                             bool is_compressible )
    : ElasticCableBase<StressStrainLaw>(physics_name,input,is_compressible),
    _lambda_factor(input("Physics/"+PhysicsNaming::elastic_cable_rayleigh_damping()+"/lambda_factor",0.0)),
    _mu_factor(input("Physics/"+PhysicsNaming::elastic_cable_rayleigh_damping()+"/mu_factor",0.0))
  {
    if( !input.have_variable("Physics/"+PhysicsNaming::elastic_cable_rayleigh_damping()+"/lambda_factor") )
      libmesh_error_msg("ERROR: Couldn't find Physics/"+PhysicsNaming::elastic_cable_rayleigh_damping()+"/lambda_factor in input!");

    if( !input.have_variable("Physics/"+PhysicsNaming::elastic_cable_rayleigh_damping()+"/mu_factor") )
      libmesh_error_msg("ERROR: Couldn't find Physics/"+PhysicsNaming::elastic_cable_rayleigh_damping()+"/mu_factor in input!");


    // If the user specified enabled subdomains in this Physics section,
    // that's an error; we're slave to ElasticCable.
    if( input.have_variable("Physics/"+PhysicsNaming::elastic_cable_rayleigh_damping()+"/enabled_subdomains" ) )
      libmesh_error_msg("ERROR: Cannot specify subdomains for "
                        +PhysicsNaming::elastic_cable_rayleigh_damping()
                        +"! Must specify subdomains through "
                        +PhysicsNaming::elastic_cable()+".");

    this->parse_enabled_subdomains(input,PhysicsNaming::elastic_cable());
  }
示例#28
0
  std::string CanteraMixture::parse_chem_file( const GetPot& input, const std::string& material )
  {
    std::string filename;

    // Preferred option
    std::string option = "Materials/"+material+"/GasMixture/Cantera/"+MaterialsParsing::chemical_data_option();
    if( input.have_variable(option) )
      filename = input(option, std::string("DIE!") );

    // Now check for deprecated option
    else
      filename = MaterialsParsing::parse_chemical_kinetics_datafile_name( input, material );

    return filename;
  }
示例#29
0
  ConstantSourceTerm::ConstantSourceTerm( const std::string& physics_name, const GetPot& input )
    : SourceTermBase(physics_name,input),
      _value(0.0)
  {
    if( !input.have_variable("Physics/"+physics_name+"/Function/value") )
      {
        libMesh::err << "Error: Must specify value for ConstantSourceTerm." << std::endl
                     << "       Please specify Physics/"+physics_name+"/Function/value" << std::endl;
        libmesh_error();
      }

    this->set_parameter
      (_value, input,
       "Physics/"+physics_name+"/Function/value", _value);
  }
示例#30
0
  HeatTransferStabilizationHelper::HeatTransferStabilizationHelper
  (const std::string & helper_name,
   const GetPot& input)
    : StabilizationHelper(helper_name),
      _C(1),
      _tau_factor(0.5),
      _temp_vars(GRINSPrivate::VariableWarehouse::get_variable_subclass<PrimitiveTempFEVariables>(VariablesParsing::temp_variable_name(input,PhysicsNaming::heat_transfer(),VariablesParsing::PHYSICS))),
      _flow_vars(GRINSPrivate::VariableWarehouse::get_variable_subclass<VelocityVariable>(VariablesParsing::velocity_variable_name(input,PhysicsNaming::heat_transfer(),VariablesParsing::PHYSICS))),
      _press_var(GRINSPrivate::VariableWarehouse::get_variable_subclass<PressureFEVariable>(VariablesParsing::press_variable_name(input,PhysicsNaming::heat_transfer(),VariablesParsing::PHYSICS)))
  {
    if (input.have_variable("Stabilization/tau_constant_T"))
      this->set_parameter
        (_C, input, "Stabilization/tau_constant_T", _C );
    else
      this->set_parameter
        (_C, input, "Stabilization/tau_constant", _C );

    if (input.have_variable("Stabilization/tau_factor_T"))
      this->set_parameter
        (_tau_factor, input, "Stabilization/tau_factor_T", _tau_factor );
    else
      this->set_parameter
        (_tau_factor, input, "Stabilization/tau_factor", _tau_factor );
  }