# Boundary conditions in Montjoie

The boundary conditions implemented in Montjoie are listed in the class BoundaryConditionEnum :

- LINE_DIRICHLET : Dirichlet condition
- LINE_NEUMANN : Neumann condition
- LINE_ABSORBING : absorbing boundary condition
- LINE_HIGH_CONDUCTIVITY : equivalent boundary condition for a highly conducting object
- LINE_IMPEDANCE : Robin boundary condition
- LINE_THIN_SLOT : equivalent boundary condition for a thin slot
- LINE_NEIGHBOR : this boundary is at the interface between two processors
- LINE_TRANSMISSION : transmission boundary conditions
- LINE_DTN : Dirichlet-to-Neumann operator
- LINE_SUPPORTED : Dirichlet condition concerning only some components of u

The boundary conditions are usually taken into account in the finite element matrix (through the variational formulation). Dirichlet and Supported boundary conditions are set by setting the concerned rows and columns to 0, with 1 on the diagonal. For inhomogenous Dirichlet, the columns are kept before erasing them so that the right hand side is modified. Periodic boundary conditions can be set by changing the numbers of degrees of freedom. Quasi-periodic boundary conditions are set either in the variational formulation or by modifying some rows of the finite element matrix.

The treatment of usual boundary conditions is performed in the class VarBoundaryCondition which is a base class of EllipticProblem.

## Public attributes of VarBoundaryCondition

exit_if_no_boundary_condition | if true, the computation will stop if no boundary condition is associated with a face on the boundary of the mesh |

Param_condition | List of parameters associated with each reference of the mesh |

NewColumnNumbers_Impedance | new column numbers when adding the surface integrals against basis functions |

NewRowNumbers_Impedance | new row numbers when adding the surface integrals against basis functions |

## Methods of VarBoundaryCondition

GetNbDirichletDof | returns the number of dofs associated with Dirichlet condition |

GetDirichletDofNumber | returns the dof number of the i-th dof associated with Dirichlet condition |

IsDofDirichlet | returns true if the dof i is associated with a Dirichlet condition |

GetNbSupportedComponents | returns the number of components to set to 0 for supported boundary condition |

GetSupportedComponent | returns the component number of the i-th component to set to 0 for supported boundary condition |

TreatDirichletCondition | finds all the dofs associated with Dirichlet condition |

SetDirichletCondition | erases rows and columns associated with Dirichlet condition and put 1 on the diagonal |

InitDirichletCondition | stores the value of source on Dirichlet dofs |

ApplyDirichletCondition | modification of the right hand side when inhomogeneous Dirichlet condition is specified |

ImposeDirichletCondition | affects values previously set when calling InitDirichletCondition |

ImposeNullDirichletCondition | sets to 0 values associated with Dirichlet condition |

ChangeDirichletCoef | modifies the diagonal coefficients of Dirichlet rows |

ComputeAndChangeDirichletCoef | modifies the diagonal coefficients of Dirichlet rows depending on the largest eigenvalues of the matrix |

GetNbModes | returns the number of modes for computations on periodized meshes or cyclic meshes |

ModesNotStored | returns true if the modes are not stored (prevents from the use of fft but requires less memory) |

GetModeNumber | returns the mode number of mode i |

GetPeriodicNumberModes | returns the number of modes along x, y, z |

GetPeriodicModes | returns the mode number along x, y, z |

InitCyclicDomain | initialises the type of periodicity and the number of modes to treat |

GetSymmetryType | returns the type of periodicity/symmetry for the computation of the solution (periodic in x, y, z and/or theta) |

GetPeriodicPhase | returns the phase associated with a given dof |

ComputeQuasiPeriodicPhase | computes the phase for all periodic dofs |

SetPeriodicCondition | sets quasi-periodic condition in the finite element matrix |

ApplyPeriodicCondition | modifies the right hand side because of quasi-periodic conditions |

GetImpedanceCoefficientABC | returns the coefficient associated with the first-order absorbing condition (usually equal to one) |

AddMatrixImpedanceBoundary | adds to a given matrix surface integrals against basis functions |

InsidePML | returns true if the element i is inside PML layers |

GetNbEltPML | returns the number of elements contained in PML layers |

FindElementsInsidePML | finds elements that are contained in PML layers |

GetTauPML | returns coefficient tau of PML layers |

GetDampingTauPML | returns coefficient tau of PML layers |

GetDeriveTauPML | returns derivative of coefficient tau of PML layers |

GetDampingFactorPML | returns the damping factor (usually called sigma) in PML layers |

ComputeMatrixDtnBoundary | adds to a given matrix surface integrals involving a Dirichlet to Neumann operator |

GetParamCondition | returns a parameter associated with a boundary condition |

AddBoundaryConditions | adds to the finite element matrix the terms due to boundary conditions |

TreatThinSlotCondition | adds terms due to thin slot boundary condition (only implemented for 2-D Helmholtz equation) |

## Methods for ImpedanceABC/ImpedanceGeneric

EvaluateImpedancePhi | evaluates the impedance involved in surface integrals against basis functions |

EvaluateImpedanceGrad | evaluates the impedance involved in surface integrals against gradient of basis functions |

ApplyImpedancePhi | applies the impedance involved in surface integrals against basis functions |

ApplyImpedanceGrad | applies the impedance involved in surface integrals against gradient of basis functions |

## Methods for VarTransmission

InitTransmission | initialisation before effective computation of transmission terms |

GetNbVolumeDofOnSurface | returns the number of volume dofs which are on the surfaces where transmissions conditions are set |

SetModifiedColNumbers | modifies column numbers before calls to AddMatrixImpedanceBoundary |

SetModifiedRowNumbers | modifies rows numbers before calls to AddMatrixImpedanceBoundary |

PartMeshTransmission | faces on which transmission conditions are set are duplicated so that the approximation is discontinuous even for continuous elements |

TreatTransmission | prepares mesh and dofs before adding transmission terms |

DistributeVolumeDofs | distributes volume dofs on several processors |

UpdateVolumeDofs | updates volume dofs on several processors |

UpdateTransmissionArray | method used in parallel |

GatherVolumeValuesOnSurface | method used in parallel |

AssembleVolumeValuesOnSurface | method used in parallel |

ScatterVolumeValuesOnSurface | method used in parallel |

AddTransmissionTerms | adds surface integrals due to transmission conditions to a sparse matrix |

#### Dirichlet Boundary condition

Dirichlet boundary conditions can be homogeneous

or inhomogeneous

In the case of edge elements, Dirichlet condition is actually a perfectly conductor condition :

Dirichlet condition is set by setting to 0 the concerned rows and columns and putting 1 on the diagonal. This coefficient one can be changed for the computation of eigenvalues to avoid the pollution of the spectrum with eigenvalues equal to 1. For discontinuous Galerkin formulations, the Dirichlet condition is handled in the variational formulation.

Neumann boundary conditions are equal for the Laplace and Helmholtz equation

In the case of Maxwell's equations, it refers to :

In the case of elastodynamics, it refers to :

In the case of aeroacoustics, it refers to :

As you can see, this boundary condition depends on the considered equation, but usually is associated with the boundary condition that will cancel the boundary integral coming from the integration by parts