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

Calculating Cp, gamma and others during runtime

Register Blogs Community New Posts Updated Threads Search

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   June 5, 2020, 16:45
Default Calculating Cp, gamma and others during runtime
  #1
Senior Member
 
Join Date: Dec 2019
Posts: 215
Rep Power: 7
shock77 is on a distinguished road
Hi,


I would like to calculate the specific heat capacity cp, specific heat ratio gamma and Ma number during the computation.


I have compiled a new solver based on rhoCentralFoam for this purpose.
In createFields.H I have added:


Code:
volScalarField cp
    (
    IOobject
        (
            "cp",
            runTime.timeName(),
            mesh,
            IOobject::READ_IF_PRESENT,
            IOobject::AUTO_WRITE
        ),
         thermo.Cp()
     );
     
volScalarField gamma
    (
    IOobject
        (
            "gamma",
            runTime.timeName(),
            mesh,
            IOobject::READ_IF_PRESENT,
            IOobject::AUTO_WRITE
        ),
         thermo.gamma()
     );
     
volScalarField Ma
    (
    IOobject
        (
            "Ma",
            runTime.timeName(),
            mesh,
            IOobject::READ_IF_PRESENT,
            IOobject::AUTO_WRITE
        ),
         mag(U)/sqrt(thermo.gamma()*thermo.p()/thermo.rho())
     );
I get the right values at time t = 0. Unfortunately they do not change over time, which is strange. Pressure, velocity and density do change, so the Mach Number should change aswell, but I cant see this. It works perfectly, if I use the functionObjects for the Mach Number.


I wanted to add also the total temperature and total pressure for compressible fluids to be calculated during runtime, but I would like to calculate them using the Mach Number, which is not calculated right at the moment.




Can anyone tell what I did wrong?






Kind regards,
shock77
shock77 is offline   Reply With Quote

 


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



All times are GMT -4. The time now is 07:13.