AMDiS 2.10
The Adaptive Multi-Dimensional Simulation Toolbox
vecellipt.cc
1
2#include <config.h>
3
4#include <iostream>
5
6#include <amdis/AMDiS.hpp>
7#include <amdis/LocalOperators.hpp>
8#include <amdis/ProblemStat.hpp>
10
12using namespace AMDiS;
14
16int main(int argc, char** argv)
17{
18 Environment env(argc, argv);
20
22 using Grid = Dune::YaspGrid<GRIDDIM>;
23 auto grid = MeshCreator<Grid>{"elliptMesh"}.create();
25
27 using namespace Dune::Functions::BasisFactory;
28 ProblemStat prob("ellipt", *grid, power<2>(lagrange<2>()));
29 prob.initialize(INIT_ALL);
30
31 AdaptInfo adaptInfo("adapt");
33
35 // ⟨∇u₁,∇v₁⟩
36 auto opL = makeOperator(tag::gradtest_gradtrial{}, 1.0);
37 prob.addMatrixOperator(opL, 1, 1);
38
39 // ⟨u₀,v₀⟩ and ⟨u₁,v₀⟩
40 auto opM = makeOperator(tag::test_trial{}, 1.0);
41 prob.addMatrixOperator(opM, 0, 0);
42 auto opM2 = makeOperator(tag::test_trial{}, -1.0);
43 prob.addMatrixOperator(opM2, 0, 1);
44
45 // (f,v₁) with f ≡ -1
46 auto opForce = makeOperator(tag::test{}, [](auto const& x) { return -1.0; }, 0);
47 prob.addVectorOperator(opForce, 1);
49
50
52 // set boundary condition
53 auto predicate = [](auto const& x){ return x[0] < 1.e-8 || x[1] < 1.e-8; }; // define boundary
54 auto dbcValues = [](auto const& x){ return 0.0; }; // set value
55 prob.addDirichletBC(predicate, 1, 1, dbcValues);
57
59 prob.buildAfterAdapt(adaptInfo, Flag(0));
60 prob.solve(adaptInfo);
61 prob.writeFiles(adaptInfo);
63
65 return 0;
66}
Holds adapt parameters and infos about the problem.
Definition: AdaptInfo.hpp:26
Establishes an environment for sequential and parallel AMDiS programs.
Definition: Environment.hpp:20
The Flag class encapsulates flags which represents simple information. Used e.g. while mesh traversal...
Definition: Flag.hpp:14
Definition: ProblemStat.hpp:55
auto makeOperator(Tag const &tag, Expr &&expr, int gridFctDeg=-1)
Definition: GridFunctionOperator.hpp:235
A creator class for dune grids.
Definition: MeshCreator.hpp:52
static std::shared_ptr< Grid > create(std::string name)
Static create mthod. See create()
Definition: MeshCreator.hpp:70
Definition: SecondOrderGradTestGradTrial.hpp:20
Definition: ZeroOrderTestTrial.hpp:18
Definition: ZeroOrderTest.hpp:17