LifeV
BCInterface< BcHandler, PhysicalSolverType > Class Template Referenceabstract

BCInterface - LifeV interface to load boundary conditions completely from a GetPot file. More...

#include <BCInterface.hpp>

+ Inheritance diagram for BCInterface< BcHandler, PhysicalSolverType >:
+ Collaboration diagram for BCInterface< BcHandler, PhysicalSolverType >:

Protected Attributes

bcHandlerPtr_Type M_handler
 
vectorFunction_Type M_vectorFunction
 
vectorFunctionSolverDefined_Type M_vectorFunctionSolverDefined
 

Type definitions

typedef BcHandler bcHandler_Type
 
typedef std::shared_ptr< bcHandler_TypebcHandlerPtr_Type
 
typedef PhysicalSolverType physicalSolver_Type
 
typedef std::shared_ptr< physicalSolver_TypephysicalSolverPtr_Type
 
typedef BCInterfaceFactory< bcHandler_Type, physicalSolver_Typefactory_Type
 
typedef factory_Type::bcFunctionPtr_Type bcFunctionPtr_Type
 
typedef std::vector< bcFunctionPtr_TypevectorFunction_Type
 
typedef factory_Type::bcFunctionParserSolver_Type bcFunctionParserSolver_Type
 
typedef factory_Type::bcFunctionParserSolverPtr_Type bcFunctionParserSolverPtr_Type
 
typedef factory_Type::bcFunctionSolverDefinedPtr_Type bcFunctionSolverDefinedPtr_Type
 
typedef std::vector< bcFunctionSolverDefinedPtr_TypevectorFunctionSolverDefined_Type
 
typedef BCInterfaceData data_Type
 
typedef std::shared_ptr< data_TypedataPtr_Type
 

Constructors & Destructor

 BCInterface ()
 Constructor. More...
 
virtual ~BCInterface ()
 Destructor. More...
 

Methods

void createHandler ()
 Create the bcHandler. More...
 
void fillHandler (const std::string &fileName, const std::string &dataSection)
 Fill the bcHandler with the BC provided in the file. More...
 
virtual void readBC (const std::string &fileName, const std::string &dataSection, const std::string &name)=0
 Read a specific boundary condition from a file and add it to the data container. More...
 
virtual void insertBC ()=0
 Insert the current boundary condition in the BChandler. More...
 
virtual void updatePhysicalSolverVariables ()
 Update the variables inside the physical solver. More...
 

Set Methods

virtual void setPhysicalSolver (const physicalSolverPtr_Type &physicalSolver)
 Set a physical solver. More...
 
void setHandler (const bcHandlerPtr_Type &handler)
 Set an Handler. More...
 

Get Methods

bcHandlerPtr_Typehandler ()
 Get the shared_ptr to the BCHandler. More...
 
virtual data_TypedataContainer ()=0
 Get the data container. More...
 

Unimplemented Methods

 BCInterface (const BCInterface &interface1D)
 
BCInterfaceoperator= (const BCInterface &interface1D)
 

Detailed Description

template<class BcHandler, class PhysicalSolverType>
class LifeV::BCInterface< BcHandler, PhysicalSolverType >

BCInterface - LifeV interface to load boundary conditions completely from a GetPot file.

Author
Cristiano Malossi

This class allows to impose boundary conditions completely from a GetPot file. You can derive a specific implementation for the BCHandler of your problem. For 0D (BCInterface0D), 1D (BCInterface1D) and 3D (BCInterface3D) problems the derived classes are already available.

EXAMPLE - DATA FILE
In the GetPot data file, BCInterface reads a new section: [boundary_conditions] .

Inside the new section there is a list of boundary conditions which correspond to other sub-section with the same name, for example: list = 'InFlow OutFlow'

Each boundary condition has a similar structure. The list of properties depends from the type of the boundary condition (if it is for 1D or 3D solver for example). For example:

[InFlow]
...
...
function = '3*0.03*(1/4-(x^2+y^2)'

[OutFlow]
...
...
function = '0'

The string function represents the base module and can be replaced by other derived/alternative modules. The following functions are available (see the related classes for more information):

  1. function, which is implemented in BCInterfaceFunctionParser;
  2. functionFile, which is implemented in BCInterfaceFunctionParserFile;
  3. functionSolver, which is implemented in BCInterfaceFunctionParserSolver;
  4. functionFileSolver, which is implemented in BCInterfaceFunctionParserFileSolver;

All the parameters are case sensitive.

EXAMPLE - HOW TO USE
Here there is a short guide on how to create and use a BCInterface object.

  1. First of all, you have to define a BCInterface class:

    BCInterface bcInterface;

  2. You can create an empty handler by calling:

    bcInterface.createHandler()

    or you can set it from outside

    std::shared_ptr< bcHandler_Type > bcHandler( new bcHandler_Type() );
    bcInterface.setHandler( bcHandler );

  3. Then you can add all the file boundary condition by calling

    bcInterface.fillHandler( "fileName.dat", "section" );

    Or you can add one specific boundary conditions by calling

    bcInterface.readBC( "fileName.dat", "section", "bcSection" );
    bcInterface.insertBC();

    Note that between readBC and insertBC you can manipulate the BC parameters by accessing the data container:

    bcInterface.dataContainer();

    In addition, you can also add BC directly from the code by accessing the bcHandler

    M_bc.handler()->addBC( ... );

  4. If you are using functions that use solver variables first you have to pass the solver

    M_bc.setPhysicalSolver( physicalSolverPtr );

    Then be sure to update the variable at each time step before using the BCHandler:

    M_bc.updatePhysicalSolverVariables();

  5. Finally, to get the handler you can use:

    M_bc.handler();

Definition at line 158 of file BCInterface.hpp.

Member Typedef Documentation

◆ bcHandler_Type

typedef BcHandler bcHandler_Type

Definition at line 165 of file BCInterface.hpp.

◆ bcHandlerPtr_Type

typedef std::shared_ptr< bcHandler_Type > bcHandlerPtr_Type

Definition at line 166 of file BCInterface.hpp.

◆ physicalSolver_Type

typedef PhysicalSolverType physicalSolver_Type

Definition at line 168 of file BCInterface.hpp.

◆ physicalSolverPtr_Type

typedef std::shared_ptr< physicalSolver_Type > physicalSolverPtr_Type

Definition at line 169 of file BCInterface.hpp.

◆ factory_Type

◆ bcFunctionPtr_Type

◆ vectorFunction_Type

typedef std::vector< bcFunctionPtr_Type > vectorFunction_Type

Definition at line 174 of file BCInterface.hpp.

◆ bcFunctionParserSolver_Type

◆ bcFunctionParserSolverPtr_Type

◆ bcFunctionSolverDefinedPtr_Type

◆ vectorFunctionSolverDefined_Type

Definition at line 180 of file BCInterface.hpp.

◆ data_Type

Definition at line 182 of file BCInterface.hpp.

◆ dataPtr_Type

typedef std::shared_ptr< data_Type > dataPtr_Type

Definition at line 183 of file BCInterface.hpp.

Constructor & Destructor Documentation

◆ BCInterface() [1/2]

BCInterface ( )
explicit

Constructor.

Definition at line 302 of file BCInterface.hpp.

◆ ~BCInterface()

virtual ~BCInterface ( )
inlinevirtual

Destructor.

Definition at line 195 of file BCInterface.hpp.

◆ BCInterface() [2/2]

BCInterface ( const BCInterface< BcHandler, PhysicalSolverType > &  interface1D)
private

Member Function Documentation

◆ createHandler()

void createHandler ( )
inline

Create the bcHandler.

Definition at line 204 of file BCInterface.hpp.

◆ fillHandler()

void fillHandler ( const std::string &  fileName,
const std::string &  dataSection 
)

Fill the bcHandler with the BC provided in the file.

Parameters
fileNameName of the data file
dataSectionSubsection inside [boundary_conditions]

Definition at line 319 of file BCInterface.hpp.

◆ readBC()

virtual void readBC ( const std::string &  fileName,
const std::string &  dataSection,
const std::string &  name 
)
pure virtual

Read a specific boundary condition from a file and add it to the data container.

Parameters
fileNameName of the data file
dataSectionsection in the data file
namename of the boundary condition

Implemented in BCInterface3D< BcHandler, PhysicalSolverType >, BCInterface1D< BcHandler, PhysicalSolverType >, and BCInterface0D< BcHandler, PhysicalSolverType >.

◆ insertBC()

virtual void insertBC ( )
pure virtual

◆ updatePhysicalSolverVariables()

void updatePhysicalSolverVariables ( )
virtual

Update the variables inside the physical solver.

Definition at line 338 of file BCInterface.hpp.

◆ setPhysicalSolver()

void setPhysicalSolver ( const physicalSolverPtr_Type physicalSolver)
virtual

Set a physical solver.

Parameters
physicalSolverphysical solver

Reimplemented in BCInterface3D< BcHandler, PhysicalSolverType >.

Definition at line 366 of file BCInterface.hpp.

◆ setHandler()

void setHandler ( const bcHandlerPtr_Type handler)
inline

Set an Handler.

Parameters
handlerBCHandler

Definition at line 246 of file BCInterface.hpp.

◆ handler()

bcHandlerPtr_Type& handler ( )
inline

Get the shared_ptr to the BCHandler.

Returns
the pointer to the BCHandler

Definition at line 261 of file BCInterface.hpp.

◆ dataContainer()

virtual data_Type& dataContainer ( )
pure virtual

◆ operator=()

BCInterface& operator= ( const BCInterface< BcHandler, PhysicalSolverType > &  interface1D)
private

Field Documentation

◆ M_handler

bcHandlerPtr_Type M_handler
protected

Definition at line 278 of file BCInterface.hpp.

◆ M_vectorFunction

vectorFunction_Type M_vectorFunction
protected

Definition at line 281 of file BCInterface.hpp.

◆ M_vectorFunctionSolverDefined

vectorFunctionSolverDefined_Type M_vectorFunctionSolverDefined
protected

Definition at line 284 of file BCInterface.hpp.


The documentation for this class was generated from the following file: