adjointOutletVelocityFvPatchVectorField.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-2018 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 "volFields.H"
29 #include "surfaceFields.H"
30 #include "fvPatchFieldMapper.H"
31 
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 
36 (
37  const fvPatch& p,
38  const DimensionedField<vector, volMesh>& iF
39 )
40 :
41  fixedValueFvPatchVectorField(p, iF)
42 {}
43 
44 
47 (
48  const fvPatch& p,
49  const DimensionedField<vector, volMesh>& iF,
50  const dictionary& dict
51 )
52 :
53  fixedValueFvPatchVectorField(p, iF, dict)
54 {}
55 
56 
59 (
60  const adjointOutletVelocityFvPatchVectorField& ptf,
61  const fvPatch& p,
62  const DimensionedField<vector, volMesh>& iF,
63  const fvPatchFieldMapper& mapper
64 )
65 :
66  fixedValueFvPatchVectorField(ptf, p, iF, mapper)
67 {}
68 
69 
72 (
73  const adjointOutletVelocityFvPatchVectorField& pivpvf,
74  const DimensionedField<vector, volMesh>& iF
75 )
76 :
77  fixedValueFvPatchVectorField(pivpvf, iF)
78 {}
79 
80 
81 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
82 
83 // Update the coefficients associated with the patch field
85 {
86  if (updated())
87  {
88  return;
89  }
90 
91  const fvsPatchField<scalar>& phiap =
92  patch().lookupPatchField<surfaceScalarField, scalar>("phia");
93 
94  const fvPatchField<vector>& Up =
95  patch().lookupPatchField<volVectorField, vector>("U");
96 
97  scalarField Un(mag(patch().nf() & Up));
98  vectorField UtHat((Up - patch().nf()*Un)/(Un + small));
99 
100  vectorField Uan(patch().nf()*(patch().nf() & patchInternalField()));
101 
102  vectorField::operator=(phiap*patch().Sf()/sqr(patch().magSf()) + UtHat);
103  // vectorField::operator=(Uan + UtHat);
104 
105  fixedValueFvPatchVectorField::updateCoeffs();
106 }
107 
108 
110 {
112  writeEntry("value", os);
113 }
114 
115 
116 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
117 
118 namespace Foam
119 {
121  (
123  adjointOutletVelocityFvPatchVectorField
124  );
125 }
126 
127 
128 // ************************************************************************* //
Foam::surfaceFields.
dictionary dict
fvPatchField< vector > fvPatchVectorField
virtual void write(Ostream &) const
Write.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:49
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:362
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:55
Macros for easy insertion into run-time selection tables.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
void operator=(const Field< vector > &)
Definition: Field.C:764
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
dimensioned< scalar > mag(const dimensioned< Type > &)
Field< vector > vectorField
Specialisation of Field<T> for vector.
adjointOutletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
volScalarField & p
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
Namespace for OpenFOAM.