Removed unnecessary return statement
[foam-extend-3.2.git] / applications / solvers / surfaceTracking / freeSurface / patchCorrectedSnGrad / patchCorrectedSnGrad.C
blob414b8a3f3812f2cc40e7d6282fb75dbfedbf479a
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     | Version:     3.2
5     \\  /    A nd           | Web:         http://www.foam-extend.org
6      \\/     M anipulation  | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
8 License
9     This file is part of foam-extend.
11     foam-extend is free software: you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation, either version 3 of the License, or (at your
14     option) any later version.
16     foam-extend is distributed in the hope that it will be useful, but
17     WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     General Public License for more details.
21     You should have received a copy of the GNU General Public License
22     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 Description
25     Simple central-difference snGrad scheme with non-orthogonal correction.
27 \*---------------------------------------------------------------------------*/
29 #include "patchCorrectedSnGrad.H"
30 #include "volFields.H"
31 #include "surfaceFields.H"
32 #include "linear.H"
33 #include "fvcGrad.H"
34 #include "gaussGrad.H"
35 #include "fixedValueCorrectedFvPatchFields.H"
36 #include "fixedGradientCorrectedFvPatchFields.H"
37 #include "zeroGradientCorrectedFvPatchFields.H"
38 #include "fixedGradientFvPatchFields.H"
39 #include "zeroGradientFvPatchFields.H"
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 namespace Foam
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 namespace fv
51 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
53 template<class Type>
54 patchCorrectedSnGrad<Type>::~patchCorrectedSnGrad()
58 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
60 template<class Type>
61 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
62 patchCorrectedSnGrad<Type>::correction
64     const GeometricField<Type, fvPatchField, volMesh>& vf
65 ) const
67     const fvMesh& mesh = this->mesh();
69     // construct GeometricField<Type, fvsPatchField, surfaceMesh>
70     tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tssf
71     (
72         new GeometricField<Type, fvsPatchField, surfaceMesh>
73         (
74             IOobject
75             (
76                 "snGradCorr("+vf.name()+')',
77                 vf.instance(),
78                 mesh,
79                 IOobject::NO_READ,
80                 IOobject::NO_WRITE
81             ),
82             mesh,
83             vf.dimensions()*mesh.deltaCoeffs().dimensions()
84         )
85     );
86     GeometricField<Type, fvsPatchField, surfaceMesh>& ssf = tssf();
89     for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++)
90     {
91         ssf.replace
92         (
93             cmpt,
94             mesh.correctionVectors()
95           & linear
96             <
97                 typename
98                 outerProduct<vector, typename pTraits<Type>::cmptType>::type
99             >(mesh).interpolate
100             (
101                 gradScheme<typename pTraits<Type>::cmptType>::New
102                 (
103                     mesh,
104                     mesh.schemesDict().gradScheme(ssf.name())
105                 )()
106                 //gaussGrad<typename pTraits<Type>::cmptType>(mesh)
107                .grad(vf.component(cmpt))
108             )
109         );
110     }
112     forAll(ssf.boundaryField(), patchI)
113     {
114         if
115         (
116             vf.boundaryField()[patchI].type()
117          == fixedValueCorrectedFvPatchField<Type>::typeName
118         )
119         {
120             const fixedValueCorrectedFvPatchField<Type>& pField =
121                 refCast<const fixedValueCorrectedFvPatchField<Type> >
122                 (
123                     vf.boundaryField()[patchI]
124                 );
126             ssf.boundaryField()[patchI] = pField.snGradCorrection();
127         }
128     }
130     return tssf;
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 } // End namespace fv
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 } // End namespace Foam
142 // ************************************************************************* //