48 objectiveIncompressible,
49 objectiveUniformityPatch,
60 const word& adjointSolverName,
61 const word& primalSolverName
96 <<
"No patches provided to " <<
type() <<
". " 97 <<
"Choosing them according to the patch mass flows" <<
nl;
106 const scalar mass =
gSum(phiPatch);
109 objectiveReportPatches.append(patchI);
113 patches_.
transfer(objectiveReportPatches);
118 if (patches_.
empty())
121 <<
"No valid patch name on which to minimize " <<
type() <<
endl 126 Info<<
"Minimizing " <<
type() <<
" in patches:" <<
endl;
143 const label patchI = patches_[oI];
145 const scalar sumMagSf =
gSum(magSf);
147 UMean_[oI] =
gSum(Ub*magSf)/sumMagSf;
148 UVar_[oI] =
gSum(
magSqr(Ub - UMean_[oI])*magSf)/sumMagSf;
162 const label patchI = patches_[oI];
164 const scalar sumMagSf =
gSum(magSf);
166 bdJdvPtr_()[patchI] = (Ub - UMean_[oI])/sumMagSf;
177 const label patchI = patches_[oI];
179 const scalar sumMagSf =
gSum(magSf);
182 bdJdvnPtr_()[patchI] = ((Ub - UMean_[oI]) & nf)/sumMagSf;
193 const label patchI = patches_[oI];
195 const scalar sumMagSf =
gSum(magSf);
201 (UdiffTangent - (UdiffTangent & nf())*nf())/sumMagSf;
209 for (
const label patchI : patches_)
void size(const label n)
Older name for setAddressableSize.
fvPatchField< vector > fvPatchVectorField
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.
Output to file stream, using an OSstream.
constexpr char nl
The newline '\n' character (0x0a)
bool empty() const noexcept
True if List is empty (ie, size() is zero)
dimensionedScalar sqrt(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
defineTypeNameAndDebug(objectiveFlowRate, 0)
const surfaceScalarField & phiInst() const
Return const reference to volume flux.
GeometricField< vector, fvPatchField, volMesh > volVectorField
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.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
label size() const noexcept
The number of entries in the list.
A List of wordRe with additional matching capabilities.
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...
const incompressibleVars & vars_
unsigned int width_
Default width of entries when writing in the objective files.
addToRunTimeSelectionTable(objectiveIncompressible, objectiveFlowRate, dictionary)
#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.
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.
Omanip< int > setw(const int i)
A class for managing temporary objects.
const volVectorField & UInst() const
Return const reference to velocity.
autoPtr< boundaryScalarField > bdJdvnPtr_
Adjoint outlet pressure.
Abstract base class for objective functions in incompressible flows.
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
static constexpr const zero Zero
Global zero (0)