CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   OpenFOAM interface with REFPROP (https://www.cfd-online.com/Forums/openfoam/101864-openfoam-interface-refprop.html)

yhaomin2007 May 15, 2012 17:25

OpenFOAM interface with REFPROP
 
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 June 20, 2012 23:58

Some progress in call REFPROP in OF
 
1 Attachment(s)
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.
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

Chris Lucas June 21, 2012 07:25

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

yhaomin2007 June 21, 2012 12:26

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.

Chris Lucas June 22, 2012 07:29

Hi,

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

Christian

fnk382 November 28, 2012 15:50

Refprop subroutine
 
Hi,
Can you share yout refprop subroutine?:)
Thank you.


Quote:

Originally Posted by yhaomin2007 (Post 367570)
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


yhaomin2007 November 28, 2012 16:32

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


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