CEPS  24.01
Cardiac ElectroPhysiology Simulator
Syntax to add boundary conditions and source terms.

Boundary conditions and source terms must be added using function already added to the functions dictionary contained in every PDE problem. The syntax to add a function to the dictionary is described in this section.

A similar pattern is used to define boundary conditions and source terms from an input string of characters. The boundary conditions and source terms are added internally, but it is easy to get the inputs from the text input file.

Add a source term

Add a source term from its definition in the dictionary is quite simple and you can add some extra options.

// stm is a SourceTermManager*
stm->add(params);

params has the form <label> <dict_label> <options> where label is a name given to this source term, dict_label is the dictionary function that will be set as source term, and options can contain several TAG value pairs;

Tag Value type Default value Description
UNKNOWN integer Mandatory Id of the unknown on which the source term is added. Depends on the problem
TYPE One of DEFAULT, KTERM or IAPP DEFAULT Default is regular source term added to the equation. Kterm is term of which the Laplacian is added to the equation (thus multiplied by stiffness matrix in finite element, hence the name). IAPP is for cardiac source terms , ie stimulations, that are linked to ionic models.
ATTRIBUTE(S) list of integers -1 Where to apply the source term. If the unknown is already restricted to a region, this restriction is aleady taken into account.
SCALE real number 1. Multiplicative factor

Add a boundary condition

In a similar way

// bcm is a BoundaryConditionManager*
bcm->add(params);

params has the form <label> <bc_type> <dict_label> <options> where label is a name given to this boundary condition, <bc_type> is either DIRICHLET NEUMANN or ROBIN, dict_label is the dictionary function that will be set as source term, and options can contain several TAG value pairs;

Tag Value type Default value Description
UNKNOWN integer Mandatory Id of the unknown for which the boundary condition applies. Depends on the problem
ATTRIBUTE(S) list of integers -1 Where to apply the boundary condition. If the unknown is already restricted to a region, this restriction is aleady taken into account.
SCALE real number 1. Multiplicative factor
VOLUMIC no argument Add this keyword for Dirichlet boundary conditions applied to volumic regions. The parameter has no effect on Robin and Neumann boundary conditions.
ROBINCOEFF dict function name Robin coefficient $\alpha$ as in $u+\alpha(x,t)\partial_n u = g(t,x)$. $g$ is the function designated with <dict_label>.

Example

Here is an implementation example for a problem derived from HeatProblem.

class SuperDuperHeatProblem : public HeatProblem
{
public:
SuperDuperHeatProblem(Geometry* g, InputParameters* params = nullptr):
HeatProblem(g,params) {
};
void
{
// 1. Add function dictionary entries
m_functions->add("robinAlpha","CPIECEWISE 70 1., 71 2.");
m_functions->add("robinValue","FUNCTION TIME START 0 END 10 PROFILE CONSTANT");
// alpha = 1 on elements with attribute 70, 2 on elements with attribute 71, 0 elsewhere
// The g function in boundary condition is equal to 1 for 0<t<10
// 2. Use the functions for the boundary condition
m_boundaryConditions->add("bc0 ROBIN robinValue UNKNOWN 0 ROBINCOEFF robinAlpha");
}
void
defineSourceTerms() override
{
m_functions->add("source0","CONSTANT 5.");
m_sourceTerms->add("st0 source0 TYPE REGULAR ATTRIBUTES 66");
// The source term is added only on elements with attribute 66
}
};
virtual void defineBoundaryConditions()
Define the boundary conditions. Should be defined in derived classes. Default is no BC.
Encapsulates all the geometrical data.
Definition: Geometry.hpp:50
Heat PDE, single unknown, constant diffusion coeff 1, homogeneous Neumann (no BC defined)
Definition: HeatProblem.hpp:36
void defineSourceTerms() override
Lists the unknowns of the problem (one here)
Definition: HeatProblem.cpp:56
Reads and stores simulation configuration.