Loading...
Searching...
No Matches
correctedSnGrad.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) 2021 OpenCFD Ltd.
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 "correctedSnGrad.H"
30#include "volFields.H"
31#include "surfaceFields.H"
32#include "linear.H"
33#include "fvcGrad.H"
34#include "gaussGrad.H"
35
36// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
37
38template<class Type>
41(
43) const
44{
45 const fvMesh& mesh = this->mesh();
46
47 // construct GeometricField<Type, fvsPatchField, surfaceMesh>
50 (
51 mesh.nonOrthCorrectionVectors(),
53 (
54 mesh,
55 mesh.gradScheme("grad(" + vf.name() + ')')
56 )().grad(vf, "grad(" + vf.name() + ')')
57 );
58 tssf.ref().rename("snGradCorr(" + vf.name() + ')');
60 return tssf;
61}
62
63
64template<class Type>
67(
69) const
70{
71 const fvMesh& mesh = this->mesh();
72
73 // construct GeometricField<Type, fvsPatchField, surfaceMesh>
75 (
77 (
79 (
80 "snGradCorr("+vf.name()+')',
81 vf.instance(),
82 mesh,
85 ),
86 mesh,
87 vf.dimensions()*mesh.nonOrthDeltaCoeffs().dimensions()
88 )
89 );
91 ssf.setOriented();
92
93 for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; ++cmpt)
94 {
95 ssf.replace
96 (
97 cmpt,
99 .fullGradCorrection(vf.component(cmpt))
100 );
101 }
102
103 return tssf;
104}
105
106
107// ************************************************************************* //
void setOriented(bool on=true) noexcept
Set the oriented flag: on/off.
const dimensionSet & dimensions() const noexcept
Return dimensions.
Generic GeometricField class.
void replace(const direction d, const GeometricField< cmptType, PatchField, GeoMesh > &gcf)
Replace specified field component with content from another field.
tmp< GeometricField< cmptType, PatchField, GeoMesh > > component(const direction) const
Return a component of the field.
@ 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
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
Surface gradient scheme with full explicit non-orthogonal correction.
correctedSnGrad(const fvMesh &mesh)
Construct from mesh.
virtual tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > correction(const GeometricField< Type, fvPatchField, volMesh > &) const
Return the explicit correction to the correctedSnGrad for the given field using the gradients of the ...
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > fullGradCorrection(const GeometricField< Type, fvPatchField, volMesh > &) const
Return the explicit correction to the correctedSnGrad for the given field using the gradient of the f...
static tmp< gradScheme< Type > > New(const fvMesh &mesh, Istream &schemeData)
Return a pointer to a new gradScheme created on freestore.
Definition gradScheme.C:30
const fvMesh & mesh() const
Return const reference to mesh.
Central-differencing interpolation scheme class.
Definition linear.H:54
A traits class, which is primarily used for primitives and vector-space.
Definition pTraits.H:64
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
dynamicFvMesh & mesh
Calculate the gradient of the given field.
uint8_t direction
Definition direction.H:49
Foam::surfaceFields.