Commit 9a180be2 authored by Praetorius, Simon's avatar Praetorius, Simon

Tutorial extended

parent 071d8abc
......@@ -872,6 +872,75 @@ int main(int argc, char* argv[])
The solution is shown in the next pictures. On the left one can see the mesh locally refined on the boundary of a circle:
\image html elliptImplicit.png "Implicit Dirichlet condition at the boundary of a circle" width=300px
\subsection manual_dirichlet_bc Dirichlet boundary condition with mesh indicators
How to solve the problems of AMDiS with Dirichlet condition, with the priority of one condition over the other? How to enforce the essential
boundary conditions independent of the boundary number set in the macro-mesh? The answer is to use manual Dirichlet boundary conditions, also
defined in ExtendedProblemStat.h. There you do not (necessarily) describe the boundary by a boundary number, but by a boundary indicator.
A mesh- or boundary indicator is an AbstractFunction, that return true if the coordinate, where it is evaluated, lies on the desired boundary,
and false otherwise. (Probably it would be better here to use the struct MeshIndictor that has exactly the desired structure). Optionally you can give
also a boundary number so that the combination of both describes the boundary part for the Dirichlet condition:
\code
template<typename ValueContainer>
void addManualDirichletBC(AbstractFunction<bool, WorldVector<double> >* meshIndicator,
int row, int col,
ValueContainer &values);
template<typename ValueContainer>
void addManualDirichletBC(BoundaryType nr, AbstractFunction<bool, WorldVector<double> >* meshIndicator,
int row, int col,
ValueContainer &values);
\endcode
In the next example we want to enforce a Dirichlet boundary condition on the left boundary, that has the x-coordinate 0.0:
\code
struct LeftBoundary : AbstractFunction< bool, WorldVector<double> >
{
bool operator()(const WorldVector<double>& x) const
{
return x[0] < DBL_TOL;
}
};
int main(int argc, char* argv[])
{
AMDiS::init(argc, argv);
// ===== create and init the scalar problem =====
ExtendedProblemStat ellipt("ellipt");
ellipt.initialize(INIT_ALL);
// === create adapt info ===
AdaptInfo adaptInfo("ellipt->adapt", ellipt.getNumComponents());
AdaptStationary adapt("ellipt->adapt", ellipt, adaptInfo);
// ===== create matrix operator =====
Operator matrixOperator(ellipt.getFeSpace());
matrixOperator.addTerm(new Simple_SOT);
ellipt.addMatrixOperator(matrixOperator, 0, 0);
// ===== create rhs operator =====
Operator rhsOperator(ellipt.getFeSpace());
rhsOperator.addTerm(new Simple_ZOT(1.0));
ellipt.addVectorOperator(rhsOperator, 0);
// ===== add boundary conditions =====
double one = 1.0;
ellipt.addManualDirichletBC(new LeftBoundary, 0, 0, one);
// ===== start simulation =====
adapt.adapt();
ellipt.writeFiles(adaptInfo, true);
AMDiS::finalize();
}
\endcode
\image html elliptManual.png "Manual Dirichlet condition at the left boundary of the domain" width=300px
*/
#endif // AMDIS_EXTENSIONS_TUTORIAL_INCLUDE
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment