|
[Sponsors] |
January 17, 2022, 08:22 |
thermo vs. turbulence() ?
|
#1 |
Senior Member
|
Why is the constructor for the thermo class called without brackets and the constructor for the turbulence class called with brackets.
Apologies for my low literacy in C++. Thx! |
|
January 17, 2022, 10:44 |
|
#2 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 668
Rep Power: 14 |
Not sure I follow you Domenico - do you want to add an example?
|
|
January 17, 2022, 15:58 |
|
#3 |
Senior Member
|
Thanks for the reply.
An example is line 67 of createFields of reactingFoam at https://develop.openfoam.com/Develop...createFields.H Motivating my question is the desire of understanding for the combustion model is implemented. It appears that the implementation of EDM combustion model is not the standard implementation. We thus might want to change that to be able to compare with standard implementations in various other codes. Cheers, Domenico. |
|
January 17, 2022, 16:28 |
|
#4 |
Member
Lorenzo
Join Date: Apr 2020
Location: Italy
Posts: 36
Rep Power: 6 |
Hi,
First of all, let me say that I consider myself as a beginner, so I cannot be totally sure of my suggestion. Could it be that thermo is defined as an object, whereas turbulence is a pointer? Looking at createFields.H, thermo is defined in line 5 (see that also pThermo, which is a pointer, is called with parentheses): Code:
psiReactionThermo& thermo = pThermo(); Code:
autoPtr<compressible::turbulenceModel> turbulence ( compressible::turbulenceModel::New ( rho, U, phi, thermo ) ); Lorenzo |
|
January 18, 2022, 13:14 |
|
#5 |
Senior Member
|
Dear Lorenzo,
Thank you so much for pointing me in the (what I perceive to be) the correct direction! Here is my current understanding of what is happening. For thermo: First, pThermo() is created as an autoPtr. Next, thermo is cast to a pointer. Code:
autoPtr<psiReactionThermo> pThermo(psiReactionThermo::New(mesh)); psiReactionThermo& thermo = pThermo(); Code:
autoPtr<compressible::turbulenceModel> turbulence ( compressible::turbulenceModel::New ( rho, U, phi, thermo ) ); |
|
January 22, 2022, 11:10 |
|
#6 | |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 668
Rep Power: 14 |
Domenico
just a few refinements to your earlier post: Quote:
1. On line 4 of createFields.H, a new psiReactionThermo object is created; this returns a pointer that is assigned to smart pointer pThermo Code:
autoPtr<psiReactionThermo> pThermo(psiReactionThermo::New(mesh)); Code:
psiReactionThermo& thermo = pThermo(); 4. The turbulence model is constructed in a similar way - first, create a new momentumTransportModel object and assign its pointer to smart pointer called turbulence Code:
autoPtr<compressible::momentumTransportModel> turbulence ( compressible::momentumTransportModel::New ( rho, U, phi, thermo ) ); Code:
psiReactionThermophysicalTransportModel::New(turbulence(), thermo) Code:
psiReactionThermophysicalTransportModel::New(turbulence(), pThermo()) |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Simulation crashes when turbulence is on (reactingMultiphaseEulerFoam) | remidemol | OpenFOAM Running, Solving & CFD | 3 | May 26, 2020 05:47 |
Average Turbulence Intensity in LES | M_Hego | Visualization & Post-Processing | 0 | July 24, 2018 15:18 |
how to set URANS turbulence model in unsteady flow simulation | TimLiu | OpenFOAM Pre-Processing | 0 | April 25, 2017 08:52 |
Turbulence postprocessing | Mohsin | FLUENT | 2 | October 3, 2016 14:18 |
Code release: Flow Transition and Turbulence | Chaoqun Liu | Main CFD Forum | 0 | September 26, 2008 17:15 |