DUNE PDELab (2.8)

jacobianapplyengine.hh
1// -*- tab-width: 2; indent-tabs-mode: nil -*-
2// vi: set et ts=2 sw=2 sts=2:
3#ifndef DUNE_PDELAB_GRIDOPERATOR_ONESTEP_JACOBIANAPPLYENGINE_HH
4#define DUNE_PDELAB_GRIDOPERATOR_ONESTEP_JACOBIANAPPLYENGINE_HH
5
6#include <dune/pdelab/gridoperator/onestep/enginebase.hh>
7#include <cmath>
8
9namespace Dune{
10 namespace PDELab{
11
19 template<typename OSLA>
22 typename OSLA::LocalAssemblerDT0::LocalJacobianApplyAssemblerEngine,
23 typename OSLA::LocalAssemblerDT1::LocalJacobianApplyAssemblerEngine
24 >
25 {
27 typename OSLA::LocalAssemblerDT0::LocalJacobianApplyAssemblerEngine,
28 typename OSLA::LocalAssemblerDT1::LocalJacobianApplyAssemblerEngine
29 > BaseT;
30
31 using BaseT::la;
32 using BaseT::lae0;
33 using BaseT::lae1;
34 using BaseT::implicit;
35 using BaseT::setLocalAssemblerEngineDT0;
36 using BaseT::setLocalAssemblerEngineDT1;
37 public:
39 typedef OSLA LocalAssembler;
40
41 typedef typename OSLA::LocalAssemblerDT0 LocalAssemblerDT0;
42 typedef typename OSLA::LocalAssemblerDT1 LocalAssemblerDT1;
43
44 typedef typename LocalAssemblerDT0::LocalJacobianApplyAssemblerEngine JacobianEngineDT0;
45 typedef typename LocalAssemblerDT1::LocalJacobianApplyAssemblerEngine JacobianEngineDT1;
46
48 typedef typename OSLA::Traits::Range Range;
49
51 typedef typename OSLA::Traits::Domain Domain;
52
54 typedef typename OSLA::Real Real;
55
62 : BaseT(local_assembler_)
63 , invalid_result(nullptr)
64 , invalid_solution(nullptr)
65 , invalid_update(nullptr)
66 , result(invalid_result)
67 , solution(invalid_solution)
68 , update(invalid_update)
69 {}
70
73 void setSolution(const Domain& solution_)
74 {
75 solution = &solution_;
76 }
77
80 void setUpdate(const Domain& update_)
81 {
82 update = &update_;
83 }
84
87 void setResult(Range& result_)
88 {
89 result = &result_;
90
91 // Initialize the engines of the two wrapped local assemblers
92 assert(update != invalid_update);
93 setLocalAssemblerEngineDT0
94 (la.la0.localJacobianApplyAssemblerEngine(*solution,*update,*result));
95 setLocalAssemblerEngineDT1
96 (la.la1.localJacobianApplyAssemblerEngine(*solution,*update,*result));
97 }
98
103 {
104 la.la0.setWeight(b_rr * la.dt_factor0);
105 la.la1.setWeight(la.dt_factor1);
106 }
107
111 {
112 lae0->preAssembly();
113 lae1->preAssembly();
114
115 // Extract the coefficients of the time step scheme
116 b_rr = la.osp_method->b(la.stage,la.stage);
117 d_r = la.osp_method->d(la.stage);
118
119 // Here we only want to know whether this stage is implicit
120 using std::abs;
121 implicit = abs(b_rr) > 1e-6;
122
123 // prepare local operators for stage
124 la.la0.setTime(la.time + d_r * la.dt);
125 la.la1.setTime(la.time + d_r * la.dt);
126
127 setWeights();
128 }
129
130 template<typename GFSU, typename GFSV>
131 void postAssembly(const GFSU& gfsu, const GFSV& gfsv)
132 {
133 lae0->postAssembly(gfsu,gfsv);
134 lae1->postAssembly(gfsu,gfsv);
135 }
137
138 private:
139
141 Range * const invalid_result;
142
144 Domain * const invalid_solution;
145
147 Domain * const invalid_update;
148
151 Range * result;
152
154 const Domain * solution;
155
157 const Domain * update;
158
160 Real b_rr, d_r;
161
162 }; // end class OneStepLocalJacobianApplyAssemblerEngine
163
164 } // end namespace PDELab
165} // end Dune
166#endif
The local assembler engine for UDG sub triangulations which assembles the residual vector.
Definition: enginebase.hh:16
const LocalAssembler & la
Definition: enginebase.hh:472
The local assembler engine for one-step methods which applies the jacobian without explicitly assembl...
Definition: jacobianapplyengine.hh:25
void preAssembly()
Definition: jacobianapplyengine.hh:110
OSLA::Traits::Domain Domain
The type of the solution vector.
Definition: jacobianapplyengine.hh:51
void setSolution(const Domain &solution_)
Definition: jacobianapplyengine.hh:73
OSLA::Real Real
The type for real numbers.
Definition: jacobianapplyengine.hh:54
void setUpdate(const Domain &update_)
Definition: jacobianapplyengine.hh:80
void setWeights()
Definition: jacobianapplyengine.hh:102
OneStepLocalJacobianApplyAssemblerEngine(LocalAssembler &local_assembler_)
Constructor.
Definition: jacobianapplyengine.hh:61
OSLA::Traits::Range Range
The type of the result vector.
Definition: jacobianapplyengine.hh:48
void setResult(Range &result_)
Definition: jacobianapplyengine.hh:87
OSLA LocalAssembler
The type of the wrapping local assembler.
Definition: jacobianapplyengine.hh:39
Dune namespace.
Definition: alignedallocator.hh:11
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 22, 23:30, 2024)