OperatorsTest.cpp 3.41 KB
Newer Older
1
2
#include <amdis/AMDiS.hpp>
#include <amdis/ProblemStat.hpp>
3
4
5
#include <amdis/LocalOperators.hpp>
#include <amdis/localoperators/ConvectionDiffusionOperator.hpp>
#include <amdis/localoperators/StokesOperator.hpp>
6
7
8
9

using namespace AMDiS;

using Grid = Dune::YaspGrid<2>;
10
using Param   = TaylorHoodBasis<Grid>;
11
12
13
14
using Problem = ProblemStat<Param>;

int main(int argc, char** argv)
{
15
  Environment env(argc, argv);
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110

  using namespace Dune::Indices;

  Problem prob("ellipt");
  prob.initialize(INIT_ALL);

  auto _v = _0;
  auto _p = _1;

  FieldVector<double,1> scalar = 1.0;
  FieldVector<double,2> vec; vec = 1.0;
  FieldMatrix<double,2,2> mat; mat = 1.0;

  auto op1 = makeOperator(tag::divtestvec{}, scalar);
  prob.addVectorOperator(op1, _v);

  auto op2 = makeOperator(tag::divtestvec_trial{}, scalar);
  prob.addMatrixOperator(op2, _v, _p);

  auto op3 = makeOperator(tag::gradtest{}, vec);
  prob.addVectorOperator(op3, _p);

  auto op4 = makeOperator(tag::gradtest_trial{}, vec);
  prob.addMatrixOperator(op4, _p, _p);

  auto op5a = makeOperator(tag::gradtest_trialvec{}, scalar);
  // auto op5b = makeOperator(tag::gradtest_trialvec{}, mat); // TODO: needs to be implemented
  prob.addMatrixOperator(op5a, _p, _v);

  auto op6 = makeOperator(tag::partialtest{0}, scalar);
  prob.addVectorOperator(op6, _p);

  auto op7 = makeOperator(tag::partialtest_trial{0}, scalar);
  prob.addMatrixOperator(op7, _p, _p);

  auto op8 = makeOperator(tag::test_divtrialvec{}, scalar);
  prob.addMatrixOperator(op8, _p, _v);

  auto op9 = makeOperator(tag::test_gradtrial{}, vec);
  prob.addMatrixOperator(op9, _p, _p);

  auto op10 = makeOperator(tag::test_partialtrial{0}, scalar);
  prob.addMatrixOperator(op10, _p, _p);

  auto op11a = makeOperator(tag::testvec_gradtrial{}, scalar);
  // auto op11b = makeOperator(tag::testvec_gradtrial{}, mat); // TODO: needs to be implemented
  prob.addMatrixOperator(op11a, _v, _p);

  auto op12 = makeOperator(tag::divtestvec_divtrialvec{}, scalar);
  prob.addMatrixOperator(op12, _v, _v);

  auto op13a = makeOperator(tag::gradtest_gradtrial{}, scalar);
  auto op13b = makeOperator(tag::gradtest_gradtrial{}, mat);
  prob.addMatrixOperator(op13a, _p, _p);
  prob.addMatrixOperator(op13b, _p, _p);

  auto op14 = makeOperator(tag::partialtest_partialtrial{0,0}, scalar);
  prob.addMatrixOperator(op14, _p, _p);

  auto op15 = makeOperator(tag::test{}, scalar);
  prob.addVectorOperator(op15, _p);

  auto op16 = makeOperator(tag::test_trial{}, scalar);
  prob.addMatrixOperator(op16, _p, _p);

  auto op17 = makeOperator(tag::test_trialvec{}, vec);
  prob.addMatrixOperator(op17, _p, _v);

  auto op18 = makeOperator(tag::testvec{}, vec);
  prob.addVectorOperator(op18, _v);

  auto op19 = makeOperator(tag::testvec_trial{}, vec);
  prob.addMatrixOperator(op19, _v, _p);

  auto op20a = makeOperator(tag::testvec_trialvec{}, scalar);
  auto op20b = makeOperator(tag::testvec_trialvec{}, mat);
  prob.addMatrixOperator(op20a, _v, _v);
  prob.addMatrixOperator(op20b, _v, _v);

  // some special operators

  auto opStokes = makeOperator(tag::stokes{}, scalar);
  prob.addMatrixOperator(opStokes);
  prob.addMatrixOperator(opStokes, {}, {});

  auto opCDa = convectionDiffusion(scalar, scalar, scalar, scalar);
  prob.addMatrixOperator(opCDa, _p, _p);
  prob.addVectorOperator(opCDa, _p);

  auto opCDb = convectionDiffusion(mat, vec, scalar, scalar, std::false_type{});
  prob.addMatrixOperator(opCDb, _p, _p);
  prob.addVectorOperator(opCDb, _p);

  return 0;
}