|
[Sponsors] |
Copy a turbulent field and correct it using fvOptions |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 18, 2021, 02:42 |
Copy a turbulent field and correct it using fvOptions
|
#1 |
Senior Member
Agustín Villa
Join Date: Apr 2013
Location: Alcorcón
Posts: 313
Rep Power: 15 |
Hello,
during my simulations I have to add an extra term in the Reynolds stress tensor R. This new term is only applicable when using eddy viscosity models, so I was planning to add it using the fvOptions.correct() function to enable this modification whenever is needed. As far as I found, I can import R in my code using: Code:
const volSymmTensorField& R = turbModel.R(); Regards, Agustín |
|
February 18, 2021, 16:00 |
|
#2 |
Senior Member
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 932
Rep Power: 12 |
Out of my head:
tmp<volSymmTensorField> tR = turbModel.R(); auto& R = tR.ref(); There might be something similar in one of those fvOptions: link. Have a look, please.
__________________
The OpenFOAM community is the biggest contributor to OpenFOAM: User guide/Wiki-1/Wiki-2/Code guide/Code Wiki/Journal Nilsson/Guerrero/Holzinger/Holzmann/Nagy/Santos/Nozaki/Jasak/Primer Governance Bugs/Features: OpenFOAM (ESI-OpenCFD-Trademark) Bugs/Features: FOAM-Extend (Wikki-FSB) Bugs: OpenFOAM.org How to create a MWE New: Forkable OpenFOAM mirror |
|
February 19, 2021, 07:13 |
|
#3 |
Senior Member
Agustín Villa
Join Date: Apr 2013
Location: Alcorcón
Posts: 313
Rep Power: 15 |
Thanks! Now it works.
EDIT: well, it works as far as the turbulence models belongs to the eddyViscosity class. If I try to use a Reynolds stress model, I get the next error message: Code:
Attempt to acquire non-const reference to const object from a tmp<N4Foam14GeometricFieldINS_10SymmTensorIdEENS_12fvPatchFieldENS_7volMeshEEE> From function T& Foam::tmp<T>::ref() const [with T = Foam::GeometricField<Foam::SymmTensor<double>, Foam::fvPatchField, Foam::volMesh>] in file /home/user/OpenFOAM/OpenFOAM-7/src/OpenFOAM/lnInclude/tmpI.H at line 187. EDIT2: I managed to implement this feature. The Reynolds stress needed to be called like: Code:
tmp<volSymmTensorField> tR = turbModel.R(); volSymmTensorField& R = const_cast<volSymmTensorField&>(tR()); Last edited by agustinvo; February 19, 2021 at 09:46. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Turbulence injection via fvOptions: addSup, constrain, or correct? | pbachant | OpenFOAM Programming & Development | 1 | May 22, 2020 22:48 |
Turbulent Dissipation Rate Field Function | osulax | STAR-CCM+ | 1 | April 5, 2017 15:15 |
rhoSimplecFoam: error in Forces output (correct pressure field) | WhiteW | OpenFOAM Running, Solving & CFD | 1 | December 8, 2015 13:02 |
Moving mesh | Niklas Wikstrom (Wikstrom) | OpenFOAM Running, Solving & CFD | 122 | June 15, 2014 06:20 |
Is this understanding of turbulence models correct? | 3kha | Main CFD Forum | 3 | January 31, 2011 21:31 |