

Public Member Functions | |
| TypeName ("DARhoSimpleCFoam") | |
| DARhoSimpleCFoam (char *argsAll, PyObject *pyOptions) | |
| virtual | ~DARhoSimpleCFoam () |
| virtual void | initSolver () |
| initialize fields and variables More... | |
| virtual label | solvePrimal () |
| solve the primal equations More... | |
Public Member Functions inherited from DASolver | |
| TypeName ("DASolver") | |
| Runtime type information. More... | |
| declareRunTimeSelectionTable (autoPtr, DASolver, dictionary,(char *argsAll, PyObject *pyOptions),(argsAll, pyOptions)) | |
| DASolver (char *argsAll, PyObject *pyOptions) | |
| virtual | ~DASolver () |
| virtual label | runFPAdj (Vec dFdW, Vec psi) |
| solve the adjoint equation using the fixed-point iteration method More... | |
| virtual label | solveAdjointFP (Vec dFdW, Vec psi) |
| solve the adjoint equation using the fixed-point iteration method More... | |
| void | setTime (scalar time, label timeIndex) |
| setTime for OF fields More... | |
| label | getDdtSchemeOrder () |
| get the ddtScheme order More... | |
| void | printElapsedTime (const Time &runTime, const label printToScreen) |
| void | calcdRdWT (const label isPC, Mat dRdWT) |
| compute dRdWT More... | |
| void | updateKSPPCMat (Mat PCMat, KSP ksp) |
| Update the preconditioner matrix for the ksp object. More... | |
| label | solveLinearEqn (const KSP ksp, const Vec rhsVec, Vec solVec) |
| solve the linear equation given a ksp and right-hand-side vector More... | |
| void | updateOFFields (const scalar *states) |
| Update the OpenFOAM field values (including both internal and boundary fields) based on the state array. More... | |
| void | updateOFMesh (const scalar *volCoords) |
| Update the OpenFoam mesh point coordinates based on the volume point coords array. More... | |
| void | getOFFields (scalar *states) |
| assign the state variables from OpenFoam layer to the states array More... | |
| void | getOFField (const word fieldName, const word fieldType, double *field) |
| get a field variable from OF layer More... | |
| void | getOFMeshPoints (double *points) |
| get the flatten mesh points coordinates More... | |
| label | getInputSize (const word inputName, const word inputType) |
| get the array size of an input type More... | |
| label | getOutputSize (const word outputName, const word outputType) |
| get the array size of an output type More... | |
| label | getInputDistributed (const word inputName, const word inputType) |
| get whether the input is distributed among processors More... | |
| label | getOutputDistributed (const word outputName, const word outputType) |
| get whether the output is distributed among processors More... | |
| void | calcOutput (const word outputName, const word outputType, double *output) |
| get whether the output is distributed among processors More... | |
| void | runColoring () |
| run the coloring solver More... | |
| void | calcJacTVecProduct (const word inputName, const word inputType, const double *input, const word outputName, const word outputType, const double *seed, double *product) |
| calculate the Jacobian-matrix-transposed and vector product for product = [dOutput/dInput]^T * seed More... | |
| void | setSolverInput (const word inputName, const word inputType, const int inputSize, const double *input, const double *seed) |
| void | createMLRKSPMatrixFree (const Mat jacPCMat, KSP ksp) |
| create a multi-level, Richardson KSP object with matrix-free Jacobians More... | |
| void | calcdRdWOldTPsiAD (const label oldTimeLevel, const double *psi, double *dRdWOldTPsi) |
| compute dRdWOld^T*Psi More... | |
| void | calcCouplingFaceCoords (const scalar *volCoords, scalar *surfCoords) |
| return the face coordinates based on vol coords More... | |
| void | getCouplingPatchList (wordList &patchList, word groupName="NONE") |
| return the coupling patch list if any scenario is active on couplingInfo dict otherwise return design surface More... | |
| void | initializedRdWTMatrixFree () |
| initialize matrix free dRdWT More... | |
| void | destroydRdWTMatrixFree () |
| destroy the matrix free dRdWT More... | |
| void | registerStateVariableInput4AD (const label oldTimeLevel=0) |
| register all state variables as the input for reverse-mode AD More... | |
| void | deactivateStateVariableInput4AD (const label oldTimeLevel=0) |
| deactivate all state variables as the input for reverse-mode AD More... | |
| void | registerResidualOutput4AD () |
| register all residuals as the output for reverse-mode AD More... | |
| void | assignVec2ResidualGradient (const double *vecX) |
| assign the reverse-mode AD input seeds from vecX to the residuals in OpenFOAM More... | |
| void | assignStateGradient2Vec (double *vecY, const label oldTimeLevel=0) |
| set the reverse-mode AD derivatives from the state variables in OpenFOAM to vecY More... | |
| void | normalizeGradientVec (double *vecY) |
| normalize the reverse-mode AD derivatives stored in vecY More... | |
| void | normalizeJacTVecProduct (const word inputName, double *product) |
| normalize the jacobian vector product that has states as the input such as dFdW and dRdW More... | |
| void | initializeGlobalADTape4dRdWT () |
| initialize the CoDiPack reverse-mode AD global tape for computing dRdWT*psi More... | |
| label | hasVolCoordInput () |
| whether the volCoord input is defined More... | |
| void | initDynamicMesh () |
| resetting internal info in fvMesh, which is needed for multiple primal runs More... | |
| label | loop (Time &runTime) |
| return whether to loop the primal solution, similar to runTime::loop() except we don't do file IO More... | |
| void | updateInputFieldUnsteady () |
| assign the inputFieldUnsteady values to the OF field vars More... | |
| void | initInputFieldUnsteady () |
| initialize inputFieldUnsteady from the GlobalVar class More... | |
| void | meanStatesToStates () |
| assign the mean states values to states More... | |
| label | getGlobalXvIndex (const label idxPoint, const label idxCoord) const |
| basically, we call DAIndex::getGlobalXvIndex More... | |
| void | writeMatrixBinary (const Mat matIn, const word prefix) |
| write the matrix in binary format More... | |
| void | writeMatrixASCII (const Mat matIn, const word prefix) |
| write the matrix in ASCII format More... | |
| void | readMatrixBinary (Mat matIn, const word prefix) |
| read petsc matrix in binary format More... | |
| void | writeVectorASCII (const Vec vecIn, const word prefix) |
| write petsc vector in ascii format More... | |
| void | readVectorBinary (Vec vecIn, const word prefix) |
| read petsc vector in binary format More... | |
| void | writeVectorBinary (const Vec vecIn, const word prefix) |
| write petsc vector in binary format More... | |
| label | getNLocalAdjointStates () const |
| return the number of local adjoint states More... | |
| label | getNLocalAdjointBoundaryStates () const |
| return the number of local adjoint boundary states More... | |
| label | getNLocalCells () const |
| return the number of local cells More... | |
| label | getNLocalPoints () const |
| return the number of local points More... | |
| void | setDAFunctionList () |
| initialize DASolver::daFunctionPtrList_ one needs to call this before calling printAllFunctions More... | |
| void | calcAllFunctions (label print=0) |
| calculate the values of all objective functions and print them to screen More... | |
| double | getTimeOpFuncVal (const word functionName) |
| get the function value based on timeOp More... | |
| label | getFunctionListIndex (const word functionName) |
| return the index of a give functionName in daFunctionPtrList_ More... | |
| label | checkMesh () const |
| check the mesh quality and return meshOK More... | |
| scalar | getdFScaling (const word functionName, const label timeIdx) |
| get the scaling factor for dF/d? derivative computation More... | |
| void | printAllOptions () |
| print all DAOption More... | |
| void | calcPrimalResidualStatistics (const word mode, const label writeRes=0) |
| calculate the norms of all residuals and print to screen More... | |
| void | updateDAOption (PyObject *pyOptions) |
| update the allOptions_ dict in DAOption based on the pyOptions from pyDAFoam More... | |
| scalar | getPrevPrimalSolTime () |
| get the solution time folder for previous primal solution More... | |
| void | updateBoundaryConditions (const word fieldName, const word fieldType) |
| update the boundary condition for a field More... | |
| void | updateStateBoundaryConditions () |
| update the boundary conditions for all states and intermediate variables More... | |
| void | calcResiduals (label isPC=0) |
| calculate the residuals More... | |
| const fvMesh & | getMesh () |
| const Time & | getRunTime () |
| return the runTime object More... | |
| const DAOption & | getDAOption () |
| get DAOption object More... | |
| const DAStateInfo & | getDAStateInfo () |
| get DAStateInfo object More... | |
| const DAIndex & | getDAIndex () |
| get DAIndex object More... | |
| const DAModel & | getDAModel () |
| get DAModel object More... | |
| const DAResidual & | getDAResidual () |
| get DAResidual object More... | |
| const DAField & | getDAField () |
| get DAField object More... | |
| const DALinearEqn & | getDALinearEqn () |
| get DALinearEqn object More... | |
| const DACheckMesh & | getDACheckMesh () |
| get DACheckMesh object More... | |
| label | getNRegressionParameters (word modelName) |
| get the number of regression model parameters More... | |
| scalar | getRegressionParameter (word modelName, const label idxI) |
| get the regression parameter More... | |
| void | setRegressionParameter (word modelName, const label idxI, scalar val) |
| set the regression parameter More... | |
| void | regressionModelCompute () |
| call the compute method of the regression model More... | |
| void | setPrimalBoundaryConditions (const label printInfo=1) |
| update the primal state boundary condition based on the primalBC dict More... | |
| void | writeFailedMesh () |
| write the failed mesh to disk More... | |
| void | readStateVars (scalar timeVal, label oldTimeLevel=0) |
| read the state variables from the disk and assign the value to the prescribe time level More... | |
| void | readMeshPoints (const scalar timeVal) |
| read the mesh points from the disk and run movePoints to deform the mesh More... | |
| void | writeMeshPoints (const double *points, const scalar timeVal) |
| write the mesh points to the disk for the given timeVal More... | |
| void | calcPCMatWithFvMatrix (Mat PCMat, const label turbOnly=0) |
| calculate the PC mat using fvMatrix More... | |
| void | initTensorFlowFuncs (pyComputeInterface computeInterface, void *compute, pyJacVecProdInterface jacVecProdInterface, void *jacVecProd, pySetCharInterface setModelNameInterface, void *setModelName) |
| initialize tensorflow functions and interfaces for callback More... | |
| void | writeAdjStates (const label writeMesh, const wordList &additionalOutput) |
| write state variables that are NO_WRITE to disk More... | |
| scalar | getElapsedClockTime () |
| return the elapsed clock time for testing speed More... | |
| scalar | getElapsedCpuTime () |
| return the elapsed CPU time for testing speed More... | |
| template<class classType > | |
| label | validateField (const classType &field) |
| check if a field variable has nan More... | |
| template<class classType > | |
| label | validateVectorField (const classType &field) |
| check if a field variable has nan More... | |
| label | validateStates () |
| check if the state variables have valid values More... | |
| void | getInitStateVals (HashTable< scalar > &initState) |
| calculate the initial value for validate states More... | |
| void | resetStateVals () |
| reset the states to its initial values this usually happens when we have nan in states More... | |
| void | writeSensMapSurface (const word name, const double *dFdXs, const double *Xs, const label size, const double timeName) |
| write the sensitivity map for all wall surfaces More... | |
| void | writeSensMapField (const word name, const double *dFdField, const word fieldType, const double timeName) |
| write the sensitivity map for the entire field More... | |
| scalar | getLatestTime () |
| get the latest time solution from the case folder. More... | |
| void | writeAdjointFields (const word function, const double writeTime, const double *psi) |
| write the adjoint variables for all states More... | |
Protected Attributes | |
| autoPtr< simpleControl > | simplePtr_ |
| simple pointer More... | |
| autoPtr< fluidThermo > | pThermoPtr_ |
| thermal model More... | |
| autoPtr< volScalarField > | pPtr_ |
| pressure field pointer More... | |
| autoPtr< volScalarField > | rhoPtr_ |
| density field pointer More... | |
| autoPtr< volVectorField > | UPtr_ |
| velocity field pointer More... | |
| autoPtr< surfaceScalarField > | phiPtr_ |
| surface flux field pointer More... | |
| autoPtr< pressureControl > | pressureControlPtr_ |
| pressure control pointer More... | |
| autoPtr< compressible::turbulenceModel > | turbulencePtr_ |
| turbulence pointer More... | |
| autoPtr< DATurbulenceModel > | daTurbulenceModelPtr_ |
| DATurbulenceModel pointer. More... | |
| dimensionedScalar | initialMass_ |
| initial mass More... | |
| scalar | cumulativeContErr_ = 0.0 |
| continuity error More... | |
Protected Attributes inherited from DASolver | |
| char * | argsAll_ |
| all the arguments More... | |
| PyObject * | pyOptions_ |
| all options in DAFoam More... | |
| autoPtr< argList > | argsPtr_ |
| args pointer More... | |
| autoPtr< Time > | runTimePtr_ |
| runTime pointer More... | |
| autoPtr< fvMesh > | meshPtr_ |
| fvMesh pointer More... | |
| autoPtr< DAOption > | daOptionPtr_ |
| DAOption pointer. More... | |
| autoPtr< DAModel > | daModelPtr_ |
| DAModel pointer. More... | |
| autoPtr< DAIndex > | daIndexPtr_ |
| DAIndex pointer. More... | |
| autoPtr< DAField > | daFieldPtr_ |
| DAField pointer. More... | |
| UPtrList< DAFunction > | daFunctionPtrList_ |
| a list of DAFunction pointers More... | |
| UPtrList< DATimeOp > | daTimeOpPtrList_ |
| a list of DATimeOp pointers More... | |
| autoPtr< DACheckMesh > | daCheckMeshPtr_ |
| DACheckMesh object pointer. More... | |
| autoPtr< DALinearEqn > | daLinearEqnPtr_ |
| DALinearEqn pointer. More... | |
| autoPtr< DAResidual > | daResidualPtr_ |
| DAResidual pointer. More... | |
| autoPtr< DAStateInfo > | daStateInfoPtr_ |
| DAStateInfo pointer. More... | |
| autoPtr< DARegression > | daRegressionPtr_ |
| DARegression pointer. More... | |
| autoPtr< DAGlobalVar > | daGlobalVarPtr_ |
| DAGlobalVar pointer. More... | |
| autoPtr< pointField > | points0Ptr_ |
| the initial points for dynamicMesh without volCoord inputs More... | |
| HashTable< wordList > | stateInfo_ |
| the stateInfo_ list from DAStateInfo object More... | |
| scalar | prevPrimalSolTime_ = -1e10 |
| the solution time for the previous primal solution More... | |
| Mat | dRdWTMF_ |
| matrix-free dRdWT matrix used in GMRES solution More... | |
| label | globalADTape4dRdWTInitialized = 0 |
| a flag in dRdWTMatVecMultFunction to determine if the global tap is initialized More... | |
| scalar | primalMinResTol_ = 0.0 |
| primal residual tolerance More... | |
| label | printToScreen_ = 0 |
| whether to print primal information to the screen More... | |
| label | regModelFail_ = 0 |
| whether the regModel compute fails More... | |
| label | printInterval_ = 100 |
| how frequent do you want to print the primal info default is every 100 steps More... | |
| label | primalMinIters_ = -1 |
| primal min number of iterations More... | |
| label | printIntervalUnsteady_ = 1 |
| how frequent do you want to print the primal info default is every 100 steps More... | |
| List< scalarList > | functionTimeSteps_ |
| a list list that saves the function value for all time steps More... | |
| label | primalFinalTimeIndex_ |
| the final time index from the primal solve. for steady state cases it can converge before endTime More... | |
| HashTable< scalar > | initStateVals_ |
| initial values for validateStates More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from DASolver | |
| static autoPtr< DASolver > | New (char *argsAll, PyObject *pyOptions) |
| static PetscErrorCode | dRdWTMatVecMultFunction (Mat dRdWT, Vec vecX, Vec vecY) |
| matrix free matrix-vector product function to compute vecY=dRdWT*vecX More... | |
Protected Member Functions inherited from DASolver | |
| label | isPrintTime (const Time &runTime, const label printInterval) const |
| label | checkPrimalFailure () |
| check whether the primal fails based on residual and regression fail flag More... | |
| void | reduceStateResConLevel (const dictionary &maxResConLv4JacPCMat, HashTable< List< List< word >>> &stateResConInfo) const |
| reduce the connectivity level for Jacobian connectivity mat More... | |
| void | writeAssociatedFields () |
| write associated fields such as relative velocity More... | |
Definition at line 52 of file DARhoSimpleCFoam.H.
| DARhoSimpleCFoam | ( | char * | argsAll, |
| PyObject * | pyOptions | ||
| ) |
Definition at line 41 of file DARhoSimpleCFoam.C.
|
inlinevirtual |
Definition at line 100 of file DARhoSimpleCFoam.H.
| TypeName | ( | "DARhoSimpleCFoam" | ) |
|
virtual |
initialize fields and variables
Implements DASolver.
Definition at line 59 of file DARhoSimpleCFoam.C.
References args, DASolver::argsPtr_, DASolver::daOptionPtr_, DARhoSimpleCFoam::daTurbulenceModelPtr_, mesh, DASolver::meshPtr_, DATurbulenceModel::New(), runTime, and DASolver::runTimePtr_.

|
virtual |
solve the primal equations
Implements DASolver.
Definition at line 90 of file DARhoSimpleCFoam.C.
References DASolver::calcAllFunctions(), DASolver::checkPrimalFailure(), DASolver::daRegressionPtr_, DARhoSimpleCFoam::daTurbulenceModelPtr_, DASolver::loop(), mesh, p, DASolver::printElapsedTime(), DASolver::printToScreen_, DASolver::regModelFail_, rho, and runTime.

|
protected |
simple pointer
Definition at line 58 of file DARhoSimpleCFoam.H.
|
protected |
thermal model
Definition at line 61 of file DARhoSimpleCFoam.H.
|
protected |
pressure field pointer
Definition at line 64 of file DARhoSimpleCFoam.H.
|
protected |
density field pointer
Definition at line 67 of file DARhoSimpleCFoam.H.
|
protected |
velocity field pointer
Definition at line 70 of file DARhoSimpleCFoam.H.
|
protected |
surface flux field pointer
Definition at line 73 of file DARhoSimpleCFoam.H.
|
protected |
pressure control pointer
Definition at line 76 of file DARhoSimpleCFoam.H.
|
protected |
turbulence pointer
Definition at line 79 of file DARhoSimpleCFoam.H.
|
protected |
DATurbulenceModel pointer.
Definition at line 82 of file DARhoSimpleCFoam.H.
Referenced by DARhoSimpleCFoam::initSolver(), and DARhoSimpleCFoam::solvePrimal().
|
protected |
initial mass
Definition at line 85 of file DARhoSimpleCFoam.H.
|
protected |
continuity error
Definition at line 88 of file DARhoSimpleCFoam.H.