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  const LagrangianEqnBase& eqn,
34  const LagrangianSp<Type>& Sp
35 )
36 :
37  LagrangianCoeff<scalar, true>(eqn, Sp)
38 {}
39 
40 
41 template<class Type>
43 (
44  const LagrangianEqnBase& eqn,
46  const bool reuse
47 )
48 :
49  LagrangianCoeff<scalar, true>(eqn, Sp, reuse)
50 {}
51 
52 
53 template<class Type>
55 :
56  LagrangianCoeff<scalar, true>(move(Sp))
57 {}
58 
59 
60 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
61 
62 template<class Type>
65 {
66  return *this;
67 }
68 
69 
70 template<class Type>
73 {
74  return
76  (
78  );
79 }
80 
81 
82 template<class Type>
85 {
86  return Su(static_cast<const LagrangianEqn<Type>&>(this->eqn()));
87 }
88 
89 
90 template<class Type>
93 {
94  return
96  (
97  valid()
98  ? new LagrangianCoeff<Type, false>(eqn, S()*eqn.psi())
100  );
101 }
102 
103 
104 // * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
105 
106 template<class Type>
107 template<class OtherType>
109 {
110  static_cast<LagrangianCoeff<scalar, true>&>(*this) += Sp;
111 }
112 
113 
114 template<class Type>
115 template<class OtherType>
117 {
118  static_cast<LagrangianCoeff<scalar, true>&>(*this) -= Sp;
119 }
120 
121 
122 // * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * * //
123 
124 template<class Type>
126 (
128  const LagrangianSp<Type>& Sp
129 )
130 {
131  return Su.S()/Sp.S();
132 }
133 
134 
135 // ************************************************************************* //
Class to store a coefficient of a Lagrangian equation.
Non-templated base class for Lagrangian equations.
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:72
tmp< LagrangianCoeff< Type, false > > Su() const
Return the equivalent explicit coefficient.
Definition: LagrangianSp.C:84
tmp< LagrangianCoeff< scalar, true > > A() const
Return the scalar diagonal coefficient.
Definition: LagrangianSp.C:64
void operator+=(const LagrangianSp< OtherType > &)
Addition assignment.
Definition: LagrangianSp.C:108
LagrangianSp(const LagrangianEqnBase &, const LagrangianSp< Type > &Sp)
Construct as copy.
Definition: LagrangianSp.C:32
void operator-=(const LagrangianSp< OtherType > &Sp)
Subtraction assignment.
Definition: LagrangianSp.C:116
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 > &)