CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Temporary deallocated error while implementing new LES subgrid model

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 3 Post By olesen
  • 1 Post By olesen

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 13, 2023, 04:32
Default Temporary deallocated error while implementing new LES subgrid model
  #1
New Member
 
Teresa Sun
Join Date: Jun 2021
Posts: 21
Rep Power: 5
Teresa Sun is on a distinguished road
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)
Solution
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_;

}
to
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
Teresa Sun is offline   Reply With Quote

Old   October 14, 2023, 09:51
Default
  #2
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
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)
snak, ztnuaa and Teresa Sun like this.
olesen is offline   Reply With Quote

Old   October 16, 2023, 09:27
Default
  #3
New Member
 
Teresa Sun
Join Date: Jun 2021
Posts: 21
Rep Power: 5
Teresa Sun is on a distinguished road
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
Teresa Sun is offline   Reply With Quote

Old   October 16, 2023, 18:36
Default
  #4
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
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 * ...
);
gcc won't care, but clang will and when you start trying to share code and other people can't get it to compile...
Teresa Sun likes this.
olesen is offline   Reply With Quote

Old   October 23, 2023, 05:56
Default
  #5
New Member
 
Teresa Sun
Join Date: Jun 2021
Posts: 21
Rep Power: 5
Teresa Sun is on a distinguished road
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
Teresa Sun is offline   Reply With Quote

Reply

Tags
les, subgrid modelling, temporary deallocated


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 12:23.