|
[Sponsors] |
Temporary deallocated error while implementing new LES subgrid model |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 13, 2023, 04:32 |
Temporary deallocated error while implementing new LES subgrid model
|
#1 |
New Member
Teresa Sun
Join Date: Jun 2021
Posts: 21
Rep Power: 5 |
Error message
Code:
tmp<N4Foam14GeometricFieldINS_6TensorIdEENS_12fvPatchFieldENS_7volMeshEEE> deallocated From const T& Foam::tmp<T>::cref() const [with T = Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>] in file /cvmfs/hpc.rug.nl/versions/2023.01/rocky8/x86_64/amd/zen3/software/OpenFOAM/v2206-foss-2022a/OpenFOAM-v2206/src/OpenFOAM/lnInclude/tmpI.H at line 217. FOAM aborting #0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::error::simpleExit(int, bool) at ??:? #2 Foam::tmp<Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh> >::cref() const at ??:? #3 Foam::tmp<Foam::GeometricField<Foam::innerProduct<Foam::Vector<double>, Foam::Tensor<double> >::type, Foam::fvPatchField, Foam::volMesh> > Foam::operator&<Foam::Vector<double>, Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>(Foam::dimensioned<Foam::Vector<double> > const&, Foam::tmp<Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh> > const&) at ??:? #4 Foam::LESModels::scalarQR<Foam::IncompressibleTurbulenceModel<Foam::transportModel> >::k(Foam::tmp<Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh> > const&) const at ??:? #5 Foam::LESModels::scalarQR<Foam::IncompressibleTurbulenceModel<Foam::transportModel> >::correctNut() at ??:? #6 ? at ??:? #7 __libc_start_main in /lib64/libc.so.6 #8 ? at ??:? Aborted (core dumped) In .C file, change the red part of the code Code:
template<class BasicTurbulenceModel> tmp<volScalarField> scalarQR<BasicTurbulenceModel>::k ( const tmp<volTensorField>& gradU ) const { volSymmTensorField D(symm(gradU)); const volVectorField& U = this->U_; const auto& rhok = U.mesh().lookupObject<volScalarField>("rhok"); volScalarField buoyancy = 1/4 * gradU & fvc::grad(rhok) & g_; } Code:
volScalarField buoyancy = 1/4 * fvc::grad(U) & fvc::grad(rhok) & g_; It's trivial matters, I post it to remind myself. It would be nicer if it helps someone else |
|
October 14, 2023, 09:51 |
|
#2 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40 |
If the first line were changed to have
volSymmTensorField D(symm(gradU())); then you wouldn't lose the temporary there and could leave the buoyancy term as-is without recalculating the gradient (again) |
|
October 16, 2023, 09:27 |
|
#3 |
New Member
Teresa Sun
Join Date: Jun 2021
Posts: 21
Rep Power: 5 |
Hi Mark,
Thanks for your advice and explanations. It worked and I guess it saves computational cost since the gradient is not recalculated again. But in the solver information, the deltaT is almost the same as the recalculated version. Anyway, your methods seem more reasonable. Thanks again for the suggestion. Best regards Teresa |
|
October 16, 2023, 18:36 |
|
#4 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40 |
It is also generally preferable to construct variables directly, not by assignment (=) since this can be ambiguous when creating a field from a tmp type.
Code:
// not so good volScalarField buoyance = 1/4 * ...; // better volScalarField buoyance ( 1/4 * ... ); |
|
October 23, 2023, 05:56 |
|
#5 |
New Member
Teresa Sun
Join Date: Jun 2021
Posts: 21
Rep Power: 5 |
Hi Mark,
Thanks for your suggestion. It's very helpful. Indeed we plan to share the code when it's ready. Thank you very much. Best, Teresa |
|
Tags |
les, subgrid modelling, temporary deallocated |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
error after implementing a new viscosity model | Lee Kyun Bum | OpenFOAM Running, Solving & CFD | 2 | November 7, 2024 05:14 |
Deardorff Subgrid model | lucamirtanini | Main CFD Forum | 4 | June 10, 2021 05:28 |
LES model (oneEqEddy), air entrainment predictions | N. A. | OpenFOAM | 1 | November 7, 2010 14:17 |
help for different between les model (subgrid-scale model) | liuyuxuan | FLUENT | 1 | October 2, 2009 16:25 |
2-equation model of LES and source code | M.R.Hadian | Main CFD Forum | 0 | February 3, 2002 06:00 |