adjointOutletVelocityFvPatchVectorField.C
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) 2011-2016 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 \*---------------------------------------------------------------------------*/
27 
28 #include "adjointOutletVelocityFvPatchVectorField.H"
29 #include "volFields.H"
31 #include "surfaceFields.H"
32 #include "fvPatchFieldMapper.H"
33 
34 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
35 
38 (
39  const fvPatch& p,
40  const DimensionedField<vector, volMesh>& iF
41 )
42 :
43  fixedValueFvPatchVectorField(p, iF)
44 {}
45 
46 
49 (
50  const fvPatch& p,
51  const DimensionedField<vector, volMesh>& iF,
52  const dictionary& dict
53 )
54 :
55  fixedValueFvPatchVectorField(p, iF, dict)
56 {}
57 
58 
61 (
62  const adjointOutletVelocityFvPatchVectorField& ptf,
63  const fvPatch& p,
64  const DimensionedField<vector, volMesh>& iF,
65  const fvPatchFieldMapper& mapper
66 )
67 :
68  fixedValueFvPatchVectorField(ptf, p, iF, mapper)
69 {}
70 
71 
74 (
75  const adjointOutletVelocityFvPatchVectorField& pivpvf,
76  const DimensionedField<vector, volMesh>& iF
77 )
78 :
79  fixedValueFvPatchVectorField(pivpvf, iF)
80 {}
81 
82 
83 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
84 
85 // Update the coefficients associated with the patch field
87 {
88  if (updated())
89  {
90  return;
91  }
92 
93  const auto& phiap = patch().lookupPatchField<surfaceScalarField>("phia");
94  const auto& Up = patch().lookupPatchField<volVectorField>("U");
95 
96  scalarField Un(mag(patch().nf() & Up));
97  vectorField UtHat((Up - patch().nf()*Un)/(Un + SMALL));
98 
99  vectorField Uan(patch().nf()*(patch().nf() & patchInternalField()));
100 
101  vectorField::operator=(phiap*patch().Sf()/sqr(patch().magSf()) + UtHat);
102  //vectorField::operator=(Uan + UtHat);
103 
104  fixedValueFvPatchVectorField::updateCoeffs();
105 }
106 
107 
109 {
112 }
113 
114 
115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
116 
117 namespace Foam
118 {
120  (
122  adjointOutletVelocityFvPatchVectorField
123  );
124 }
125 
126 
127 // ************************************************************************* //
Foam::surfaceFields.
dictionary dict
fvPatchField< vector > fvPatchVectorField
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
void writeValueEntry(Ostream &os) const
Write *this field as a "value" entry.
Definition: fvPatchField.H:403
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:372
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:76
Macros for easy insertion into run-time selection tables.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
OBJstream os(runTime.globalPath()/outputName)
void operator=(const Field< vector > &)
Copy assignment.
Definition: Field.C:747
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
const std::string patch
OpenFOAM patch number as a std::string.
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.