AMDiS 2.10
The Adaptive Multi-Dimensional Simulation Toolbox
heat.cc
1
2#include <config.h>
3
4#include <iostream>
5
6#include <amdis/AMDiS.hpp>
7#include <amdis/AdaptInstationary.hpp>
8#include <amdis/LocalOperators.hpp>
9#include <amdis/ProblemInstat.hpp>
10#include <amdis/ProblemStat.hpp>
11#include <amdis/GridFunctions.hpp>
13
15using namespace AMDiS;
17
19// 1 component with polynomial degree 1
20//using Grid = Dune::AlbertaGrid<GRIDDIM, WORLDDIM>;
21using HeatParam = YaspGridBasis<GRIDDIM, 2>;
22using HeatProblem = ProblemStat<HeatParam>;
23using HeatProblemInstat = ProblemInstat<HeatParam>;
25
27int main(int argc, char** argv)
28{
29 Environment env(argc, argv);
31
33 HeatProblem prob("heat");
34 prob.initialize(INIT_ALL);
35
36 HeatProblemInstat probInstat("heat", prob);
37 probInstat.initialize(INIT_UH_OLD);
38
39 AdaptInfo adaptInfo("adapt");
41
43 auto invTau = std::ref(probInstat.invTau());
44
45 // 1/τ*⟨u,v⟩
46 auto opTimeLhs = makeOperator(tag::test_trial{}, invTau);
47 prob.addMatrixOperator(opTimeLhs);
48
49 // ⟨∇u,∇v⟩
50 auto opL = makeOperator(tag::gradtest_gradtrial{}, 1.0);
51 prob.addMatrixOperator(opL);
52
53 // 1/τ*⟨u_old,v⟩
54 auto opTimeRhs = makeOperator(tag::test{},
55 invokeAtQP([invTau](double u) { return u * invTau.get(); }, prob.solution()), 2);
56 prob.addVectorOperator(opTimeRhs);
57
58 // (-1.0,v)
59 auto opForce = makeOperator(tag::test{}, [](auto const& x) { return -1.0; }, 0);
60 prob.addVectorOperator(opForce);
62
63
65 // set boundary condition
66 auto predicate = [](auto const& p){ return p[0] < 1.e-8 || p[1] < 1.e-8; };
67 auto dbcValues = [](auto const& p){ return 0.0; };
68 prob.addDirichletBC(predicate, dbcValues);
70
72 AdaptInstationary adapt("adapt", prob, adaptInfo, probInstat, adaptInfo);
73 adapt.adapt();
75
77 return 0;
78}
Holds adapt parameters and infos about the problem.
Definition: AdaptInfo.hpp:26
AdaptInstationary implements the adaptive procedure for time dependent problems (see ProblemInstat)....
Definition: AdaptInstationary.hpp:24
Establishes an environment for sequential and parallel AMDiS programs.
Definition: Environment.hpp:20
Standard implementation of ProblemTimeInterface for a time dependent problems.
Definition: ProblemInstat.hpp:26
Definition: ProblemStat.hpp:55
auto invokeAtQP(Functor const &f, PreGridFcts &&... gridFcts)
Generator function for ComposerGridFunction.
Definition: ComposerGridFunction.hpp:305
auto makeOperator(Tag const &tag, Expr &&expr, int gridFctDeg=-1)
Definition: GridFunctionOperator.hpp:235
Specialization of LagrangeBasis for Grid type Dune::YaspGrid for a given dimension.
Definition: ProblemStatTraits.hpp:118
Definition: SecondOrderGradTestGradTrial.hpp:20
Definition: ZeroOrderTestTrial.hpp:18
Definition: ZeroOrderTest.hpp:17