57 { preconditioners::diag,
"diag" },
59 { preconditioners::ShermanMorrison,
"ShermanMorrison" }
100 if (includeBoundConstraints_)
103 const label
n(activeDesignVars_.size());
127 const label m(nConstraints_);
129 if (includeExtraVars_)
132 const scalar t = mesh_.time().timeOutputValue();
139 doAllocateLagrangeMultipliers_ =
false;
146 scalarField LagrangianDerivativesOld(derivativesOld_);
147 forAll(constraintDerivatives_, cI)
149 LagrangianDerivatives_ += lamdas_[cI]*constraintDerivatives_[cI];
150 LagrangianDerivativesOld += lamdas_[cI]*constraintDerivativesOld_[cI];
153 if (includeBoundConstraints_)
155 forAll(activeDesignVars_, aI)
157 const label varI(activeDesignVars_[aI]);
158 const scalar contr(uTilda_()[aI] - lTilda_()[aI]);
159 LagrangianDerivatives_[varI] += contr;
160 LagrangianDerivativesOld[varI] += contr;
165 updateVectors(LagrangianDerivatives_, LagrangianDerivativesOld);
171 const scalarField x(designVars_().getVars(), activeDesignVars_);
175 if (includeBoundConstraints_)
177 lTilda_() = scalar(1);
178 uTilda_() = scalar(1);
187 if (includeExtraVars_)
189 extraVars_() = scalar(1);
190 const scalar
c = c_->
value(mesh_.time().timeOutputValue());
191 z_() =
max(1, 0.5*c);
192 Info<<
"Penalty multiplier (c):: " <<
c <<
endl;
206 if (includeBoundConstraints_)
208 deltaLTilda_() =
Zero;
210 deltaUTilda_() =
Zero;
214 if (includeExtraVars_)
227 if (includeBoundConstraints_)
230 (uTilda_()*resFus() + resFuTilda())/us_()
231 - (lTilda_()*resFls() + resFlTilda())/ls_();
235 if (includeExtraVars_)
237 mult += extraVars_()/z_();
238 AMult -= (extraVars_()*resFExtraVars() + resFz())/z_();
243 const label varI(activeDesignVars_[aI]);
244 forAll(constraintDerivatives_, cI)
263 forAll(constraintDerivatives_, cI)
265 const scalarField& cDerivsI = constraintDerivatives_[cI];
267 globalSum(
scalarField(cDerivsI, activeDesignVars_)*deltaP_);
269 GsLADp *= lamdas_/gs_;
274 const label varI(activeDesignVars_[aI]);
275 forAll(constraintDerivatives_, cI)
277 rhs[aI] += constraintDerivatives_[cI][varI]*GsLADp[cI];
282 if (includeBoundConstraints_)
284 rhs += (lTilda_()/ls_() + uTilda_()/us_())*deltaP_;
301 scalar res(
sqrt(globalSum(r*r)));
303 scalar rz(globalSum(r*z));
309 scalar a = rz/globalSum(
p*Ap);
312 res =
sqrt(globalSum(r*r));
313 z = preconVectorProduct(r, precon);
315 scalar
beta = rz/rzOld;
318 }
while (iter++ < maxDxIters_ && res > relTol_*resInit);
320 <<
"CG, Solving for deltaP, Initial Residual " << resInit
321 <<
", Final Residual " << res
322 <<
", No Iterations " << iter <<
endl;
335 forAll(constraintDerivatives_, cI)
337 const scalarField& cDerivsI = constraintDerivatives_[cI];
342 if (includeExtraVars_)
344 mult += extraVars_()/z_();
351 const label varI(activeDesignVars_[aI]);
352 forAll(constraintDerivatives_, cI)
354 Ap[aI] += constraintDerivatives_[cI][varI]*GsLAv[cI];
359 if (includeBoundConstraints_)
361 Ap += (lTilda_()/ls_() + uTilda_()/us_())*
vector;
372 autoPtr<scalarField>& precon
376 if (preconType_ == preconditioners::diag)
380 precon.reset(diagPreconditioner().ptr());
384 else if (preconType_ == preconditioners::invHessian)
386 return invHessianVectorProduct(
vector);
388 else if (preconType_ == preconditioners::ShermanMorrison)
399 tmp<scalarField> tpreconditioner(HessianDiag());
400 scalarField& preconditioner = tpreconditioner.ref();
403 forAll(constraintDerivatives_, cI)
405 scalarField cDerivs(constraintDerivatives_[cI], activeDesignVars_);
406 scalar mult(gs_[cI]/lamdas_[cI]);
407 if (includeExtraVars_)
409 mult += extraVars_()[cI]/z_()[cI];
411 preconditioner +=
sqr(cDerivs)/mult;
414 if (includeBoundConstraints_)
416 preconditioner += lTilda_()/ls_() + uTilda_()/us_();
419 preconditioner = 1./preconditioner;
421 return tpreconditioner;
439 if (includeBoundConstraints_)
441 tdiag.
reset((lTilda_()/ls_() + uTilda_()/us_()).ptr());
446 PtrList<scalarField> r1Updates(cValues_.size());
448 forAll(constraintDerivatives_, cI)
450 const scalarField& cDerivsI = constraintDerivatives_[cI];
455 if (includeExtraVars_)
457 mult += extraVars_()/z_();
461 ShermanMorrisonRank1Update(r1Updates,
vector, tdiag, mult, mult.size());
467 const PtrList<scalarField>& r1Updates,
469 const refPtr<scalarField>&
diag,
479 Ap = invHessianVectorProduct(
p, counter_,
diag.shallowClone());
486 Ap = ShermanMorrisonRank1Update(r1Updates,
p,
diag, mult,
n);
488 ShermanMorrisonRank1Update(r1Updates, r1Updates[
n],
diag, mult,
n);
491 Ap -= Av*
globalSum(r1Updates[
n]*Ap)/(1 + yHs)/mult[
n];
508 forAll(constraintDerivatives_, cI)
510 const scalarField& cDerivsI = constraintDerivatives_[cI];
512 globalSum(
scalarField(cDerivsI, activeDesignVars_)*deltaP_);
515 if (includeExtraVars_)
517 mult += extraVars_()/z_();
518 deltaLamda_ += (resFz() + extraVars_()*resFExtraVars())/z_();
520 deltaLamda_ += resFGs() - resFlamda()/lamdas_;
524 deltaGs_ = -(gs_*deltaLamda_ + resFlamda())/lamdas_;
526 if (includeBoundConstraints_)
529 deltaLs_() = deltaP_ + resFls();
532 deltaUs_() = -deltaP_ + resFus();
535 deltaLTilda_() = -(lTilda_()*deltaLs_() + resFlTilda())/ls_();
538 deltaUTilda_() = -(uTilda_()*deltaUs_() + resFuTilda())/us_();
541 if (includeExtraVars_)
551 const label
n(p_.size());
552 const label m(cValues_.size());
555 if (includeBoundConstraints_)
557 for (label i = 0; i <
n; ++i)
559 adjustStep(step, ls_()[i], deltaLs_()[i]);
560 adjustStep(step, us_()[i], deltaUs_()[i]);
561 adjustStep(step, lTilda_()[i], deltaLTilda_()[i]);
562 adjustStep(step, uTilda_()[i], deltaUTilda_()[i]);
567 for (label i = 0; i < m; ++i)
569 adjustStep(step, lamdas_[i], deltaLamda_[i]);
570 adjustStep(step, gs_[i], deltaGs_[i]);
571 if (includeExtraVars_)
573 adjustStep(step, extraVars_()[i], deltaExtraVars_()[i]);
574 adjustStep(step, z_()[i], deltaZ_()[i]);
589 Info<<
"Step before line search is " << step <<
endl;
593 scalar normResOld =
sqrt(globalSum(
magSqr(computeResiduals())));
594 scalar maxRes(GREAT);
596 for (label i = 0; i < maxLineSearchIters_ ; ++i)
599 updateSolution(step);
603 scalar normResNew =
sqrt(globalSum(
magSqr(resNew)));
606 if (normResNew < normResOld)
609 <<
"Initial residual = " << normResOld <<
", "
610 <<
"Final residual = " << normResNew <<
", "
611 <<
"No of LineSearch Iterations = " << i + 1
618 if (i != maxLineSearchIters_ - 1)
620 updateSolution(-step);
625 Info<<
tab <<
"Line search did not converge. "
626 <<
"Procceding with the last compute step" <<
endl;
647 if (0.99*value + step*
update < scalar(0))
649 step = -0.99*value/
update;
657 lamdas_ += step*deltaLamda_;
658 gs_ += step*deltaGs_;
659 if (includeBoundConstraints_)
661 lTilda_() += step*deltaLTilda_();
662 ls_() += step*deltaLs_();
663 uTilda_() += step*deltaUTilda_();
664 us_() += step*deltaUs_();
666 if (includeExtraVars_)
676 const label
n(activeDesignVars_.size());
677 const label m(cValues_.size());
678 label size(includeBoundConstraints_ ? 5*
n + 2*m :
n + 2*m);
679 if (includeExtraVars_)
693 res.rmap(resFGs()(),
identity(m, iRes));
697 res.rmap(resFlamda()(),
identity(m, iRes));
700 if (includeBoundConstraints_)
711 res.rmap(resFlTilda()(),
identity(
n, iRes));
715 res.rmap(resFuTilda()(),
identity(
n, iRes));
719 if (includeExtraVars_)
722 res.rmap(resFExtraVars()(),
identity(m, iRes));
726 res.rmap(resFz(),
identity(m, iRes));
736 tmp<scalarField> tgradL
750 forAll(constraintDerivatives_, cI)
754 *
scalarField(constraintDerivatives_[cI], activeDesignVars_);
757 if (includeBoundConstraints_)
768 tmp<scalarField> tinvHFL
772 forAll(constraintDerivatives_, cI)
776 *
scalarField(constraintDerivatives_[cI], activeDesignVars_);
779 if (includeBoundConstraints_)
781 invHFL += uTilda_() - lTilda_();
799 forAll(constraintDerivatives_, cI)
804 scalarField(constraintDerivatives_[cI], activeDesignVars_)*p_
808 if (includeExtraVars_)
825 if (includeBoundConstraints_)
827 const scalarField x(designVars_().getVars(), activeDesignVars_);
829 (designVars_().lowerBounds()(), activeDesignVars_);
839 if (includeBoundConstraints_)
841 const scalarField x(designVars_().getVars(), activeDesignVars_);
843 (designVars_().upperBounds()(), activeDesignVars_);
853 if (includeBoundConstraints_)
863 if (includeBoundConstraints_)
873 if (includeExtraVars_)
883 if (includeExtraVars_)
895 if (includeBoundConstraints_ || !cValues_.empty())
897 scalar resMax(
gMax(
mag(computeResiduals())));
902 <<
"Newton iter " << iter <<
nl <<
endl;
905 if (resMax < 0.9*eps_)
911 computeNewtonDirection();
918 <<
"max residual = " << resMax <<
", "
919 <<
"eps = " << eps_ <<
nl <<
endl;
922 iter++ < maxNewtonIters_ && (eps_ > epsMin_ || resMax > 0.9*eps_)
924 Info<<
"Finished solving the QP subproblem" <<
nl <<
endl;
925 if (iter == maxNewtonIters_)
928 <<
"Iterative solution of the QP problem did not converge"
933 scalarField vars(designVars_().getVars(), activeDesignVars_);
942 if (includeBoundConstraints_)
948 Info<<
"Max of lTilda*ls " <<
gMax(lTilda_()*ls_()) <<
endl;
949 Info<<
"Max of uTilda*us " <<
gMax(uTilda_()*us_()) <<
endl;
951 if (includeExtraVars_)
953 Info<<
"Min of extraVars " <<
gMin(extraVars_()) <<
endl;
954 Info<<
"Max of extraVars*z " <<
gMax(extraVars_()*z_()) <<
endl;
957 if (includeExtraVars_)
960 <<
"Constraint penalization variables (y) " << extraVars_()
966 computeNewtonDirection();
971 correction_.rmap(p_, activeDesignVars_);
985 derivativesOld_ = objectiveDerivatives_;
986 if (constraintDerivativesOld_.empty())
988 constraintDerivativesOld_.setSize(constraintDerivatives_.size());
990 forAll(constraintDerivativesOld_, cI)
994 correctionOld_ = correction_;
1015 const label nConstraints,
1022 doAllocateLagrangeMultipliers_(true),
1023 includeBoundConstraints_
1025 designVars->upperBounds() && designVars->lowerBounds()
1029 coeffsDict(
type).getOrDefault<bool>(
"includeExtraVars", false)
1031 p_(activeDesignVars_.size(),
Zero),
1032 gs_(nConstraints_, 1),
1035 includeBoundConstraints_ &&
found(
"lTilda") ?
1036 new
scalarField(
"lTilda", *this, activeDesignVars_.size()) :
1042 includeBoundConstraints_ &&
found(
"uTilda") ?
1043 new
scalarField(
"uTilda", *this, activeDesignVars_.size()) :
1047 extraVars_(nullptr),
1050 deltaP_(activeDesignVars_.size(),
Zero),
1051 deltaLamda_(nConstraints_,
Zero),
1052 deltaGs_(nConstraints_,
Zero),
1053 deltaLTilda_(nullptr),
1055 deltaUTilda_(nullptr),
1057 deltaExtraVars_(nullptr),
1060 epsMin_(coeffsDict(
type).getOrDefault<scalar>(
"epsMin", 1.e-07)),
1061 maxNewtonIters_(coeffsDict(
type).getOrDefault<label>(
"maxIters", 1000)),
1064 coeffsDict(
type).getOrDefault<label>(
"maxLineSearchIters", 10)
1066 maxDxIters_(coeffsDict(
type).getOrDefault<label>(
"maxDpIters", 1000)),
1067 relTol_(coeffsDict(
type).getOrDefault<scalar>(
"relTol", 0.01)),
1070 preconditionerNames.getOrDefault
1072 "preconditioner", coeffsDict(
type), preconditioners::
diag
1076 (coeffsDict(
type).getOrDefault<scalar>(
"targetConstraintReduction", 1)),
1078 (coeffsDict(
type).getOrDefault<bool>(
"disableDamping", false)),
1079 meritFunctionFile_(nullptr)
1081 Info<<
"Preconditioner type of the SQP subproblem is ::"
1096 Info<<
"Reading constraint penalty function type from dict" <<
endl;
1101 Info<<
"Setting constant penalty factor" <<
endl;
1102 c_.reset(
new Function1Types::Constant<scalar>(
"c", 100));
1120 LagrangianDerivatives_ = objectiveDerivatives_;
1168 if (includeBoundConstraints_)
1170 uTilda_().writeEntry(
"uTilda",
os);
Istream and Ostream manipulators taking arguments.
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
label size() const noexcept
The number of elements in list.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
const List< word > & names() const noexcept
The list of enum names, in construction order. Same as toc().
void rmap(const UList< Type > &mapF, const labelUList &mapAddressing)
1 to 1 reverse-map from the given field
Templated function that returns a constant value.
An L-BFGS-based SQP algorithm for computing the update of the design variables in the presence of ine...
bool doAllocateLagrangeMultipliers_
Should Lagrange multipliers be allocated.
scalar lineSearch()
Perform line search and return max residual corresponding to the updated solution.
tmp< scalarField > matrixVectorProduct(const scalarField &vector)
Procudt of the LHS of the deltaP eqn with a vector.
void updateSolution(const scalar step)
Update the current solution using the known direction and the given step length.
scalar cRed_
Percentage reduction for the constraints.
tmp< scalarField > resFls()
Residual of the lower bounds slackness.
void CGforDeltaP(const scalarField &FDx)
CG algorithm for the solution of the deltaP eqn.
void solveSubproblem()
Solve subproblem using a Newton optimiser.
void computeCorrection()
Compute design variables correction.
virtual scalar meritFunctionDirectionalDerivative()
Derivative of the merit function. Could be different than the objective derivative in the presence of...
bool includeExtraVars_
Are additional design variables included?
tmp< scalarField > resFL()
Residual of the gradient of the Lagrangian.
void initialize()
Allocate fields related to constraints.
virtual bool writeAuxiliaryData()
Write merit function information.
autoPtr< Function1< scalar > > c_
Multiplier of the additional variables y in the Lagrangian, to make them 'expensive'.
tmp< scalarField > invHFL()
Product of the inverse Hessian with the residual of the gradient of the Lagrangian.
tmp< scalarField > resFz()
Residual of the complementarity slackness for the extra variables.
void adjustStep(scalar &step, const scalar value, const scalar update)
Adjust step to satisfy cireteria.
autoPtr< scalarField > z_
Lagrange multipliers for positive extra variables.
virtual bool writeData(Ostream &os) const
Write useful quantities to files.
tmp< scalarField > resFExtraVars()
Residual of the Lagrangian derivative wrt the extra variables.
virtual scalar meritFunctionConstraintPart() const
Get the part the merit function that depends on the constraints.
tmp< scalarField > preconVectorProduct(const scalarField &vector, autoPtr< scalarField > &precon)
Preconditioner-vector product for CG.
static const Enum< preconditioners > preconditionerNames
Names of preconditioners for the subproblem.
scalarField p_
The set of design variables being updated during the subproblem.
void computeNewtonDirection()
Compute direction for the Newton problem.
autoPtr< scalarField > us_
Slack variables the upper bound constraints.
scalar epsMin_
Final eps quantity to be reached during the solution of the subproblem.
autoPtr< scalarField > deltaUs_
tmp< scalarField > resFuTilda()
Residual of the complementarity slackness for the upper bound constraints.
autoPtr< scalarField > deltaUTilda_
autoPtr< OFstream > meritFunctionFile_
File including the l1 merit function.
autoPtr< scalarField > deltaLs_
void zeroUpdates()
Zero the updates computed in the previous optimisation cycle.
virtual scalar computeMeritFunction()
Compute merit function. Could be different than the objective in the presence of constraints.
tmp< scalarField > ShermanMorrisonRank1Update(const PtrList< scalarField > &r1Updates, const scalarField &p, const refPtr< scalarField > &diag, const scalarField &mult, label n)
Recursive (naive) implementation of the rank-1 update.
tmp< scalarField > resFGs()
Residual of the inequality constraint slackness.
scalar eps_
Infinitesimal quantity.
preconditioners
Enumeration of preconditioners for the subproblem.
autoPtr< scalarField > deltaExtraVars_
label maxDxIters_
Maxmimum number of iterations for the deltaX equation.
void allocateBoundMultipliers()
Allocate multipliers for the bound constraints.
tmp< scalarField > resFus()
Residual of the upper bounds slackness.
label maxLineSearchIters_
Maxmimum number of line search iterations for each iteration of the subproblem.
autoPtr< scalarField > deltaZ_
scalar relTol_
Relative tolerance of the CG solver, solving for deltaP_.
autoPtr< scalarField > extraVars_
Extra variables for finding solutions even in infeasible problems.
autoPtr< scalarField > ls_
Slack variables the lower bound constraints.
tmp< scalarField > diagPreconditioner()
Diagonal preconditioner of the deltaP eqn.
tmp< scalarField > resFlamda()
Residual of the complementarity slackness for the inequality constraints.
bool includeBoundConstraints_
Are bound constraints included?
bool disableDamping_
Disable damping.
autoPtr< scalarField > lTilda_
Lagrange multipliers for the lower bound constraints.
virtual void updateOldCorrection(const scalarField &oldCorrection)
Update old correction. Useful for quasi-Newton methods coupled with line search.
void updateYS()
Update the vectors accosiated with the Hessian matrix.
tmp< scalarField > resFlTilda()
Residual of the complementarity slackness for the lower bound constraints.
autoPtr< scalarField > uTilda_
Lagrange multipliers for the upper bound constraints.
void storeOldFields()
Store old fields needed for the next iter.
tmp< scalarField > computeResiduals()
Compute and return residuals based on the current solution.
void updateSizes()
Update sizes of fields related to the active design variables.
void solveDeltaPEqn()
Solve the equation for deltaX, which is the expensive part of the Newtopn step.
autoPtr< scalarField > deltaLTilda_
scalarField gs_
Slack variables for the inequality constraints.
label maxNewtonIters_
Maxmimum number of Newton iterations for the subproblem.
label preconType_
Which preconditioner to use for the solution of the subproblem.
tmp< scalarField > ShermanMorrisonPrecon(const scalarField &vector)
Use the Sherman-Morrison formula to compute the matrix-free product of the approximate inverse of the...
void allocateLagrangeMultipliers()
Allocate Lagrange multipliers for the inequality constraints.
tmp< scalarField > computeRHSForDeltaX(const scalarField &FDx)
Compute the RHS for the deltaX equation.
The quasi-Newton Limited-memory BFGS formula. Keeps nPrevSteps_ of the y and s vectors and approximat...
PtrList< scalarField > y_
The previous differences of derivatives. Holds nPrevSteps_ fields.
void updateVectors(const scalarField &derivatives, const scalarField &derivativesOld)
Update y and s vectors.
virtual tmp< scalarField > HessianVectorProduct(const scalarField &vector)
Compute the Hessian - vector product.
virtual bool writeData(Ostream &os) const
Write useful quantities to files.
PtrList< scalarField > s_
The previous correction. Holds nPrevSteps_ fields.
tmp< scalarField > HessianDiag()
Return the diagonal of the Hessian.
bool useYDamping_
Use damping for s to ensure positive-definitiveness.
label nPrevSteps_
Number of old corrections and grad differences kept.
bool useSDamping_
Use damping for s to ensure positive-definitiveness.
virtual tmp< scalarField > invHessianVectorProduct(const scalarField &vector)
Compute the inverse Hessian - vector product.
virtual void update()
Update design variables.
bool set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie,...
Base class for Sequantial Quadratic Programming (SQP) methods.
scalarField lamdas_
Lagrange multipliers.
virtual bool addToFile(Ostream &os) const
Write continuation info.
scalar mu_
Penalty value for the merit function.
virtual bool writeMeritFunction(const updateMethod &UpdateMethod)
Write info about the merit function.
List< scalarField > constraintDerivativesOld_
The previous constraint derivatives.
scalar delta_
Safety factor.
scalarField LagrangianDerivatives_
Derivatives of the Lagrangian function.
void size(const label n)
Older name for setAddressableSize.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
Abstract base class for optimisation methods supporting constraints. Does not add functionality to up...
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...
const Type & value() const noexcept
Return const reference to value.
Mesh data needed to do the Finite Volume discretisation.
Abstract base class for line search methods.
scalarField correctionOld_
The previous correction.
scalar etaHessian_
Step for the Newton method.
scalarField derivativesOld_
The previous derivatives.
A class for managing references or pointers (no reference counting).
void reset(T *p=nullptr) noexcept
Delete managed pointer and set to new given pointer.
A class for managing temporary objects.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
Abstract base class for optimisation methods.
scalarField objectiveDerivatives_
Derivatives of the objective functions.
label nConstraints_
Number of constraints.
scalarField correction_
Design variables correction.
bool globalSum_
Whether to use gSum or sum in the inner products.
dictionary coeffsDict(const word &type) const
Return optional dictionary with parameters specific to each method.
scalar globalSum(const scalarField &field)
Compute either global or local sum, based on globalSum flag.
scalarField cValues_
Constraint values.
scalar objectiveValue_
Objective value.
PtrList< scalarField > constraintDerivatives_
Derivatives of the constraints.
const labelList & activeDesignVars_
Map to active design variables.
label counter_
Optimisation cycle count.
label nConstraints() const
Get the number of constraints.
virtual void updateOldCorrection(const scalarField &oldCorrection)
Update old correction. Useful for quasi-newton methods coupled with line search.
scalar eta_
Step multiplying the correction.
autoPtr< designVariables > & designVars_
Design variables.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
OBJstream os(runTime.globalPath()/outputName)
#define DebugInfo
Report an information message using Foam::Info.
#define WarningInFunction
Report a warning using Foam::Warning.
const dimensionedScalar c
Speed of light in a vacuum.
Namespace for handling debugging switches.
dimensionedScalar pos(const dimensionedScalar &ds)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Type gSum(const FieldField< Field, Type > &f)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
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.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void reduce(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce).
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
static constexpr const zero Zero
Global zero (0).
Type gMin(const FieldField< Field, Type > &f)
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
Type gMax(const FieldField< Field, Type > &f)
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
constexpr char nl
The newline '\n' character (0x0a).
constexpr char tab
The tab '\t' character(0x09).
#define addProfiling(Name,...)
Define profiling trigger with specified name and description string. The description is generated by ...
dimensionedScalar beta("beta", dimless/dimTemperature, laminarTransport)
#define forAll(list, i)
Loop across all elements in list.
const vector L(dict.get< vector >("L"))