adjointOutletVelocityFvPatchVectorField.H
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) 2007-2020 PCOpt/NTUA
9  Copyright (C) 2013-2020 FOSS GP
10  Copyright (C) 2019 OpenCFD Ltd.
11 -------------------------------------------------------------------------------
12 License
13  This file is part of OpenFOAM.
14 
15  OpenFOAM is free software: you can redistribute it and/or modify it
16  under the terms of the GNU General Public License as published by
17  the Free Software Foundation, either version 3 of the License, or
18  (at your option) any later version.
19 
20  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
21  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23  for more details.
24 
25  You should have received a copy of the GNU General Public License
26  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
27 
28 
29 Class
30  Foam::adjointOutletVelocityFvPatchVectorField
31 
32 Description
33  Provides the adjoint outlet velocity values (i.e. adjoint velocity in
34  case of a zeroGradient U boundary condition). Can have stability issues
35  in cases of backflow of the primal velocity.
36  The adjointOutletVelocityFlux should preferably be used.
37 
38 
39 SourceFiles
40  adjointOutletVelocityFvPatchVectorField.C
41 
42 \*---------------------------------------------------------------------------*/
43 
44 #ifndef adjointOutletVelocityFvPatchVectorField_H
45 #define adjointOutletVelocityFvPatchVectorField_H
46 
47 #include "fvPatchFields.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 /*---------------------------------------------------------------------------*\
57  Class adjointOutletVelocityFvPatch Declaration
58 \*---------------------------------------------------------------------------*/
59 
61 :
62  public fixedValueFvPatchVectorField,
64 {
65  // Private Member Functions
66 
67  void assignBoundaryValue();
68 
69 
70 public:
71 
72  //- Runtime type information
73  TypeName("adjointOutletVelocity");
74 
75 
76  // Constructors
77 
78  //- Construct from patch and internal field
80  (
81  const fvPatch&,
83  );
84 
85  //- Construct from patch, internal field and dictionary
87  (
88  const fvPatch&,
90  const dictionary&
91  );
92 
93  //- Construct by mapping given adjointOutletVelocityFvPatchVectorField
94  //- onto a new patch
96  (
98  const fvPatch&,
100  const fvPatchFieldMapper&
101  );
102 
103  //- Construct and return a clone
104  virtual tmp<fvPatchVectorField> clone() const
105  {
107  (
109  );
110  }
111 
112  //- Construct as copy setting internal field reference
114  (
117  );
118 
119  //- Construct and return a clone setting internal field reference
121  (
123  ) const
124  {
126  (
128  );
129  }
130 
131 
132 
133  // Member functions
134 
135  //- Return true: Allow adjoint solvers to obtain the outlet phia
136  // value through HbyA
137  virtual bool assignable() const
138  {
139  return true;
140  }
141 
142  //- Update the coefficients associated with the patch field
143  // Apply adjoint BCs through evaluate rather than updateCoeffs
144  // in order to have the correct Ua boundaryField when computing the
145  // adjoint pressure BC
146  virtual void evaluate
147  (
149  );
150 
151  //virtual void updateCoeffs();
152 
153  //- Write
154  virtual void write(Ostream&) const;
155 
156 
157  // Member operators
158 
159  virtual void operator=(const fvPatchField<vector>& pvf);
160 };
161 
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 } // End namespace Foam
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 #endif
170 
171 // ************************************************************************* //
Foam::fvPatchField< vector >
Foam::adjointOutletVelocityFvPatchVectorField
Provides the adjoint outlet velocity values (i.e. adjoint velocity in case of a zeroGradient U bounda...
Definition: adjointOutletVelocityFvPatchVectorField.H:59
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::adjointOutletVelocityFvPatchVectorField::assignable
virtual bool assignable() const
Return true: Allow adjoint solvers to obtain the outlet phia.
Definition: adjointOutletVelocityFvPatchVectorField.H:136
Foam::adjointBoundaryCondition
Base class for solution control classes.
Definition: adjointBoundaryCondition.H:52
Foam::adjointOutletVelocityFvPatchVectorField::evaluate
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Update the coefficients associated with the patch field.
Definition: adjointOutletVelocityFvPatchVectorField.C:156
Foam::adjointOutletVelocityFvPatchVectorField::TypeName
TypeName("adjointOutletVelocity")
Runtime type information.
Foam::adjointOutletVelocityFvPatchVectorField::operator=
virtual void operator=(const fvPatchField< vector > &pvf)
Definition: adjointOutletVelocityFvPatchVectorField.C:176
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
adjointBoundaryConditions.H
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::adjointOutletVelocityFvPatchVectorField::clone
virtual tmp< fvPatchVectorField > clone() const
Construct and return a clone.
Definition: adjointOutletVelocityFvPatchVectorField.H:103
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:69
Foam::adjointOutletVelocityFvPatchVectorField::write
virtual void write(Ostream &) const
Write.
Definition: adjointOutletVelocityFvPatchVectorField.C:165
fvPatchFields.H
fixedValueFvPatchFields.H
Foam::adjointOutletVelocityFvPatchVectorField::adjointOutletVelocityFvPatchVectorField
adjointOutletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
Definition: adjointOutletVelocityFvPatchVectorField.C:99
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54
Foam::UPstream::commsTypes::blocking