58 mesh_.boundary().size(),
59 fixedValueFvPatchScalarField::typeName
75 const scalar defaultEps =
76 mesh_.schemesDict().subDict(
"wallDist").
77 subOrEmptyDict(
"advectionDiffusionCoeffs").
78 getOrDefault<scalar>(
"epsilon", 0.1);
110 nybf[patchi] == -
patches[patchi].nf();
123adjointEikonalSolver::adjointEikonalSolver
132 dict_(
dict.subOrEmptyDict(
"adjointEikonalSolver")),
134 sensitivityPatchIDs_(sensitivityPatchIDs),
231 Info<<
"Adjoint Eikonal Iteration : " << iter <<
endl;
245 scalar residual = daEqn.solve().initialResidual();
255 Info<<
"\n***Reached adjoint eikonal convergence limit, iteration "
256 << iter <<
"***\n\n";
276 Info<<
"Calculating distance sensitivities " <<
endl;
288 distanceSens[patchi] =
290 *
d.boundaryField()[patchi].snGrad()
291 *
d.boundaryField()[patchi].snGrad()*nf;
299 Info<<
"Calculating distance sensitivities " <<
endl;
351 distanceSens.correctBoundaryConditions();
353 return tdistanceSens;
359 const word& designVarsName
const dimensionSet & dimensions() const noexcept
Return dimensions.
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
GeometricBoundaryField< vector, fvPatchField, volMesh > Boundary
const Internal::FieldType & primitiveField() const noexcept
Return a const-reference to the internal field values.
void correctBoundaryConditions()
Correct boundary field.
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
@ NO_REGISTER
Do not request registration (bool: false).
@ NO_READ
Nothing to be read.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
@ AUTO_WRITE
Automatically write from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
Ostream & printExecutionTime(OSstream &os) const
Print the elapsed ExecutionTime (cpu-time), ClockTime.
void size(const label n)
Older name for setAddressableSize.
Solver of the adjoint to the eikonal PDE.
tmp< volVectorField > gradEikonal()
Return the gradient of the eikonal equation.
boundaryVectorField & distanceSensitivities()
Return the sensitivity term depending on da.
const volScalarField & da()
Return the adjoint distance field.
autoPtr< boundaryVectorField > distanceSensPtr_
Wall face sens w.r.t. (x,y.z).
tmp< surfaceScalarField > computeYPhi()
Compute convecting velocity.
const volScalarField & d()
Return the distance field.
adjointSolver & adjointSolver_
labelHashSet wallPatchIDs_
virtual bool readDict(const dictionary &dict)
Read dict if changed.
const labelHashSet & sensitivityPatchIDs_
tmp< volTensorField > getFISensitivityTerm() const
Return the volume-based sensitivity term depending on da.
void read()
Read options each time a new solution is found.
void accumulateIntegrand(const scalar dt)
Accumulate source term.
void reset()
Reset source term.
tmp< scalarField > topologySensitivities(const word &designVarsName) const
Return sensitivity contribution to topology optimisation.
wordList patchTypes() const
Return the boundary condition types for da.
void solve()
Calculate the adjoint distance field.
Base class for adjoint solvers.
virtual tmp< volScalarField > yWall() const
Return the distance field, to be used in the solution of the adjoint eikonal PDE.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
void relax(const scalar alpha)
Relax matrix (for steady-state solution).
SolverPerformance< Type > solve(const dictionary &)
Solve returning the solution statistics.
Mesh data needed to do the Finite Volume discretisation.
const Time & time() const
Return the top-level database.
const fvBoundaryMesh & boundary() const noexcept
Return reference to boundary mesh.
static const word & zeroGradientType() noexcept
The type name for zeroGradient patch fields.
Finite-volume options, which is an IOdictionary of values and a fv::optionList.
static options & New(const fvMesh &mesh)
Construct fvOptions and register to database if not present otherwise lookup and return.
static wordList patchTypes(const fvMesh &mesh, const labelHashSet &patchIDs)
Return the patch types for y and n.
static void postProcessSens(scalarField &sens, scalarField &auxSens, fv::options &fvOptions, const word &fieldName, const word &designVariablesName)
Add part of the sensitivities coming from fvOptions.
A class for managing temporary objects.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const polyBoundaryMesh & patches
wallPoints::trackData td(isBlockedFace, regionToBlockSize)
Namespace for handling debugging switches.
static tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
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)
zeroField SuSp(const Foam::zero, const GeometricField< Type, fvPatchField, volMesh > &)
A no-op source.
GeometricField< vector, fvsPatchField, surfaceMesh > surfaceVectorField
List< word > wordList
List of word.
GeometricField< vector, fvPatchField, volMesh > volVectorField
const dimensionSet dimless
Dimensionless.
PtrList< fvPatch > fvPatchList
Store lists of fvPatch as a PtrList.
bool read(const char *buf, int32_t &val)
Same as readInt32.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
fvMatrix< scalar > fvScalarMatrix
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
messageStream Info
Information stream (stdout output on master, null elsewhere).
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
GeometricField< tensor, fvPatchField, volMesh > volTensorField
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Field< vector > vectorField
Specialisation of Field<T> for vector.
static constexpr const zero Zero
Global zero (0).
autoPtr< typename GeometricField< Type, fvPatchField, volMesh >::Boundary > createZeroBoundaryPtr(const fvMesh &mesh, bool printAllocation=false)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
volVectorField::Boundary boundaryVectorField
Type gMax(const FieldField< Field, Type > &f)
dimensioned< tensor > dimensionedTensor
Dimensioned tensor obtained from generic dimensioned type.
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
wordList patchTypes(nPatches)
Calculation of adjoint based sensitivities for topology optimisation. This returns just the field par...
Forwards and collection of common volume field types.