Wiki

Clone wiki

lifev-release / tutorial / Application_of_Boundary_Conditions

Go back


Update/Application of Boundary Conditions

Once the BCHandler object has been created and fed with the list of boundary conditions, we need to communicate these data to the solver. We need to:

  1. for each boundary condition, construct the list of DOFs interested by the specific condition;
  2. call a method to apply the boundary conditions to the linear system.

To construct the list of DOFs related to each specific boundary conditions we call the method bcUpdate of the class BCHandler. This call should be inserted inside the main function after the definition of the mesh and finite element spaces structures. In case we have partitioned the mesh, each processor constructs the list of DOFs related to the mesh partition that it owns.

    // ...
    // mesh reading and partition
    // creation of the finite element space

    // ...

    bcH.bcUpdate( *local_mesh, uFESpace.feBd(), uFESpace.dof()) ;

Last step consists in applying the conditions to the matrix and right hand side vector of the linear system before calling the solver. This operation is performed by the function bcManage declared in the file BCManage.hpp. First, we need to insert inside the main file the following header

    // ...

    // Header for the BCManage
    #include <lifev/core/fem/BCManage.hpp>

    // ...

Finally, inside the main function, after the call to the method bcUpdate and the definition and assembly of the system matrix (systemMatrix), and the right hand side vector (rhs), we write:

    // ...
    // assembly of systemMatrix and rhs

    bcManage( systemMatrix, rhs, *uFESpace.mesh(), uFESpace.dof(), bcH, uFESpace.feBd(), 1.0, time );

where bcH is the BCHandler object we defined previously in the main. The seventh input argument (equal to 1.0 in the example) is the coefficient set on the diagonal entry of the system matrix.

In case of a steady problem, the input argument time can be substituted with 0.0.

Updated