dune-fem 2.12-git
Loading...
Searching...
No Matches
dghelmholtz.hh
Go to the documentation of this file.
1#ifndef DUNE_FEM_OPERATOR_DGHELMHOLTZ_HH
2#define DUNE_FEM_OPERATOR_DGHELMHOLTZ_HH
3
6
8
9
10namespace Dune
11{
12
13 namespace Fem
14 {
15
16 // DGHelmholtzJacobianOperator
17 // ---------------------------
18
19 template< class JacobianOp >
21 : public JacobianOp
22 {
23 typedef JacobianOp BaseType;
24
25 public:
26 typedef typename BaseType::DomainFunctionType DomainFunctionType;
27 typedef typename BaseType::RangeFunctionType RangeFunctionType;
28
29 typedef typename DomainFunctionType::DiscreteFunctionSpaceType DomainFunctionSpaceType;
30 typedef typename RangeFunctionType::DiscreteFunctionSpaceType RangeFunctionSpaceType;
31
33 const SolverParameter& param = SolverParameter() )
34 : BaseType( name, dSpace, rSpace ),
35 lambda_( 0 ),
36 wTmp_( "DGHelmholtzJacobianOperator temporary", rSpace )
37 {}
38
40 {
41 w.assign( u );
42 if( lambda() != 0.0 )
43 {
44 BaseType::operator()( u, wTmp_ );
45 w.axpy( -lambda(), wTmp_ );
46 }
47 }
48
49 const double &lambda () const { return lambda_; }
50 void setLambda ( double lambda ) { lambda_ = lambda; }
51
52 protected:
53 double lambda_;
55 };
56
57
58
59 // DGHelmholtzOperator
60 // -------------------
61
62 template< class SpaceOperator >
64 : public DifferentiableOperator< DGHelmholtzJacobianOperator< typename SpaceOperator::JacobianOperatorType > >
65 {
68
69 public:
70 typedef SpaceOperator SpaceOperatorType;
71
74
76
77 typedef typename DomainFunctionType::DiscreteFunctionSpaceType DiscreteFunctionSpaceType;
78
80 : spaceOp_( spaceOp ),
81 lambda_( 0 ),
82 wTmp_( "DGHelmholtz::tmp", space() )
83 {}
84
86 {
87 w.assign( u );
88 if( lambda() != 0.0 )
89 {
90 spaceOperator()( u, wTmp_ );
91 w.axpy( -lambda(), wTmp_ );
92 }
93 }
94
95 void jacobian ( const DomainFunctionType &u, JacobianOperatorType &jOp ) const
96 {
97 spaceOperator().jacobian( u, jOp );
98 jOp.setLambda( lambda() );
99 }
100
101 const double &lambda () const { return lambda_; }
102 void setLambda ( double lambda ) { lambda_ = lambda; }
103
104 void setTime ( double time ) { spaceOperator().setTime( time ); }
105
106 const DiscreteFunctionSpaceType &space () const { return spaceOperator().space(); }
107
109 {
110 spaceOperator()( u, wTmp_ );
111 }
112
113 double timeStepEstimate () const { return spaceOperator().timeStepEstimate(); }
114
115 const SpaceOperatorType &spaceOperator () const { return spaceOp_; }
117
118 protected:
119 SpaceOperator &spaceOp_;
120 double lambda_;
122 };
123
124 } // namespace Fem
125
126} // namespace Dune
127
128#endif // #ifndef DUNE_FEM_OPERATOR_DGHELMHOLTZ_HH
const char * name()
virtual void operator()()=0
abstract differentiable operator
Definition differentiableoperator.hh:29
BaseType::RangeFunctionType RangeFunctionType
type of discrete function in the operator's range
Definition differentiableoperator.hh:40
JacobianOperator JacobianOperatorType
type of linear operator modelling the operator's Jacobian
Definition differentiableoperator.hh:35
BaseType::DomainFunctionType DomainFunctionType
type of discrete function in the operator's domain
Definition differentiableoperator.hh:38
Definition dghelmholtz.hh:22
BaseType::DomainFunctionType DomainFunctionType
Definition dghelmholtz.hh:26
DomainFunctionType::DiscreteFunctionSpaceType DomainFunctionSpaceType
Definition dghelmholtz.hh:29
BaseType::RangeFunctionType RangeFunctionType
Definition dghelmholtz.hh:27
double lambda_
Definition dghelmholtz.hh:53
void setLambda(double lambda)
Definition dghelmholtz.hh:50
RangeFunctionType wTmp_
Definition dghelmholtz.hh:54
const double & lambda() const
Definition dghelmholtz.hh:49
RangeFunctionType::DiscreteFunctionSpaceType RangeFunctionSpaceType
Definition dghelmholtz.hh:30
DGHelmholtzJacobianOperator(const std::string &name, const DomainFunctionSpaceType &dSpace, const RangeFunctionSpaceType &rSpace, const SolverParameter &param=SolverParameter())
Definition dghelmholtz.hh:32
Definition dghelmholtz.hh:65
void setLambda(double lambda)
Definition dghelmholtz.hh:102
void setTime(double time)
Definition dghelmholtz.hh:104
const SpaceOperatorType & spaceOperator() const
Definition dghelmholtz.hh:115
RangeFunctionType wTmp_
Definition dghelmholtz.hh:121
SpaceOperatorType & spaceOperator()
Definition dghelmholtz.hh:116
const double & lambda() const
Definition dghelmholtz.hh:101
SpaceOperator SpaceOperatorType
Definition dghelmholtz.hh:70
void initializeTimeStepSize(const DomainFunctionType &u) const
Definition dghelmholtz.hh:108
double timeStepEstimate() const
Definition dghelmholtz.hh:113
BaseType::JacobianOperatorType JacobianOperatorType
Definition dghelmholtz.hh:75
DGHelmholtzOperator(SpaceOperatorType &spaceOp)
Definition dghelmholtz.hh:79
double lambda_
Definition dghelmholtz.hh:120
DomainFunctionType::DiscreteFunctionSpaceType DiscreteFunctionSpaceType
Definition dghelmholtz.hh:77
BaseType::DomainFunctionType DomainFunctionType
Definition dghelmholtz.hh:72
void jacobian(const DomainFunctionType &u, JacobianOperatorType &jOp) const
Definition dghelmholtz.hh:95
SpaceOperator & spaceOp_
Definition dghelmholtz.hh:119
const DiscreteFunctionSpaceType & space() const
Definition dghelmholtz.hh:106
BaseType::RangeFunctionType RangeFunctionType
Definition dghelmholtz.hh:73
Definition solver/parameter.hh:25