46 objectiveIncompressible,
58 const word& adjointSolverName,
59 const word& primalSolverName
71 Aref_(
dict.
get<scalar>(
"Aref")),
72 rhoInf_(
dict.
get<scalar>(
"rhoInf")),
79 <<
"No valid patch name on which to minimize " <<
type() <<
endl 84 Info<<
"Minimizing " <<
type() <<
" in patches:" <<
endl;
118 pressureForce +=
gSum(Sf*
p.boundaryField()[patchI]);
119 viscousForce +=
gSum(devReff.boundaryField()[patchI] & Sf);
122 cumulativeForce = pressureForce + viscousForce;
131 <<
"Force|Coeff " << force <<
"|" << Cforce <<
endl;
200 if (isA<wallFvPatch>(
patch))
203 gradUbf[patchI] = tnf*
U.boundaryField()[patchI].snGrad();
214 *gradp.boundaryField()[patchI]/
denom();
219 tmp<volScalarField> tnuEff = lamTransp.
nu() + turbVars->nut();
220 tmp<volSymmTensorField> tstress = tnuEff*
twoSymm(tgradU);
222 autoPtr<volVectorField> ptemp
233 tmp<vectorField> tnf =
patch.nf();
236 *(gradStressDir.boundaryField()[patchI] & tnf)/
denom();
250 tmp<vectorField> tnf =
patch.nf();
269 - nuEff.boundaryField()[patchI]
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
GeometricField< symmTensor, fvPatchField, volMesh > volSymmTensorField
const volScalarField & pInst() const
Return const reference to pressure.
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
autoPtr< boundaryVectorField > bdxdbMultPtr_
Term multiplying delta(x)/delta b at the boundary.
const surfaceVectorField & Sf() const
Return cell face area vectors.
labelHashSet forcePatches_
errorManipArg< error, int > exit(error &err, const int errNo=1)
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...
virtual void update_boundarydJdGradU()
Update dJ/dGradU multiplier.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
GeometricField< tensor, fvPatchField, volMesh > volTensorField
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface...
Ostream & endl(Ostream &os)
Add newline and flush stream.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
objectiveForce(const fvMesh &mesh, const dictionary &dict, const word &adjointSolverName, const word &primalSolverName)
Construct from components.
virtual void update_boundarydJdnut()
Update dJ/dnut multiplier.
void unzipRow(const FieldField< Field, SymmTensor< Cmpt >> &input, const direction idx, FieldField< Field, Vector< Cmpt >> &result)
Extract a symmTensor field field row (x,y,z) == (0,1,2)
autoPtr< boundaryTensorField > bdJdGradUPtr_
Term multiplying gradU variations.
virtual void update_boundarydJdp()
Update values to be added to the adjoint wall velocity.
::Foam::direction nComponents(const expressions::valueTypeCode) noexcept
The number of components associated with given valueTypeCode.
GeometricField< vector, fvPatchField, volMesh > volVectorField
Macros for easy insertion into run-time selection tables.
dimensionedSymmTensor twoSymm(const dimensionedSymmTensor &dt)
virtual void update_dSdbMultiplier()
Update delta(n dS)/delta b multiplier.
#define forAll(list, i)
Loop across all elements in list.
autoPtr< boundaryScalarField > bdJdnutPtr_
Jacobian wrt to nut.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
dimensionedSymmTensor dev(const dimensionedSymmTensor &dt)
Type gSum(const FieldField< Field, Type > &f)
const singlePhaseTransportModel & laminarTransport() const
Return const reference to transport model.
A class for handling words, derived from Foam::string.
defineTypeNameAndDebug(objectivePartialVolume, 1)
const volScalarField & p() const
Return const reference to pressure.
virtual scalar denom() const
Return denominator, without density.
A List of wordRe with additional matching capabilities.
scalar J_
Objective function value and weight.
#define DebugInfo
Report an information message using Foam::Info.
const volVectorField & U() const
Return const reference to velocity.
static tmp< GeometricField< tensor, fvPatchField, volMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=fvPatchField< tensor >::calculatedType())
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions and patch type. [Takes current timeN...
bool empty() const noexcept
True if the hash table is empty.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
int debug
Static debugging option.
autoPtr< boundaryVectorField > bdJdpPtr_
Adjoint (intlet,wall) velocity.
Info<< "Reading field U\"<< endl;volVectorField U(IOobject("U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);volScalarField rho(IOobject("rho", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), thermo.rho());volVectorField rhoU(IOobject("rhoU", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), rho *U);volScalarField rhoE(IOobject("rhoE", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), rho *(e+0.5 *magSqr(U)));surfaceScalarField pos(IOobject("pos", runTime.timeName(), mesh), mesh, dimensionedScalar("pos", dimless, 1.0));surfaceScalarField neg(IOobject("neg", runTime.timeName(), mesh), mesh, dimensionedScalar("neg", dimless, -1.0));surfaceScalarField phi("phi", fvc::flux(rhoU));Info<< "Creating turbulence model\"<< endl;autoPtr< compressible::turbulenceModel > turbulence(compressible::turbulenceModel::New(rho, U, phi, thermo))
virtual const vector & forceDirection() const
Return force direction.
addToRunTimeSelectionTable(objectiveGeometric, objectivePartialVolume, dictionary)
const autoPtr< incompressible::RASModelVariables > & RASModelVariables() const
Return const reference to the turbulence model variables.
const incompressibleVars & vars_
Mesh data needed to do the Finite Volume discretisation.
virtual void update_dxdbMultiplier()
Update delta(x)/delta b multiplier.
const std::string patch
OpenFOAM patch number as a std::string.
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
virtual scalar J()
Return the objective function value.
List< label > sortedToc(const UList< bool > &bools)
Return the (sorted) values corresponding to 'true' entries.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Internal & ref(const bool updateAccessTime=true)
Same as internalFieldRef()
const fvBoundaryMesh & boundary() const noexcept
Return reference to boundary mesh.
const autoPtr< incompressible::turbulenceModel > & turbulence() const
Return const reference to the turbulence model.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
A class for managing temporary objects.
autoPtr< boundaryVectorField > bdSdbMultPtr_
Term multiplying delta(n dS)/delta b.
A simple single-phase transport model based on viscosityModel.
Abstract base class for objective functions in incompressible flows.
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
virtual tmp< volScalarField > nu() const
Return the laminar viscosity.
SymmTensor< Cmpt > devTwoSymm(const SymmTensor< Cmpt > &st)
Return the deviatoric part of twice the symmetric part of a SymmTensor.
static constexpr const zero Zero
Global zero (0)
const dimensionSet dimVelocity