Go to the documentation of this file.
49 objectiveIncompressible,
61 const word& adjointSolverName,
62 const word& primalSolverName
73 bdJdpPtr_.reset(createZeroBoundaryPtr<vector>(mesh_));
74 bdJdvPtr_.reset(createZeroBoundaryPtr<vector>(mesh_));
75 bdJdvnPtr_.reset(createZeroBoundaryPtr<scalar>(mesh_));
76 bdJdvtPtr_.reset(createZeroBoundaryPtr<vector>(mesh_));
102 <<
"No patches provided to PtLosses. Chossing them according to "
103 <<
"the patch mass flows"
112 const scalar mass =
gSum(phiPatch);
113 if (
mag(mass) > SMALL)
115 objectiveReportPatches.append(patchI);
119 patches_.
transfer(objectiveReportPatches);
121 patchPt_.setSize(patches_.size());
123 if (patches_.empty())
126 <<
"No valid patch name on which to minimize " <<
type() <<
endl
131 Info<<
"Minimizing " <<
type() <<
" in patches:" <<
endl;
151 const label patchI = patches_[oI];
155 (
U.boundaryField()[patchI] & Sf)
157 p.boundaryField()[patchI]
158 + 0.5*
magSqr(
U.boundaryField()[patchI])
161 patchPt_[oI] =
mag(pt);
175 const label patchI = patches_[oI];
180 bdJdpPtr_()[patchI] = -(
U.boundaryField()[patchI] & nf)*nf;
192 const label patchI = patches_[oI];
199 - (
p.boundaryField()[patchI] + 0.5*
magSqr(Ub))*nf
212 const label patchI = patches_[oI];
218 -
p.boundaryField()[patchI]
219 - 0.5*
magSqr(
U.boundaryField()[patchI])
220 -
sqr(
U.boundaryField()[patchI] & nf);
231 const label patchI = patches_[oI];
237 bdJdvtPtr_()[patchI] = -Un*(
U.boundaryField()[patchI] - Un*nf);
257 label patchI = patches_[oI];
int debug
Static debugging option.
void initialize()
Return the objectiveReportPatches.
const surfaceScalarField & phiInst() const
Return const reference to volume flux.
void write() const
Write objective function values and its contrituents.
A class for handling words, derived from Foam::string.
A class for managing temporary objects.
static constexpr const zero Zero
Global zero.
const incompressibleVars & vars_
addToRunTimeSelectionTable(objectiveIncompressible, objectiveForce, dictionary)
List< wordRe > wordReList
A List of wordRe (word or regular expression)
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
void setObjectiveFilePtr() const
Set the output file ptr.
autoPtr< boundaryScalarField > bdJdvnPtr_
Adjoint outlet pressure.
void update_boundarydJdv()
Update values to be added to the adjoint outlet velocity.
autoPtr< boundaryVectorField > bdJdvPtr_
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Type & value() const
Return const reference to value.
Type gSum(const FieldField< Field, Type > &f)
const volVectorField & UInst() const
Return const reference to velocity.
autoPtr< boundaryVectorField > bdJdvtPtr_
Adjoint outlet velocity.
const volScalarField & p() const
Return const reference to pressure.
autoPtr< OFstream > objFunctionFilePtr_
File to keep the objective values after the end of the primal solver.
#define forAll(list, i)
Loop across all elements in list.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
defineTypeNameAndDebug(objectiveForce, 0)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
messageStream Info
Information stream (uses stdout - output is on the master only)
void transfer(List< T > &list)
Istream and Ostream manipulators taking arguments.
const volVectorField & U() const
Return const reference to velocity.
Abstract base class for objective functions in incompressible flows.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Macros for easy insertion into run-time selection tables.
Mesh data needed to do the Finite Volume discretisation.
Omanip< int > setw(const int i)
errorManipArg< error, int > exit(error &err, const int errNo=1)
static bool master(const label communicator=0)
Am I the master process.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
scalar J()
Return the objective function value.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
void update_boundarydJdp()
Update values to be added to the adjoint inlet velocity.
static unsigned int defaultPrecision()
Return the default precision.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
labelHashSet patchSet(const UList< wordRe > &patchNames, const bool warnNotFound=true, const bool useGroups=true) const
Return the set of patch IDs corresponding to the given names.
const polyBoundaryMesh & patches
const dictionary & dict() const
Return objective dictionary.
const Time & time() const
Return the top-level database.
autoPtr< boundaryVectorField > bdJdpPtr_
Adjoint (intlet,wall) velocity.
objectivePtLosses(const fvMesh &mesh, const dictionary &dict, const word &adjointSolverName, const word &primalSolverName)
from components
void update_boundarydJdvn()
Update values to be added to the adjoint outlet pressure.
#define WarningInFunction
Report a warning using Foam::Warning.
void update_boundarydJdvt()
Update values to be added to the adjoint outlet tangential velocity.
const volScalarField & pInst() const
Return const reference to pressure.