Go to the documentation of this file.
58 Info <<
"Initializing fields for DALaplacianFoam" << endl;
72 if (
mode_ ==
"hybridAdjoint")
76 daOptionPtr_->getSubDictOption<label>(
"unsteadyAdjoint",
"nTimeInstances");
79 daOptionPtr_->getSubDictOption<scalar>(
"unsteadyAdjoint",
"periodicity");
83 FatalErrorIn(
"") <<
"periodicity <= 0!" << abort(FatalError);
86 else if (
mode_ ==
"timeAccurateAdjoint")
90 daOptionPtr_->getSubDictOption<label>(
"unsteadyAdjoint",
"nTimeInstances");
94 label maxNTimeInstances = round(endTime / deltaT) + 1;
97 FatalErrorIn(
"") <<
"nTimeInstances in timeAccurateAdjoint is not equal to "
98 <<
"the maximal possible value!" << abort(FatalError);
102 if (
mode_ ==
"hybridAdjoint" ||
mode_ ==
"timeAccurateAdjoint")
107 FatalErrorIn(
"") <<
"nTimeInstances <= 0!" << abort(FatalError);
144 daOptionPtr_->setOption<word>(
"runStatus",
"solvePrimal");
146 Info <<
"\nCalculating temperature distribution\n"
168 label printInterval =
daOptionPtr_->getOption<label>(
"printIntervalUnsteady");
169 label printToScreen = 0;
170 label timeInstanceI = 0;
172 if (
mode_ ==
"timeAccurateAdjoint")
183 Info <<
"Time = " <<
runTime.timeName() << nl << endl;
188 - fvm::laplacian(
DT,
T));
205 Info <<
"ExecutionTime = " <<
runTime.elapsedCpuTime() <<
" s"
206 <<
" ClockTime = " <<
runTime.elapsedClockTime() <<
" s"
212 if (
mode_ ==
"hybridAdjoint")
217 if (
mode_ ==
"timeAccurateAdjoint")
void writeFailedMesh()
write the failed mesh to disk
label loop(Time &runTime)
return whether to loop the primal solution, similar to runTime::loop() except we don't do file IO
autoPtr< DACheckMesh > daCheckMeshPtr_
DACheckMesh object pointer.
forAll(pseudoP.boundaryField(), patchI)
fvScalarMatrix TEqn(fvm::div(phi, T) - fvm::laplacian(alphaEff, T))
autoPtr< DAIndex > daIndexPtr_
DAIndex pointer.
virtual label solvePrimal(const Vec xvVec, Vec wVec)
solve the primal equations
List< label > runTimeIndexAllInstances_
the runtime index for all instances (unsteady)
autoPtr< DAOption > daOptionPtr_
DAOption pointer.
void saveTimeInstanceFieldHybrid(label &timeInstanceI)
save primal variable to time instance list for hybrid adjoint (unsteady)
void calcPrimalResidualStatistics(const word mode, const label writeRes=0)
calculate the norms of all residuals and print to screen
DALaplacianFoam(char *argsAll, PyObject *pyOptions)
label isPrintTime(const Time &runTime, const label printInterval) const
this primalResidualControl< scalar >(solverE, printToScreen, printInterval, "he")
autoPtr< DALinearEqn > daLinearEqnPtr_
DALinearEqn pointer.
void saveTimeInstanceFieldTimeAccurate(label &timeInstanceI)
save primal variable to time instance list for time accurate adjoint (unsteady)
List< scalar > runTimeAllInstances_
the runtime value for all instances (unsteady)
void setDAObjFuncList()
initialize DASolver::daObjFuncPtrList_ one needs to call this before calling printAllObjFuncs
void printAllObjFuncs()
calculate the values of all objective functions and print them to screen
List< dictionary > objFuncsAllInstances_
objective function for all instances (unsteady)
scalar primalMinRes_
the maximal residual for primal solution
autoPtr< Time > runTimePtr_
runTime pointer
autoPtr< fvMesh > meshPtr_
fvMesh pointer
defineTypeNameAndDebug(DAFvSource, 0)
addToRunTimeSelectionTable(DAFvSource, DAFvSourceActuatorDisk, dictionary)
void ofField2StateVec(Vec stateVec) const
set the state vector based on the latest fields in OpenFOAM
label checkMesh() const
check the mesh quality and return meshOK
label nTimeInstances_
number of time instances for hybird adjoint (unsteady)
virtual void initSolver()
initialize fields and variables
List< List< scalar > > stateAllInstances_
state variable list for all instances (unsteady)
scalar periodicity_
periodicity of oscillating flow variables (unsteady)
void pointVec2OFMesh(const Vec xvVec) const
assign the points in fvMesh of OpenFOAM based on the point vector
List< List< scalar > > stateBoundaryAllInstances_
state boundary variable list for all instances (unsteady)
SolverPerformance< scalar > solverT