Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
DASolver Class Referenceabstract
Inheritance diagram for DASolver:
Inheritance graph
[legend]

Public Member Functions

 TypeName ("DASolver")
 Runtime type information. More...
 
 declareRunTimeSelectionTable (autoPtr, DASolver, dictionary,(char *argsAll, PyObject *pyOptions),(argsAll, pyOptions))
 
 DASolver (char *argsAll, PyObject *pyOptions)
 
virtual ~DASolver ()
 
virtual void initSolver ()=0
 initialize fields and variables More...
 
virtual label solvePrimal (const Vec xvVec, Vec wVec)=0
 solve the primal equations More...
 
virtual label runFPAdj (const Vec xvVec, const Vec wVec, Vec dFdW, Vec psi)
 solve the adjoint equation using the fixed-point iteration method More...
 
void setTimeInstanceField (const label instanceI)
 assign primal variables based on the current time instance More...
 
scalar getTimeInstanceObjFunc (const label instanceI, const word objFuncName)
 return the value of objective function at the given time instance and name More...
 
void setTimeInstanceVar (const word mode, Mat stateMat, Mat stateBCMat, Vec timeVec, Vec timeIdxVec)
 assign the time instance mats to/from the lists in the OpenFOAM layer depending on the mode More...
 
void initOldTimes ()
 initialize the oldTime for all state variables More...
 
void calcdRdWT (const Vec xvVec, const Vec wVec, const label isPC, Mat dRdWT)
 compute dRdWT More...
 
void calcdRdWTPsiAD (const Vec xvVec, const Vec wVec, const Vec psi, Vec dRdWTPsi)
 compute [dRdW]^T*Psi More...
 
void calcdRdWTPsiAD (const label isInit, const Vec psi, Vec dRdWTPsi)
 compute [dRdW]^T*Psi but without updating xvVec and wVec to the OF fields More...
 
void calcdFdW (const Vec xvVec, const Vec wVec, const word objFuncName, Vec dFdW)
 compute dFdW More...
 
void createMLRKSP (const Mat jacMat, const Mat jacPCMat, KSP ksp)
 create a multi-level, Richardson 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 convertMPIVec2SeqVec (const Vec mpiVec, Vec seqVec)
 convert the mpi vec to a seq vec More...
 
void updateOFField (const Vec wVec)
 Update the OpenFOAM field values (including both internal and boundary fields) based on the state vector wVec. More...
 
void updateOFMesh (const Vec xvVec)
 Update the OpenFoam mesh point coordinates based on the point vector xvVec. More...
 
void updateOFField (const scalar *volCoords)
 Update the OpenFOAM field values (including both internal and boundary fields) based on the state array. More...
 
void updateOFMesh (const scalar *states)
 Update the OpenFoam mesh point coordinates based on the volume point coords array. More...
 
void resetOFSeeds ()
 reset the seeds (gradient to zeros) for all OpenFOAM variables More...
 
void calcdRdBC (const Vec xvVec, const Vec wVec, const word designVarName, Mat dRdBC)
 compute dRdBC More...
 
void calcdFdBC (const Vec xvVec, const Vec wVec, const word objFuncName, const word designVarName, Vec dFdBC)
 compute dFdBC More...
 
void calcdRdBCTPsiAD (const Vec xvVec, const Vec wVec, const Vec psi, const word designVarName, Vec dRdBCTPsi)
 compute dRdBCAD More...
 
void calcdFdBCAD (const Vec xvVec, const Vec wVec, const word objFuncName, const word designVarName, Vec dFdBC)
 compute dFdBCAD More...
 
void calcdRdAOA (const Vec xvVec, const Vec wVec, const word designVarName, Mat dRdAOA)
 compute dRdAOA More...
 
void calcdFdAOA (const Vec xvVec, const Vec wVec, const word objFuncName, const word designVarName, Vec dFdAOA)
 compute dFdAOA More...
 
void calcdRdAOATPsiAD (const Vec xvVec, const Vec wVec, const Vec psi, const word designVarName, Vec dRdAOATPsi)
 compute dRdAOAAD More...
 
void calcdRdFFD (const Vec xvVec, const Vec wVec, const word designVarName, Mat dRdFFD)
 compute dRdFFD More...
 
void calcdFdFFD (const Vec xvVec, const Vec wVec, const word objFuncName, const word designVarName, Vec dFdFFD)
 compute dFdFFD More...
 
void calcdRdACT (const Vec xvVec, const Vec wVec, const word designVarName, const word designVarType, Mat dRdACT)
 compute dRdACT More...
 
void calcdFdACT (const Vec xvVec, const Vec wVec, const word objFuncName, const word designVarName, const word designVarType, Vec dFdACT)
 compute dFdACT More...
 
void calcdRdFieldTPsiAD (const Vec xvVec, const Vec wVec, const Vec psi, const word designVarName, Vec dRdFieldTPsi)
 compute dRdField^T*Psi More...
 
void calcdFdFieldAD (const Vec xvVec, const Vec wVec, const word objFuncName, const word designVarName, Vec dFdField)
 compute dFdField More...
 
void createMLRKSPMatrixFree (const Mat jacPCMat, KSP ksp)
 create a multi-level, Richardson KSP object with matrix-free Jacobians More...
 
void calcdFdWAD (const Vec xvVec, const Vec wVec, const word objFuncName, Vec dFdW)
 compute dFdW using AD More...
 
void calcdRdThermalTPsiAD (const double *volCoords, const double *states, const double *thermal, const double *seeds, double *product)
 
void calcdRdXvTPsiAD (const Vec xvVec, const Vec wVec, const Vec psi, Vec dRdXvTPsi)
 compute dRdXv^T*Psi More...
 
void calcdForcedXvAD (const Vec xvVec, const Vec wVec, const Vec fBarVec, Vec dForcedXv)
 compute dForcedXv More...
 
void calcdAcousticsdXvAD (const Vec xvVec, const Vec wVec, const Vec fBarVec, Vec dForcedXv, word varName, word groupName)
 compute dAcoudXv More...
 
void calcdFdXvAD (const Vec xvVec, const Vec wVec, const word objFuncName, const word designVarName, Vec dFdXv)
 compute dFdXv AD More...
 
void calcdRdActTPsiAD (const Vec xvVec, const Vec wVec, const Vec psi, const word designVarName, Vec dRdActTPsi)
 
void calcdForcedWAD (const Vec xvVec, const Vec wVec, const Vec fBarVec, Vec dForcedW)
 
void calcdAcousticsdWAD (const Vec xvVec, const Vec wVec, const Vec fBarVec, Vec dForcedW, word varName, word groupName)
 
void calcdFdACTAD (const Vec xvVec, const Vec wVec, const word objFuncName, const word designVarName, Vec dFdACT)
 compute dFdACT AD More...
 
void calcdRdWOldTPsiAD (const label oldTimeLevel, const Vec psi, Vec dRdWOldTPsi)
 compute dRdWOld^T*Psi 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 (const Vec xvVec, const Vec wVec)
 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 registerFieldVariableInput4AD (const word fieldName, const word fieldType)
 register field variables as the input for reverse-mode AD More...
 
void registerResidualOutput4AD ()
 register all residuals as the output for reverse-mode AD More...
 
void registerForceOutput4AD (List< scalar > &fX, List< scalar > &fY, List< scalar > &fZ)
 register all force as the ouptut for referse-mod AD More...
 
void registerAcousticOutput4AD (List< scalar > &a)
 register acoustic as the ouptut for referse-mod AD More...
 
void assignVec2ResidualGradient (Vec vecX)
 assign the reverse-mode AD input seeds from vecX to the residuals in OpenFOAM More...
 
void assignSeeds2ResidualGradient (const double *seeds)
 assign the reverse-mode AD input seeds from vecX to the residuals in OpenFOAM More...
 
void assignVec2ForceGradient (Vec fBarVec, List< scalar > &fX, List< scalar > &fY, List< scalar > &fZ)
 assign the reverse-mode AD input seeds from fBarVec to the force vectors in OpenFOAM More...
 
void assignVec2AcousticGradient (Vec fBarVec, List< scalar > &a, label offset, label step)
 assign the reverse-mode AD input seeds from fBarVec to the acoustic vectors in OpenFOAM More...
 
void assignStateGradient2Vec (Vec vecY, const label oldTimeLevel=0)
 set the reverse-mode AD derivatives from the state variables in OpenFOAM to vecY More...
 
void assignFieldGradient2Vec (const word fieldName, const word fieldType, Vec vecY)
 set the reverse-mode AD derivatives from the field variables in OpenFOAM to vecY More...
 
void normalizeGradientVec (Vec vecY)
 normalize the reverse-mode AD derivatives stored in vecY More...
 
void initializeGlobalADTape4dRdWT ()
 initialize the CoDiPack reverse-mode AD global tape for computing dRdWT*psi More...
 
label loop (Time &runTime)
 return whether to loop the primal solution, similar to runTime::loop() except we don't do file IO More...
 
label getGlobalXvIndex (const label idxPoint, const label idxCoord) const
 basically, we call DAIndex::getGlobalXvIndex More...
 
void ofField2StateVec (Vec stateVec) const
 set the state vector based on the latest fields in OpenFOAM More...
 
void stateVec2OFField (const Vec stateVec) const
 assign the fields in OpenFOAM based on the state vector More...
 
void pointVec2OFMesh (const Vec xvVec) const
 assign the points in fvMesh of OpenFOAM based on the point vector More...
 
void ofMesh2PointVec (Vec xvVec) const
 assign the point vector based on the points in fvMesh of OpenFOAM More...
 
void resVec2OFResField (const Vec resVec) const
 assign the OpenFOAM residual fields based on the resVec More...
 
void ofResField2ResVec (Vec resVec) const
 assign the resVec based on OpenFOAM residual fields 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 setDAObjFuncList ()
 initialize DASolver::daObjFuncPtrList_ one needs to call this before calling printAllObjFuncs More...
 
void printAllObjFuncs ()
 calculate the values of all objective functions and print them to screen More...
 
label checkMesh () const
 check the mesh quality and return meshOK More...
 
scalar getObjFuncValue (const word objFuncName)
 return the value of the objective function More...
 
void getForces (Vec fX, Vec fY, Vec fZ)
 return the forces of the desired fluid-structure-interaction patches More...
 
void getAcousticData (Vec x, Vec y, Vec z, Vec nX, Vec nY, Vec nZ, Vec a, Vec fX, Vec fY, Vec fZ, word groupName)
 return the positions, normals, areas, and forces of the desired acoustic patches More...
 
void getPatchInfo (label &nPoints, label &nFaces, List< word > &patchList)
 return the number of points and faces for MDO patches More...
 
void getForcesInternal (List< scalar > &fX, List< scalar > &fY, List< scalar > &fZ, List< word > &patchList)
 compute the forces of the desired fluid-structure-interation patches More...
 
label getNCouplingFaces ()
 Get the number of faces for the MDO coupling patches. More...
 
label getNCouplingPoints ()
 Get the number of points for the MDO coupling patches. More...
 
void calcCouplingFaceCoords (const scalar *volCoords, scalar *surfCoords)
 return the face coordinates based on vol coords More...
 
void calcCouplingFaceCoordsAD (const double *volCoords, const double *seeds, double *product)
 calc matrix-vector products for calcCouplingFaceCoords More...
 
void getThermal (const scalar *volCoords, const scalar *states, scalar *thermal)
 compute the temperature on the conjugate heat transfer patches More...
 
void getThermalAD (const word inputName, const double *volCoords, const double *states, const double *seeds, double *product)
 compute the temperature on the conjugate heat transfer patches AD More...
 
void setThermal (scalar *thermal)
 assign temperature values to the conjugate heat transfer patches More...
 
void getAcousticDataInternal (List< scalar > &x, List< scalar > &y, List< scalar > &z, List< scalar > &nX, List< scalar > &nY, List< scalar > &nZ, List< scalar > &a, List< scalar > &fX, List< scalar > &fY, List< scalar > &fZ, List< word > &patchList)
 compute the positions, normals, areas, and forces of the desired acoustic patches More...
 
void calcForceProfile (Vec center, Vec aForceL, Vec tForceL, Vec rDistL)
 calculate the radial profile of the force on the propeller surface More...
 
void calcForceProfileInternal (fvMesh &mesh, const vector &center, scalarList &aForceL, scalarList &tForceL, scalarList &rDistL)
 
void calcdForcedStateTPsiAD (const word mode, Vec xvVec, Vec stateVec, Vec psiVec, Vec prodVec)
 
void calcFvSourceInternal (const word propName, const scalarField &aForce, const scalarField &tForce, const scalarField &rDistList, const scalarList &targetForce, const vector &center, volVectorField &fvSource)
 calculate the fvSource based on the radial force profile More...
 
void calcFvSource (const word propName, Vec aForce, Vec tForce, Vec rDist, Vec targetForce, Vec center, Vec fvSource)
 
void calcdFvSourcedInputsTPsiAD (const word propName, const word mode, Vec aForce, Vec tForce, Vec rDist, Vec targetForce, Vec center, Vec psi, Vec dFvSource)
 
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 setdXvdFFDMat (const Mat dXvdFFDMat)
 set the value for DASolver::dXvdFFDMat_ More...
 
void setFFD2XvSeedVec (Vec vecIn)
 set the value for DASolver::FFD2XvSeedVec_ 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 setFieldValue4GlobalCellI (const word fieldName, const scalar val, const label globalCellI, const label compI=0)
 set the field value More...
 
void setFieldValue4LocalCellI (const word fieldName, const scalar val, const label localCellI, const label compI=0)
 
void updateBoundaryConditions (const word fieldName, const word fieldType)
 update the boundary condition for a field More...
 
void syncDAOptionToActuatorDVs ()
 synchronize the values in DAOption and actuatorDiskDVs_ More...
 
const fvMesh & getMesh ()
 
const Time & getRunTime ()
 return the runTime object More...
 
const DAOptiongetDAOption ()
 get DAOption object More...
 
const DAStateInfogetDAStateInfo ()
 get DAStateInfo object More...
 
const DAIndexgetDAIndex ()
 get DAIndex object More...
 
const DAModelgetDAModel ()
 get DAModel object More...
 
const DAResidualgetDAResidual ()
 get DAResidual object More...
 
const DAFieldgetDAField ()
 get DAField object More...
 
const DALinearEqngetDALinearEqn ()
 get DALinearEqn object More...
 
const DACheckMeshgetDACheckMesh ()
 get DACheckMesh object More...
 
PetscScalar getForwardADDerivVal (const word objFuncName)
 get forwardADDerivVal_ More...
 
void setPrimalBoundaryConditions (const label printInfo=1)
 update the primal state boundary condition based on the primalBC dict More...
 
void calcResidualVec (Vec resVec)
 calculate the residual and assign it to the resVec vector More...
 
void writeFailedMesh ()
 write the failed mesh to disk More...
 
void initTensorFlowFuncs (pyComputeInterface computeInterface, void *compute, pyJacVecProdInterface jacVecProdInterface, void *jacVecProd)
 initialize tensorflow functions and interfaces for callback More...
 

Static Public Member Functions

static autoPtr< DASolverNew (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

template<class classType >
void primalResidualControl (const SolverPerformance< classType > &solverP, const label printToScreen, const label printInterval, const word varName)
 setup maximal residual control and print the residual as needed More...
 
label isPrintTime (const Time &runTime, const label printInterval) const
 
label checkResidualTol ()
 check whether the min residual in primal satisfy the prescribed tolerance 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...
 
void saveTimeInstanceFieldHybrid (label &timeInstanceI)
 save primal variable to time instance list for hybrid adjoint (unsteady) More...
 
void saveTimeInstanceFieldTimeAccurate (label &timeInstanceI)
 save primal variable to time instance list for time accurate adjoint (unsteady) More...
 

Protected Attributes

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< DAOptiondaOptionPtr_
 DAOption pointer. More...
 
autoPtr< DAModeldaModelPtr_
 DAModel pointer. More...
 
autoPtr< DAIndexdaIndexPtr_
 DAIndex pointer. More...
 
autoPtr< DAFielddaFieldPtr_
 DAField pointer. More...
 
UPtrList< DAObjFuncdaObjFuncPtrList_
 a list of DAObjFunc pointers More...
 
autoPtr< DACheckMeshdaCheckMeshPtr_
 DACheckMesh object pointer. More...
 
autoPtr< DALinearEqndaLinearEqnPtr_
 DALinearEqn pointer. More...
 
autoPtr< DAResidualdaResidualPtr_
 DAResidual pointer. More...
 
autoPtr< DAStateInfodaStateInfoPtr_
 DAStateInfo pointer. More...
 
HashTable< wordList > stateInfo_
 the stateInfo_ list from DAStateInfo object More...
 
wordList objFuncNames4Adj_
 the list of objective function names that requires adjoint solution More...
 
dictionary psiVecDict_
 the dictionary of adjoint vector (psi) values for all objectives More...
 
dictionary totalDerivDict_
 the dictionary that stores the total derivatives reduced from processors More...
 
autoPtr< OFstream > objFuncAvgHistFilePtr_
 pointer to the objective function file used in unsteady primal solvers More...
 
label nItersObjFuncAvg_ = -9999
 number of iterations since the start of objFunc averaging More...
 
scalarList avgObjFuncValues_
 the averaged objective function values used in unsteady flow More...
 
Mat dRdWTPC_
 the preconditioner matrix for the adjoint linear equation solution More...
 
label nSolveAdjointCalls_ = 0
 how many times the DASolver::solveAdjoint function is called More...
 
Mat dXvdFFDMat_
 the matrix that stores the partials dXv/dFFD computed from the idwarp and pygeo in the pyDAFoam.py More...
 
Vec FFD2XvSeedVec_
 the vector that stores the AD seeds that propagate from FFD to Xv and will be used in forward mode AD More...
 
HashTable< PetscScalar > forwardADDerivVal_
 the derivative value computed by the forward mode primal solution. More...
 
scalar primalMinRes_ = 1e10
 the maximal residual for primal solution 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...
 
List< List< scalar > > stateAllInstances_
 state variable list for all instances (unsteady) More...
 
List< List< scalar > > stateBoundaryAllInstances_
 state boundary variable list for all instances (unsteady) More...
 
List< dictionary > objFuncsAllInstances_
 objective function for all instances (unsteady) More...
 
List< scalar > runTimeAllInstances_
 the runtime value for all instances (unsteady) More...
 
List< label > runTimeIndexAllInstances_
 the runtime index for all instances (unsteady) More...
 
label nTimeInstances_ = -9999
 number of time instances for hybird adjoint (unsteady) More...
 
scalar periodicity_ = 0.0
 periodicity of oscillating flow variables (unsteady) More...
 
scalar primalMinResTol_ = 0.0
 primal residual tolerance More...
 
label primalMinIters_ = -1
 primal min number of iterations More...
 

Detailed Description

Definition at line 49 of file DASolver.H.

Constructor & Destructor Documentation

◆ DASolver()

DASolver ( char *  argsAll,
PyObject *  pyOptions 
)

◆ ~DASolver()

virtual ~DASolver ( )
inlinevirtual

Definition at line 235 of file DASolver.H.

Member Function Documentation

◆ primalResidualControl()

void primalResidualControl ( const SolverPerformance< classType > &  solverP,
const label  printToScreen,
const label  printInterval,
const word  varName 
)
protected

setup maximal residual control and print the residual as needed

Definition at line 1007 of file DASolver.H.

References DASolver::primalMinRes_.

◆ isPrintTime()

label isPrintTime ( const Time &  runTime,
const label  printInterval 
) const
protected

◆ checkResidualTol()

label checkResidualTol ( )
protected

check whether the min residual in primal satisfy the prescribed tolerance

Definition at line 7432 of file DASolver.C.

References DASolver::daOptionPtr_, and DASolver::primalMinRes_.

Referenced by DATurboFoam::solvePrimal(), DARhoSimpleCFoam::solvePrimal(), DASolidDisplacementFoam::solvePrimal(), DARhoSimpleFoam::solvePrimal(), DASimpleTFoam::solvePrimal(), and DASimpleFoam::solvePrimal().

Here is the caller graph for this function:

◆ reduceStateResConLevel()

void reduceStateResConLevel ( const dictionary &  maxResConLv4JacPCMat,
HashTable< List< List< word >>> &  stateResConInfo 
) const
protected

reduce the connectivity level for Jacobian connectivity mat

Definition at line 2428 of file DASolver.C.

References DASolver::daOptionPtr_, and forAll().

Referenced by DASolver::calcdRdWT().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeAssociatedFields()

void writeAssociatedFields ( )
protected

write associated fields such as relative velocity

Definition at line 7478 of file DASolver.C.

References DASolver::meshPtr_, MRF, DASolver::runTimePtr_, U, and URel.

Referenced by DARhoSimpleFoam::solvePrimal(), and DASimpleFoam::solvePrimal().

Here is the caller graph for this function:

◆ saveTimeInstanceFieldHybrid()

void saveTimeInstanceFieldHybrid ( label &  timeInstanceI)
protected

◆ saveTimeInstanceFieldTimeAccurate()

void saveTimeInstanceFieldTimeAccurate ( label &  timeInstanceI)
protected

◆ TypeName()

TypeName ( "DASolver"  )

Runtime type information.

◆ declareRunTimeSelectionTable()

declareRunTimeSelectionTable ( autoPtr  ,
DASolver  ,
dictionary  ,
(char *argsAll, PyObject *pyOptions)  ,
(argsAll, pyOptions)   
)

◆ New()

autoPtr< DASolver > New ( char *  argsAll,
PyObject *  pyOptions 
)
static

Definition at line 69 of file DASolver.C.

References allOptions, and DAUtility::pyDict2OFDict().

Referenced by DASolvers::DASolvers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initSolver()

virtual void initSolver ( )
pure virtual

◆ solvePrimal()

virtual label solvePrimal ( const Vec  xvVec,
Vec  wVec 
)
pure virtual

◆ runFPAdj()

label runFPAdj ( const Vec  xvVec,
const Vec  wVec,
Vec  dFdW,
Vec  psi 
)
virtual

solve the adjoint equation using the fixed-point iteration method

Reimplemented in DASimpleFoam.

Definition at line 8003 of file DASolver.C.

◆ setTimeInstanceField()

void setTimeInstanceField ( const label  instanceI)

◆ getTimeInstanceObjFunc()

scalar getTimeInstanceObjFunc ( const label  instanceI,
const word  objFuncName 
)

return the value of objective function at the given time instance and name

Definition at line 7970 of file DASolver.C.

References DASolver::objFuncsAllInstances_.

◆ setTimeInstanceVar()

void setTimeInstanceVar ( const word  mode,
Mat  stateMat,
Mat  stateBCMat,
Vec  timeVec,
Vec  timeIdxVec 
)

assign the time instance mats to/from the lists in the OpenFOAM layer depending on the mode

Definition at line 7864 of file DASolver.C.

References assignValueCheckAD, dafoam_plot3dtransform::mode, DASolver::nTimeInstances_, DASolver::runTimeAllInstances_, DASolver::runTimeIndexAllInstances_, DASolver::stateAllInstances_, and DASolver::stateBoundaryAllInstances_.

◆ initOldTimes()

void initOldTimes ( )

initialize the oldTime for all state variables

◆ calcdRdWT()

void calcdRdWT ( const Vec  xvVec,
const Vec  wVec,
const label  isPC,
Mat  dRdWT 
)

◆ calcdRdWTPsiAD() [1/2]

void calcdRdWTPsiAD ( const Vec  xvVec,
const Vec  wVec,
const Vec  psi,
Vec  dRdWTPsi 
)

◆ calcdRdWTPsiAD() [2/2]

void calcdRdWTPsiAD ( const label  isInit,
const Vec  psi,
Vec  dRdWTPsi 
)

compute [dRdW]^T*Psi but without updating xvVec and wVec to the OF fields

Definition at line 6228 of file DASolver.C.

◆ calcdFdW()

void calcdFdW ( const Vec  xvVec,
const Vec  wVec,
const word  objFuncName,
Vec  dFdW 
)

◆ createMLRKSP()

void createMLRKSP ( const Mat  jacMat,
const Mat  jacPCMat,
KSP  ksp 
)

create a multi-level, Richardson KSP object

Definition at line 4675 of file DASolver.C.

References DASolver::daLinearEqnPtr_.

◆ solveLinearEqn()

label solveLinearEqn ( const KSP  ksp,
const Vec  rhsVec,
Vec  solVec 
)

solve the linear equation given a ksp and right-hand-side vector

Definition at line 4709 of file DASolver.C.

References DASolver::daLinearEqnPtr_, and DASolver::globalADTape4dRdWTInitialized.

◆ convertMPIVec2SeqVec()

void convertMPIVec2SeqVec ( const Vec  mpiVec,
Vec  seqVec 
)

convert the mpi vec to a seq vec

Definition at line 7367 of file DASolver.C.

◆ updateOFField() [1/2]

void updateOFField ( const Vec  wVec)

◆ updateOFMesh() [1/2]

void updateOFMesh ( const Vec  xvVec)

◆ updateOFField() [2/2]

void updateOFField ( const scalar *  volCoords)

Update the OpenFOAM field values (including both internal and boundary fields) based on the state array.

Definition at line 4800 of file DASolver.C.

References DASolver::daFieldPtr_, DASolver::daModelPtr_, DASolver::daOptionPtr_, DASolver::daResidualPtr_, and DASolver::setPrimalBoundaryConditions().

Here is the call graph for this function:

◆ updateOFMesh() [2/2]

void updateOFMesh ( const scalar *  states)

Update the OpenFoam mesh point coordinates based on the volume point coords array.

Definition at line 4842 of file DASolver.C.

References DASolver::daFieldPtr_, and DASolver::daOptionPtr_.

◆ resetOFSeeds()

void resetOFSeeds ( )

reset the seeds (gradient to zeros) for all OpenFOAM variables

Definition at line 4738 of file DASolver.C.

References DASolver::daFieldPtr_, DASolver::daModelPtr_, DASolver::daResidualPtr_, and DASolver::setPrimalBoundaryConditions().

Referenced by DASolver::calcCouplingFaceCoordsAD(), DASolver::calcdRdThermalTPsiAD(), and DASolver::getThermalAD().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ calcdRdBC()

void calcdRdBC ( const Vec  xvVec,
const Vec  wVec,
const word  designVarName,
Mat  dRdBC 
)

◆ calcdFdBC()

void calcdFdBC ( const Vec  xvVec,
const Vec  wVec,
const word  objFuncName,
const word  designVarName,
Vec  dFdBC 
)

◆ calcdRdBCTPsiAD()

void calcdRdBCTPsiAD ( const Vec  xvVec,
const Vec  wVec,
const Vec  psi,
const word  designVarName,
Vec  dRdBCTPsi 
)

◆ calcdFdBCAD()

void calcdFdBCAD ( const Vec  xvVec,
const Vec  wVec,
const word  objFuncName,
const word  designVarName,
Vec  dFdBC 
)

◆ calcdRdAOA()

void calcdRdAOA ( const Vec  xvVec,
const Vec  wVec,
const word  designVarName,
Mat  dRdAOA 
)

◆ calcdFdAOA()

void calcdFdAOA ( const Vec  xvVec,
const Vec  wVec,
const word  objFuncName,
const word  designVarName,
Vec  dFdAOA 
)

◆ calcdRdAOATPsiAD()

void calcdRdAOATPsiAD ( const Vec  xvVec,
const Vec  wVec,
const Vec  psi,
const word  designVarName,
Vec  dRdAOATPsi 
)

◆ calcdRdFFD()

void calcdRdFFD ( const Vec  xvVec,
const Vec  wVec,
const word  designVarName,
Mat  dRdFFD 
)

◆ calcdFdFFD()

void calcdFdFFD ( const Vec  xvVec,
const Vec  wVec,
const word  objFuncName,
const word  designVarName,
Vec  dFdFFD 
)

◆ calcdRdACT()

void calcdRdACT ( const Vec  xvVec,
const Vec  wVec,
const word  designVarName,
const word  designVarType,
Mat  dRdACT 
)

◆ calcdFdACT()

void calcdFdACT ( const Vec  xvVec,
const Vec  wVec,
const word  objFuncName,
const word  designVarName,
const word  designVarType,
Vec  dFdACT 
)

◆ calcdRdFieldTPsiAD()

void calcdRdFieldTPsiAD ( const Vec  xvVec,
const Vec  wVec,
const Vec  psi,
const word  designVarName,
Vec  dRdFieldTPsi 
)

◆ calcdFdFieldAD()

void calcdFdFieldAD ( const Vec  xvVec,
const Vec  wVec,
const word  objFuncName,
const word  designVarName,
Vec  dFdField 
)

◆ createMLRKSPMatrixFree()

void createMLRKSPMatrixFree ( const Mat  jacPCMat,
KSP  ksp 
)

create a multi-level, Richardson KSP object with matrix-free Jacobians

Definition at line 4690 of file DASolver.C.

References DASolver::daLinearEqnPtr_, and DASolver::dRdWTMF_.

◆ calcdFdWAD()

void calcdFdWAD ( const Vec  xvVec,
const Vec  wVec,
const word  objFuncName,
Vec  dFdW 
)

◆ calcdRdThermalTPsiAD()

void calcdRdThermalTPsiAD ( const double *  volCoords,
const double *  states,
const double *  thermal,
const double *  seeds,
double *  product 
)

◆ calcdRdXvTPsiAD()

void calcdRdXvTPsiAD ( const Vec  xvVec,
const Vec  wVec,
const Vec  psi,
Vec  dRdXvTPsi 
)

◆ calcdForcedXvAD()

void calcdForcedXvAD ( const Vec  xvVec,
const Vec  wVec,
const Vec  fBarVec,
Vec  dForcedXv 
)

◆ calcdAcousticsdXvAD()

void calcdAcousticsdXvAD ( const Vec  xvVec,
const Vec  wVec,
const Vec  fBarVec,
Vec  dForcedXv,
word  varName,
word  groupName 
)

◆ calcdFdXvAD()

void calcdFdXvAD ( const Vec  xvVec,
const Vec  wVec,
const word  objFuncName,
const word  designVarName,
Vec  dFdXv 
)

◆ calcdRdActTPsiAD()

void calcdRdActTPsiAD ( const Vec  xvVec,
const Vec  wVec,
const Vec  psi,
const word  designVarName,
Vec  dRdActTPsi 
)

◆ calcdForcedWAD()

void calcdForcedWAD ( const Vec  xvVec,
const Vec  wVec,
const Vec  fBarVec,
Vec  dForcedW 
)

◆ calcdAcousticsdWAD()

void calcdAcousticsdWAD ( const Vec  xvVec,
const Vec  wVec,
const Vec  fBarVec,
Vec  dForcedW,
word  varName,
word  groupName 
)

◆ calcdFdACTAD()

void calcdFdACTAD ( const Vec  xvVec,
const Vec  wVec,
const word  objFuncName,
const word  designVarName,
Vec  dFdACT 
)

◆ calcdRdWOldTPsiAD()

void calcdRdWOldTPsiAD ( const label  oldTimeLevel,
const Vec  psi,
Vec  dRdWOldTPsi 
)

◆ getCouplingPatchList()

void getCouplingPatchList ( wordList &  patchList,
word  groupName = "NONE" 
)

return the coupling patch list if any scenario is active on couplingInfo dict otherwise return design surface

Definition at line 488 of file DASolver.C.

References DASolver::daOptionPtr_, and forAll().

Referenced by DASolver::calcCouplingFaceCoords(), DASolver::calcdAcousticsdWAD(), DASolver::calcdAcousticsdXvAD(), DASolver::calcdForcedWAD(), DASolver::calcdForcedXvAD(), DASolver::getAcousticData(), DASolver::getForces(), DASolver::getNCouplingFaces(), DASolver::getNCouplingPoints(), DASolver::getThermal(), and DASolver::setThermal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dRdWTMatVecMultFunction()

PetscErrorCode dRdWTMatVecMultFunction ( Mat  dRdWT,
Vec  vecX,
Vec  vecY 
)
static

matrix free matrix-vector product function to compute vecY=dRdWT*vecX

Definition at line 4906 of file DASolver.C.

Referenced by DASolver::initializedRdWTMatrixFree().

Here is the caller graph for this function:

◆ initializedRdWTMatrixFree()

void initializedRdWTMatrixFree ( const Vec  xvVec,
const Vec  wVec 
)

◆ destroydRdWTMatrixFree()

void destroydRdWTMatrixFree ( )

destroy the matrix free dRdWT

Definition at line 4895 of file DASolver.C.

References DASolver::dRdWTMF_.

◆ registerStateVariableInput4AD()

void registerStateVariableInput4AD ( const label  oldTimeLevel = 0)

register all state variables as the input for reverse-mode AD

Definition at line 6445 of file DASolver.C.

References forAll(), DASolver::meshPtr_, and DASolver::stateInfo_.

Referenced by DASolver::calcdAcousticsdWAD(), DASolver::calcdFdWAD(), DASolver::calcdForcedWAD(), DASolver::calcdRdWOldTPsiAD(), DASolver::calcdRdWTPsiAD(), and DASolver::initializeGlobalADTape4dRdWT().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ registerFieldVariableInput4AD()

void registerFieldVariableInput4AD ( const word  fieldName,
const word  fieldType 
)

register field variables as the input for reverse-mode AD

Definition at line 6602 of file DASolver.C.

References forAll(), and DASolver::meshPtr_.

Referenced by DASolver::calcdFdFieldAD(), and DASolver::calcdRdFieldTPsiAD().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ registerResidualOutput4AD()

void registerResidualOutput4AD ( )

register all residuals as the output for reverse-mode AD

Definition at line 6649 of file DASolver.C.

References forAll(), DASolver::meshPtr_, and DASolver::stateInfo_.

Referenced by DASolver::calcdRdActTPsiAD(), DASolver::calcdRdAOATPsiAD(), DASolver::calcdRdBCTPsiAD(), DASolver::calcdRdFieldTPsiAD(), DASolver::calcdRdThermalTPsiAD(), DASolver::calcdRdWOldTPsiAD(), DASolver::calcdRdWTPsiAD(), DASolver::calcdRdXvTPsiAD(), and DASolver::initializeGlobalADTape4dRdWT().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ registerForceOutput4AD()

void registerForceOutput4AD ( List< scalar > &  fX,
List< scalar > &  fY,
List< scalar > &  fZ 
)

register all force as the ouptut for referse-mod AD

Definition at line 6721 of file DASolver.C.

References forAll().

Referenced by DASolver::calcdForcedWAD(), and DASolver::calcdForcedXvAD().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ registerAcousticOutput4AD()

void registerAcousticOutput4AD ( List< scalar > &  a)

register acoustic as the ouptut for referse-mod AD

Definition at line 6748 of file DASolver.C.

References forAll().

Referenced by DASolver::calcdAcousticsdWAD(), and DASolver::calcdAcousticsdXvAD().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ assignVec2ResidualGradient()

void assignVec2ResidualGradient ( Vec  vecX)

assign the reverse-mode AD input seeds from vecX to the residuals in OpenFOAM

Definition at line 6960 of file DASolver.C.

References DASolver::daIndexPtr_, forAll(), DASolver::meshPtr_, and DASolver::stateInfo_.

Referenced by DASolver::calcdRdActTPsiAD(), DASolver::calcdRdAOATPsiAD(), DASolver::calcdRdBCTPsiAD(), DASolver::calcdRdFieldTPsiAD(), DASolver::calcdRdWOldTPsiAD(), DASolver::calcdRdWTPsiAD(), and DASolver::calcdRdXvTPsiAD().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ assignSeeds2ResidualGradient()

void assignSeeds2ResidualGradient ( const double *  seeds)

assign the reverse-mode AD input seeds from vecX to the residuals in OpenFOAM

Definition at line 6873 of file DASolver.C.

References DASolver::daIndexPtr_, forAll(), DASolver::meshPtr_, and DASolver::stateInfo_.

Referenced by DASolver::calcdRdThermalTPsiAD().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ assignVec2ForceGradient()

void assignVec2ForceGradient ( Vec  fBarVec,
List< scalar > &  fX,
List< scalar > &  fY,
List< scalar > &  fZ 
)

assign the reverse-mode AD input seeds from fBarVec to the force vectors in OpenFOAM

Definition at line 7051 of file DASolver.C.

References forAll().

Referenced by DASolver::calcdForcedWAD(), and DASolver::calcdForcedXvAD().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ assignVec2AcousticGradient()

void assignVec2AcousticGradient ( Vec  fBarVec,
List< scalar > &  a,
label  offset,
label  step 
)

assign the reverse-mode AD input seeds from fBarVec to the acoustic vectors in OpenFOAM

Definition at line 7093 of file DASolver.C.

References forAll().

Referenced by DASolver::calcdAcousticsdWAD(), and DASolver::calcdAcousticsdXvAD().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ assignStateGradient2Vec()

void assignStateGradient2Vec ( Vec  vecY,
const label  oldTimeLevel = 0 
)

set the reverse-mode AD derivatives from the state variables in OpenFOAM to vecY

Definition at line 7129 of file DASolver.C.

References DASolver::daIndexPtr_, forAll(), DASolver::meshPtr_, and DASolver::stateInfo_.

Referenced by DASolver::calcdAcousticsdWAD(), DASolver::calcdFdWAD(), DASolver::calcdForcedWAD(), DASolver::calcdRdWOldTPsiAD(), and DASolver::calcdRdWTPsiAD().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ assignFieldGradient2Vec()

void assignFieldGradient2Vec ( const word  fieldName,
const word  fieldType,
Vec  vecY 
)

set the reverse-mode AD derivatives from the field variables in OpenFOAM to vecY

Definition at line 7311 of file DASolver.C.

References forAll(), and DASolver::meshPtr_.

Referenced by DASolver::calcdFdFieldAD(), and DASolver::calcdRdFieldTPsiAD().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ normalizeGradientVec()

void normalizeGradientVec ( Vec  vecY)

normalize the reverse-mode AD derivatives stored in vecY

Definition at line 6767 of file DASolver.C.

References DASolver::daIndexPtr_, DASolver::daOptionPtr_, forAll(), DASolver::meshPtr_, and DASolver::stateInfo_.

Referenced by DASolver::calcdAcousticsdWAD(), DASolver::calcdFdWAD(), DASolver::calcdForcedWAD(), DASolver::calcdRdWOldTPsiAD(), and DASolver::calcdRdWTPsiAD().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initializeGlobalADTape4dRdWT()

void initializeGlobalADTape4dRdWT ( )

initialize the CoDiPack reverse-mode AD global tape for computing dRdWT*psi

Definition at line 4947 of file DASolver.C.

References DASolver::daModelPtr_, DASolver::daResidualPtr_, DASolver::registerResidualOutput4AD(), and DASolver::registerStateVariableInput4AD().

Here is the call graph for this function:

◆ loop()

label loop ( Time &  runTime)

◆ getGlobalXvIndex()

label getGlobalXvIndex ( const label  idxPoint,
const label  idxCoord 
) const
inline

basically, we call DAIndex::getGlobalXvIndex

Definition at line 588 of file DASolver.H.

References DASolver::daIndexPtr_.

◆ ofField2StateVec()

void ofField2StateVec ( Vec  stateVec) const
inline

◆ stateVec2OFField()

void stateVec2OFField ( const Vec  stateVec) const
inline

assign the fields in OpenFOAM based on the state vector

Definition at line 602 of file DASolver.H.

References DASolver::daFieldPtr_.

◆ pointVec2OFMesh()

void pointVec2OFMesh ( const Vec  xvVec) const
inline

◆ ofMesh2PointVec()

void ofMesh2PointVec ( Vec  xvVec) const
inline

assign the point vector based on the points in fvMesh of OpenFOAM

Definition at line 614 of file DASolver.H.

References DASolver::daFieldPtr_.

◆ resVec2OFResField()

void resVec2OFResField ( const Vec  resVec) const
inline

assign the OpenFOAM residual fields based on the resVec

Definition at line 620 of file DASolver.H.

References DASolver::daFieldPtr_.

◆ ofResField2ResVec()

void ofResField2ResVec ( Vec  resVec) const
inline

assign the resVec based on OpenFOAM residual fields

Definition at line 626 of file DASolver.H.

References DASolver::daFieldPtr_.

◆ writeMatrixBinary()

void writeMatrixBinary ( const Mat  matIn,
const word  prefix 
)
inline

write the matrix in binary format

Definition at line 632 of file DASolver.H.

References DAUtility::writeMatrixBinary().

Here is the call graph for this function:

◆ writeMatrixASCII()

void writeMatrixASCII ( const Mat  matIn,
const word  prefix 
)
inline

write the matrix in ASCII format

Definition at line 640 of file DASolver.H.

References DAUtility::writeMatrixASCII().

Here is the call graph for this function:

◆ readMatrixBinary()

void readMatrixBinary ( Mat  matIn,
const word  prefix 
)
inline

read petsc matrix in binary format

Definition at line 648 of file DASolver.H.

References DAUtility::readMatrixBinary().

Here is the call graph for this function:

◆ writeVectorASCII()

void writeVectorASCII ( const Vec  vecIn,
const word  prefix 
)
inline

write petsc vector in ascii format

Definition at line 656 of file DASolver.H.

References DAUtility::writeVectorASCII().

Here is the call graph for this function:

◆ readVectorBinary()

void readVectorBinary ( Vec  vecIn,
const word  prefix 
)
inline

read petsc vector in binary format

Definition at line 664 of file DASolver.H.

References DAUtility::readVectorBinary().

Here is the call graph for this function:

◆ writeVectorBinary()

void writeVectorBinary ( const Vec  vecIn,
const word  prefix 
)
inline

write petsc vector in binary format

Definition at line 672 of file DASolver.H.

References DAUtility::writeVectorBinary().

Here is the call graph for this function:

◆ getNLocalAdjointStates()

label getNLocalAdjointStates ( ) const
inline

return the number of local adjoint states

Definition at line 680 of file DASolver.H.

References DASolver::daIndexPtr_.

◆ getNLocalAdjointBoundaryStates()

label getNLocalAdjointBoundaryStates ( ) const
inline

return the number of local adjoint boundary states

Definition at line 686 of file DASolver.H.

References DASolver::daIndexPtr_.

◆ getNLocalCells()

label getNLocalCells ( ) const
inline

return the number of local cells

Definition at line 692 of file DASolver.H.

References DASolver::meshPtr_.

◆ getNLocalPoints()

label getNLocalPoints ( ) const
inline

return the number of local points

Definition at line 698 of file DASolver.H.

References DASolver::meshPtr_.

◆ setDAObjFuncList()

void setDAObjFuncList ( )

◆ printAllObjFuncs()

void printAllObjFuncs ( )

◆ checkMesh()

label checkMesh ( ) const
inline

◆ getObjFuncValue()

scalar getObjFuncValue ( const word  objFuncName)

return the value of the objective function

Definition at line 200 of file DASolver.C.

References DASolver::daObjFuncPtrList_, forAll(), DAObjFunc::getObjFuncName(), and DAObjFunc::getObjFuncValue().

Referenced by DASolver::saveTimeInstanceFieldHybrid(), and DASolver::saveTimeInstanceFieldTimeAccurate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getForces()

void getForces ( Vec  fX,
Vec  fY,
Vec  fZ 
)

return the forces of the desired fluid-structure-interaction patches

Definition at line 1042 of file DASolver.C.

References assignValueCheckAD, forAll(), DASolver::getCouplingPatchList(), DASolver::getForcesInternal(), and DASolver::getPatchInfo().

Here is the call graph for this function:

◆ getAcousticData()

void getAcousticData ( Vec  x,
Vec  y,
Vec  z,
Vec  nX,
Vec  nY,
Vec  nZ,
Vec  a,
Vec  fX,
Vec  fY,
Vec  fZ,
word  groupName 
)

return the positions, normals, areas, and forces of the desired acoustic patches

Definition at line 1114 of file DASolver.C.

References assignValueCheckAD, forAll(), DASolver::getAcousticDataInternal(), DASolver::getCouplingPatchList(), and DASolver::getPatchInfo().

Here is the call graph for this function:

◆ getPatchInfo()

void getPatchInfo ( label &  nPoints,
label &  nFaces,
List< word > &  patchList 
)

return the number of points and faces for MDO patches

Definition at line 1251 of file DASolver.C.

References forAll(), and DASolver::meshPtr_.

Referenced by DASolver::calcCouplingFaceCoords(), DASolver::calcdAcousticsdWAD(), DASolver::calcdAcousticsdXvAD(), DASolver::calcdForcedWAD(), DASolver::calcdForcedXvAD(), DASolver::getAcousticData(), DASolver::getForces(), DASolver::getNCouplingFaces(), and DASolver::getNCouplingPoints().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getForcesInternal()

void getForcesInternal ( List< scalar > &  fX,
List< scalar > &  fY,
List< scalar > &  fZ,
List< word > &  patchList 
)

compute the forces of the desired fluid-structure-interation patches

Definition at line 1292 of file DASolver.C.

References DASolver::daModelPtr_, DASolver::daOptionPtr_, DATurbulenceModel::devRhoReff(), forAll(), DASolver::meshPtr_, and p.

Referenced by DASolver::calcdForcedWAD(), DASolver::calcdForcedXvAD(), and DASolver::getForces().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getNCouplingFaces()

label getNCouplingFaces ( )

Get the number of faces for the MDO coupling patches.

Definition at line 332 of file DASolver.C.

References DASolver::getCouplingPatchList(), and DASolver::getPatchInfo().

Referenced by DASolver::calcCouplingFaceCoordsAD(), DASolver::calcdRdThermalTPsiAD(), and DASolver::getThermalAD().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getNCouplingPoints()

label getNCouplingPoints ( )

Get the number of points for the MDO coupling patches.

Definition at line 347 of file DASolver.C.

References DASolver::getCouplingPatchList(), and DASolver::getPatchInfo().

Here is the call graph for this function:

◆ calcCouplingFaceCoords()

void calcCouplingFaceCoords ( const scalar *  volCoords,
scalar *  surfCoords 
)

return the face coordinates based on vol coords

Definition at line 362 of file DASolver.C.

References forAll(), DASolver::getCouplingPatchList(), DASolver::getPatchInfo(), DASolver::meshPtr_, and DASolver::updateOFMesh().

Referenced by DASolver::calcCouplingFaceCoordsAD().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ calcCouplingFaceCoordsAD()

void calcCouplingFaceCoordsAD ( const double *  volCoords,
const double *  seeds,
double *  product 
)

calc matrix-vector products for calcCouplingFaceCoords

Definition at line 421 of file DASolver.C.

References DASolver::calcCouplingFaceCoords(), DASolver::daIndexPtr_, DASolver::getNCouplingFaces(), and DASolver::resetOFSeeds().

Here is the call graph for this function:

◆ getThermal()

void getThermal ( const scalar *  volCoords,
const scalar *  states,
scalar *  thermal 
)

compute the temperature on the conjugate heat transfer patches

Definition at line 731 of file DASolver.C.

References alphaEff(), DATurbulenceModel::alphaEff(), DASolver::daModelPtr_, forAll(), DASolver::getCouplingPatchList(), he, k, DASolver::meshPtr_, T, thermo, DASolver::updateOFField(), and DASolver::updateOFMesh().

Referenced by DASolver::getThermalAD().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getThermalAD()

void getThermalAD ( const word  inputName,
const double *  volCoords,
const double *  states,
const double *  seeds,
double *  product 
)

compute the temperature on the conjugate heat transfer patches AD

Definition at line 896 of file DASolver.C.

References DASolver::daIndexPtr_, DASolver::getNCouplingFaces(), DASolver::getThermal(), and DASolver::resetOFSeeds().

Here is the call graph for this function:

◆ setThermal()

void setThermal ( scalar *  thermal)

assign temperature values to the conjugate heat transfer patches

Definition at line 550 of file DASolver.C.

References alphaEff(), DATurbulenceModel::alphaEff(), DASolver::daModelPtr_, forAll(), DASolver::getCouplingPatchList(), he, k, DASolver::meshPtr_, T, and thermo.

Referenced by DASolver::calcdRdThermalTPsiAD().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAcousticDataInternal()

void getAcousticDataInternal ( List< scalar > &  x,
List< scalar > &  y,
List< scalar > &  z,
List< scalar > &  nX,
List< scalar > &  nY,
List< scalar > &  nZ,
List< scalar > &  a,
List< scalar > &  fX,
List< scalar > &  fY,
List< scalar > &  fZ,
List< word > &  patchList 
)

compute the positions, normals, areas, and forces of the desired acoustic patches

Definition at line 1459 of file DASolver.C.

References DASolver::daModelPtr_, DASolver::daOptionPtr_, DATurbulenceModel::devRhoReff(), forAll(), DASolver::meshPtr_, and p.

Referenced by DASolver::calcdAcousticsdWAD(), DASolver::calcdAcousticsdXvAD(), and DASolver::getAcousticData().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ calcForceProfile()

void calcForceProfile ( Vec  center,
Vec  aForceL,
Vec  tForceL,
Vec  rDistL 
)

calculate the radial profile of the force on the propeller surface

Definition at line 1566 of file DASolver.C.

◆ calcForceProfileInternal()

void calcForceProfileInternal ( fvMesh &  mesh,
const vector &  center,
scalarList &  aForceL,
scalarList &  tForceL,
scalarList &  rDistL 
)

Definition at line 1649 of file DASolver.C.

◆ calcdForcedStateTPsiAD()

void calcdForcedStateTPsiAD ( const word  mode,
Vec  xvVec,
Vec  stateVec,
Vec  psiVec,
Vec  prodVec 
)

Definition at line 1760 of file DASolver.C.

◆ calcFvSourceInternal()

void calcFvSourceInternal ( const word  propName,
const scalarField &  aForce,
const scalarField &  tForce,
const scalarField &  rDistList,
const scalarList &  targetForce,
const vector &  center,
volVectorField &  fvSource 
)

calculate the fvSource based on the radial force profile

Definition at line 1769 of file DASolver.C.

References dafoam_plot3dtransform::axis, DASolver::daOptionPtr_, forAll(), fvSource, mesh, DASolver::meshPtr_, and mu.

Referenced by DASolver::calcdFvSourcedInputsTPsiAD(), and DASolver::calcFvSource().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ calcFvSource()

void calcFvSource ( const word  propName,
Vec  aForce,
Vec  tForce,
Vec  rDist,
Vec  targetForce,
Vec  center,
Vec  fvSource 
)

Definition at line 2129 of file DASolver.C.

References assignValueCheckAD, DASolver::calcFvSourceInternal(), DASolver::daOptionPtr_, forAll(), fvSource, and DASolver::meshPtr_.

Here is the call graph for this function:

◆ calcdFvSourcedInputsTPsiAD()

void calcdFvSourcedInputsTPsiAD ( const word  propName,
const word  mode,
Vec  aForce,
Vec  tForce,
Vec  rDist,
Vec  targetForce,
Vec  center,
Vec  psi,
Vec  dFvSource 
)

Definition at line 2231 of file DASolver.C.

References DASolver::calcFvSourceInternal(), DASolver::daOptionPtr_, forAll(), DASolver::meshPtr_, dafoam_plot3dtransform::mode, and psi.

Here is the call graph for this function:

◆ printAllOptions()

void printAllOptions ( )
inline

print all DAOption

Definition at line 851 of file DASolver.H.

References DASolver::daOptionPtr_.

◆ calcPrimalResidualStatistics()

void calcPrimalResidualStatistics ( const word  mode,
const label  writeRes = 0 
)

◆ setdXvdFFDMat()

void setdXvdFFDMat ( const Mat  dXvdFFDMat)

set the value for DASolver::dXvdFFDMat_

Definition at line 7407 of file DASolver.C.

References DASolver::dXvdFFDMat_.

Referenced by PYDAFOAM::solveAdjoint().

Here is the caller graph for this function:

◆ setFFD2XvSeedVec()

void setFFD2XvSeedVec ( Vec  vecIn)

set the value for DASolver::FFD2XvSeedVec_

Definition at line 7419 of file DASolver.C.

References DASolver::FFD2XvSeedVec_.

◆ updateDAOption()

void updateDAOption ( PyObject *  pyOptions)
inline

update the allOptions_ dict in DAOption based on the pyOptions from pyDAFoam

Definition at line 869 of file DASolver.H.

References DASolver::daOptionPtr_.

Referenced by PYDAFOAM::solveAdjoint().

Here is the caller graph for this function:

◆ getPrevPrimalSolTime()

scalar getPrevPrimalSolTime ( )
inline

get the solution time folder for previous primal solution

Definition at line 875 of file DASolver.H.

References DASolver::prevPrimalSolTime_.

◆ setFieldValue4GlobalCellI()

void setFieldValue4GlobalCellI ( const word  fieldName,
const scalar  val,
const label  globalCellI,
const label  compI = 0 
)

set the field value

Definition at line 7550 of file DASolver.C.

References DASolver::daIndexPtr_, and DASolver::meshPtr_.

◆ setFieldValue4LocalCellI()

void setFieldValue4LocalCellI ( const word  fieldName,
const scalar  val,
const label  localCellI,
const label  compI = 0 
)

Definition at line 7511 of file DASolver.C.

References DASolver::meshPtr_.

◆ updateBoundaryConditions()

void updateBoundaryConditions ( const word  fieldName,
const word  fieldType 
)

update the boundary condition for a field

Definition at line 7694 of file DASolver.C.

References DASolver::meshPtr_.

Referenced by DASolver::calcdFdFieldAD(), and DASolver::calcdRdFieldTPsiAD().

Here is the caller graph for this function:

◆ syncDAOptionToActuatorDVs()

void syncDAOptionToActuatorDVs ( )
inline

synchronize the values in DAOption and actuatorDiskDVs_

Definition at line 899 of file DASolver.H.

References fvSource, and DASolver::meshPtr_.

Referenced by PYDAFOAM::updateDAOption().

Here is the caller graph for this function:

◆ getMesh()

const fvMesh& getMesh ( )
inline

Accessing members return the mesh object

Definition at line 908 of file DASolver.H.

References DASolver::meshPtr_.

◆ getRunTime()

const Time& getRunTime ( )
inline

return the runTime object

Definition at line 914 of file DASolver.H.

References DASolver::runTimePtr_.

◆ getDAOption()

const DAOption& getDAOption ( )
inline

get DAOption object

Definition at line 920 of file DASolver.H.

References DASolver::daOptionPtr_.

◆ getDAStateInfo()

const DAStateInfo& getDAStateInfo ( )
inline

get DAStateInfo object

Definition at line 926 of file DASolver.H.

References DASolver::daStateInfoPtr_.

◆ getDAIndex()

const DAIndex& getDAIndex ( )
inline

get DAIndex object

Definition at line 932 of file DASolver.H.

References DASolver::daIndexPtr_.

◆ getDAModel()

const DAModel& getDAModel ( )
inline

get DAModel object

Definition at line 938 of file DASolver.H.

References DASolver::daModelPtr_.

◆ getDAResidual()

const DAResidual& getDAResidual ( )
inline

get DAResidual object

Definition at line 944 of file DASolver.H.

References DASolver::daResidualPtr_.

◆ getDAField()

const DAField& getDAField ( )
inline

get DAField object

Definition at line 950 of file DASolver.H.

References DASolver::daFieldPtr_.

◆ getDALinearEqn()

const DALinearEqn& getDALinearEqn ( )
inline

get DALinearEqn object

Definition at line 956 of file DASolver.H.

References DASolver::daLinearEqnPtr_.

◆ getDACheckMesh()

const DACheckMesh& getDACheckMesh ( )
inline

get DACheckMesh object

Definition at line 962 of file DASolver.H.

References DASolver::daCheckMeshPtr_.

◆ getForwardADDerivVal()

PetscScalar getForwardADDerivVal ( const word  objFuncName)
inline

get forwardADDerivVal_

Definition at line 968 of file DASolver.H.

References DASolver::forwardADDerivVal_.

◆ setPrimalBoundaryConditions()

void setPrimalBoundaryConditions ( const label  printInfo = 1)

update the primal state boundary condition based on the primalBC dict

Definition at line 7982 of file DASolver.C.

References DASolver::daFieldPtr_, and DASolver::daOptionPtr_.

Referenced by DASolver::resetOFSeeds(), and DASolver::updateOFField().

Here is the caller graph for this function:

◆ calcResidualVec()

void calcResidualVec ( Vec  resVec)

calculate the residual and assign it to the resVec vector

Definition at line 7601 of file DASolver.C.

References assignValueCheckAD, DASolver::daIndexPtr_, DASolver::daModelPtr_, DASolver::daResidualPtr_, forAll(), DASolver::meshPtr_, and DASolver::stateInfo_.

Here is the call graph for this function:

◆ writeFailedMesh()

void writeFailedMesh ( )

◆ initTensorFlowFuncs()

void initTensorFlowFuncs ( pyComputeInterface  computeInterface,
void *  compute,
pyJacVecProdInterface  jacVecProdInterface,
void *  jacVecProd 
)
inline

initialize tensorflow functions and interfaces for callback

Definition at line 983 of file DASolver.H.

References DAUtility::pyCalcBeta, DAUtility::pyCalcBetaInterface, DAUtility::pyCalcBetaJacVecProd, and DAUtility::pyCalcBetaJacVecProdInterface.

Member Data Documentation

◆ argsAll_

char* argsAll_
protected

all the arguments

Definition at line 61 of file DASolver.H.

◆ pyOptions_

PyObject* pyOptions_
protected

all options in DAFoam

Definition at line 64 of file DASolver.H.

Referenced by DASolver::DASolver(), and DAPimpleDyMFoam::initSolver().

◆ argsPtr_

autoPtr<argList> argsPtr_
protected

◆ runTimePtr_

autoPtr<Time> runTimePtr_
protected

◆ meshPtr_

autoPtr<fvMesh> meshPtr_
protected

fvMesh pointer

Definition at line 73 of file DASolver.H.

Referenced by DASolver::assignFieldGradient2Vec(), DASolver::assignSeeds2ResidualGradient(), DASolver::assignStateGradient2Vec(), DASolver::assignVec2ResidualGradient(), DASimpleFoam::calcAdjointResidual(), DASolver::calcCouplingFaceCoords(), DASolver::calcdAcousticsdXvAD(), DASolver::calcdFdACT(), DASolver::calcdFdACTAD(), DASolver::calcdFdAOA(), DASolver::calcdFdBC(), DASolver::calcdFdBCAD(), DASolver::calcdFdFFD(), DASolver::calcdFdFieldAD(), DASolver::calcdFdW(), DASolver::calcdFdWAD(), DASolver::calcdFdXvAD(), DASolver::calcdForcedXvAD(), DASolver::calcdFvSourcedInputsTPsiAD(), DASolver::calcdRdACT(), DASolver::calcdRdActTPsiAD(), DASolver::calcdRdAOA(), DASolver::calcdRdAOATPsiAD(), DASolver::calcdRdBC(), DASolver::calcdRdBCTPsiAD(), DASolver::calcdRdFFD(), DASolver::calcdRdWT(), DASolver::calcdRdXvTPsiAD(), DASolver::calcFvSource(), DASolver::calcFvSourceInternal(), DASimpleFoam::calcLduResiduals(), DASolver::calcPrimalResidualStatistics(), DASolver::calcResidualVec(), DASimpleFoam::DASimpleFoam(), DASolver::DASolver(), DASolver::getAcousticDataInternal(), DASolver::getForcesInternal(), DASolver::getMesh(), DASolver::getNLocalCells(), DASolver::getNLocalPoints(), DASolver::getPatchInfo(), DASolver::getThermal(), DAHeatTransferFoam::initSolver(), DALaplacianFoam::initSolver(), DAPimpleDyMFoam::initSolver(), DAScalarTransportFoam::initSolver(), DATurboFoam::initSolver(), DARhoSimpleCFoam::initSolver(), DASolidDisplacementFoam::initSolver(), DAPisoFoam::initSolver(), DAPimpleFoam::initSolver(), DARhoSimpleFoam::initSolver(), DASimpleTFoam::initSolver(), DASimpleFoam::initSolver(), DASimpleFoam::L2norm(), DASolver::normalizeGradientVec(), DASolver::registerFieldVariableInput4AD(), DASolver::registerResidualOutput4AD(), DASolver::registerStateVariableInput4AD(), DASimpleFoam::runFPAdj(), DASolver::setDAObjFuncList(), DASolver::setFieldValue4GlobalCellI(), DASolver::setFieldValue4LocalCellI(), DASolver::setThermal(), DASolver::syncDAOptionToActuatorDVs(), DASolver::updateBoundaryConditions(), DASimpleFoam::vec2Fields(), and DASolver::writeAssociatedFields().

◆ daOptionPtr_

autoPtr<DAOption> daOptionPtr_
protected

DAOption pointer.

Definition at line 76 of file DASolver.H.

Referenced by DASolver::calcdFdACT(), DASolver::calcdFdACTAD(), DASolver::calcdFdAOA(), DASolver::calcdFdBC(), DASolver::calcdFdBCAD(), DASolver::calcdFdFFD(), DASolver::calcdFdFieldAD(), DASolver::calcdFdW(), DASolver::calcdFdWAD(), DASolver::calcdFdXvAD(), DASolver::calcdFvSourcedInputsTPsiAD(), DASolver::calcdRdACT(), DASolver::calcdRdActTPsiAD(), DASolver::calcdRdAOA(), DASolver::calcdRdAOATPsiAD(), DASolver::calcdRdBC(), DASolver::calcdRdBCTPsiAD(), DASolver::calcdRdFFD(), DASolver::calcdRdFieldTPsiAD(), DASolver::calcdRdWOldTPsiAD(), DASolver::calcdRdWT(), DASolver::calcdRdWTPsiAD(), DASolver::calcFvSource(), DASolver::calcFvSourceInternal(), DASolver::checkResidualTol(), DASolver::DASolver(), DASolver::getAcousticDataInternal(), DASolver::getCouplingPatchList(), DASolver::getDAOption(), DASolver::getForcesInternal(), DASolver::initializedRdWTMatrixFree(), DAHeatTransferFoam::initSolver(), DALaplacianFoam::initSolver(), DAPimpleDyMFoam::initSolver(), DAScalarTransportFoam::initSolver(), DATurboFoam::initSolver(), DARhoSimpleCFoam::initSolver(), DASolidDisplacementFoam::initSolver(), DAPisoFoam::initSolver(), DAPimpleFoam::initSolver(), DARhoSimpleFoam::initSolver(), DASimpleTFoam::initSolver(), DASimpleFoam::initSolver(), DASolver::normalizeGradientVec(), DASolver::printAllObjFuncs(), DASolver::printAllOptions(), DASolver::reduceStateResConLevel(), DASimpleFoam::runFPAdj(), DASolver::saveTimeInstanceFieldHybrid(), DASolver::saveTimeInstanceFieldTimeAccurate(), DASolver::setDAObjFuncList(), DASolver::setPrimalBoundaryConditions(), DASolver::setTimeInstanceField(), DAHeatTransferFoam::solvePrimal(), DALaplacianFoam::solvePrimal(), DAPimpleDyMFoam::solvePrimal(), DAScalarTransportFoam::solvePrimal(), DATurboFoam::solvePrimal(), DARhoSimpleCFoam::solvePrimal(), DASolidDisplacementFoam::solvePrimal(), DAPimpleFoam::solvePrimal(), DAPisoFoam::solvePrimal(), DARhoSimpleFoam::solvePrimal(), DASimpleTFoam::solvePrimal(), DASimpleFoam::solvePrimal(), DASolver::updateDAOption(), DASolver::updateOFField(), DASolver::updateOFMesh(), and DASolver::writeFailedMesh().

◆ daModelPtr_

autoPtr<DAModel> daModelPtr_
protected

◆ daIndexPtr_

autoPtr<DAIndex> daIndexPtr_
protected

◆ daFieldPtr_

autoPtr<DAField> daFieldPtr_
protected

◆ daObjFuncPtrList_

UPtrList<DAObjFunc> daObjFuncPtrList_
protected

a list of DAObjFunc pointers

Definition at line 88 of file DASolver.H.

Referenced by DASolver::getObjFuncValue(), DASolver::printAllObjFuncs(), and DASolver::setDAObjFuncList().

◆ daCheckMeshPtr_

autoPtr<DACheckMesh> daCheckMeshPtr_
protected

◆ daLinearEqnPtr_

autoPtr<DALinearEqn> daLinearEqnPtr_
protected

◆ daResidualPtr_

autoPtr<DAResidual> daResidualPtr_
protected

◆ daStateInfoPtr_

autoPtr<DAStateInfo> daStateInfoPtr_
protected

DAStateInfo pointer.

Definition at line 100 of file DASolver.H.

Referenced by DASolver::calcdRdWT(), and DASolver::getDAStateInfo().

◆ stateInfo_

HashTable<wordList> stateInfo_
protected

◆ objFuncNames4Adj_

wordList objFuncNames4Adj_
protected

the list of objective function names that requires adjoint solution

Definition at line 106 of file DASolver.H.

◆ psiVecDict_

dictionary psiVecDict_
protected

the dictionary of adjoint vector (psi) values for all objectives

Definition at line 109 of file DASolver.H.

◆ totalDerivDict_

dictionary totalDerivDict_
protected

the dictionary that stores the total derivatives reduced from processors

Definition at line 112 of file DASolver.H.

◆ objFuncAvgHistFilePtr_

autoPtr<OFstream> objFuncAvgHistFilePtr_
protected

pointer to the objective function file used in unsteady primal solvers

Definition at line 115 of file DASolver.H.

◆ nItersObjFuncAvg_

label nItersObjFuncAvg_ = -9999
protected

number of iterations since the start of objFunc averaging

Definition at line 118 of file DASolver.H.

◆ avgObjFuncValues_

scalarList avgObjFuncValues_
protected

the averaged objective function values used in unsteady flow

Definition at line 121 of file DASolver.H.

◆ dRdWTPC_

Mat dRdWTPC_
protected

the preconditioner matrix for the adjoint linear equation solution

Definition at line 124 of file DASolver.H.

◆ nSolveAdjointCalls_

label nSolveAdjointCalls_ = 0
protected

how many times the DASolver::solveAdjoint function is called

Definition at line 127 of file DASolver.H.

◆ dXvdFFDMat_

Mat dXvdFFDMat_
protected

the matrix that stores the partials dXv/dFFD computed from the idwarp and pygeo in the pyDAFoam.py

Definition at line 130 of file DASolver.H.

Referenced by DASolver::calcdFdFFD(), DASolver::calcdRdFFD(), and DASolver::setdXvdFFDMat().

◆ FFD2XvSeedVec_

Vec FFD2XvSeedVec_
protected

the vector that stores the AD seeds that propagate from FFD to Xv and will be used in forward mode AD

Definition at line 133 of file DASolver.H.

Referenced by DASolver::setFFD2XvSeedVec().

◆ forwardADDerivVal_

HashTable<PetscScalar> forwardADDerivVal_
protected

the derivative value computed by the forward mode primal solution.

Definition at line 136 of file DASolver.H.

Referenced by DASolver::getForwardADDerivVal(), and DASolver::printAllObjFuncs().

◆ primalMinRes_

scalar primalMinRes_ = 1e10
protected

◆ prevPrimalSolTime_

scalar prevPrimalSolTime_ = -1e10
protected

the solution time for the previous primal solution

Definition at line 142 of file DASolver.H.

Referenced by DASolver::getPrevPrimalSolTime(), and DASolver::loop().

◆ dRdWTMF_

Mat dRdWTMF_
protected

matrix-free dRdWT matrix used in GMRES solution

Definition at line 168 of file DASolver.H.

Referenced by DASolver::createMLRKSPMatrixFree(), DASolver::destroydRdWTMatrixFree(), and DASolver::initializedRdWTMatrixFree().

◆ globalADTape4dRdWTInitialized

label globalADTape4dRdWTInitialized = 0
protected

a flag in dRdWTMatVecMultFunction to determine if the global tap is initialized

Definition at line 171 of file DASolver.H.

Referenced by DASolver::solveLinearEqn().

◆ stateAllInstances_

List<List<scalar> > stateAllInstances_
protected

◆ stateBoundaryAllInstances_

List<List<scalar> > stateBoundaryAllInstances_
protected

◆ objFuncsAllInstances_

List<dictionary> objFuncsAllInstances_
protected

◆ runTimeAllInstances_

List<scalar> runTimeAllInstances_
protected

◆ runTimeIndexAllInstances_

List<label> runTimeIndexAllInstances_
protected

◆ nTimeInstances_

label nTimeInstances_ = -9999
protected

◆ periodicity_

scalar periodicity_ = 0.0
protected

periodicity of oscillating flow variables (unsteady)

Definition at line 192 of file DASolver.H.

Referenced by DALaplacianFoam::initSolver(), DAScalarTransportFoam::initSolver(), DAPimpleFoam::initSolver(), DAPisoFoam::initSolver(), and DASolver::saveTimeInstanceFieldHybrid().

◆ primalMinResTol_

scalar primalMinResTol_ = 0.0
protected

primal residual tolerance

Definition at line 195 of file DASolver.H.

Referenced by DASolver::DASolver(), and DASolver::loop().

◆ primalMinIters_

label primalMinIters_ = -1
protected

primal min number of iterations

Definition at line 198 of file DASolver.H.

Referenced by DASolver::DASolver(), and DASolver::loop().


The documentation for this class was generated from the following files: