예제 #1
0
std::map< GRINS::PhysicsName, GRINS::NBCContainer > GRINS::ThermallyDrivenFlowTestBCFactory::build_neumann( libMesh::EquationSystems& es )
{
    std::map< std::string, GRINS::NBCContainer > nbcs;

    /* Hack to work around the fact that we're using this test for the axisymmetric
       case as well the fact I'm and idiot in the design of the axisymmetric cases. */
    if( _input("Physics/enabled_physics", "DIE!", 1) != std::string("HeatTransfer") )
    {
        // Do nothing.
    }
    else
    {
        // These are hardcoded for the 2D and 3D tests, *not* the axisymmetric test.
        const libMesh::System& system = es.get_system("GRINS");
        const GRINS::VariableIndex T_var = system.variable_number("T");

        GRINS::SharedPtr<GRINS::NeumannFuncObj> func( new ZeroFluxBC );

        GRINS::NBCContainer nbc_container;
        nbc_container.set_bc_id(0);
        nbc_container.add_var_func_pair( T_var, func );


        nbcs.insert( std::pair< std::string, GRINS::NBCContainer >( "HeatTransfer", nbc_container ) );
    }

    return nbcs;
}
  void DisplacementContinuationSolver::increment_displacement( GRINS::MultiphysicsSystem& system,
                                                               libMesh::EquationSystems& equation_system,
                                                               const libMesh::Real displacement )
  {
    // Get DirichetBoundaries vector.
    libMesh::DirichletBoundaries* d_vector = system.get_dof_map().get_dirichlet_boundaries();

    // Get the DirichletBoundary we want
    libMesh::DirichletBoundary* dirichlet = (*d_vector)[_bc_index];

    // Kill the old FunctionBase object and put in our new one.
    libMesh::FunctionBase<libMesh::Real>* composite_func_ptr = new libMesh::CompositeFunction<libMesh::Real>;
    libMesh::CompositeFunction<libMesh::Real>& composite_func = libMesh::cast_ref<libMesh::CompositeFunction<libMesh::Real>&>( *composite_func_ptr );

    std::vector<VariableIndex> var_idx(1,0); // Hardcoding to Ux displacement component
    composite_func.attach_subfunction( libMesh::ConstFunction<libMesh::Real>(displacement), var_idx );

    // DirichletBoundary now takes ownership of the pointer
    dirichlet->f.reset(composite_func_ptr);

    // Need to reinit system
    equation_system.reinit();

    return;
  }
  void DisplacementContinuationSolver::increment_displacement( GRINS::MultiphysicsSystem& system,
                                                               libMesh::EquationSystems& equation_system,
                                                               const libMesh::Real displacement )
  {
    // Get DirichetBoundaries vector.
    libMesh::DirichletBoundaries* d_vector = system.get_dof_map().get_dirichlet_boundaries();

    // Get the DirichletBoundary we want
    libMesh::DirichletBoundary* dirichlet = (*d_vector)[_bc_index];

    // Kill the old FunctionBase object and put in our new one.
    dirichlet->f.reset( new libMesh::ConstFunction<libMesh::Real>( displacement ) );

    // Need to reinit system
    equation_system.reinit();

    return;
  }