CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Is there a global container where all Function1 are stored? (https://www.cfd-online.com/Forums/openfoam-programming-development/230139-there-global-container-where-all-function1-stored.html)

Siassei September 10, 2020 04:32

Is there a global container where all Function1 are stored?
 
Hello,

for a plugin I need an way to manipulate a Function1<scalar> value each time step. I knowing the type of Function1, the patches of interesset and the boundary condition.

BC: externalWallHeatFluxTemperatureFvPatchScalarField
The function1 for the heat flux is stored in local private member q_. The function1 is of type constant for that example.

The way as shown in followed code is not possible. So, perhaps it is a global storage of all Function1-Objects with corresponding patchIds.
Do have OpenFOAM an global Function1-Storage?

Code:

// get T field
auto T_ = const_cast<volScalarField*>(&mesh.lookupObject<volScalarField>(nameTField))

// get bc for path with Id
auto bPatch = refCast<const externalWallHeatFluxTemperatureFvPatchScalarField>(T_->boundaryField()[patchID]);

// how to access the q_ Function1<...> of patch ...?
bPatch.q_[0] = 1.0;



All times are GMT -4. The time now is 17:41.