levelSet.H
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) 2017 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Description:
27  Functions to create an averaged field from a discontinuous field defined by
28  a level-set.
29 
30 SourceFiles:
31  levelSet.C
32  levelSetTemplates.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef levelSet_H
37 #define levelSet_H
38 
39 #include "DimensionedField.H"
40 #include "fvMesh.H"
41 #include "pointMesh.H"
42 #include "volMesh.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 //- Calculate the average value of two fields, one on each side of a level set
52 // The level set and the fields are given both on the points and cell-centres.
53 template<class Type>
54 tmp<DimensionedField<Type, volMesh>> levelSetAverage
55 (
56  const fvMesh& mesh,
57  const scalarField& levelC,
58  const scalarField& levelP,
59  const DimensionedField<Type, volMesh>& positiveC,
60  const DimensionedField<Type, pointMesh>& positiveP,
61  const DimensionedField<Type, volMesh>& negativeC,
62  const DimensionedField<Type, pointMesh>& negativeP
63 );
64 
65 //- As the above overload, but on the faces of a patch
66 template<class Type>
67 tmp<Field<Type>> levelSetAverage
68 (
69  const fvPatch& patch,
70  const scalarField& levelF,
71  const scalarField& levelP,
72  const Field<Type>& positiveF,
73  const Field<Type>& positiveP,
74  const Field<Type>& negativeF,
75  const Field<Type>& negativeP
76 );
77 
78 //- Calculate the volume-fraction that a level set occupies. This gives the the
79 // same result as levelSetAverage if the fields passed to the latter are
80 // uniformly 0 and 1. The above flag flips the direction.
81 tmp<DimensionedField<scalar, volMesh>> levelSetFraction
82 (
83  const fvMesh& mesh,
84  const scalarField& levelC,
85  const scalarField& levelP,
86  const bool above
87 );
88 
89 //- As the above overload, but on the faces of a patch
90 tmp<scalarField> levelSetFraction
91 (
92  const fvPatch& patch,
93  const scalarField& levelF,
94  const scalarField& levelP,
95  const bool above
96 );
97 
98 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
99 
100 } // End namespace Foam
101 
102 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
103 
104 #ifdef NoRepository
105  #include "levelSetTemplates.C"
106 #endif
107 
108 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
109 
110 #endif
111 
112 // ************************************************************************* //
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:52
DimensionedField.H
volMesh.H
Foam::levelSetFraction
tmp< DimensionedField< scalar, volMesh > > levelSetFraction(const fvMesh &mesh, const scalarField &levelC, const scalarField &levelP, const bool above)
Calculate the volume-fraction that a level set occupies. This gives the the.
Definition: levelSet.C:38
levelSetTemplates.C
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::levelSetAverage
tmp< DimensionedField< Type, volMesh > > levelSetAverage(const fvMesh &mesh, const scalarField &levelC, const scalarField &levelP, const DimensionedField< Type, volMesh > &positiveC, const DimensionedField< Type, pointMesh > &positiveP, const DimensionedField< Type, volMesh > &negativeC, const DimensionedField< Type, pointMesh > &negativeP)
Calculate the average value of two fields, one on each side of a level set.
pointMesh.H