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

FluidThermo class updating its variables

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 18, 2023, 15:35
Default FluidThermo class updating its variables
  #1
New Member
 
Felipe Silva Maffei
Join Date: Dec 2015
Posts: 11
Rep Power: 10
Maffei is on a distinguished road
Hello everyone!

I am writing a solver (let's name it as firstSolver) where I get the initial variables from another solver (let's name it as primalSolver). The primalSolver is called using inside the firstSolver:

system(myPrimalSolver);

Then, the primalSolver saves in the current runTime and, forcing the last runtime value in runTime object, the firstSolver reads what was calculated in the primalSolver. I know that it is not the best practice, however, using both solvers in one will create a problem that I pretend to solve in the future.

For U, p and phi variables, everything works fine. The problem lies in the FluidThemo object that I can not force to update to the loaded variables. So, when I calculate things using:

thermo.T()
thermo.he()
thermo.rho()

I have different values from what was calculated in the primalSolver. The best that I could do is force the variables by doing:

volScalarField TRead (IOobject("T", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE), mesh);

thermo.T() = Tread;
thermo.he() = Tread*thermo.Cp();
thermo.rho() = thermo.p()/(Rgas*thermo.T())

But I still have differences from the reader field around 1e-1. This increases the residuals from my equation which is terrible for me because I need this information very precisely.

Does anyone have any idea how can I force the values in the thermo class?
Maffei is offline   Reply With Quote

Reply

Tags
fluidthemo, programming, updating variables


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
[swak4Foam] How to define boundary condition variables by using previosly defined variables? pawlo OpenFOAM Community Contributions 8 September 13, 2020 11:37
[foam-extend.org] paraview not runing? (foam extended 3.2 and ubuntu 15.04) Milan2013 OpenFOAM Installation 23 April 20, 2017 05:49
Possible bug in OpenFoam Interpolation class MMC15 OpenFOAM Bugs 2 March 23, 2014 12:55
Nested class and inheritance permissions MMC15 OpenFOAM Programming & Development 0 December 20, 2013 10:16
Reference "mesh" inside a class tonyuprm OpenFOAM 3 November 5, 2010 10:30


All times are GMT -4. The time now is 19:59.