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 DAOption & | daOption_ |
Foam::DAOption object. More... | |
const DAModel & | daModel_ |
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... | |
Definition at line 31 of file DARegression.H.
DARegression | ( | const fvMesh & | mesh, |
const DAOption & | daOption, | ||
const DAModel & | daModel | ||
) |
Constructors.
Definition at line 17 of file DARegression.C.
References DARegression::activationFunction_, DARegression::active_, DARegression::defaultOutputValue_, DARegression::features_, DARegression::featuresFlattenArray_, DARegression::featuresFlattenArraySize_, forAll(), DAOption::getAllOptions(), DARegression::hiddenLayerNeurons_, DARegression::inputNames_, DARegression::inputScale_, DARegression::inputShift_, DARegression::leakyCoeff_, DARegression::mesh_, DARegression::modelNames_, DARegression::modelType_, DARegression::nParameters(), DARegression::nRBFs_, DARegression::outputFieldArray_, DARegression::outputLowerBound_, DARegression::outputName_, DARegression::outputScale_, DARegression::outputShift_, DARegression::outputUpperBound_, DARegression::parameters_, DARegression::printInputInfo_, DARegression::useExternalModel_, and DARegression::writeFeatures_.
|
inlinevirtual |
Destructor.
Definition at line 139 of file DARegression.H.
References DARegression::featuresFlattenArray_, DARegression::outputFieldArray_, and DARegression::useExternalModel_.
label compute | ( | ) |
compute the output based on the latest parameters and inputs
Definition at line 340 of file DARegression.C.
References DARegression::activationFunction_, DARegression::active_, DARegression::calcInputFeatures(), DARegression::checkOutput(), DARegression::features_, DARegression::featuresFlattenArray_, forAll(), DARegression::hiddenLayerNeurons_, DARegression::inputNames_, DARegression::leakyCoeff_, DARegression::mesh_, DARegression::modelNames_, DARegression::modelType_, DARegression::nRBFs_, DARegression::outputFieldArray_, DARegression::outputName_, DARegression::outputScale_, DARegression::outputShift_, DARegression::parameters_, DAUtility::pyCalcBeta, DAUtility::pyCalcBetaInterface, DAUtility::pySetModelName, and DAUtility::pySetModelNameInterface.
Referenced by DAInputRegressionPar::run().
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().
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().
|
inline |
get a specific parameter value
Definition at line 165 of file DARegression.H.
References DARegression::parameters_.
|
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().
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().
|
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_.
|
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_.
|
inline |
this is a virtual function for regIOobject
Definition at line 250 of file DARegression.H.
|
protected |
Foam::fvMesh object.
Definition at line 44 of file DARegression.H.
Referenced by DARegression::calcInputFeatures(), DARegression::checkOutput(), DARegression::compute(), and DARegression::DARegression().
|
protected |
Foam::DAOption object.
Definition at line 47 of file DARegression.H.
|
protected |
DAModel object.
Definition at line 50 of file DARegression.H.
Referenced by DARegression::calcInputFeatures().
|
protected |
whether the regression model is active
Definition at line 53 of file DARegression.H.
Referenced by DARegression::compute(), DARegression::DARegression(), DARegression::nParameters(), DARegression::printInputInfo(), and DARegression::writeFeatures().
|
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().
|
protected |
the type of regression model
Definition at line 59 of file DARegression.H.
Referenced by DARegression::compute(), DARegression::DARegression(), and DARegression::nParameters().
|
protected |
a list of words for the inputs
Definition at line 62 of file DARegression.H.
Referenced by DARegression::calcInputFeatures(), DARegression::compute(), DARegression::DARegression(), DARegression::nParameters(), and DARegression::printInputInfo().
|
protected |
a list of words for the outputs
Definition at line 65 of file DARegression.H.
Referenced by DARegression::compute(), and DARegression::DARegression().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
protected |
neural network activation function
Definition at line 86 of file DARegression.H.
Referenced by DARegression::compute(), and DARegression::DARegression().
|
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().
|
protected |
the upper bound for the output
Definition at line 92 of file DARegression.H.
Referenced by DARegression::checkOutput(), and DARegression::DARegression().
|
protected |
the lower bound for the output
Definition at line 95 of file DARegression.H.
Referenced by DARegression::checkOutput(), and DARegression::DARegression().
|
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().
|
protected |
default output values
Definition at line 101 of file DARegression.H.
Referenced by DARegression::checkOutput(), and DARegression::DARegression().
|
protected |
number of radial basis function
Definition at line 104 of file DARegression.H.
Referenced by DARegression::compute(), DARegression::DARegression(), and DARegression::nParameters().
|
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().
|
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().
|
protected |
output field array for externalTensorFlow model
Definition at line 120 of file DARegression.H.
Referenced by DARegression::compute(), DARegression::DARegression(), and DARegression::~DARegression().
|
protected |
whether to use external model
Definition at line 123 of file DARegression.H.
Referenced by DARegression::DARegression(), and DARegression::~DARegression().
|
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().
|
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().