Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
amdis
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
iwr
amdis
Commits
9a180be2
Commit
9a180be2
authored
12 years ago
by
Praetorius, Simon
Browse files
Options
Downloads
Patches
Plain Diff
Tutorial extended
parent
071d8abc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
extensions/tutorial.hpp
+69
-0
69 additions, 0 deletions
extensions/tutorial.hpp
with
69 additions
and
0 deletions
extensions/tutorial.hpp
+
69
−
0
View file @
9a180be2
...
...
@@ -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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment