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-2023 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,
39  const dictionary& dict
40 )
41 :
42  fixedValueFvPatchVectorField(p, iF, dict)
43 {}
44 
45 
48 (
50  const fvPatch& p,
52  const fvPatchFieldMapper& mapper
53 )
54 :
55  fixedValueFvPatchVectorField(ptf, p, iF, mapper)
56 {}
57 
58 
61 (
64 )
65 :
66  fixedValueFvPatchVectorField(pivpvf, iF)
67 {}
68 
69 
70 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
71 
72 // Update the coefficients associated with the patch field
74 {
75  if (updated())
76  {
77  return;
78  }
79 
80  const fvsPatchField<scalar>& phiap =
81  patch().lookupPatchField<surfaceScalarField, scalar>("phia");
82 
83  const fvPatchField<vector>& Up =
84  patch().lookupPatchField<volVectorField, vector>("U");
85 
86  scalarField Un(mag(patch().nf() & Up));
87  vectorField UtHat((Up - patch().nf()*Un)/(Un + small));
88 
89  vectorField Uan(patch().nf()*(patch().nf() & patchInternalField()));
90 
91  vectorField::operator=(phiap*patch().Sf()/sqr(patch().magSf()) + UtHat);
92  // vectorField::operator=(Uan + UtHat);
93 
94  fixedValueFvPatchVectorField::updateCoeffs();
95 }
96 
97 
99 {
101  writeEntry(os, "value", *this);
102 }
103 
104 
105 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
106 
107 namespace Foam
108 {
110  (
113  );
114 }
115 
116 
117 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
void operator=(const Field< vector > &)
Definition: Field.C:526
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
adjointOutletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Foam::fvPatchFieldMapper.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:87
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:231
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
Definition: fvsPatchField.H:82
Namespace for OpenFOAM.
VolField< vector > volVectorField
Definition: volFieldsFwd.H:62
dimensionedSymmTensor sqr(const dimensionedVector &dv)
SurfaceField< scalar > surfaceScalarField
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
dimensioned< scalar > mag(const dimensioned< Type > &)
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
dictionary dict
volScalarField & p
Foam::surfaceFields.