Public Member Functions | List of all members
DASolvers Class Reference

Public Member Functions

 DASolvers (char *argsAll, PyObject *pyOptions)
 Construct from components. More...
 
virtual ~DASolvers ()
 Destructor. More...
 
void initSolver ()
 initialize fields and variables More...
 
label solvePrimal ()
 solve the primal equations More...
 
label getInputSize (const word inputName, const word inputType)
 
label getOutputSize (const word outputName, const word outputType)
 
void calcOutput (const word outputName, const word outputType, double *output)
 
label getInputDistributed (const word inputName, const word inputType)
 
label getOutputDistributed (const word outputName, const word outputType)
 
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 runColoring ()
 run the coloring solver More...
 
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...
 
void createMLRKSPMatrixFree (const Mat jacPCMat, KSP ksp)
 create a multi-level, Richardson KSP object with matrix-free Jacobians More...
 
void initializedRdWTMatrixFree ()
 initialize matrix free dRdWT More...
 
void destroydRdWTMatrixFree ()
 destroy matrix free dRdWT More...
 
label solveLinearEqn (const KSP ksp, const Vec rhsVec, Vec solVec)
 solve the linear equation More...
 
void calcdRdWOldTPsiAD (const label oldTimeLevel, const double *psi, double *dRdWOldTPsi)
 compute dRdWOld^T*Psi More...
 
void updateOFFields (const double *states)
 Update the OpenFOAM field values (including both internal and boundary fields) based on the states array. More...
 
void getOFMeshPoints (double *points)
 get the flatten mesh points coordinates More...
 
void getOFFields (double *states)
 Assign the OpenFOAM field values to the states array. More...
 
void getOFField (const word fieldName, const word fieldType, double *field)
 get a field variable from OF layer More...
 
void updateOFMesh (const double *volCoords)
 Update the OpenFoam mesh point coordinates based on the point vector xvVec. More...
 
label getGlobalXvIndex (const label idxPoint, const label idxCoord) const
 basically, we call DAIndex::getGlobalXvIndex More...
 
label checkMesh () const
 basically, we call DASolver::checkMesh More...
 
label getNLocalPoints () const
 
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...
 
double getTimeOpFuncVal (const word functionName)
 return the value of objective based on timeOp More...
 
double getdFScaling (const word functionName, const label timeIdx)
 get the scaling factor for dF/d? computation More...
 
void calcCouplingFaceCoords (const double *volCoords, double *surfCoords)
 
double getElapsedClockTime ()
 return the elapsed clock time for testing speed More...
 
double getElapsedCpuTime ()
 return the elapsed CPU time for testing speed More...
 
label getNRegressionParameters (word modelName)
 get the number of regression model parameters More...
 
void printAllOptions ()
 call DASolver::printAllOptions More...
 
label hasVolCoordInput ()
 whether the volCoord input is defined More...
 
void updateDAOption (PyObject *pyOptions)
 update the allOptions_ dict in DAOption based on the pyOptions from pyDAFoam More...
 
double getPrevPrimalSolTime ()
 get the solution time folder for previous primal solution More...
 
void writeFailedMesh ()
 
void readStateVars (scalar timeVal, label timeLevel=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)
 calculate the PC mat using fvMatrix More...
 
void setTime (scalar time, label timeIndex)
 setTime for OF fields More...
 
label getDdtSchemeOrder ()
 get the ddtScheme order More...
 
double getEndTime ()
 return the endTime More...
 
double getDeltaT ()
 return the deltaT 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 calcPrimalResidualStatistics (const word mode)
 Calculate the mean, max, and norm2 for all residuals and print it to screen. More...
 
void setPrimalBoundaryConditions (const label printInfo=1)
 
label runFPAdj (Vec dFdW, Vec psi)
 
label solveAdjointFP (Vec dFdW, Vec psi)
 
void initTensorFlowFuncs (pyComputeInterface computeInterface, void *compute, pyJacVecProdInterface jacVecProdInterface, void *jacVecProd, pySetCharInterface setModelNameInterface, void *setModelName)
 initialize the call back function pointer More...
 
void writeAdjointFields (const word function, const double writeTime, const double *psi)
 write the adjoint variables for all 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...
 
double getLatestTime ()
 get the latest solution time More...
 
void meanStatesToStates ()
 assign the mean states values to states More...
 
void updateInputFieldUnsteady ()
 assign the inputFieldUnsteady values to the OF field vars More...
 

Detailed Description

Definition at line 27 of file DASolvers.H.

Constructor & Destructor Documentation

◆ DASolvers()

DASolvers ( char *  argsAll,
PyObject *  pyOptions 
)

Construct from components.

Definition at line 15 of file DASolvers.C.

References DASolver::New().

Here is the call graph for this function:

◆ ~DASolvers()

~DASolvers ( )
virtual

Destructor.

Definition at line 25 of file DASolvers.C.

Member Function Documentation

◆ initSolver()

void initSolver ( )
inline

initialize fields and variables

Definition at line 58 of file DASolvers.H.

◆ solvePrimal()

label solvePrimal ( )
inline

solve the primal equations

Definition at line 64 of file DASolvers.H.

◆ getInputSize()

label getInputSize ( const word  inputName,
const word  inputType 
)
inline

Definition at line 69 of file DASolvers.H.

◆ getOutputSize()

label getOutputSize ( const word  outputName,
const word  outputType 
)
inline

Definition at line 76 of file DASolvers.H.

◆ calcOutput()

void calcOutput ( const word  outputName,
const word  outputType,
double *  output 
)
inline

Definition at line 83 of file DASolvers.H.

◆ getInputDistributed()

label getInputDistributed ( const word  inputName,
const word  inputType 
)
inline

Definition at line 91 of file DASolvers.H.

◆ getOutputDistributed()

label getOutputDistributed ( const word  outputName,
const word  outputType 
)
inline

Definition at line 98 of file DASolvers.H.

◆ calcJacTVecProduct()

void calcJacTVecProduct ( const word  inputName,
const word  inputType,
const double *  input,
const word  outputName,
const word  outputType,
const double *  seed,
double *  product 
)
inline

calculate the Jacobian-matrix-transposed and vector product for product = [dOutput/dInput]^T * seed

Definition at line 106 of file DASolvers.H.

◆ setSolverInput()

void setSolverInput ( const word  inputName,
const word  inputType,
const int  inputSize,
const double *  input,
const double *  seed 
)
inline

Definition at line 125 of file DASolvers.H.

◆ runColoring()

void runColoring ( )
inline

run the coloring solver

Definition at line 141 of file DASolvers.H.

◆ calcdRdWT()

void calcdRdWT ( const label  isPC,
Mat  dRdWT 
)
inline

compute dRdWT

Definition at line 147 of file DASolvers.H.

◆ updateKSPPCMat()

void updateKSPPCMat ( Mat  PCMat,
KSP  ksp 
)
inline

Update the preconditioner matrix for the ksp object.

Definition at line 155 of file DASolvers.H.

◆ createMLRKSPMatrixFree()

void createMLRKSPMatrixFree ( const Mat  jacPCMat,
KSP  ksp 
)
inline

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

Definition at line 163 of file DASolvers.H.

◆ initializedRdWTMatrixFree()

void initializedRdWTMatrixFree ( )
inline

initialize matrix free dRdWT

Definition at line 171 of file DASolvers.H.

◆ destroydRdWTMatrixFree()

void destroydRdWTMatrixFree ( )
inline

destroy matrix free dRdWT

Definition at line 177 of file DASolvers.H.

◆ solveLinearEqn()

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

solve the linear equation

Definition at line 183 of file DASolvers.H.

◆ calcdRdWOldTPsiAD()

void calcdRdWOldTPsiAD ( const label  oldTimeLevel,
const double *  psi,
double *  dRdWOldTPsi 
)
inline

compute dRdWOld^T*Psi

Definition at line 192 of file DASolvers.H.

References psi.

◆ updateOFFields()

void updateOFFields ( const double *  states)
inline

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

Definition at line 201 of file DASolvers.H.

References DASolvers::getNLocalAdjointStates().

Here is the call graph for this function:

◆ getOFMeshPoints()

void getOFMeshPoints ( double *  points)
inline

get the flatten mesh points coordinates

Definition at line 218 of file DASolvers.H.

◆ getOFFields()

void getOFFields ( double *  states)
inline

Assign the OpenFOAM field values to the states array.

Definition at line 224 of file DASolvers.H.

References DASolvers::getNLocalAdjointStates().

Here is the call graph for this function:

◆ getOFField()

void getOFField ( const word  fieldName,
const word  fieldType,
double *  field 
)
inline

get a field variable from OF layer

Definition at line 241 of file DASolvers.H.

◆ updateOFMesh()

void updateOFMesh ( const double *  volCoords)
inline

Update the OpenFoam mesh point coordinates based on the point vector xvVec.

Definition at line 250 of file DASolvers.H.

References DASolvers::getNLocalPoints().

Here is the call graph for this function:

◆ getGlobalXvIndex()

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

basically, we call DAIndex::getGlobalXvIndex

Definition at line 267 of file DASolvers.H.

◆ checkMesh()

label checkMesh ( ) const
inline

basically, we call DASolver::checkMesh

Definition at line 275 of file DASolvers.H.

◆ getNLocalPoints()

label getNLocalPoints ( ) const
inline

Definition at line 281 of file DASolvers.H.

Referenced by DASolvers::updateOFMesh().

Here is the caller graph for this function:

◆ getNLocalAdjointStates()

label getNLocalAdjointStates ( ) const
inline

return the number of local adjoint states

Definition at line 287 of file DASolvers.H.

Referenced by DASolvers::getOFFields(), and DASolvers::updateOFFields().

Here is the caller graph for this function:

◆ getNLocalAdjointBoundaryStates()

label getNLocalAdjointBoundaryStates ( ) const
inline

return the number of local adjoint boundary states

Definition at line 293 of file DASolvers.H.

◆ getNLocalCells()

label getNLocalCells ( ) const
inline

return the number of local cells

Definition at line 299 of file DASolvers.H.

◆ getTimeOpFuncVal()

double getTimeOpFuncVal ( const word  functionName)
inline

return the value of objective based on timeOp

Definition at line 305 of file DASolvers.H.

◆ getdFScaling()

double getdFScaling ( const word  functionName,
const label  timeIdx 
)
inline

get the scaling factor for dF/d? computation

Definition at line 311 of file DASolvers.H.

References assignValueCheckAD.

◆ calcCouplingFaceCoords()

void calcCouplingFaceCoords ( const double *  volCoords,
double *  surfCoords 
)
inline

Definition at line 318 of file DASolvers.H.

◆ getElapsedClockTime()

double getElapsedClockTime ( )
inline

return the elapsed clock time for testing speed

Definition at line 331 of file DASolvers.H.

References assignValueCheckAD.

◆ getElapsedCpuTime()

double getElapsedCpuTime ( )
inline

return the elapsed CPU time for testing speed

Definition at line 339 of file DASolvers.H.

References assignValueCheckAD.

◆ getNRegressionParameters()

label getNRegressionParameters ( word  modelName)
inline

get the number of regression model parameters

Definition at line 347 of file DASolvers.H.

◆ printAllOptions()

void printAllOptions ( )
inline

call DASolver::printAllOptions

Definition at line 353 of file DASolvers.H.

◆ hasVolCoordInput()

label hasVolCoordInput ( )
inline

whether the volCoord input is defined

Definition at line 359 of file DASolvers.H.

◆ updateDAOption()

void updateDAOption ( PyObject *  pyOptions)
inline

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

Definition at line 365 of file DASolvers.H.

Referenced by PYDAFOAM::__call__().

Here is the caller graph for this function:

◆ getPrevPrimalSolTime()

double getPrevPrimalSolTime ( )
inline

get the solution time folder for previous primal solution

Definition at line 371 of file DASolvers.H.

References assignValueCheckAD.

◆ writeFailedMesh()

void writeFailedMesh ( )
inline

Definition at line 378 of file DASolvers.H.

◆ readStateVars()

void readStateVars ( scalar  timeVal,
label  timeLevel = 0 
)
inline

read the state variables from the disk and assign the value to the prescribe time level

Definition at line 384 of file DASolvers.H.

◆ readMeshPoints()

void readMeshPoints ( const scalar  timeVal)
inline

read the mesh points from the disk and run movePoints to deform the mesh

Definition at line 392 of file DASolvers.H.

◆ writeMeshPoints()

void writeMeshPoints ( const double *  points,
const scalar  timeVal 
)
inline

write the mesh points to the disk for the given timeVal

Definition at line 398 of file DASolvers.H.

◆ calcPCMatWithFvMatrix()

void calcPCMatWithFvMatrix ( Mat  PCMat,
const label  turbOnly 
)
inline

calculate the PC mat using fvMatrix

Definition at line 404 of file DASolvers.H.

◆ setTime()

void setTime ( scalar  time,
label  timeIndex 
)
inline

setTime for OF fields

Definition at line 410 of file DASolvers.H.

◆ getDdtSchemeOrder()

label getDdtSchemeOrder ( )
inline

get the ddtScheme order

Definition at line 416 of file DASolvers.H.

◆ getEndTime()

double getEndTime ( )
inline

return the endTime

Definition at line 422 of file DASolvers.H.

◆ getDeltaT()

double getDeltaT ( )
inline

return the deltaT

Definition at line 432 of file DASolvers.H.

◆ updateBoundaryConditions()

void updateBoundaryConditions ( const word  fieldName,
const word  fieldType 
)
inline

update the boundary condition for a field

Definition at line 442 of file DASolvers.H.

◆ updateStateBoundaryConditions()

void updateStateBoundaryConditions ( )
inline

update the boundary conditions for all states and intermediate variables

Definition at line 450 of file DASolvers.H.

◆ calcPrimalResidualStatistics()

void calcPrimalResidualStatistics ( const word  mode)
inline

Calculate the mean, max, and norm2 for all residuals and print it to screen.

Definition at line 456 of file DASolvers.H.

References dafoam_plot3dtransform::mode.

◆ setPrimalBoundaryConditions()

void setPrimalBoundaryConditions ( const label  printInfo = 1)
inline

Definition at line 461 of file DASolvers.H.

◆ runFPAdj()

label runFPAdj ( Vec  dFdW,
Vec  psi 
)
inline

Definition at line 466 of file DASolvers.H.

References psi.

◆ solveAdjointFP()

label solveAdjointFP ( Vec  dFdW,
Vec  psi 
)
inline

Definition at line 473 of file DASolvers.H.

References psi.

◆ initTensorFlowFuncs()

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

initialize the call back function pointer

Definition at line 481 of file DASolvers.H.

◆ writeAdjointFields()

void writeAdjointFields ( const word  function,
const double  writeTime,
const double *  psi 
)
inline

write the adjoint variables for all states

Definition at line 494 of file DASolvers.H.

References psi.

◆ writeSensMapSurface()

void writeSensMapSurface ( const word  name,
const double *  dFdXs,
const double *  Xs,
const label  size,
const double  timeName 
)
inline

write the sensitivity map for all wall surfaces

Definition at line 503 of file DASolvers.H.

◆ writeSensMapField()

void writeSensMapField ( const word  name,
const double *  dFdField,
const word  fieldType,
const double  timeName 
)
inline

write the sensitivity map for the entire field

Definition at line 514 of file DASolvers.H.

◆ getLatestTime()

double getLatestTime ( )
inline

get the latest solution time

Definition at line 524 of file DASolvers.H.

◆ meanStatesToStates()

void meanStatesToStates ( )
inline

assign the mean states values to states

Definition at line 537 of file DASolvers.H.

◆ updateInputFieldUnsteady()

void updateInputFieldUnsteady ( )
inline

assign the inputFieldUnsteady values to the OF field vars

Definition at line 543 of file DASolvers.H.


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