49 objectiveIncompressible,
57 void objectivePtLosses::initialize()
61 wordRes patchSelection;
72 <<
"No patches provided to PtLosses. " 73 <<
"Choosing them according to the patch mass flows" <<
nl;
82 const scalar mass =
gSum(phiPatch);
83 if (
mag(mass) > SMALL)
85 objectiveReportPatches.push_back(patchI);
89 patches_.
transfer(objectiveReportPatches);
96 <<
"No valid patch name on which to minimize " <<
type() <<
endl 101 Info<<
"Minimizing " <<
type() <<
" in patches:" <<
endl;
116 const word& adjointSolverName,
117 const word& primalSolverName
148 const label patchI = patches_[oI];
152 (
U.boundaryField()[patchI] & Sf)
154 p.boundaryField()[patchI]
155 + 0.5*
magSqr(
U.boundaryField()[patchI])
158 patchPt_[oI] =
mag(pt);
172 const label patchI = patches_[oI];
177 bdJdpPtr_()[patchI] = -(
U.boundaryField()[patchI] & nf)*nf;
189 const label patchI = patches_[oI];
196 - (
p.boundaryField()[patchI] + 0.5*
magSqr(Ub))*nf
209 const label patchI = patches_[oI];
215 -
p.boundaryField()[patchI]
216 - 0.5*
magSqr(
U.boundaryField()[patchI])
217 -
sqr(
U.boundaryField()[patchI] & nf);
228 const label patchI = patches_[oI];
234 bdJdvtPtr_()[patchI] = -Un*(
U.boundaryField()[patchI] - Un*nf);
241 for (
const label patchI : patches_)
251 for (
const scalar pt : patchPt_)
fvsPatchField< scalar > fvsPatchScalarField
const volScalarField & pInst() const
Return const reference to pressure.
void size(const label n)
Older name for setAddressableSize.
const dictionary & dict() const
Return objective dictionary.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
autoPtr< OFstream > objFunctionFilePtr_
File to keep the objective values after the end of the primal solver.
labelHashSet patchSet(const UList< wordRe > &select, const bool warnNotFound=true, const bool useGroups=true) const
Return the set of patch IDs corresponding to the given names.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
constexpr char nl
The newline '\n' character (0x0a)
virtual void update_boundarydJdp()
Update values to be added to the adjoint inlet velocity.
bool empty() const noexcept
True if List is empty (ie, size() is zero)
virtual void update_boundarydJdvt()
Update values to be added to the adjoint outlet tangential velocity.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual void update_boundarydJdv()
Update values to be added to the adjoint outlet velocity.
const surfaceScalarField & phiInst() const
Return const reference to volume flux.
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
void setSize(const label n)
Alias for resize()
Type gSum(const FieldField< Field, Type > &f)
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
A class for handling words, derived from Foam::string.
defineTypeNameAndDebug(objectivePartialVolume, 1)
label size() const noexcept
The number of entries in the list.
const volScalarField & p() const
Return const reference to pressure.
scalar J_
Objective function value and weight.
autoPtr< boundaryVectorField > bdJdvPtr_
const volVectorField & U() const
Return const reference to velocity.
Istream and Ostream manipulators taking arguments.
int debug
Static debugging option.
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry if present, and assign to T val. FatalIOError if it is found and the number of tokens i...
autoPtr< boundaryVectorField > bdJdpPtr_
Adjoint (intlet,wall) velocity.
objectivePtLosses(const fvMesh &mesh, const dictionary &dict, const word &adjointSolverName, const word &primalSolverName)
from components
addToRunTimeSelectionTable(objectiveGeometric, objectivePartialVolume, dictionary)
virtual void addHeaderColumns() const
Write headers for additional columns.
const incompressibleVars & vars_
unsigned int width_
Default width of entries when writing in the objective files.
#define WarningInFunction
Report a warning using Foam::Warning.
Mesh data needed to do the Finite Volume discretisation.
List< Key > sortedToc() const
The table of contents (the keys) in sorted order.
autoPtr< boundaryVectorField > bdJdvtPtr_
Adjoint outlet velocity.
messageStream Info
Information stream (stdout output on master, null elsewhere)
const fvBoundaryMesh & boundary() const noexcept
Return reference to boundary mesh.
Omanip< int > setw(const int i)
A class for managing temporary objects.
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
virtual scalar J()
Return the objective function value.
const volVectorField & UInst() const
Return const reference to velocity.
autoPtr< boundaryScalarField > bdJdvnPtr_
Adjoint outlet pressure.
virtual void addColumnValues() const
Write information to additional columns.
Abstract base class for objective functions in incompressible flows.
virtual void update_boundarydJdvn()
Update values to be added to the adjoint outlet pressure.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
static constexpr const zero Zero
Global zero (0)