adjointOutletPressureFvPatchScalarField.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 | Copyright (C) 2011 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 
28 #include "fvPatchMapper.H"
29 #include "volFields.H"
30 #include "surfaceFields.H"
31 
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 
36 (
37  const fvPatch& p,
38  const DimensionedField<scalar, volMesh>& iF
39 )
40 :
41  fixedValueFvPatchScalarField(p, iF)
42 {}
43 
44 
47 (
48  const adjointOutletPressureFvPatchScalarField& ptf,
49  const fvPatch& p,
50  const DimensionedField<scalar, volMesh>& iF,
51  const fvPatchFieldMapper& mapper
52 )
53 :
54  fixedValueFvPatchScalarField(ptf, p, iF, mapper)
55 {}
56 
57 
60 (
61  const fvPatch& p,
62  const DimensionedField<scalar, volMesh>& iF,
63  const dictionary& dict
64 )
65 :
66  fixedValueFvPatchScalarField(p, iF)
67 {
68  fvPatchField<scalar>::operator=
69  (
70  scalarField("value", dict, p.size())
71  );
72 }
73 
74 
77 (
78  const adjointOutletPressureFvPatchScalarField& tppsf,
79  const DimensionedField<scalar, volMesh>& iF
80 )
81 :
82  fixedValueFvPatchScalarField(tppsf, iF)
83 {}
84 
85 
86 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
87 
89 {
90  if (updated())
91  {
92  return;
93  }
94 
95  const fvsPatchField<scalar>& phip =
96  patch().lookupPatchField<surfaceScalarField, scalar>("phi");
97 
98  const fvsPatchField<scalar>& phiap =
99  patch().lookupPatchField<surfaceScalarField, scalar>("phia");
100 
101  const fvPatchField<vector>& Up =
102  patch().lookupPatchField<volVectorField, vector>("U");
103 
104  const fvPatchField<vector>& Uap =
105  patch().lookupPatchField<volVectorField, vector>("Ua");
106 
107  operator==((phiap/patch().magSf() - 1.0)*phip/patch().magSf() + (Up & Uap));
108 
109  fixedValueFvPatchScalarField::updateCoeffs();
110 }
111 
112 
114 {
116  writeEntry("value", os);
117 }
118 
119 
120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
121 
122 namespace Foam
123 {
125  (
128  );
129 }
130 
131 // ************************************************************************* //
Foam::surfaceFields.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
adjointOutletPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:49
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:55
Macros for easy insertion into run-time selection tables.
makePatchTypeField(fvPatchVectorField, SRFFreestreamVelocityFvPatchVectorField)
fvPatchField< scalar > fvPatchScalarField
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
virtual void write(Ostream &) const
Write.
volScalarField scalarField(fieldObject, mesh)
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Namespace for OpenFOAM.
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:363