heat.cc 1.66 KB
Newer Older
1
2
3
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
4
5
#include <iostream>

6
7
#include <amdis/AMDiS.hpp>
#include <amdis/AdaptInstationary.hpp>
8
#include <amdis/LocalOperators.hpp>
9
10
11
12
#include <amdis/ProblemInstat.hpp>
#include <amdis/ProblemStat.hpp>
#include <amdis/GridFunctions.hpp>
#include <amdis/common/Literals.hpp>
13
14
15
16

using namespace AMDiS;

// 1 component with polynomial degree 1
17
18
//using Grid = Dune::AlbertaGrid<AMDIS_DIM, AMDIS_DOW>;
using HeatParam   = YaspGridBasis<AMDIS_DIM, 2>;
19
20
21
22
23
using HeatProblem = ProblemStat<HeatParam>;
using HeatProblemInstat = ProblemInstat<HeatParam>;

int main(int argc, char** argv)
{
24
  AMDiS::init(argc, argv);
25

26
27
  HeatProblem prob("heat");
  prob.initialize(INIT_ALL);
28

29
30
  HeatProblemInstat probInstat("heat", prob);
  probInstat.initialize(INIT_UH_OLD);
31

32
  AdaptInfo adaptInfo("adapt");
33

Praetorius, Simon's avatar
Praetorius, Simon committed
34
  auto invTau = std::ref(probInstat.invTau());
35

Praetorius, Simon's avatar
Praetorius, Simon committed
36
  auto opTimeLhs = makeOperator(tag::test_trial{}, invTau);
37
  prob.addMatrixOperator(opTimeLhs, 0, 0);
38

39
  auto opL = makeOperator(tag::gradtest_gradtrial{}, 1.0);
40
  prob.addMatrixOperator(opL, 0, 0);
41

42
  auto opTimeRhs = makeOperator(tag::test{},
Praetorius, Simon's avatar
Praetorius, Simon committed
43
    invokeAtQP([invTau](double u) { return u * invTau.get(); }, prob.solution(0)), 2);
44
  prob.addVectorOperator(opTimeRhs, 0);
45

46
  auto opForce = makeOperator(tag::test{}, [](auto const& x) { return -1.0; }, 0);
47
  prob.addVectorOperator(opForce, 0);
48
49


50
51
52
53
  // set boundary condition
  auto predicate = [](auto const& p){ return p[0] < 1.e-8 || p[1] < 1.e-8; };
  auto dbcValues = [](auto const& p){ return 0.0; };
  prob.addDirichletBC(predicate, 0, 0, dbcValues);
54

55
56
  AdaptInstationary adapt("adapt", prob, adaptInfo, probInstat, adaptInfo);
  adapt.adapt();
57

58
59
  AMDiS::finalize();
  return 0;
60
}