43namespace incompressibleAdjoint
45namespace adjointRASModels
120 tr.ref().boundaryFieldRef() ==
Zero;
192 return pos(fieldSwitch) +
neg(fieldSwitch)*
Cs_;
206 return pos(fieldSwitch)*(dFv2dChi*
nuTilda()*invDenom/
nu() +
fv2*invDenom);
219 return - 2.*
pos(fieldSwitch)*aux/
y_;
231 *(scalar(10) -
r_)/(scalar(10) -
r_ + SMALL)
233 tdrdNutilda.
ref().boundaryFieldRef() ==
Zero;
247 *(scalar(10) -
r_)/(scalar(10) -
r_ + SMALL)
249 tdrdStilda.
ref().boundaryFieldRef() ==
Zero;
263 *(scalar(10) -
r_)/(scalar(10) -
r_ + SMALL)
265 tdrdDelta.
ref().boundaryFieldRef() ==
Zero;
282 pow6Cw3/(pow6g + pow6Cw3)
283 *
pow((1.0 + pow6Cw3)/(pow6g + pow6Cw3), 1.0/6.0)
339 return -
Cb1_*dStildadNuTilda;
360 if(!isA<coupledFvPatch>(patch))
377 Info<<
"Updating primal-based fields of the adjoint turbulence "
378 <<
"model ..." <<
endl;
477 const word& adjointTurbulenceModelName,
478 const word& modelName
487 adjointTurbulenceModelName
527 Cw1_(Cb1_/
sqr(kappa_) + (1.0 + Cb2_)/sigmaNut_),
565 limitAdjointProduction_
567 coeffDict_.getOrDefault(
"limitAdjointProduction", true)
570 y_(primalVars_.RASModelVariables()().d()),
572 mask_(allocateMask()),
574 symmAdjointProductionU_
578 "symmAdjointProductionU",
588 productionDestructionSource_
592 "productionDestructionSource",
662 "momentumSourceMult",
672 gradU_(fvc::grad(primalVars.
U())),
673 gradNuTilda_(fvc::grad(nuTilda())),
674 minStilda_(
"SMALL", Stilda_.dimensions(), SMALL)
800 if (isA<wallFvPatch>(patch) && patch.size() != 0)
802 wallShapeSens[patchI] =
809 return wallShapeSens;
821 wallFloCoSens[patchI] =
826 return wallFloCoSens;
849 auto tadjointEikonalSource =
852 "adjointEikonalSource" +
type(),
862 SAwallFunctionPatchField;
870 forAll(nutBoundary, patchi)
875 isA<SAwallFunctionPatchField>(nutBoundary[patchi])
879 const scalar
kappa_(0.41);
880 const scalar E_(9.8);
909 ((
kappa_/E_)*(
exp(kUu) - 1 - kUu - 0.5*kUu*kUu));
932 adjointEikonalSource[cellI] -=
933 2.*( rt[faceI] + Uap_t[faceI] )
934 *vtau[faceI]*Cwf_d[faceI]*magSf[faceI]
942 return tadjointEikonalSource;
956 tgradNuaTilda.
ref().boundaryFieldRef();
963 if (isA<wallFvPatch>(patch))
974 gradNuaTildab[patchI] =
984 (gradU & gradU)().
T()
985 - (gradU & gradU.
T())
1061 + gradNua*oneOverSigmaNut
1073 nuaTildaEqn.
ref().relax();
1080 scalar maxDeltaNuaTilda =
1083 Info<<
"Max mag of nuaTilda = " << maxNuaTilda.
value() <<
endl;
1084 Info<<
"Max mag of delta nuaTilda = " << maxDeltaNuaTilda <<
endl;
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
const uniformDimensionedVectorField & g
static tmp< volScalarField > createLimiter(const fvMesh &mesh, const dictionary &dict)
const dimensionSet & dimensions() const
Return dimensions.
const Field< Type > & field() const
Return field.
Generic GeometricBoundaryField class.
void relax(const scalar alpha)
Relax field (for steady-state solution).
tmp< GeometricField< Type, PatchField, GeoMesh > > T() const
Return transpose (only if it is a tensor field)
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
Internal & ref(const bool updateAccessTime=true)
Return a reference to the dimensioned internal field.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
void storePrevIter() const
Store the field as the previous iteration value.
void correctBoundaryConditions()
Correct boundary field.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
void setSize(const label n)
Alias for resize()
tmp< volScalarField::Internal > Stilda() const
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
static word timeName(const scalar t, const int precision=precision_)
label size() const noexcept
The number of elements in the list.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const Type & value() const
Return const reference to value.
bool readIfPresent(const dictionary &dict)
Smooth ATC in cells next to a set of patches supplied by type.
const DimensionedField< scalar, volMesh > & V() const
Return cell volumes.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
const Time & time() const
Return the top-level database.
virtual tmp< Field< Type > > patchInternalField() const
Return internal field next to patch as patch field.
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Manages the adjoint mean flow fields and their mean values.
const volVectorField & Ua() const
Return const reference to velocity.
const volVectorField & UaInst() const
Return const reference to velocity.
const solverControl & getSolverControl() const
Return const reference to solverControl.
Abstract base class for incompressible turbulence models.
dictionary coeffDict_
Model coefficients dictionary.
autoPtr< boundaryVectorField > wallShapeSensitivitiesPtr_
Wall sensitivity term for shape optimisation.
Switch adjointTurbulence_
Turbulence on/off flag.
bool changedPrimalSolution_
Has the primal solution changed?
autoPtr< boundaryVectorField > adjMomentumBCSourcePtr_
const nearWallDist & y() const
Return the near wall distances.
autoPtr< volScalarField > adjointTMVariable1Ptr_
Adjoint turbulence model variable 1.
objectiveManager & objectiveManager_
Reference to the objectiveManager.
wordList adjointTMVariablesBaseNames_
Base names of the adjoint fields.
autoPtr< boundaryVectorField > wallFloCoSensitivitiesPtr_
Wall sensitivity term for flow control optimisation.
const dictionary & coeffDict() const
Const access to the coefficients dictionary.
void setMeanFields()
Set mean fields.
virtual bool read()
Read adjointRASProperties dictionary.
Continuous adjoint to the Spalart-Allmaras one-eqn mixing-length model for incompressible flows.
tmp< volScalarField > dfw_dNuTilda(const volScalarField &Stilda, const volScalarField &dfwdr, const volScalarField &dStildadNuTilda) const
virtual tmp< fvVectorMatrix > divDevReff(volVectorField &U) const
Return the diffusion term for the momentum equation.
virtual tmp< scalarField > diffusionCoeffVar1(label patchI) const
const volScalarField & nuTilda() const
References to the primal turbulence model variables.
tmp< volScalarField > dStilda_dNuTilda(const volScalarField &Omega, const volScalarField &fv2, const volScalarField &dFv2dChi) const
virtual tmp< volTensorField > FISensitivityTerm()
Term contributing to the computation of FI-based sensitivities.
tmp< volScalarField > chi() const
tmp< volScalarField > dfw_dOmega(const volScalarField &Stilda, const volScalarField &dfwdr, const volScalarField &dStildadOmega) const
tmp< volScalarField > dFv2_dChi(const volScalarField &chi, const volScalarField &fv1, const volScalarField &dFv1dChi) const
tmp< volScalarField > fw(const volScalarField &Stilda) const
volVectorField gradNuTilda_
tmp< volScalarField > dStilda_dDelta(const volScalarField &Omega, const volScalarField &fv2) const
virtual void correct()
Solve the adjoint turbulence equations.
tmp< volVectorField > conservativeMomentumSource()
Conservative source term for the adjoint momentum equations.
tmp< volScalarField > DnuTildaEff() const
tmp< volScalarField > dStilda_dOmega(const volScalarField &Omega, const volScalarField &fv2) const
void updatePrimalRelatedFields()
Update the constant primal-related fields.
virtual const boundaryVectorField & adjointMomentumBCSource() const
virtual tmp< volSymmTensorField > devReff() const
Return the effective stress tensor including the laminar stress.
tmp< volScalarField > dP_dNuTilda(const volScalarField &dStildadNuTilda) const
volTensorField momentumSourceMult_
virtual void nullify()
Nullify all adjoint turbulence model fields and their old times.
tmp< volScalarField > dr_dNuTilda(const volScalarField &Stilda) const
tmp< volScalarField > fv1(const volScalarField &chi) const
virtual tmp< volScalarField > nutJacobianTMVar1() const
Jacobian of nut wrt the first turbulence model variable.
tmp< volScalarField > Stilda(const volScalarField &chi, const volScalarField &fv1) const
volScalarField & nuaTilda()
Access to the adjoint Spalart - Allmaras field.
tmp< volScalarField > dfw_dDelta(const volScalarField &Stilda, const volScalarField &dfwdr, const volScalarField &dStildadDelta) const
dimensionedScalar minStilda_
bool limitAdjointProduction_
volScalarField productionDestructionSource_
tmp< volScalarField > dfw_dr(const volScalarField &Stilda) const
virtual const boundaryVectorField & wallShapeSensitivities()
Sensitivity terms for shape optimisation, emerging from.
tmp< volScalarField > allocateMask()
Allocate the mask field.
const volScalarField & y_
Wall distance.
virtual tmp< volVectorField > adjointMeanFlowSource()
virtual const boundaryVectorField & wallFloCoSensitivities()
Sensitivity terms for flow control, emerging from the.
dimensionedScalar sigmaNut_
tmp< volScalarField > dD_dNuTilda(const volScalarField &fw, const volScalarField &dfwdNuTilda) const
virtual tmp< volScalarField > distanceSensitivities()
tmp< volScalarField > dr_dStilda(const volScalarField &Stilda) const
tmp< volScalarField > dnut_dNuTilda(const volScalarField &fv1, const volScalarField &dFv1dChi) const
tmp< volScalarField > dr_dDelta(const volScalarField &Stilda) const
const volScalarField & nut() const
Return the turbulence viscosity.
tmp< volScalarField > fv2(const volScalarField &chi, const volScalarField &fv1) const
volScalarField mask_
Field for masking (convergence enhancement)
volSymmTensorField symmAdjointProductionU_
virtual bool read()
Read adjointRASProperties dictionary.
tmp< volScalarField > dFv1_dChi(const volScalarField &chi) const
tmp< volScalarField > r(const volScalarField &Stilda) const
virtual tmp< volScalarField > nuEff() const
Return the effective viscosity.
incompressibleAdjointMeanFlowVars & adjointVars_
tmp< volScalarField > nu() const
Return the laminar viscosity.
virtual void correct()=0
Solve the adjoint turbulence equations.
incompressibleVars & primalVars_
Base class for solution control classes.
const volVectorField & U() const
Return const reference to velocity.
const surfaceScalarField & phi() const
Return const reference to volume flux.
const autoPtr< incompressible::RASModelVariables > & RASModelVariables() const
Return const reference to the turbulence model variables.
This boundary condition provides a wall function for the turbulent viscosity (i.e....
class for managing incompressible objective functions.
const word & adjointSolverName() const
Return name of the adjointSolver.
virtual void addTMEqn1Source(fvScalarMatrix &adjTMEqn1)=0
Add contribution to first adjoint turbulence model PDE.
const quaternion & r() const
bool printMaxMags() const
Print max mags of solver fields.
A class for managing temporary objects.
void clear() const noexcept
static void setField(autoPtr< GeometricField< Type, fvPatchField, volMesh > > &fieldPtr, const fvMesh &mesh, const word &baseName, const word &solverName, const bool useSolverNameForFields)
Read vol fields.
const word & solverName() const
Return solver name.
bool useSolverNameForFields() const
Append solver name to fields?
static void nullifyField(GeometricField< Type, PatchField, GeoMesh > &fieldPtr)
Nullify field and old times, if present.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh > > grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
tmp< GeometricField< Type, fvPatchField, volMesh > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
tmp< fvMatrix< Type > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
tmp< fvMatrix< Type > > div(const surfaceScalarField &flux, const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
tmp< fvMatrix< Type > > ddt(const GeometricField< Type, fvPatchField, volMesh > &vf)
zeroField SuSp(const Foam::zero, const GeometricField< Type, fvPatchField, volMesh > &)
A no-op source.
zeroField Sp(const Foam::zero, const GeometricField< Type, fvPatchField, volMesh > &)
A no-op source.
dimensionedSymmTensor dev(const dimensionedSymmTensor &dt)
dimensionedScalar pow6(const dimensionedScalar &ds)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
dimensionedScalar pos(const dimensionedScalar &ds)
dimensionedScalar pow5(const dimensionedScalar &ds)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
dimensionedSymmTensor symm(const dimensionedSymmTensor &dt)
dimensionedScalar exp(const dimensionedScalar &ds)
const dimensionSet dimless
Dimensionless.
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
dimensionedScalar pow3(const dimensionedScalar &ds)
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
dimensionedSymmTensor twoSymm(const dimensionedSymmTensor &dt)
messageStream Info
Information stream (stdout output on master, null elsewhere)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
dimensionedScalar neg(const dimensionedScalar &ds)
static constexpr const zero Zero
Global zero (0)
Type gMax(const FieldField< Field, Type > &f)
dimensionedTensor skew(const dimensionedTensor &dt)
#define addProfiling(name, descr)
Define profiling trigger with specified name and description string.
#define forAll(list, i)
Loop across all elements in list.