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-2023 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 "emptyFvPatchFields.H"
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 namespace patchDistMethods
38 {
41 }
42 }
43 
44 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
45 
47 (
48  const dictionary& dict,
49  const fvMesh& mesh,
50  const labelHashSet& patchIDs
51 )
52 :
53  patchDistMethod(mesh, patchIDs),
54  nCorrectors_(dict.lookupOrDefault<label>("nCorrectors", 2)),
55  minFaceFraction_(dict.lookupOrDefault<scalar>("minFaceFraction", 1e-1))
56 {}
57 
58 
60 (
61  const fvMesh& mesh,
62  const labelHashSet& patchIDs,
63  const label nCorrectors,
64  const scalar minFaceFraction
65 )
66 :
67  patchDistMethod(mesh, patchIDs),
68  nCorrectors_(nCorrectors),
69  minFaceFraction_(minFaceFraction)
70 {}
71 
72 
73 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
74 
76 {
77  y = dimensionedScalar(dimLength, great);
78 
79  const label nUnset =
81  (
82  mesh_,
83  patchIndices_,
84  minFaceFraction_,
85  nCorrectors_,
86  y
87  );
88 
89  // Update coupled and transform BCs
90  y.correctBoundaryConditions();
91 
92  return nUnset > 0;
93 }
94 
95 
97 (
100 )
101 {
102  y = dimensionedScalar(dimLength, great);
103 
104  const label nUnset =
106  (
107  mesh_,
108  patchIndices_,
109  minFaceFraction_,
110  nCorrectors_,
111  y,
112  n
113  );
114 
115  // Update coupled and transform BCs
116  y.correctBoundaryConditions();
117  n.correctBoundaryConditions();
118 
119  return nUnset > 0;
120 }
121 
122 
123 // ************************************************************************* //
scalar y
label n
Macros for easy insertion into run-time selection tables.
Generic GeometricField class.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:99
Specialisation of patchDist for wall distance calculation.
Fast topological mesh-wave method for calculating the distance to nearest patch for all cells and bou...
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.
const dimensionedScalar e
Elementary charge.
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.
defineTypeNameAndDebug(advectionDiffusion, 0)
addToRunTimeSelectionTable(patchDistMethod, advectionDiffusion, dictionary)
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
const dimensionSet dimLength
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
dictionary dict