meshWavePatchDistMethod.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) 2011-2022 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 
27 #include "fvMesh.H"
28 #include "volFields.H"
29 #include "fvPatchDistWave.H"
30 #include "FvWallInfoData.H"
31 #include "emptyFvPatchFields.H"
33 
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
38 namespace patchDistMethods
39 {
40  defineTypeNameAndDebug(meshWave, 0);
41  addToRunTimeSelectionTable(patchDistMethod, meshWave, dictionary);
42 }
43 }
44 
45 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
46 
48 (
49  const dictionary& dict,
50  const fvMesh& mesh,
51  const labelHashSet& patchIDs
52 )
53 :
54  patchDistMethod(mesh, patchIDs),
55  nCorrectors_(dict.lookupOrDefault<label>("nCorrectors", 2)),
56  minFaceFraction_(dict.lookupOrDefault<scalar>("minFaceFraction", 1e-1))
57 {}
58 
59 
61 (
62  const fvMesh& mesh,
63  const labelHashSet& patchIDs,
64  const label nCorrectors,
65  const scalar minFaceFraction
66 )
67 :
68  patchDistMethod(mesh, patchIDs),
69  nCorrectors_(nCorrectors),
70  minFaceFraction_(minFaceFraction)
71 {}
72 
73 
74 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
75 
77 {
78  y = dimensionedScalar(dimLength, great);
79 
80  const label nUnset =
82  (
83  mesh_,
84  patchIDs_,
85  minFaceFraction_,
86  nCorrectors_,
87  y
88  );
89 
90  // Update coupled and transform BCs
92 
93  return nUnset > 0;
94 }
95 
96 
98 (
99  volScalarField& y,
100  volVectorField& n
101 )
102 {
103  y = dimensionedScalar(dimLength, great);
104 
105  const label nUnset =
106  fvPatchDistWave::calculateAndCorrect<FvWallInfoVector>
107  (
108  mesh_,
109  patchIDs_,
110  minFaceFraction_,
111  nCorrectors_,
112  y,
113  n
114  );
115 
116  // Update coupled and transform BCs
117  y.correctBoundaryConditions();
119 
120  return nUnset > 0;
121 }
122 
123 
124 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
addToRunTimeSelectionTable(patchDistMethod, advectionDiffusion, dictionary)
meshWave(const dictionary &dict, const fvMesh &mesh, const labelHashSet &patchIDs)
Construct from coefficients dictionary, mesh.
virtual bool correct(volScalarField &y)
Correct the given distance-to-patch field.
Macros for easy insertion into run-time selection tables.
const dimensionSet dimLength
scalar y
label calculateAndCorrect(const fvMesh &mesh, const labelHashSet &patchIDs, const scalar minFaceFraction, const label nCorrections, GeometricField< scalar, PatchField, GeoMesh > &distance)
Calculate and correct distance data from patches.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:95
defineTypeNameAndDebug(advectionDiffusion, 0)
void correctBoundaryConditions()
Correct boundary field.
label n
const doubleScalar e
Elementary charge.
Definition: doubleScalar.H:105
Specialisation of patchDist for wall distance calculation.
Namespace for OpenFOAM.