LagrangianSp.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2025 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "LagrangianSp.H"
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 template<class Type>
32 :
33  LagrangianCoeff<scalar, true>(Sp)
34 {}
35 
36 
37 template<class Type>
39 :
40  LagrangianCoeff<scalar, true>(Sp, reuse)
41 {}
42 
43 
44 template<class Type>
46 :
47  LagrangianCoeff<scalar, true>(move(Sp))
48 {}
49 
50 
51 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
52 
53 template<class Type>
56 {
57  return *this;
58 }
59 
60 
61 template<class Type>
64 {
65  return
67  (
69  );
70 }
71 
72 
73 template<class Type>
76 {
77  return Su(static_cast<const LagrangianEqn<Type>&>(this->eqn()));
78 }
79 
80 
81 template<class Type>
84 {
85  return
87  (
88  valid()
89  ? new LagrangianCoeff<Type, false>(eqn, S()*eqn.psi())
91  );
92 }
93 
94 
95 // * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
96 
97 template<class Type>
99 {
100  static_cast<LagrangianCoeff<scalar, true>&>(*this) += Sp;
101 }
102 
103 
104 template<class Type>
106 {
107  static_cast<LagrangianCoeff<scalar, true>&>(*this) -= Sp;
108 }
109 
110 
111 // * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * * //
112 
113 template<class Type>
115 (
117  const LagrangianSp<Type>& Sp
118 )
119 {
120  return Su.S()/Sp.S();
121 }
122 
123 
124 // ************************************************************************* //
Class to store a coefficient of a Lagrangian equation.
This class stores the coefficients of a Lagrangian equation, and facilitates solving that equation an...
Definition: LagrangianEqn.H:56
tmp< LagrangianSubSubField< Type > > psi() const
Return the field.
Wrapper around LagrangianCoeff to specialise for the implicit coefficient. Trivial at present....
Definition: LagrangianSp.H:71
tmp< LagrangianCoeff< Type, false > > H() const
Return the scalar off-diagonal coefficients.
Definition: LagrangianSp.C:63
LagrangianSp(const LagrangianSp< Type > &Sp)
Construct as copy.
Definition: LagrangianSp.C:31
void operator-=(const LagrangianSp< Type > &Sp)
Subtraction assignment.
Definition: LagrangianSp.C:105
tmp< LagrangianCoeff< Type, false > > Su() const
Return the equivalent explicit coefficient.
Definition: LagrangianSp.C:75
tmp< LagrangianCoeff< scalar, true > > A() const
Return the scalar diagonal coefficient.
Definition: LagrangianSp.C:55
void operator+=(const LagrangianSp< Type > &Sp)
Addition assignment.
Definition: LagrangianSp.C:98
A class for managing temporary objects.
Definition: tmp.H:55
bool valid(const PtrList< ModelType > &l)
tmp< VolField< Type > > Su(const VolField< Type > &su, const VolField< Type > &vf)
Definition: fvcSup.C:44
tmp< VolField< Type > > Sp(const volScalarField &sp, const VolField< Type > &vf)
Definition: fvcSup.C:67
tmp< fvMatrix< Type > > S(const Pair< tmp< volScalarField::Internal >> &, const VolField< Type > &)