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

janaf dynamic

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 7, 2015, 10:11
Default janaf dynamic
  #1
New Member
 
sebastien vilfayeau
Join Date: Feb 2012
Posts: 14
Rep Power: 14
sebastien_F1 is on a distinguished road
Hi,

I'm working on fireFoam and I try to implement a new model. For this model, I need to have access to polynomial Janaf coefficients defined in "constant/thermo.compressibleGas".

My solution was to use a dynamic_cast inside my code as follows :
Code:
    // Setup the janaf thermo class
       typedef janafThermo<perfectGas<specie> > janafType;

         typedef sutherlandTransport<sensibleEnthalpy<janafType> > thermoType;

         const multiComponentMixture<thermoType>& myThermo =
         dynamic_cast<const multiComponentMixture<thermoType>&>(this->thermoPtr_());
        
    // O2 thermal enthalpy 
        // Oxygen label
         const label specie_O2 = this->thermoPtr_->composition().species()["O2"];
        // Compute janaf class for O2
         const janafType& myThermo_O2 = dynamic_cast<const janafType&>(myThermo.speciesData()[specie_O2]);
        // Compute molecular thermal enthalpy [J/kmol]               
        scalar H_O2 = myThermo_O2.hs(1e5, Tair_);
        // Compute molecular weight [kg/kmol]
        scalar MW_O2 =  this->thermoPtr_->composition().W(specie_O2);
        // Calculate thermal enthalpy [J/kg]
        scalar hs_O2 = H_O2/MW_O2;
        
        Info << "hs_O2 = " << hs_O2 << endl;
It was working fine in OpenFOAM.2.1 but in OpenFOAM.2.2, I have the following error:
cannot dynamic_cast ... (source type is not polymorphic)

Anyone has a hint how to solve this problem?

Thanks
Sebastien
sebastien_F1 is offline   Reply With Quote

Old   July 26, 2017, 11:24
Default type is not polymorphic
  #2
New Member
 
Join Date: Jun 2014
Posts: 4
Rep Power: 11
zbtlfd is on a distinguished road
This thread is quite old, however maybe it's still a useful reply for someone.

The error message "type is not polymorphic" refers at least to the type of
speciesData()[specie_O2] in
Code:
const janafType& myThermo_O2 = dynamic_cast<const janafType&>(myThermo.speciesData()[specie_O2]);
, which is usually referred to as "ThermoType" in the source files. In the base classe of the type "ThermoType", i.e. src/thermophysicalModels/specie/specie/specie.H, you can see that it is not a polymorphic type, because it contains no virtual methods. Therefore you cannot downcast from it. At least this is my understanding of the dynamic_cast operation.
zbtlfd is offline   Reply With Quote

Reply


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
Dynamic Mesh on Pintle type injector. herntan FLUENT 16 September 4, 2020 08:27
Dynamic SGS model procedure in Large eddy simulation mrf6166 Main CFD Forum 39 November 25, 2016 14:13
Dynamic contact angle raj kumar saini Fluent UDF and Scheme Programming 0 October 13, 2014 02:18
Entropy calculation in OpenFoam immortality OpenFOAM 23 September 8, 2013 17:18
Dynamic Mesh moving interface help akash.iitb FLUENT 0 August 23, 2010 23:53


All times are GMT -4. The time now is 00:22.