Public Member Functions | Protected Attributes | List of all members
DARegression Class Reference
Inheritance diagram for DARegression:
Inheritance graph
[legend]
Collaboration diagram for DARegression:
Collaboration graph
[legend]

Public Member Functions

 DARegression (const fvMesh &mesh, const DAOption &daOption, const DAModel &daModel)
 Constructors. More...
 
virtual ~DARegression ()
 Destructor. More...
 
label compute ()
 compute the output based on the latest parameters and inputs More...
 
void calcInputFeatures (word modelName)
 calculate the input flow features More...
 
label nParameters (word modelName)
 get the number of parameters for this regression model More...
 
scalar getParameter (word modelName, label idxI)
 get a specific parameter value More...
 
void setParameter (word modelName, label idxI, scalar val)
 set a value to a parameter give an index and a value More...
 
label checkOutput (word modelName, volScalarField &outputField)
 check if the output values are valid otherwise bound or fix them More...
 
void printInputInfo (const label printToScreen)
 print the input More...
 
void writeFeatures ()
 write the features to the disk More...
 
bool writeData (Ostream &os) const
 this is a virtual function for regIOobject More...
 

Protected Attributes

const fvMesh & mesh_
 Foam::fvMesh object. More...
 
const DAOptiondaOption_
 Foam::DAOption object. More...
 
const DAModeldaModel_
 DAModel object. More...
 
label active_
 whether the regression model is active More...
 
wordList modelNames_
 name of the regression models More...
 
HashTable< word > modelType_
 the type of regression model More...
 
HashTable< wordList > inputNames_
 a list of words for the inputs More...
 
HashTable< word > outputName_
 a list of words for the outputs More...
 
HashTable< labelList > hiddenLayerNeurons_
 number of neurons hidden layers of the neural network More...
 
HashTable< scalarList > inputShift_
 we can shift each input. we always shift before scaling it. More...
 
HashTable< scalarList > inputScale_
 we can scale each input. we always shift before scaling it. More...
 
HashTable< scalar > outputShift_
 we can shift the output. we always shift before scaling it. More...
 
HashTable< scalar > outputScale_
 we can scale the output. we always shift before scaling it. More...
 
HashTable< scalarList > parameters_
 the parameters for the regression model More...
 
HashTable< word > activationFunction_
 neural network activation function More...
 
HashTable< scalar > leakyCoeff_
 if the ReLU activation function is used we can prescribe a potentially leaky coefficient More...
 
HashTable< scalar > outputUpperBound_
 the upper bound for the output More...
 
HashTable< scalar > outputLowerBound_
 the lower bound for the output More...
 
HashTable< label > printInputInfo_
 whether to print the input range info this is used to scale the input More...
 
HashTable< scalar > defaultOutputValue_
 default output values More...
 
HashTable< label > nRBFs_
 number of radial basis function More...
 
HashTable< PtrList< volScalarField > > features_
 a list of scalarField to save the input features More...
 
scalar * featuresFlattenArray_
 a flatten feature array for externalTensorFlow model More...
 
scalar * outputFieldArray_
 output field array for externalTensorFlow model More...
 
label useExternalModel_ = 0
 whether to use external model More...
 
label featuresFlattenArraySize_ = -100
 the array size is chosen based on the regModel that has the largest number of inputs (this is important because we support multiple regModels but we don't want to create multiple featuresFlattenArray_) More...
 
HashTable< label > writeFeatures_
 whether to write the feature fields to the disk More...
 

Detailed Description

Definition at line 31 of file DARegression.H.

Constructor & Destructor Documentation

◆ DARegression()

DARegression ( const fvMesh &  mesh,
const DAOption daOption,
const DAModel daModel 
)

◆ ~DARegression()

virtual ~DARegression ( )
inlinevirtual

Member Function Documentation

◆ compute()

label compute ( )

◆ calcInputFeatures()

void calcInputFeatures ( word  modelName)

calculate the input flow features

Definition at line 161 of file DARegression.C.

References DARegression::daModel_, DARegression::features_, forAll(), DAModel::getDATurbulenceModel(), DAModel::getTurbConvOverProd(), DAModel::getTurbProdOverDestruct(), DARegression::inputNames_, DARegression::inputScale_, DARegression::inputShift_, k, DARegression::mesh_, DATurbulenceModel::nu(), p, and U.

Referenced by DARegression::compute().

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

◆ nParameters()

label nParameters ( word  modelName)

get the number of parameters for this regression model

Definition at line 638 of file DARegression.C.

References DARegression::active_, DARegression::hiddenLayerNeurons_, DARegression::inputNames_, DARegression::modelType_, and DARegression::nRBFs_.

Referenced by DARegression::DARegression(), and DAInputRegressionPar::size().

Here is the caller graph for this function:

◆ getParameter()

scalar getParameter ( word  modelName,
label  idxI 
)
inline

get a specific parameter value

Definition at line 165 of file DARegression.H.

References DARegression::parameters_.

◆ setParameter()

void setParameter ( word  modelName,
label  idxI,
scalar  val 
)
inline

set a value to a parameter give an index and a value

Definition at line 171 of file DARegression.H.

References DARegression::parameters_.

Referenced by DAInputRegressionPar::run().

Here is the caller graph for this function:

◆ checkOutput()

label checkOutput ( word  modelName,
volScalarField &  outputField 
)

check if the output values are valid otherwise bound or fix them

Definition at line 698 of file DARegression.C.

References DARegression::defaultOutputValue_, forAll(), DARegression::mesh_, DARegression::outputLowerBound_, and DARegression::outputUpperBound_.

Referenced by DARegression::compute().

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

◆ printInputInfo()

void printInputInfo ( const label  printToScreen)
inline

print the input

Definition at line 180 of file DARegression.H.

References DARegression::active_, DARegression::features_, forAll(), DARegression::inputNames_, DARegression::modelNames_, and DARegression::printInputInfo_.

Here is the call graph for this function:

◆ writeFeatures()

void writeFeatures ( )
inline

write the features to the disk

Definition at line 203 of file DARegression.H.

References DARegression::active_, DARegression::features_, forAll(), DARegression::modelNames_, and DARegression::writeFeatures_.

Here is the call graph for this function:

◆ writeData()

bool writeData ( Ostream &  os) const
inline

this is a virtual function for regIOobject

Definition at line 250 of file DARegression.H.

Member Data Documentation

◆ mesh_

const fvMesh& mesh_
protected

◆ daOption_

const DAOption& daOption_
protected

Foam::DAOption object.

Definition at line 47 of file DARegression.H.

◆ daModel_

const DAModel& daModel_
protected

DAModel object.

Definition at line 50 of file DARegression.H.

Referenced by DARegression::calcInputFeatures().

◆ active_

label active_
protected

◆ modelNames_

wordList modelNames_
protected

name of the regression models

Definition at line 56 of file DARegression.H.

Referenced by DARegression::compute(), DARegression::DARegression(), DARegression::printInputInfo(), and DARegression::writeFeatures().

◆ modelType_

HashTable<word> modelType_
protected

the type of regression model

Definition at line 59 of file DARegression.H.

Referenced by DARegression::compute(), DARegression::DARegression(), and DARegression::nParameters().

◆ inputNames_

HashTable<wordList> inputNames_
protected

◆ outputName_

HashTable<word> outputName_
protected

a list of words for the outputs

Definition at line 65 of file DARegression.H.

Referenced by DARegression::compute(), and DARegression::DARegression().

◆ hiddenLayerNeurons_

HashTable<labelList> hiddenLayerNeurons_
protected

number of neurons hidden layers of the neural network

Definition at line 68 of file DARegression.H.

Referenced by DARegression::compute(), DARegression::DARegression(), and DARegression::nParameters().

◆ inputShift_

HashTable<scalarList> inputShift_
protected

we can shift each input. we always shift before scaling it.

Definition at line 71 of file DARegression.H.

Referenced by DARegression::calcInputFeatures(), and DARegression::DARegression().

◆ inputScale_

HashTable<scalarList> inputScale_
protected

we can scale each input. we always shift before scaling it.

Definition at line 74 of file DARegression.H.

Referenced by DARegression::calcInputFeatures(), and DARegression::DARegression().

◆ outputShift_

HashTable<scalar> outputShift_
protected

we can shift the output. we always shift before scaling it.

Definition at line 77 of file DARegression.H.

Referenced by DARegression::compute(), and DARegression::DARegression().

◆ outputScale_

HashTable<scalar> outputScale_
protected

we can scale the output. we always shift before scaling it.

Definition at line 80 of file DARegression.H.

Referenced by DARegression::compute(), and DARegression::DARegression().

◆ parameters_

HashTable<scalarList> parameters_
protected

the parameters for the regression model

Definition at line 83 of file DARegression.H.

Referenced by DARegression::compute(), DARegression::DARegression(), DARegression::getParameter(), and DARegression::setParameter().

◆ activationFunction_

HashTable<word> activationFunction_
protected

neural network activation function

Definition at line 86 of file DARegression.H.

Referenced by DARegression::compute(), and DARegression::DARegression().

◆ leakyCoeff_

HashTable<scalar> leakyCoeff_
protected

if the ReLU activation function is used we can prescribe a potentially leaky coefficient

Definition at line 89 of file DARegression.H.

Referenced by DARegression::compute(), and DARegression::DARegression().

◆ outputUpperBound_

HashTable<scalar> outputUpperBound_
protected

the upper bound for the output

Definition at line 92 of file DARegression.H.

Referenced by DARegression::checkOutput(), and DARegression::DARegression().

◆ outputLowerBound_

HashTable<scalar> outputLowerBound_
protected

the lower bound for the output

Definition at line 95 of file DARegression.H.

Referenced by DARegression::checkOutput(), and DARegression::DARegression().

◆ printInputInfo_

HashTable<label> printInputInfo_
protected

whether to print the input range info this is used to scale the input

Definition at line 98 of file DARegression.H.

Referenced by DARegression::DARegression(), and DARegression::printInputInfo().

◆ defaultOutputValue_

HashTable<scalar> defaultOutputValue_
protected

default output values

Definition at line 101 of file DARegression.H.

Referenced by DARegression::checkOutput(), and DARegression::DARegression().

◆ nRBFs_

HashTable<label> nRBFs_
protected

number of radial basis function

Definition at line 104 of file DARegression.H.

Referenced by DARegression::compute(), DARegression::DARegression(), and DARegression::nParameters().

◆ features_

HashTable<PtrList<volScalarField> > features_
protected

a list of scalarField to save the input features

Definition at line 107 of file DARegression.H.

Referenced by DARegression::calcInputFeatures(), DARegression::compute(), DARegression::DARegression(), DARegression::printInputInfo(), and DARegression::writeFeatures().

◆ featuresFlattenArray_

scalar* featuresFlattenArray_
protected

a flatten feature array for externalTensorFlow model

Definition at line 117 of file DARegression.H.

Referenced by DARegression::compute(), DARegression::DARegression(), and DARegression::~DARegression().

◆ outputFieldArray_

scalar* outputFieldArray_
protected

output field array for externalTensorFlow model

Definition at line 120 of file DARegression.H.

Referenced by DARegression::compute(), DARegression::DARegression(), and DARegression::~DARegression().

◆ useExternalModel_

label useExternalModel_ = 0
protected

whether to use external model

Definition at line 123 of file DARegression.H.

Referenced by DARegression::DARegression(), and DARegression::~DARegression().

◆ featuresFlattenArraySize_

label featuresFlattenArraySize_ = -100
protected

the array size is chosen based on the regModel that has the largest number of inputs (this is important because we support multiple regModels but we don't want to create multiple featuresFlattenArray_)

Definition at line 126 of file DARegression.H.

Referenced by DARegression::DARegression().

◆ writeFeatures_

HashTable<label> writeFeatures_
protected

whether to write the feature fields to the disk

Definition at line 129 of file DARegression.H.

Referenced by DARegression::DARegression(), and DARegression::writeFeatures().


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