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

OpenFOAM interface with REFPROP

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   May 15, 2012, 17:25
Default OpenFOAM interface with REFPROP
  #1
Member
 
Haomin Yuan
Join Date: Jan 2012
Location: Madison, Wisconsin, USA
Posts: 54
Rep Power: 5
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 20, 2012, 23:58
Default Some progress in call REFPROP in OF
  #2
Member
 
Haomin Yuan
Join Date: Jan 2012
Location: Madison, Wisconsin, USA
Posts: 54
Rep Power: 5
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, 07:25
Default
  #3
Senior Member
 
Christian Lucas
Join Date: Aug 2009
Location: Braunschweig, Germany
Posts: 198
Rep Power: 8
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, 12:26
Default
  #4
Member
 
Haomin Yuan
Join Date: Jan 2012
Location: Madison, Wisconsin, USA
Posts: 54
Rep Power: 5
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, 07:29
Default
  #5
Senior Member
 
Christian Lucas
Join Date: Aug 2009
Location: Braunschweig, Germany
Posts: 198
Rep Power: 8
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: 8
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: 54
Rep Power: 5
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
yhaomin2007 is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wind turbine simulation Saturn CFX 34 October 16, 2014 05:27
creating interface in openfoam vinnithepooh OpenFOAM 16 February 12, 2013 04:39
Interface w. Pitch Change: Thcfd CFX 0 December 22, 2010 04:50
64bitrhel5 OF installation instructions mirko OpenFOAM Installation 2 August 12, 2008 18:07
OpenFOAM Training and Workshop Zagreb 2628Jan2006 hjasak OpenFOAM 1 February 2, 2006 22:07


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