Example #1
0
  void MultiphysicsSystem::read_input_options( const GetPot& input )
  {
    // Cache this for building boundary condition later
    _input = &input;

    // Read options for MultiphysicsSystem first
    this->verify_analytic_jacobians = input("linear-nonlinear-solver/verify_analytic_jacobians", 0.0 );
    this->print_solution_norms = input("screen-options/print_solution_norms", false );
    this->print_solutions = input("screen-options/print_solutions", false );
    this->print_residual_norms = input("screen-options/print_residual_norms", false );

    // backwards compatibility with old config files.
    /*! \todo Remove old print_residual nomenclature */
    this->print_residuals = input("screen-options/print_residual", false );
    if (this->print_residuals)
      libmesh_deprecated();

    this->print_residuals = input("screen-options/print_residuals", this->print_residuals );
    this->print_jacobian_norms = input("screen-options/print_jacobian_norms", false );
    this->print_jacobians = input("screen-options/print_jacobians", false );
    this->print_element_solutions = input("screen-options/print_element_solutions", false );
    this->print_element_residuals = input("screen-options/print_element_residuals", false );
    this->print_element_jacobians = input("screen-options/print_element_jacobians", false );

    _use_numerical_jacobians_only = input("linear-nonlinear-solver/use_numerical_jacobians_only", false );

    numerical_jacobian_h =
      input("linear-nonlinear-solver/numerical_jacobian_h",
            numerical_jacobian_h);

    const unsigned int n_numerical_jacobian_h_values =
      input.vector_variable_size
        ("linear-nonlinear-solver/numerical_jacobian_h_values");

    if (n_numerical_jacobian_h_values !=
        input.vector_variable_size
          ("linear-nonlinear-solver/numerical_jacobian_h_variables"))
      {
        std::cerr << "Error: found " << n_numerical_jacobian_h_values
                  << " numerical_jacobian_h_values" << std::endl;
        std::cerr << "  but "
                  << input.vector_variable_size
                       ("linear-nonlinear-solver/numerical_jacobian_h_variables")
                << " numerical_jacobian_h_variables" << std::endl;
        libmesh_error();
      }

    _numerical_jacobian_h_variables.resize(n_numerical_jacobian_h_values);
    _numerical_jacobian_h_values.resize(n_numerical_jacobian_h_values);
    for (unsigned int i=0; i != n_numerical_jacobian_h_values; ++i)
      {
        _numerical_jacobian_h_variables[i] =
          input("linear-nonlinear-solver/numerical_jacobian_h_variables",
                "", i);
        _numerical_jacobian_h_values[i] =
          input("linear-nonlinear-solver/numerical_jacobian_h_values",
                libMesh::Real(0), i);
      }
  }
Example #2
0
  void ICHandlingBase::read_ic_data( const GetPot& input, const std::string& id_str,
                                     const std::string& ic_str,
                                     const std::string& var_str,
                                     const std::string& value_str)
  {
    int num_ids = input.vector_variable_size(id_str);
    int num_ics = input.vector_variable_size(ic_str);
    int num_vars = input.vector_variable_size(var_str);
    int num_values = input.vector_variable_size(value_str);

    if( num_ids != num_ics )
      {
        std::cerr << "Error: number of subdomain ids " << num_ids
                  << "must equal number of initial condition types " << num_ics
                  << std::endl;
        libmesh_error();
      }

    if( num_ids != num_vars )
      {
        std::cerr << "Error: number of subdomain ids " << num_ids
                  << "must equal number of variable name lists " << num_vars
                  << std::endl;
        libmesh_error();
      }

    if( num_ids != num_values )
      {
        std::cerr << "Error: number of subdomain ids " << num_ids
                  << "must equal number of initial condition values " << num_values
                  << std::endl;
        libmesh_error();
      }

    if( num_ids > 1 )
      {
        std::cerr << "Error: GRINS does not yet support per-subdomain initial conditions" << std::endl;
        libmesh_not_implemented();
      }

    for( int i = 0; i < num_ids; i++ )
      {
        int ic_id = input(id_str, -1, i );
        std::string ic_type_in = input(ic_str, "NULL", i );
        std::string ic_value_in = input(value_str, "NULL", i );
        std::string ic_vars_in = input(var_str, "NULL", i );

        int ic_type = this->string_to_int( ic_type_in );

        std::stringstream ss;
        ss << ic_id;
        std::string ic_id_string = ss.str();

        this->init_ic_types( ic_id, ic_id_string, ic_type, ic_vars_in, ic_value_in, input );
      }

    return;
  }
Example #3
0
  void Simulation::init_params( const GetPot& input,
                                SimulationBuilder& /*sim_builder*/ )
  {
    unsigned int n_adjoint_parameters =
      input.vector_variable_size("QoI/adjoint_sensitivity_parameters");

    unsigned int n_forward_parameters =
      input.vector_variable_size("QoI/forward_sensitivity_parameters");

    // If the user actually asks for parameter sensitivities, then we
    // set up the parameter vectors to use.
    if ( n_adjoint_parameters )
      {
        // If we're doing adjoint sensitivities, dq/dp only makes
        // sense if we have q
        CompositeQoI* qoi =
          libMesh::cast_ptr<CompositeQoI*>
          (this->_multiphysics_system->get_qoi());

        if (!qoi)
          {
            std::cout <<
              "Error: adjoint_sensitivity_parameters are specified but\n"
                      << "no QoIs have been specified.\n" << std::endl;
            libmesh_error();
          }

        _adjoint_parameters.initialize
          (input, "QoI/adjoint_sensitivity_parameters",
           *this->_multiphysics_system, qoi);
      }

    if ( n_forward_parameters )
      {
        // If we're doing forward sensitivities, du/dp can make
        // sense even with no q defined
        CompositeQoI* qoi =
          dynamic_cast<CompositeQoI*>
          (this->_multiphysics_system->get_qoi());

        // dynamic_cast returns NULL if our QoI isn't a CompositeQoI;
        // i.e. if there were no QoIs that made us bother setting up
        // the CompositeQoI object.  Passing NULL tells
        // ParameterManager not to bother asking for qoi registration
        // of parameters.

        _forward_parameters.initialize
          (input, "QoI/forward_sensitivity_parameters",
           *this->_multiphysics_system, qoi);
      }
  }
Example #4
0
  void ParsedBoundaryQoI::init( const GetPot& input, const MultiphysicsSystem& system )
  {
    // Read boundary ids on which we want to compute qoi
    int num_bcs =  input.vector_variable_size("QoI/ParsedBoundary/bc_ids");

    if( num_bcs <= 0 )
      {
        std::cerr << "Error: Must specify at least one boundary id to compute"
                  << " parsed boundary QoI." << std::endl
                  << "Found: " << num_bcs << std::endl;
        libmesh_error();
      }

    for( int i = 0; i < num_bcs; i++ )
      {
        _bc_ids.insert( input("QoI/ParsedBoundary/bc_ids", -1, i ) );
      }

    std::string qoi_functional_string =
      input("QoI/ParsedBoundary/qoi_functional", std::string("0"));

    if (qoi_functional_string == "0")
      libmesh_error_msg("Error! Zero ParsedBoundaryQoI specified!" <<
                        std::endl);

    this->qoi_functional.reset
      (new libMesh::ParsedFEMFunction<libMesh::Number>
       (system, qoi_functional_string));
  }
  void AverageNusseltNumber::read_input_options( const GetPot& input )
  {
    // Read thermal conductivity
    this->_k = input( "QoI/NusseltNumber/thermal_conductivity", -1.0 );

    if( this->_k < 0.0 )
      {
	std::cerr << "Error: thermal conductivity for AverageNusseltNumber must be positive." << std::endl
		  << "Found k = " << _k << std::endl;
	libmesh_error();
      }

    // Read boundary ids for which we want to compute
    int num_bcs =  input.vector_variable_size("QoI/NusseltNumber/bc_ids");

    if( num_bcs <= 0 )
      {
	std::cerr << "Error: Must specify at least one boundary id to compute"
		  << " average Nusselt number." << std::endl
		  << "Found: " << num_bcs << std::endl;
	libmesh_error();
      }

    for( int i = 0; i < num_bcs; i++ )
      {
	_bc_ids.insert( input("QoI/NusseltNumber/bc_ids", -1, i ) );
      }

    this->_scaling = input( "QoI/NusseltNumber/scaling", 1.0 );

    return;
  }
  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) );
      }
  }
Example #7
0
  void QoIFactory::check_qoi_physics_consistency( const GetPot& input, 
						  const std::string& qoi_name )
  {
    int num_physics =  input.vector_variable_size("Physics/enabled_physics");

    // This should be checked other places, but let's be double sure.
    libmesh_assert(num_physics > 0);
  
    std::set<std::string> requested_physics;
    std::set<std::string> required_physics;

    // Build Physics name set
    for( int i = 0; i < num_physics; i++ )
      {
	requested_physics.insert( input("Physics/enabled_physics", "NULL", i ) );
      }
  
    /* If it's Nusselt, we'd better have HeatTransfer or LowMachNavierStokes. 
       HeatTransfer implicitly requires fluids, so no need to check for those. `*/
    if( qoi_name == avg_nusselt )
      {
	required_physics.insert(heat_transfer);
	required_physics.insert(low_mach_navier_stokes);
	this->consistency_helper( requested_physics, required_physics, qoi_name );
      }
      
    return;
  }
Example #8
0
  void SourceTermBase::parse_var_info( const GetPot& input )
  {
    if( !input.have_variable("Physics/"+this->_physics_name+"/Variables/names") )
      {
        libMesh::err << "Error: Must have at least one variable for source function." << std::endl
                     << "       Ensure that Physics/"+this->_physics_name+"/Variables/names is set." << std::endl;
        libmesh_error();
      }

    unsigned int n_vars = input.vector_variable_size("Physics/"+this->_physics_name+"/Variables/names");

    // Make sure we have consisent number of FE types and FE orders
    /*! \todo In the future, after refactoring Variable parsing, we should be
              able get the FE type and order information from there. */
    unsigned int n_fe_types = input.vector_variable_size("Physics/"+this->_physics_name+"/Variables/FE_types");

    unsigned int n_fe_orders = input.vector_variable_size("Physics/"+this->_physics_name+"/Variables/FE_orders");

    if( n_fe_types != n_vars )
      {
        libMesh::err << "Error: Must have matching number of variable names and FE types." << std::endl
                     << "       Found " << n_fe_types << " FE types and " << n_vars << " variables." << std::endl
                     << "       Ensure Physics/"+this->_physics_name+"/Variables/FE_types is consistent." << std::endl;
        libmesh_error();
      }

    if( n_fe_orders != n_vars )
      {
        libMesh::err << "Error: Must have matching number of variable names and FE orders." << std::endl
                     << "       Found " << n_fe_orders << " FE orders and " << n_vars << " variables." << std::endl
                     << "       Ensure Physics/"+this->_physics_name+"/Variables/FE_orders is consistent." << std::endl;
        libmesh_error();
      }

    _var_names.reserve(n_vars);
    _var_FE.reserve(n_vars);
    _var_order.reserve(n_vars);
    for( unsigned int v = 0; v < n_vars; v++ )
      {
        _var_names.push_back( input("Physics/"+this->_physics_name+"/Variables/names", "DIE!", v) );
        _var_FE.push_back( libMesh::Utility::string_to_enum<GRINSEnums::FEFamily>(input("Physics/"+this->_physics_name+"/Variables/FE_types", "DIE!", v)) );
        _var_order.push_back( libMesh::Utility::string_to_enum<GRINSEnums::Order>(input("Physics/"+this->_physics_name+"/Variables/FE_orders", "DIE!", v)) );
      }

    return;
  }
  PostProcessedQuantities<NumericType>::PostProcessedQuantities( const GetPot& input )
    : libMesh::FEMFunctionBase<NumericType>(),
      _prev_point(1.0e15,0.0,0.0) //Initialize to an absurd value
  {
    this->build_name_map();

    /* Parse the quantities requested for postprocessing and cache the 
       corresponding enum value */
    unsigned int n_quantities = input.vector_variable_size( "vis-options/output_vars" );
    std::vector<std::string> names(n_quantities);
    _quantities.resize(n_quantities);

    for( unsigned int n = 0; n < n_quantities; n++ )
      {
	names[n] = input("vis-options/output_vars", "DIE!", n);
	
	typename std::map<std::string, unsigned int>::const_iterator name_it = 
	  _quantity_name_map.find(names[n]);
	
	if( name_it != _quantity_name_map.end() )
	  {
	    _quantities[n] = name_it->second;
	  }
	else
	  {
	    std::cerr << "Error: Invalid name " << names[n] << " for PostProcessedQuantity." 
		      << std::endl;
	    libmesh_error();
	  }

	// Need to cache species names if needed.
	if( names[n] == std::string("mole_fractions") )
	  {
	    unsigned int species_size = input.vector_variable_size( "Physics/Chemistry/species" );
	    _species_names.resize(species_size);
	    
	    for( unsigned int s = 0; s < species_size; s++ )
	      {
		_species_names[s] = input("Physics/Chemistry/species","DIE!",s);
	      }
	  }
      }

    return;
  }
Example #10
0
void
BCInterfaceData::readParameters( const GetPot& dataFile, const char* parameters )
{
    UInt parametersSize = dataFile.vector_variable_size( parameters );

    M_parameters.resize( parametersSize );
    for ( UInt j( 0 ); j < parametersSize; ++j )
        M_parameters[j] = dataFile( parameters, 0, j );
}
Example #11
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 );
      }
  }
Example #12
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;
  }
  void HeatTransferBCHandling::init_bc_types( const BoundaryID bc_id, 
					      const std::string& bc_id_string, 
					      const int bc_type, 
					      const std::string& bc_vars, 
					      const std::string& bc_value, 
					      const GetPot& input )
  {
    switch(bc_type)
      {
      case(ISOTHERMAL_WALL):
	{
	  this->set_dirichlet_bc_type( bc_id, bc_type );

	  this->set_dirichlet_bc_value( bc_id, input("Physics/"+_physics_name+"/T_wall_"+bc_id_string, 0.0 ) );
	}
	break;
      
      case(ADIABATIC_WALL):
	{
	  this->set_neumann_bc_type( bc_id, bc_type );
	}
	break;
      
      case(PRESCRIBED_HEAT_FLUX):
	{
	  this->set_neumann_bc_type( bc_id, bc_type );
	
	  libMesh::RealGradient q_in;
	
	  int num_q_components = input.vector_variable_size("Physics/"+_physics_name+"/q_wall_"+bc_id_string);
	
	  for( int i = 0; i < num_q_components; i++ )
	    {
	      q_in(i) = input("Physics/"+_physics_name+"/q_wall_"+bc_id_string, 0.0, i );
	    }

	  this->set_neumann_bc_value( bc_id, q_in );
	}
	break;
      case(GENERAL_HEAT_FLUX):
	{
	  this->set_neumann_bc_type( bc_id, bc_type );
	}
	break;
      default:
	{
	  // Call base class to detect any physics-common boundary conditions
	  BCHandlingBase::init_bc_types( bc_id, bc_id_string, bc_type,
                                         bc_vars, bc_value, input );
	}
      
      }// End switch(bc_type)

    return;
  }
Example #14
0
// ===================================================
// Private Methods
// ===================================================
void
BCInterfaceData1D::readResistance ( const GetPot& dataFile, const char* resistance )
{
    UInt resistanceSize = dataFile.vector_variable_size ( resistance );

    M_resistance.resize ( resistanceSize );
    for ( UInt j ( 0 ); j < resistanceSize; ++j )
    {
        M_resistance[j] = dataFile ( resistance, 0, j );
    }
}
Example #15
0
  void Physics::read_input_options( const GetPot& input )
  {
    int num_ids = input.vector_variable_size( "Physics/"+this->_physics_name+"/enabled_subdomains" );

    for( int i = 0; i < num_ids; i++ )
      {
	libMesh::subdomain_id_type dumvar = input( "Physics/"+this->_physics_name+"/enabled_subdomains", -1, i );
	_enabled_subdomains.insert( dumvar );
      }

    return;
  }
  void NeumannBCFactoryAbstract::check_for_flux( const GetPot& input, const std::string& flux_input,
                                                 const std::vector<std::string>& var_names )
  {
    if( !input.have_variable(flux_input) )
      libmesh_error_msg("ERROR: Could not find input specification for "+flux_input+"!");

    unsigned int flux_size = input.vector_variable_size(flux_input);
    if( flux_size != var_names.size() )
      {
        std::string error_msg = "ERROR: Mismatch in size between flux input and variables size!\n";
        error_msg += "       Found flux size      = "+StringUtilities::T_to_string<unsigned int>(flux_size)+"\n";
        error_msg += "       Found variables size = "+StringUtilities::T_to_string<unsigned int>(var_names.size())+"\n";
        libmesh_error_msg(error_msg);
      }
  }
void
PreconditionerComposed::createParametersList (       list_Type& /*list*/,
                                                     const GetPot&      dataFile,
                                                     const std::string& section,
                                                     const std::string& subSection )
{
    //! See http://trilinos.sandia.gov/packages/docs/r9.0/packages/ifpack/doc/html/index.html
    //! for more informations on the parameters
    ASSERT ( !M_prec->number(), "Error, when initializing the preconditioner, it must be empty" );
    for ( UInt i (0); i < dataFile.vector_variable_size ( ( section + "/" + subSection + "/list" ).data() ); ++i )
    {
        epetraPrecPtr_Type tmp ( PRECFactory::instance().createObject ( dataFile ( ( section + "/" + subSection + "/list" ).data(), "ML", i ) ) );
        M_prec->push_back (tmp);
        M_prec->OperatorView() [i]->createParametersList (M_prec->OperatorView() [i]->parametersList(), dataFile, section, dataFile ( ( section + "/" + subSection + "/sections" ).data(), "ML", i ) );
    }
}
Example #18
0
  std::vector<std::string> VariableFactoryBasic<VariableType>::parse_var_names( const GetPot& input,
                                                                                const std::string& var_section )
  {
    std::vector<std::string> var_names;

    std::string input_sec = var_section+"/names";

    // Make sure the names are present
    if( !input.have_variable(input_sec) )
      libmesh_error_msg("ERROR: Could not find input parameter "+input_sec);

    unsigned int n_names = input.vector_variable_size(input_sec);

    var_names.resize(n_names);
    for( unsigned int i = 0; i < n_names; i++ )
      var_names[i] = input(input_sec,std::string("DIE!"),i);

    return var_names;
  }
Example #19
0
  void Vorticity::read_input_options( const GetPot& input )
  {
    // Extract subdomain on which to compute to qoi
    int num_ids = input.vector_variable_size( "QoI/Vorticity/enabled_subdomains" );

    if( num_ids == 0 )
      {
	std::cerr << "Error: Must specify at least one subdomain id on which to compute vorticity." << std::endl;
	libmesh_error();
      }

    for( int i = 0; i < num_ids; i++ )
      {
	libMesh::subdomain_id_type s_id = input( "QoI/Vorticity/enabled_subdomains", -1, i );
	_subdomain_ids.insert( s_id );
      }

    return;
  }
  void AverageNusseltNumber::init
    (const GetPot& input,
     const MultiphysicsSystem& system,
     unsigned int /*qoi_num*/ )
  {
    this->set_parameter
      ( _k, input, "QoI/NusseltNumber/thermal_conductivity", -1.0 );

    this->set_parameter
      ( _scaling, input, "QoI/NusseltNumber/scaling", 1.0 );

    if( this->_k < 0.0 )
      {
	std::cerr << "Error: thermal conductivity for AverageNusseltNumber must be positive." << std::endl
		  << "Found k = " << _k << std::endl;
	libmesh_error();
      }

    // Read boundary ids for which we want to compute
    int num_bcs =  input.vector_variable_size("QoI/NusseltNumber/bc_ids");

    if( num_bcs <= 0 )
      {
	std::cerr << "Error: Must specify at least one boundary id to compute"
		  << " average Nusselt number." << std::endl
		  << "Found: " << num_bcs << std::endl;
	libmesh_error();
      }

    for( int i = 0; i < num_bcs; i++ )
      {
	_bc_ids.insert( input("QoI/NusseltNumber/bc_ids", -1, i ) );
      }

    // Grab temperature variable index
    std::string T_var_name = input( "Physics/VariableNames/Temperature",
				    T_var_name_default );

    this->_T_var = system.variable_number(T_var_name);

    return;
  }
Example #21
0
  void ParameterManager::initialize
    ( const GetPot& input,
      const std::string & parameters_varname,
      MultiphysicsSystem & system,
      CompositeQoI * qoi)
  {
    const unsigned int n_parameters =
      input.vector_variable_size(parameters_varname);
    libmesh_assert(n_parameters);

    this->parameter_name_list.resize(n_parameters);
    this->parameter_vector.clear();
    for (unsigned int i=0; i != n_parameters; ++i)
      {
        std::string param_name =
          input(parameters_varname, std::string(), i);

        this->parameter_name_list[i] = param_name;

        libMesh::ParameterMultiAccessor<libMesh::Number> *next_param =
          new libMesh::ParameterMultiAccessor<libMesh::Number>();

        // We always have Physics solving for u
        system.register_parameter(param_name, *next_param);

        // We don't always have QoIs when solving for du/dp
        if (qoi)
          qoi->register_parameter(param_name, *next_param);

        if (next_param->size() == 0)
          {
            std::cout << "No parameters named " << param_name <<
              " found in active Physics or QoIs" << std::endl;
            libmesh_error();
          }

        this->parameter_vector.push_back
          (libMesh::UniquePtr<libMesh::ParameterAccessor<libMesh::Number> >
           (next_param));
      }
  }
Example #22
0
  AntiochChemistry::AntiochChemistry( const GetPot& input )
    : _antioch_gas(NULL)
  {
    if( !input.have_variable("Physics/Chemistry/species") )
      {
        std::cerr << "Error: Must specify species list to use Antioch." << std::endl;
        libmesh_error();
      }

    unsigned int n_species = input.vector_variable_size("Physics/Chemistry/species");
    std::vector<std::string> species_list(n_species);

    for( unsigned int s = 0; s < n_species; s++ )
      {
        species_list[s] = input( "Physics/Chemistry/species", "DIE!", s );
      }

    _antioch_gas.reset( new Antioch::ChemicalMixture<libMesh::Real>( species_list ) );

    return;
  }
Example #23
0
  AntiochChemistry::AntiochChemistry( const GetPot& input )
    : _antioch_gas(NULL)
  {
    if( !input.have_variable("Physics/Chemistry/species") )
      {
        std::cerr << "Error: Must specify species list to use Antioch." << std::endl;
        libmesh_error();
      }

    unsigned int n_species = input.vector_variable_size("Physics/Chemistry/species");
    std::vector<std::string> species_list(n_species);

    for( unsigned int s = 0; s < n_species; s++ )
      {
        species_list[s] = input( "Physics/Chemistry/species", "DIE!", s );
      }

    bool verbose_antioch_read = input("Physics/Antioch/verbose_read",false);

    std::string species_data_filename = input("Physics/Antioch/species_data", "default" );
    if( species_data_filename == std::string("default") )
      species_data_filename = Antioch::DefaultInstallFilename::chemical_mixture();

    std::string vibration_data_filename = input("Physics/Antioch/vibration_data", "default" );
    if( vibration_data_filename == std::string("default") )
      vibration_data_filename = Antioch::DefaultInstallFilename::vibrational_data();

    std::string electronic_data_filename = input("Physics/Antioch/electronic_data", "default" );
    if( electronic_data_filename == std::string("default") )
      electronic_data_filename = Antioch::DefaultInstallFilename::electronic_data();

    // By default, Antioch is using its ASCII parser. We haven't added more options yet.
    _antioch_gas.reset( new Antioch::ChemicalMixture<libMesh::Real>( species_list,
                                                                     verbose_antioch_read,
                                                                     species_data_filename,
                                                                     vibration_data_filename,
                                                                     electronic_data_filename ) );

    return;
  }
Example #24
0
  PressurePinning::PressurePinning( const GetPot& input,
				    const std::string& physics_name )
  {
    _pin_value = input("Physics/"+physics_name+"/pin_value", 0.0 );

    unsigned int pin_loc_dim = input.vector_variable_size("Physics/"+physics_name+"/pin_location");

    // If the user is specifying a pin_location, it had better be at least 2-dimensional
    if( pin_loc_dim > 0 && pin_loc_dim < 2 )
      {
	std::cerr << "Error: pressure pin location must be at least 2 dimensional"
		  << std::endl;
	libmesh_error();
      }

    _pin_location(0) = input("Physics/"+physics_name+"/pin_location", 0.0, 0 );
    _pin_location(1) = input("Physics/"+physics_name+"/pin_location", 0.0, 1 );

    if( pin_loc_dim == 3 ) 
      _pin_location(2) = input("Physics/"+physics_name+"/pin_location", 0.0, 2 );

    return;
  }
Example #25
0
void FEMParameters::read(GetPot &input)
{
  std::vector<std::string> variable_names;


  GETPOT_INT_INPUT(coarserefinements);
  GETPOT_INPUT(domainfile);

  GETPOT_INPUT(solver_quiet);
  GETPOT_INPUT(reuse_preconditioner);
  GETPOT_INPUT(require_residual_reduction);
  GETPOT_INPUT(min_step_length);
  GETPOT_INT_INPUT(max_linear_iterations);
  GETPOT_INT_INPUT(max_nonlinear_iterations);
  GETPOT_INPUT(relative_step_tolerance);
  GETPOT_INPUT(relative_residual_tolerance);
  GETPOT_INPUT(initial_linear_tolerance);
  GETPOT_INPUT(minimum_linear_tolerance);
  GETPOT_INPUT(linear_tolerance_multiplier);
  GETPOT_INT_INPUT(nelem_target);
  GETPOT_INPUT(global_tolerance);
  GETPOT_INPUT(refine_fraction);
  GETPOT_INPUT(coarsen_fraction);
  GETPOT_INPUT(coarsen_threshold);
  GETPOT_INT_INPUT(max_adaptivesteps);
  GETPOT_INPUT(refine_uniformly);
  GETPOT_INPUT(indicator_type);
  GETPOT_INPUT(patch_reuse);

  GETPOT_REGISTER(fe_family);
  const unsigned int n_fe_family =
    std::max(1u, input.vector_variable_size("fe_family"));
  fe_family.resize(n_fe_family, "LAGRANGE");
  for (unsigned int i=0; i != n_fe_family; ++i)
    fe_family[i]              = input("fe_family", fe_family[i].c_str(), i);
  GETPOT_REGISTER(fe_order);
  const unsigned int n_fe_order =
    input.vector_variable_size("fe_order");
  fe_order.resize(n_fe_order, 1);
  for (unsigned int i=0; i != n_fe_order; ++i)
    fe_order[i]               = input("fe_order", (int)fe_order[i], i);

  GETPOT_INPUT(analytic_jacobians);
  GETPOT_INPUT(verify_analytic_jacobians);
  GETPOT_INPUT(print_solution_norms);
  GETPOT_INPUT(print_solutions);
  GETPOT_INPUT(print_residual_norms);
  GETPOT_INPUT(print_residuals);
  GETPOT_INPUT(print_jacobian_norms);
  GETPOT_INPUT(print_jacobians);

  std::vector<std::string> bad_variables =
    input.unidentified_arguments(variable_names);

  if (libMesh::global_processor_id() == 0 && !bad_variables.empty())
    {
      std::cerr << "ERROR: Unrecognized variables:" << std::endl;
      for (unsigned int i = 0; i != bad_variables.size(); ++i)
        std::cerr << bad_variables[i] << std::endl;
      std::cerr << "not found among recognized variables." << std::endl;
      for (unsigned int i = 0; i != variable_names.size(); ++i)
        std::cerr << variable_names[i] << std::endl;
      libmesh_error();
    }
}
void FEMParameters::read(GetPot &input)
{
    std::vector<std::string> variable_names;

    GETPOT_INT_INPUT(initial_timestep);
    GETPOT_INT_INPUT(n_timesteps);
    GETPOT_INPUT(transient);
    GETPOT_INT_INPUT(deltat_reductions);
    GETPOT_INPUT(timesolver_core);
    GETPOT_INPUT(end_time);
    GETPOT_INPUT(deltat);
    GETPOT_INPUT(timesolver_theta);
    GETPOT_INPUT(timesolver_maxgrowth);
    GETPOT_INPUT(timesolver_tolerance);
    GETPOT_INPUT(timesolver_upper_tolerance);
    GETPOT_INPUT(steadystate_tolerance);

    GETPOT_REGISTER(timesolver_norm);
    const unsigned int n_timesolver_norm = input.vector_variable_size("timesolver_norm");
    timesolver_norm.resize(n_timesolver_norm, L2);
    for (unsigned int i=0; i != n_timesolver_norm; ++i)
      {
        int current_norm = 0; // L2
        if (timesolver_norm[i] == H1)
          current_norm = 1;
        if (timesolver_norm[i] == H2)
          current_norm = 2;
        current_norm = input("timesolver_norm", current_norm, i);
        if (current_norm == 0)
          timesolver_norm[i] = L2;
        else if (current_norm == 1)
          timesolver_norm[i] = H1;
        else if (current_norm == 2)
          timesolver_norm[i] = H2;
        else
          timesolver_norm[i] = DISCRETE_L2;
      }


    GETPOT_INT_INPUT(dimension);
    GETPOT_INPUT(domaintype);
    GETPOT_INPUT(domainfile);
    GETPOT_INPUT(elementtype);
    GETPOT_INPUT(elementorder);
    GETPOT_INPUT(domain_xmin);
    GETPOT_INPUT(domain_ymin);
    GETPOT_INPUT(domain_zmin);
    GETPOT_INPUT(domain_edge_width);
    GETPOT_INPUT(domain_edge_length);
    GETPOT_INPUT(domain_edge_height);
    GETPOT_INT_INPUT(coarsegridx);
    GETPOT_INT_INPUT(coarsegridy);
    GETPOT_INT_INPUT(coarsegridz);
    GETPOT_INT_INPUT(coarserefinements);
    GETPOT_INT_INPUT(extrarefinements);


    GETPOT_INT_INPUT(nelem_target);
    GETPOT_INPUT(global_tolerance);
    GETPOT_INPUT(refine_fraction);
    GETPOT_INPUT(coarsen_fraction);
    GETPOT_INPUT(coarsen_threshold);
    GETPOT_INT_INPUT(max_adaptivesteps);
    GETPOT_INT_INPUT(initial_adaptivesteps);


    GETPOT_INT_INPUT(write_interval);
    GETPOT_INPUT(output_xda);
    GETPOT_INPUT(output_xdr);
    GETPOT_INPUT(output_gz);
#ifndef LIBMESH_HAVE_GZSTREAM
    output_gz                   = false;
#endif
    GETPOT_INPUT(output_bz2);
#ifndef LIBMESH_HAVE_BZ2
    output_bz2                  = false;
#endif
    GETPOT_INPUT(output_gmv);
    GETPOT_INPUT(write_gmv_error);
#ifndef LIBMESH_HAVE_GMV
    output_gmv                  = false;
    write_gmv_error             = false;
#endif
    GETPOT_INPUT(output_tecplot);
    GETPOT_INPUT(write_tecplot_error);
#ifndef LIBMESH_HAVE_TECPLOT_API
    output_tecplot              = false;
    write_tecplot_error         = false;
#endif


    GETPOT_REGISTER(system_types);
    const unsigned int n_system_types =
      input.vector_variable_size("system_types");
    if (n_system_types)
      {
        system_types.resize(n_system_types, "");
        for (unsigned int i=0; i != n_system_types; ++i)
          {
            system_types[i] = input("system_types", system_types[i], i);
          }
      }


    GETPOT_REGISTER(periodic_boundaries);
    const unsigned int n_periodic_bcs =
      input.vector_variable_size("periodic_boundaries");

    if (n_periodic_bcs)
      {
        if (domaintype != "square" && 
            domaintype != "cylinder" && 
            domaintype != "file" && 
            domaintype != "od2")
          {
            libMesh::out << "Periodic boundaries need rectilinear domains" << std::endl;;
            libmesh_error();
          }
        for (unsigned int i=0; i != n_periodic_bcs; ++i)
          {
            unsigned int myboundary =
              input("periodic_boundaries", -1, i);
            unsigned int pairedboundary = 0;
            RealVectorValue translation_vector;
            if (dimension == 2)
              switch (myboundary)
              {
              case 0:
                pairedboundary = 2;
                translation_vector = RealVectorValue(0., domain_edge_length);
                break;
              case 1:
                pairedboundary = 3;
                translation_vector = RealVectorValue(-domain_edge_width, 0);
                break;
              default:
                libMesh::out << "Unrecognized periodic boundary id " <<
                                myboundary << std::endl;;
                libmesh_error();
              }
            else if (dimension == 3)
              switch (myboundary)
              {
              case 0:
                pairedboundary = 5;
                translation_vector = RealVectorValue(0., 0., domain_edge_height);
                break;
              case 1:
                pairedboundary = 3;
                translation_vector = RealVectorValue(0., domain_edge_length, 0.);
                break;
              case 2:
                pairedboundary = 4;
                translation_vector = RealVectorValue(-domain_edge_width, 0., 0.);
                break;
              default:
                libMesh::out << "Unrecognized periodic boundary id " <<
                                myboundary << std::endl;;
                libmesh_error();
              }
            periodic_boundaries.push_back(PeriodicBoundary(translation_vector));
            periodic_boundaries[i].myboundary = myboundary;
            periodic_boundaries[i].pairedboundary = pairedboundary;
          }
      }

    // Use std::string inputs so GetPot doesn't have to make a bunch
    // of internal C string copies
    std::string zero_string = "zero";
    std::string empty_string = "";

    GETPOT_REGISTER(dirichlet_condition_types);
    GETPOT_REGISTER(dirichlet_condition_values);
    GETPOT_REGISTER(dirichlet_condition_boundaries);
    GETPOT_REGISTER(dirichlet_condition_variables);

    const unsigned int n_dirichlet_conditions=
      input.vector_variable_size("dirichlet_condition_types");

    if (n_dirichlet_conditions !=
        input.vector_variable_size("dirichlet_condition_values"))
      {
        libMesh::out << "Error: " << n_dirichlet_conditions
                     << " Dirichlet condition types does not match "
                     << input.vector_variable_size("dirichlet_condition_values")
                     << " Dirichlet condition values." << std::endl;
        
        libmesh_error();
      }

    if (n_dirichlet_conditions !=
        input.vector_variable_size("dirichlet_condition_boundaries"))
      {
        libMesh::out << "Error: " << n_dirichlet_conditions
                     << " Dirichlet condition types does not match "
                     << input.vector_variable_size("dirichlet_condition_boundaries")
                     << " Dirichlet condition boundaries." << std::endl;
        
        libmesh_error();
      }

    if (n_dirichlet_conditions !=
        input.vector_variable_size("dirichlet_condition_variables"))
      {
        libMesh::out << "Error: " << n_dirichlet_conditions
                     << " Dirichlet condition types does not match "
                     << input.vector_variable_size("dirichlet_condition_variables")
                     << " Dirichlet condition variables sets." << std::endl;
        
        libmesh_error();
      }

    for (unsigned int i=0; i != n_dirichlet_conditions; ++i)
      {
        const std::string func_type =
          input("dirichlet_condition_types", zero_string, i);

        const std::string func_value =
          input("dirichlet_condition_values", empty_string, i);

        const boundary_id_type func_boundary =
          input("dirichlet_condition_boundaries", boundary_id_type(0), i);

        dirichlet_conditions[func_boundary] =
          (new_function_base(func_type, func_value).release());

        const std::string variable_set =
          input("dirichlet_condition_variables", empty_string, i);

        for (unsigned int i=0; i != variable_set.size(); ++i)
          {
            if (variable_set[i] == '1')
              dirichlet_condition_variables[func_boundary].push_back(i);
            else if (variable_set[i] != '0')
              {
                libMesh::out << "Unable to understand Dirichlet variable set" 
                             << variable_set << std::endl;
                libmesh_error();
              }
          }
      }

    GETPOT_REGISTER(neumann_condition_types);
    GETPOT_REGISTER(neumann_condition_values);
    GETPOT_REGISTER(neumann_condition_boundaries);
    GETPOT_REGISTER(neumann_condition_variables);

    const unsigned int n_neumann_conditions=
      input.vector_variable_size("neumann_condition_types");

    if (n_neumann_conditions !=
        input.vector_variable_size("neumann_condition_values"))
      {
        libMesh::out << "Error: " << n_neumann_conditions
                     << " Neumann condition types does not match "
                     << input.vector_variable_size("neumann_condition_values")
                     << " Neumann condition values." << std::endl;
        
        libmesh_error();
      }

    if (n_neumann_conditions !=
        input.vector_variable_size("neumann_condition_boundaries"))
      {
        libMesh::out << "Error: " << n_neumann_conditions
                     << " Neumann condition types does not match "
                     << input.vector_variable_size("neumann_condition_boundaries")
                     << " Neumann condition boundaries." << std::endl;
        
        libmesh_error();
      }

    if (n_neumann_conditions !=
        input.vector_variable_size("neumann_condition_variables"))
      {
        libMesh::out << "Error: " << n_neumann_conditions
                     << " Neumann condition types does not match "
                     << input.vector_variable_size("neumann_condition_variables")
                     << " Neumann condition variables sets." << std::endl;
        
        libmesh_error();
      }

    for (unsigned int i=0; i != n_neumann_conditions; ++i)
      {
        const std::string func_type =
          input("neumann_condition_types", zero_string, i);

        const std::string func_value =
          input("neumann_condition_values", empty_string, i);

        const boundary_id_type func_boundary =
          input("neumann_condition_boundaries", boundary_id_type(0), i);

        neumann_conditions[func_boundary] =
          (new_function_base(func_type, func_value).release());

        const std::string variable_set =
          input("neumann_condition_variables", empty_string, i);

        for (unsigned int i=0; i != variable_set.size(); ++i)
          {
            if (variable_set[i] == '1')
              neumann_condition_variables[func_boundary].push_back(i);
            else if (variable_set[i] != '0')
              {
                libMesh::out << "Unable to understand Neumann variable set" 
                             << variable_set << std::endl;
                libmesh_error();
              }
          }
      }

    GETPOT_REGISTER(initial_condition_types);
    GETPOT_REGISTER(initial_condition_values);
    GETPOT_REGISTER(initial_condition_subdomains);

    const unsigned int n_initial_conditions=
      input.vector_variable_size("initial_condition_types");

    if (n_initial_conditions !=
        input.vector_variable_size("initial_condition_values"))
      {
        libMesh::out << "Error: " << n_initial_conditions
                     << " initial condition types does not match "
                     << input.vector_variable_size("initial_condition_values")
                     << " initial condition values." << std::endl;
        
        libmesh_error();
      }

    if (n_initial_conditions !=
        input.vector_variable_size("initial_condition_subdomains"))
      {
        libMesh::out << "Error: " << n_initial_conditions
                     << " initial condition types does not match "
                     << input.vector_variable_size("initial_condition_subdomains")
                     << " initial condition subdomains." << std::endl;
        
        libmesh_error();
      }

    for (unsigned int i=0; i != n_initial_conditions; ++i)
      {
        const std::string func_type =
          input("initial_condition_types", zero_string, i);

        const std::string func_value =
          input("initial_condition_values", empty_string, i);

        const subdomain_id_type func_subdomain =
          input("initial_condition_subdomains", subdomain_id_type(0), i);

        initial_conditions[func_subdomain] =
          (new_function_base(func_type, func_value).release());
      }

    GETPOT_REGISTER(other_interior_function_types);
    GETPOT_REGISTER(other_interior_function_values);
    GETPOT_REGISTER(other_interior_function_subdomains);
    GETPOT_REGISTER(other_interior_function_ids);

    const unsigned int n_other_interior_functions =
      input.vector_variable_size("other_interior_function_types");

    if (n_other_interior_functions !=
        input.vector_variable_size("other_interior_function_values"))
      {
        libMesh::out << "Error: " << n_other_interior_functions
                     << " other interior function types does not match "
                     << input.vector_variable_size("other_interior_function_values")
                     << " other interior function values." << std::endl;
        
        libmesh_error();
      }

    if (n_other_interior_functions !=
        input.vector_variable_size("other_interior_function_subdomains"))
      {
        libMesh::out << "Error: " << n_other_interior_functions
                     << " other interior function types does not match "
                     << input.vector_variable_size("other_interior_function_subdomains")
                     << " other interior function subdomains." << std::endl;
        
        libmesh_error();
      }

    if (n_other_interior_functions !=
        input.vector_variable_size("other_interior_function_ids"))
      {
        libMesh::out << "Error: " << n_other_interior_functions
                     << " other interior function types does not match "
                     << input.vector_variable_size("other_interior_function_ids")
                     << " other interior function ids." << std::endl;
        
        libmesh_error();
      }

    for (unsigned int i=0; i != n_other_interior_functions; ++i)
      {
        const std::string func_type =
          input("other_interior_function_types", zero_string, i);

        const std::string func_value =
          input("other_interior_function_values", empty_string, i);

        const subdomain_id_type func_subdomain =
          input("other_interior_condition_subdomains", subdomain_id_type(0), i);

        const int func_id =
          input("other_interior_condition_ids", int(0), i);

        other_interior_functions[func_id][func_subdomain] =
          (new_function_base(func_type, func_value).release());
      }

    GETPOT_REGISTER(other_boundary_function_types);
    GETPOT_REGISTER(other_boundary_function_values);
    GETPOT_REGISTER(other_boundary_function_boundaries);
    GETPOT_REGISTER(other_boundary_function_ids);

    const unsigned int n_other_boundary_functions =
      input.vector_variable_size("other_boundary_function_types");

    if (n_other_boundary_functions !=
        input.vector_variable_size("other_boundary_function_values"))
      {
        libMesh::out << "Error: " << n_other_boundary_functions
                     << " other boundary function types does not match "
                     << input.vector_variable_size("other_boundary_function_values")
                     << " other boundary function values." << std::endl;
        
        libmesh_error();
      }

    if (n_other_boundary_functions !=
        input.vector_variable_size("other_boundary_function_boundaries"))
      {
        libMesh::out << "Error: " << n_other_boundary_functions
                     << " other boundary function types does not match "
                     << input.vector_variable_size("other_boundary_function_boundaries")
                     << " other boundary function boundaries." << std::endl;
        
        libmesh_error();
      }

    if (n_other_boundary_functions !=
        input.vector_variable_size("other_boundary_function_ids"))
      {
        libMesh::out << "Error: " << n_other_boundary_functions
                     << " other boundary function types does not match "
                     << input.vector_variable_size("other_boundary_function_ids")
                     << " other boundary function ids." << std::endl;
        
        libmesh_error();
      }

    for (unsigned int i=0; i != n_other_boundary_functions; ++i)
      {
        const std::string func_type =
          input("other_boundary_function_types", zero_string, i);

        const std::string func_value =
          input("other_boundary_function_values", empty_string, i);

        const boundary_id_type func_boundary =
          input("other_boundary_function_boundaries", boundary_id_type(0), i);

        const int func_id =
          input("other_boundary_function_ids", int(0), i);

        other_boundary_functions[func_id][func_boundary] =
          (new_function_base(func_type, func_value).release());
      }

    GETPOT_INPUT(run_simulation);
    GETPOT_INPUT(run_postprocess);


    GETPOT_REGISTER(fe_family);
    const unsigned int n_fe_family =
      std::max(1u, input.vector_variable_size("fe_family"));
    fe_family.resize(n_fe_family, "LAGRANGE");
    for (unsigned int i=0; i != n_fe_family; ++i)
      fe_family[i]              = input("fe_family", fe_family[i].c_str(), i);
    GETPOT_REGISTER(fe_order);
    const unsigned int n_fe_order =
      input.vector_variable_size("fe_order");
    fe_order.resize(n_fe_order, 1);
    for (unsigned int i=0; i != n_fe_order; ++i)
      fe_order[i]               = input("fe_order", (int)fe_order[i], i);
    GETPOT_INPUT(extra_quadrature_order);


    GETPOT_INPUT(analytic_jacobians);
    GETPOT_INPUT(verify_analytic_jacobians);
    GETPOT_INPUT(numerical_jacobian_h);
    GETPOT_INPUT(print_solution_norms);
    GETPOT_INPUT(print_solutions);
    GETPOT_INPUT(print_residual_norms);
    GETPOT_INPUT(print_residuals);
    GETPOT_INPUT(print_jacobian_norms);
    GETPOT_INPUT(print_jacobians);
    GETPOT_INPUT(print_element_jacobians);


    GETPOT_INPUT(use_petsc_snes);
    GETPOT_INPUT(time_solver_quiet);
    GETPOT_INPUT(solver_quiet);
    GETPOT_INPUT(solver_verbose);
    GETPOT_INPUT(require_residual_reduction);
    GETPOT_INPUT(min_step_length);
    GETPOT_INT_INPUT(max_linear_iterations);
    GETPOT_INT_INPUT(max_nonlinear_iterations);
    GETPOT_INPUT(relative_step_tolerance);
    GETPOT_INPUT(relative_residual_tolerance);
    GETPOT_INPUT(initial_linear_tolerance);
    GETPOT_INPUT(minimum_linear_tolerance);
    GETPOT_INPUT(linear_tolerance_multiplier);


    GETPOT_INT_INPUT(initial_sobolev_order);
    GETPOT_INT_INPUT(initial_extra_quadrature);
    GETPOT_INPUT(indicator_type);
    GETPOT_INT_INPUT(sobolev_order);

    GETPOT_INPUT(system_config_file);

  std::vector<std::string> bad_variables =
    input.unidentified_arguments(variable_names);

  if (libMesh::processor_id() == 0 && !bad_variables.empty())
    {
      std::cerr << "ERROR: Unrecognized variables:" << std::endl;
      for (unsigned int i = 0; i != bad_variables.size(); ++i)
        std::cerr << bad_variables[i] << std::endl;
      std::cerr << "Not found among recognized variables:" << std::endl;
      for (unsigned int i = 0; i != variable_names.size(); ++i)
        std::cerr << variable_names[i] << std::endl;
      libmesh_error();
    }
}
int do_transport_eval( const GetPot& input )
{
  GRINS::AntiochWilkeTransportMixture<Thermo,Viscosity,Conductivity,Diffusivity> mixture(input);

  GRINS::AntiochWilkeTransportEvaluator<Thermo,Viscosity,Conductivity,Diffusivity> evaluator(mixture);

  libMesh::Real T0 = input( "Conditions/T0", 300.0 );
  libMesh::Real T1 = input( "Conditions/T1", 300.0 );
  libMesh::Real T_inc = input( "Conditions/T_increment", 100.0 );

  libMesh::Real rho = input( "Conditions/density", 1.0e-3 );

  const unsigned int n_species = mixture.n_species();

  std::vector<libMesh::Real> Y(n_species);
  if( input.vector_variable_size( "Conditions/mass_fractions" ) != n_species )
    {
      std::cerr << "Error: mass fractions size not consistent with n_species"
                << std::endl;
      libmesh_error();
    }
    
  for( unsigned int s = 0; s < n_species; s++ )
    {
      Y[s] = input( "Conditions/mass_fractions", 0.0, s );
    }

  libMesh::Real T = T0;

  std::ofstream output;
  output.open( "transport.dat", std::ios::trunc );
  
  output << "# Species names" << std::endl;
  for( unsigned int s = 0; s < n_species; s++ )
    {
      output << mixture.species_name( s ) << " ";
    }
  output << std::endl;
  output << "# T [K]    mu         k           D[s]" << std::endl;

  output.close();

  while( T < T1 )
    { 
      output.open( "transport.dat", std::ios::app );
      output << std::scientific << std::setprecision(16);
      output << T << " ";
     
      libMesh::Real mu = evaluator.mu(T,Y);
      libMesh::Real k = evaluator.k(T,Y);

      output <<  mu << " ";
      output << k << " ";
      
      std::vector<libMesh::Real> D(n_species);
      for( unsigned int s = 0; s< n_species; s++ )
        {
          evaluator.D(rho, evaluator.cp(T,Y), k, D);

          output << D[s] << " ";
        }
      output << std::endl;
      output.close();

      T += T_inc;
    }

  return 0;
}
                                                                     libMesh::CompositeFunction<libMesh::Number>& composite_func ) const
#else
  void PrescribedMoleFractionsDirichletOldStyleBCFactory::add_funcs( const GetPot& input,
                                                                     MultiphysicsSystem& /*system*/,
                                                                     const std::string& input_string,
                                                                     const std::vector<std::string>& var_names,
                                                                     libMesh::CompositeFunction<libMesh::Number>& /*composite_func*/ ) const
#endif
  {
    const unsigned int n_vars = var_names.size();

    // Parse in all the species mole fracs that are in the input
    std::vector<libMesh::Number> species_mole_fracs(n_vars);
    libMesh::Number invalid_num = std::numeric_limits<libMesh::Number>::max();

    if( input.vector_variable_size(input_string) != n_vars )
      libmesh_error_msg("ERROR: Expected "+StringUtilities::T_to_string<unsigned int>(n_vars)+" components in "+input_string);

    for(unsigned int v = 0; v < n_vars; v++ )
      species_mole_fracs[v] = input(input_string,invalid_num,v);

    // Make sure mole fracs sum to 1
    libMesh::Number sum = 0.0;
    for(unsigned int v = 0; v < n_vars; v++ )
      sum += species_mole_fracs[v];

    libMesh::Number tol = std::numeric_limits<libMesh::Number>::epsilon()*10;
    if( std::abs(sum-1.0) > tol )
      libmesh_error_msg("ERROR: Mole fractions do not sum to 1! Found sum = "+StringUtilities::T_to_string<libMesh::Number>(sum));


    // To avoid compiler warnings without GRINS or Cantera
#if defined(GRINS_HAVE_ANTIOCH) || defined(GRINS_HAVE_CANTERA)
    // 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>
      (VariablesParsing::species_mass_fractions_section());
#endif

    std::string thermochem_lib;
    MaterialsParsing::thermochemistry_lib( input,
                                             PhysicsNaming::reacting_low_mach_navier_stokes(),
                                             thermochem_lib );

    if( thermochem_lib == "cantera" )
      {
#ifdef GRINS_HAVE_CANTERA
        this->convert_mole_fracs_and_add_to_func<CanteraMixture>(input,
                                                                 species_mole_fracs,
                                                                 species_fe_var,
                                                                 composite_func);
#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->convert_mole_fracs_and_add_to_func<AntiochChemistry>(input,
                                                                   species_mole_fracs,
                                                                   species_fe_var,
                                                                   composite_func);
#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+"!");
  }
  FullModelComposition<Vec,Mat>::FullModelComposition( int argc, char** argv,
                                                       const QUESO::BaseEnvironment& queso_env,
                                                       const GetPot& model_input )
    : _model(ModelBuilder<Vec,Mat>::build_model(queso_env,model_input)),
      _comm_handler(queso_env.subComm().Comm(),
                    model_input.vector_variable_size("Likelihood/datasets") )
  {
    // Grab the datasets we'll be working with
    unsigned int n_datasets = model_input.vector_variable_size("Likelihood/datasets");

    std::vector<std::string> datasets(n_datasets);
    for( unsigned int d = 0; d < n_datasets; d++ )
      {
        datasets[d] = model_input( "Likelihood/datasets", "DIE!", d );
      }

    // This is the dataset the current set of processors is going to work on
    int dataset_index = this->_comm_handler.get_dataset_index();

    // Input for this dataset
    _forward_run_input.reset( new GetPot(datasets[dataset_index]) );


    // Setup data space, 2 datapoints per dataset
    unsigned int n_datapoints = 2*n_datasets;
    QUESO::VectorSpace<Vec,Mat> data_space( queso_env, "data_", n_datapoints, NULL);

    _observations.reset( data_space.newVector() );
    _covariance.reset( data_space.newVector() );

    // Now parse data values and the corresponding covariances
    // Each processor parses its own dataset
    // Then we'll gather/broadcast to everyone
    std::vector<double> local_values(2);
    std::vector<double> all_values(n_datapoints);

    // Convention, mass_loss is first, then avg_N
    local_values[0] = (*_forward_run_input)("MassLossLikelihood/data_value", 0.0);
    local_values[1] = (*_forward_run_input)("AverageNLikelihood/data_value", 0.0);

    if( _comm_handler.get_inter0_rank() >= 0 )
      MPI_Gather( &local_values[0], 2, MPI_DOUBLE,
                  &all_values[0], 2, MPI_DOUBLE, 0,
                  _comm_handler.get_inter_chain_0_comm() );

    MPI_Bcast( &all_values[0], n_datapoints, MPI_DOUBLE,
               0, _comm_handler.get_inter_chain_comm() );

    for( unsigned int i = 0; i < n_datapoints; i++ )
      (*_observations)[i] = all_values[i];

    local_values[0] = (*_forward_run_input)("MassLossLikelihood/sigma", -1.0);
    local_values[1] = (*_forward_run_input)("AverageNLikelihood/sigma", -1.0);

    if( _comm_handler.get_inter0_rank() >= 0 )
      MPI_Gather( &local_values[0], 2, MPI_DOUBLE,
                  &all_values[0], 2, MPI_DOUBLE, 0,
                  _comm_handler.get_inter_chain_0_comm() );

    MPI_Bcast( &all_values[0], n_datapoints, MPI_DOUBLE,
               0, _comm_handler.get_inter_chain_comm() );

    for( unsigned int i = 0; i < n_datapoints; i++ )
      (*_covariance)[i] = all_values[i];


    // Now setup model to be evaluated on this set of processors
    // We do this last because of the UFO check in GRINS
    _model_evaluator.reset( new FullModelEvaluator<Vec,Mat>(argc,argv,
                                                            queso_env,
                                                            *(_forward_run_input.get()),
                                                            _comm_handler.get_split_chain_comm(),
                                                            *(_model.get())) );
  }
int run( int argc, char* argv[], const GetPot& input, GetPot& command_line )
{
  // Initialize libMesh library.
  libMesh::LibMeshInit libmesh_init(argc, argv);

  GRINS::SimulationBuilder sim_builder;

  GRINS::Simulation grins( input,
			   sim_builder,
                           libmesh_init.comm() );

  //FIXME: We need to move this to within the Simulation object somehow...
  std::string restart_file = input( "restart-options/restart_file", "none" );

  if( restart_file == "none" )
    {
      // Asssign initial temperature value
      std::string system_name = input( "screen-options/system_name", "GRINS" );
      std::tr1::shared_ptr<libMesh::EquationSystems> es = grins.get_equation_system();
      const libMesh::System& system = es->get_system(system_name);

      libMesh::Parameters &params = es->parameters;

      libMesh::Real& w_N2 = params.set<libMesh::Real>( "w_N2" );
      w_N2 = input( "Physics/ReactingLowMachNavierStokes/bound_species_0", 0.0, 0.0 );

      libMesh::Real& w_N = params.set<libMesh::Real>( "w_N" );
      w_N = input( "Physics/ReactingLowMachNavierStokes/bound_species_0", 0.0, 1.0 );

      system.project_solution( initial_values, NULL, params );
    }

  grins.run();

  // Get equation systems to create ExactSolution object
  std::tr1::shared_ptr<libMesh::EquationSystems> es = grins.get_equation_system();

   // Create Exact solution object and attach exact solution quantities
  libMesh::ExactSolution exact_sol(*es);

  libMesh::EquationSystems es_ref( es->get_mesh() );

  // Filename of file where comparison solution is stashed
  std::string solution_file = command_line("soln-data", "DIE!");
  es_ref.read( solution_file );

  exact_sol.attach_reference_solution( &es_ref );

  // Now grab the variables for which we want to compare
  unsigned int n_vars = command_line.vector_variable_size("vars");
  std::vector<std::string> vars(n_vars);
  for( unsigned int v = 0; v < n_vars; v++ )
    {
      vars[v] = command_line("vars", "DIE!", v);
    }

  // Now grab the norms to compute for each variable error
  unsigned int n_norms = command_line.vector_variable_size("norms");
  std::vector<std::string> norms(n_norms);
  for( unsigned int n = 0; n < n_norms; n++ )
    {
      norms[n] = command_line("norms", "DIE!", n);
      if( norms[n] != std::string("L2") &&
          norms[n] != std::string("H1") )
        {
          std::cerr << "ERROR: Invalid norm input " << norms[n] << std::endl
                    << "       Valid values are: L2" << std::endl
                    << "                         H1" << std::endl;
        }
    }

  const std::string& system_name = grins.get_multiphysics_system_name();

  // Now compute error for each variable
  for( unsigned int v = 0; v < n_vars; v++ )
    {
      exact_sol.compute_error(system_name, vars[v]);
    }

  int return_flag = 0;

  double tol = command_line("tol", 1.0e-10);

  // Now test error for each variable, for each norm
  for( unsigned int v = 0; v < n_vars; v++ )
    {
      for( unsigned int n = 0; n < n_norms; n++ )
        {
          test_error_norm( exact_sol, system_name, vars[v], norms[n], tol, return_flag );
        }
    }

  return return_flag;
}