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

OpenFOAM interface with REFPROP

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By yhaomin2007

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 15, 2012, 18:25
Default OpenFOAM interface with REFPROP
  #1
Member
 
Haomin Yuan
Join Date: Jan 2012
Location: Madison, Wisconsin, USA
Posts: 59
Rep Power: 14
yhaomin2007 is on a distinguished road
Hi, all:

I want to find a way to interface OpenFOAM with Refprop.

I know a thread talking about this issue two years ago, but I don's think it gives me a clear answer.

Can somebody give me a tutorial or something to show me how to do that ?

thank you all in advance.
yhaomin2007 is offline   Reply With Quote

Old   June 21, 2012, 00:58
Default Some progress in call REFPROP in OF
  #2
Member
 
Haomin Yuan
Join Date: Jan 2012
Location: Madison, Wisconsin, USA
Posts: 59
Rep Power: 14
yhaomin2007 is on a distinguished road
Hey, guys,

I think I have made some progress in calling REFPROP In OF.
Here is what I have changed in OF.

In hPsiThermo.C
Quote:
forAll(TCells, celli)
{
const typename MixtureType::thermoType& mixture_ =
this->cellMixture(celli);

TCells[celli] = mixture_.TH(hCells[celli], TCells[celli]);
psiCells[celli] = mixture_.psi(pCells[celli], TCells[celli]);

muCells[celli] = mixture_.mu(TCells[celli]);
alphaCells[celli] = mixture_.alpha(TCells[celli]);
}
this is the original part of the calculate() function

I changed this to
Code:
TCells[celli] = refTPH(pCells[celli], hCells[celli]); // call REFPROP subroutine
        psiCells[celli] = refPsiPH(pCells[celli],hCells[celli]);
        muCells[celli] = refMuPH(pCells[celli],hCells[celli]); 
        alphaCells[celli] = refAlphaPH(pCells[celli],hCells[celli]);
the solver is running.

I have made simple case to compare the perfectGas model in OF and the real Air by REFPROP. but the results are little bit different.

the case using perfectGas model gives this temperature profile that everywhere is 300 K.

but the case using REFPROP property gives this temperature profile as attachment.
T.jpg
I cannot explain the temperature rise in the internal filed. The boundary are all fixed to 300K.

This is really wield . I think there must be some place I did not notice. And hope somebody can help me.

thank you in advance
yhaomin2007 is offline   Reply With Quote

Old   June 21, 2012, 08:25
Default
  #3
Senior Member
 
Christian Lucas
Join Date: Aug 2009
Location: Braunschweig, Germany
Posts: 202
Rep Power: 18
Chris Lucas is on a distinguished road
Hi,

have you corrected the h or e boundary functions?

How long did the case run. What BC did you use for p and U

Christian
Chris Lucas is offline   Reply With Quote

Old   June 21, 2012, 13:26
Default
  #4
Member
 
Haomin Yuan
Join Date: Jan 2012
Location: Madison, Wisconsin, USA
Posts: 59
Rep Power: 14
yhaomin2007 is on a distinguished road
HI, Chris

thank you for your reply.

I do not know how to change the h and e boundary functions. i know the h and e boundary functions are defined in basicThermo.C . Do you mean hBoundaryCorrection and eBoundaryCorrection?? I do not know how to change them. Can you show me?

thank you.
yhaomin2007 is offline   Reply With Quote

Old   June 22, 2012, 08:29
Default
  #5
Senior Member
 
Christian Lucas
Join Date: Aug 2009
Location: Braunschweig, Germany
Posts: 202
Rep Power: 18
Chris Lucas is on a distinguished road
Hi,

the BC's are defined in derivedFvPatchField and the question is if you use the correct temperature and pressure to calculate h

Christian
Chris Lucas is offline   Reply With Quote

Old   November 28, 2012, 16:50
Default Refprop subroutine
  #6
New Member
 
fnk
Join Date: Aug 2009
Posts: 4
Rep Power: 17
fnk382 is on a distinguished road
Hi,
Can you share yout refprop subroutine?
Thank you.


Quote:
Originally Posted by yhaomin2007 View Post
Hey, guys,

I think I have made some progress in calling REFPROP In OF.
Here is what I have changed in OF.

In hPsiThermo.C

this is the original part of the calculate() function

I changed this to
Code:
TCells[celli] = refTPH(pCells[celli], hCells[celli]); // call REFPROP subroutine
        psiCells[celli] = refPsiPH(pCells[celli],hCells[celli]);
        muCells[celli] = refMuPH(pCells[celli],hCells[celli]); 
        alphaCells[celli] = refAlphaPH(pCells[celli],hCells[celli]);
the solver is running.

I have made simple case to compare the perfectGas model in OF and the real Air by REFPROP. but the results are little bit different.

the case using perfectGas model gives this temperature profile that everywhere is 300 K.

but the case using REFPROP property gives this temperature profile as attachment.
Attachment 13948
I cannot explain the temperature rise in the internal filed. The boundary are all fixed to 300K.

This is really wield . I think there must be some place I did not notice. And hope somebody can help me.

thank you in advance
fnk382 is offline   Reply With Quote

Old   November 28, 2012, 17:32
Default
  #7
Member
 
Haomin Yuan
Join Date: Jan 2012
Location: Madison, Wisconsin, USA
Posts: 59
Rep Power: 14
yhaomin2007 is on a distinguished road
hi, fnk382

This is very easy, you can just follow the REFPROP manual.

But you need to find out how to call FORTRAN subroutine in C++, you will easily find out by google online
mgg likes this.
yhaomin2007 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
Wind turbine simulation Saturn CFX 60 July 17, 2024 06:45
creating interface in openfoam vinnithepooh OpenFOAM 17 June 20, 2022 07:58
Interface w. Pitch Change: Thcfd CFX 0 December 22, 2010 04:50
64bitrhel5 OF installation instructions mirko OpenFOAM Installation 2 August 12, 2008 19:07
OpenFOAM Training and Workshop Zagreb 2628Jan2006 hjasak OpenFOAM 1 February 2, 2006 22:07


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