Loading...
Searching...
No Matches
fusedGaussDivScheme.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2024 M. Janssens
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
29#include "fvcSurfaceOps.H"
30#include "fusedGaussDivScheme.H"
31#include "fvcSurfaceIntegrate.H"
32#include "fvMatrices.H"
33
34// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35
36namespace Foam
37{
38
39// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40
41namespace fv
42{
43
44// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46template<class Type>
47tmp
48<
51>
53(
55)
56{
57 typedef typename innerProduct<vector, Type>::type DivType;
59
60 const fvMesh& mesh = vf.mesh();
61
62 DebugPout<< "fusedGaussDivScheme<Type>::fvcDiv on " << vf.name()
63 << endl;
64
66 (
67 new DivFieldType
68 (
70 (
71 "div(" + vf.name() + ')',
72 vf.instance(),
73 mesh,
76 ),
77 mesh,
80 )
81 );
82 DivFieldType& div = tDiv.ref();
83
84 //fvcDiv(vf, this->tinterpScheme_().weights(vf), div);
85
86 if (this->tinterpScheme_().corrected())
87 {
88 const auto tfaceCorr(this->tinterpScheme_().correction(vf));
89 auto& faceCorr = tfaceCorr();
90
91 const auto dotInterpolate = [&]
92 (
93 const vector& area,
94 const scalar lambda,
95
96 const Type& ownVal,
97 const Type& neiVal,
98
99 const Type& correction
100
101 ) -> DivType
102 {
103 return area & ((lambda*(ownVal - neiVal) + neiVal) + correction);
104 };
105
107 (
108 this->tinterpScheme_().weights(vf),
109 vf,
110 faceCorr,
111 dotInterpolate,
112 div,
113 false
114 );
115 }
116 else
117 {
118 const auto dotInterpolate = [&]
119 (
120 const vector& area,
121 const scalar lambda,
122 const Type& ownVal,
123 const Type& neiVal
124 ) -> DivType
125 {
126 return area & (lambda*(ownVal - neiVal) + neiVal);
127 };
128
130 (
131 this->tinterpScheme_().weights(vf),
132 vf,
133 dotInterpolate,
134 div,
135 false
136 );
137 }
138
139 tDiv.ref().primitiveFieldRef() /= mesh.V();
140
141 tDiv.ref().correctBoundaryConditions();
142
143 return tDiv;
144}
145
146
147// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148
149} // End namespace fv
150
151// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152
153} // End namespace Foam
154
155// ************************************************************************* //
const Mesh & mesh() const noexcept
Return const reference to mesh.
const dimensionSet & dimensions() const noexcept
Return dimensions.
Generic GeometricField class.
@ NO_READ
Nothing to be read.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
const word & name() const noexcept
Return the object name.
Definition IOobjectI.H:205
const fileName & instance() const noexcept
Read access to instance path component.
Definition IOobjectI.H:289
Generic dimensioned Type class.
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
static const word & extrapolatedCalculatedType() noexcept
The type name for extrapolatedCalculated patch fields combines zero-gradient and calculated.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
tmp< surfaceInterpolationScheme< Type > > tinterpScheme_
Definition divScheme.H:75
const fvMesh & mesh() const
Return mesh reference.
Definition divScheme.H:170
tmp< GeometricField< typename innerProduct< vector, Type >::type, fvPatchField, volMesh > > fvcDiv(const GeometricField< Type, fvPatchField, volMesh > &)
typeOfRank< typenamepTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) -2 >::type type
Definition products.H:155
A class for managing temporary objects.
Definition tmp.H:75
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
Definition tmpI.H:235
Mesh data needed to do the Finite Volume discretisation.
Definition volMesh.H:47
A special matrix type and solver, designed for finite volume solutions of scalar equations.
Surface integrate surfaceField creating a volField. Surface sum a surfaceField creating a volField.
Surface integrate surfaceField creating a volField. Surface sum a surfaceField creating a volField.
#define DebugPout
Report an information message using Foam::Pout.
Namespace for finite-volume.
tmp< GeometricField< Type, fvPatchField, volMesh > > surfaceSum(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Namespace for OpenFOAM.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
static constexpr const zero Zero
Global zero (0).
Definition zero.H:127
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix by subtracting the matrix multiplied by the current fi...
Vector< scalar > vector
Definition vector.H:57
dimensionedScalar lambda("lambda", dimTime/sqr(dimLength), laminarTransport)