void AverageNusseltNumber::init( const GetPot& input, const MultiphysicsSystem& system )
  {
    // 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;
  }
示例#2
0
  void Vorticity::init( const GetPot& input, const MultiphysicsSystem& system )
  {
    // Grab velocity variable indices
    std::string u_var_name = input("Physics/VariableNames/u_velocity", u_var_name_default);
    std::string v_var_name = input("Physics/VariableNames/v_velocity", v_var_name_default);
    this->_u_var = system.variable_number(u_var_name);
    this->_v_var = system.variable_number(v_var_name);

    return;
  }
 void PrescribedVectorValueDirichletOldStyleBCFactory::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
 {
   for( unsigned int n = 0; n < var_names.size(); n++ )
     {
       std::vector<VariableIndex> dbc_vars(1,system.variable_number(var_names[n]));
       libMesh::Number value = input(input_string, 0.0, n);
       libMesh::ConstFunction<libMesh::Number> const_func(value);
       composite_func.attach_subfunction(const_func, dbc_vars);
     }
 }
  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;
  }
示例#5
0
  void ConstantFunctionDirichletBCFactory::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
  {
    libMesh::Number invalid_num = std::numeric_limits<libMesh::Number>::max();

    for( std::set<std::string>::const_iterator var = vars_found.begin();
         var != vars_found.end(); ++var )
      {
        std::vector<VariableIndex> var_idx(1,system.variable_number(*var));

        libMesh::Number value = input(section+"/"+(*var),invalid_num);

        libMesh::ConstFunction<libMesh::Number> const_func(value);
        composite_func.attach_subfunction(const_func,var_idx);
      }

    vars_added = vars_found;
  }
示例#6
0
  libMesh::UniquePtr<FunctionType>
  ParsedFunctionDirichletOldStyleBCFactory<FunctionType>::build_func( const GetPot& input,
                                                                      MultiphysicsSystem& system,
                                                                      std::vector<std::string>& var_names,
                                                                      const std::string& section )
  {
    libmesh_assert_equal_to( var_names.size(), 1 );

    std::vector<VariableIndex> dbc_vars(1,system.variable_number(var_names[0]));

    std::string section_str = section+"/"+DirichletBCFactoryFunctionOldStyleBase<FunctionType>::_value_var_old_style;
    std::string expression = input(section_str,"DIE!",DirichletBCFactoryFunctionOldStyleBase<FunctionType>::_value_idx_old_style);

    libMesh::UniquePtr<FunctionType> all_funcs = this->build_composite_func();

    typedef typename TypeFrom<FunctionType>::to_composite composite_type;
    composite_type * composite_func =
      libMesh::cast_ptr<composite_type *>(all_funcs.get());

    composite_func->attach_subfunction
      (TypeFrom<FunctionType>::to_parsed(system, expression), dbc_vars);

    return all_funcs;
  }