DUNE PDELab (2.8)

jacobianengine.hh
1#ifndef DUNE_PDELAB_GRIDOPERATOR_ONESTEP_JACOBIANENGINE_HH
2#define DUNE_PDELAB_GRIDOPERATOR_ONESTEP_JACOBIANENGINE_HH
3
4#include <dune/pdelab/gridoperator/onestep/enginebase.hh>
5#include <cmath>
6
7namespace Dune{
8 namespace PDELab{
9
17 template<typename OSLA>
20 typename OSLA::LocalAssemblerDT0::LocalJacobianAssemblerEngine,
21 typename OSLA::LocalAssemblerDT1::LocalJacobianAssemblerEngine
22 >
23 {
24
26 typename OSLA::LocalAssemblerDT0::LocalJacobianAssemblerEngine,
27 typename OSLA::LocalAssemblerDT1::LocalJacobianAssemblerEngine
28 > BaseT;
29
30 using BaseT::la;
31 using BaseT::lae0;
32 using BaseT::lae1;
33 using BaseT::implicit;
34 using BaseT::setLocalAssemblerEngineDT0;
35 using BaseT::setLocalAssemblerEngineDT1;
36 public:
38 typedef OSLA LocalAssembler;
39
40 typedef typename OSLA::LocalAssemblerDT0 LocalAssemblerDT0;
41 typedef typename OSLA::LocalAssemblerDT1 LocalAssemblerDT1;
42
43 typedef typename LocalAssemblerDT0::LocalJacobianAssemblerEngine JacobianEngineDT0;
44 typedef typename LocalAssemblerDT1::LocalJacobianAssemblerEngine JacobianEngineDT1;
45
47 typedef typename OSLA::Traits::Jacobian Jacobian;
48
50 typedef typename OSLA::Traits::Solution Solution;
51
53 typedef typename OSLA::Real Real;
54
62 : BaseT(local_assembler_),
63 invalid_jacobian(nullptr),
64 invalid_solution(nullptr),
65 jacobian(invalid_jacobian), solution(invalid_solution)
66 {}
67
68
71 void setSolution(const Solution & solution_)
72 {
73 solution = &solution_;
74 }
75
78 void setJacobian(Jacobian & jacobian_)
79 {
80 jacobian = &jacobian_;
81
82 assert(solution != invalid_solution);
83
84 // Initialize the engines of the two wrapped local assemblers
85 setLocalAssemblerEngineDT0(la.la0.localJacobianAssemblerEngine(*jacobian,*solution));
86 setLocalAssemblerEngineDT1(la.la1.localJacobianAssemblerEngine(*jacobian,*solution));
87 }
88
93 {
94 la.la0.setWeight(b_rr * la.dt_factor0);
95 la.la1.setWeight(la.dt_factor1);
96 }
97
101 {
102 lae0->preAssembly();
103 lae1->preAssembly();
104
105 // Extract the coefficients of the time step scheme
106 b_rr = la.osp_method->b(la.stage,la.stage);
107 d_r = la.osp_method->d(la.stage);
108
109 // Here we only want to know whether this stage is implicit
110 using std::abs;
111 implicit = abs(b_rr) > 1e-6;
112
113 // prepare local operators for stage
114 la.la0.setTime(la.time + d_r * la.dt);
115 la.la1.setTime(la.time + d_r * la.dt);
116
117 setWeights();
118 }
119
120 template<typename GFSU, typename GFSV>
121 void postAssembly(const GFSU& gfsu, const GFSV& gfsv)
122 {
123 lae0->postAssembly(gfsu,gfsv);
124 lae1->postAssembly(gfsu,gfsv);
125 }
127
128 private:
129
131 Jacobian * const invalid_jacobian;
132
134 Solution * const invalid_solution;
135
138 Jacobian * jacobian;
139
141 const Solution * solution;
142
144 Real b_rr, d_r;
145
146 }; // End of class OneStepLocalJacobianAssemblerEngine
147
148 }
149}
150
151#endif // DUNE_PDELAB_GRIDOPERATOR_ONESTEP_JACOBIANENGINE_HH
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 assembles the residual vector.
Definition: jacobianengine.hh:23
OSLA LocalAssembler
The type of the wrapping local assembler.
Definition: jacobianengine.hh:38
void setJacobian(Jacobian &jacobian_)
Definition: jacobianengine.hh:78
void setSolution(const Solution &solution_)
Definition: jacobianengine.hh:71
OSLA::Real Real
The type for real numbers.
Definition: jacobianengine.hh:53
void setWeights()
Definition: jacobianengine.hh:92
OSLA::Traits::Solution Solution
The type of the solution vector.
Definition: jacobianengine.hh:50
void preAssembly()
Definition: jacobianengine.hh:100
OSLA::Traits::Jacobian Jacobian
The type of the residual vector.
Definition: jacobianengine.hh:47
OneStepLocalJacobianAssemblerEngine(const LocalAssembler &local_assembler_)
Constructor.
Definition: jacobianengine.hh:61
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)