CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Custom Thermophysical Properties (https://www.cfd-online.com/Forums/openfoam/157215-custom-thermophysical-properties.html)

wsmith02 July 22, 2015 22:35

Custom Thermophysical Properties
 
1 Attachment(s)
I am trying to implement arbitrary thermophysical properties for all major quantities (rho, mu, alpha, cp, h, etc...) for sensitivity studies.

It seems the easiest way to do this is by cloning the thermo class rhoThermo/heRhoThermo and implementing the properties there. Before you ask, I cant/dont want to implement the properties at the solver level because then I cant arbitrarily take advantage of them in the turbulence models (unless you can tell me how... which would be great!).

Attached is a modified heRhoThermo (now heArbThermo, sub class of arbThermo).

The code compiles (OF230) and can be added to the buoyantPimpleFoam solver, but running the hotRoom tutorial case (with max temperatures modified to be ~ 375K to match the fake properties) diverges in about 100 iterations and looks like it blows up in the turbulence properties.

There is a bit of a hack in heArbThermo in that the enthalpy (assumed to be the instantiated quantity for the energy transport equation) is re-calculated so that the original invocation of the thermo class calculation of "h" is overwritten. This is not ideal mostly because it only allows constant T boundary conditions.

I tried digging deeper into the thermo models, such as icoPoly/hPoly/poly/etc. but I cant actually tell how the properties are calculated there. for instance... what does "this->W()" mean? I am sure that modifying these would be more robust/elegant.

Does anyone have any thoughts on why the attached when used with the buoyantPimpleFoam/hotRoom tutorial blows up?

I know the properties are non-sense, but this is a MWE for clarity.

Thanks,

-w.

ps... if you are going to re-compile buoyantPimpleFoam to use these remember to add the following to your make files in addition to changing all references of rhoThermo to arbThermo:

to the end of EXE_INC:

-I<your openfoam user dir here>/src/thermophysicalModels/basic/lnInclude

and to the end of EXE_LIBS:
-L$(FOAM_USER_LIBBIN) \
-larbFluidThermo

chriss85 July 23, 2015 09:48

I haven't looked into your code, but there are two thermophysical libraries on the forum using tabular data, one of which was developed by me. See here: http://www.cfd-online.com/Forums/ope...rmo-model.html

Speaking for my library, I got rid of the manual inversion for temperature calculation, because it is slow and possibly unstable when a direct enthalpy,pressure->temperature mapping is available.

wsmith02 July 24, 2015 12:14

Thanks! that is a great starting point. I downloaded your version (i will look at the other one too eventually) and tried to compile it.

I tried. :(

i have tried both compiling it from the $FOAM_RUN directory and even from just copying over the functions that exist in the $FOAM_SRC/thermophysical directory.

I have tried it with both OF230 and OF24x

the error shown below is pretty similar across the board. am i missing something?



+ wmake libso basic
Making dependency list for source file psiThermo/psiThermos.C
could not open file specie.H for source file psiThermo/psiThermos.C due to No such file or directory
could not open file perfectGas.H for source file psiThermo/psiThermos.C due to No such file or directory
could not open file PengRobinsonGas.H for source file psiThermo/psiThermos.C due to No such file or directory
could not open file tabulated.H for source file psiThermo/psiThermos.C due to No such file or directory
could not open file hConstThermo.H for source file psiThermo/psiThermos.C due to No such file or directory
could not open file eConstThermo.H for source file psiThermo/psiThermos.C due to No such file or directory
could not open file janafThermo.H for source file psiThermo/psiThermos.C due to No such file or directory
could not open file sensibleEnthalpy.H for source file psiThermo/psiThermos.C due to No such file or directory
could not open file sensibleInternalEnergy.H for source file psiThermo/psiThermos.C due to No such file or directory
could not open file thermo.H for source file psiThermo/psiThermos.C due to No such file or directory
could not open file tabulatedThermo.H for source file psiThermo/psiThermos.C due to No such file or directory
could not open file constTransport.H for source file psiThermo/psiThermos.C due to No such file or directory
could not open file sutherlandTransport.H for source file psiThermo/psiThermos.C due to No such file or directory
could not open file tabulatedTransport.H for source file psiThermo/psiThermos.C due to No such file or directory
could not open file hPolynomialThermo.H for source file psiThermo/psiThermos.C due to No such file or directory
could not open file polynomialTransport.H for source file psiThermo/psiThermos.C due to No such file or directory
Making dependency list for source file rhoThermo/rhoThermos.C
could not open file specie.H for source file rhoThermo/rhoThermos.C due to No such file or directory
could not open file perfectGas.H for source file rhoThermo/rhoThermos.C due to No such file or directory
could not open file incompressiblePerfectGas.H for source file rhoThermo/rhoThermos.C due to No such file or directory
could not open file rhoConst.H for source file rhoThermo/rhoThermos.C due to No such file or directory
could not open file perfectFluid.H for source file rhoThermo/rhoThermos.C due to No such file or directory
could not open file PengRobinsonGas.H for source file rhoThermo/rhoThermos.C due to No such file or directory
could not open file adiabaticPerfectFluid.H for source file rhoThermo/rhoThermos.C due to No such file or directory
could not open file tabulated.H for source file rhoThermo/rhoThermos.C due to No such file or directory
could not open file hConstThermo.H for source file rhoThermo/rhoThermos.C due to No such file or directory
could not open file janafThermo.H for source file rhoThermo/rhoThermos.C due to No such file or directory
could not open file sensibleEnthalpy.H for source file rhoThermo/rhoThermos.C due to No such file or directory
could not open file sensibleInternalEnergy.H for source file rhoThermo/rhoThermos.C due to No such file or directory
could not open file thermo.H for source file rhoThermo/rhoThermos.C due to No such file or directory
could not open file tabulatedThermo.H for source file rhoThermo/rhoThermos.C due to No such file or directory
could not open file constTransport.H for source file rhoThermo/rhoThermos.C due to No such file or directory
could not open file sutherlandTransport.H for source file rhoThermo/rhoThermos.C due to No such file or directory
could not open file tabulatedTransport.H for source file rhoThermo/rhoThermos.C due to No such file or directory
could not open file icoPolynomial.H for source file rhoThermo/rhoThermos.C due to No such file or directory
could not open file hPolynomialThermo.H for source file rhoThermo/rhoThermos.C due to No such file or directory
could not open file polynomialTransport.H for source file rhoThermo/rhoThermos.C due to No such file or directory
Making dependency list for source file derivedFvPatchFields/energyJump/energyJump/energyJumpFvPatchScalarField.C
Making dependency list for source file rhoThermo/rhoThermo.C
Making dependency list for source file psiThermo/psiThermo.C
Making dependency list for source file basicThermo/basicThermo.C
SOURCE=basicThermo/basicThermo.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam230/src/finiteVolume/lnInclude -I/root/OpenFOAM/root-2.3.0/src/thermophysicalModels/specie/lnInclude -I/opt/openfoam230/src/meshTools/lnInclude -I/opt/openfoam230/src/OpenFOAM/lnInclude -IlnInclude -I. -I/opt/openfoam230/src/OpenFOAM/lnInclude -I/opt/openfoam230/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/basicThermo.o
SOURCE=fluidThermo/fluidThermo.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam230/src/finiteVolume/lnInclude -I/root/OpenFOAM/root-2.3.0/src/thermophysicalModels/specie/lnInclude -I/opt/openfoam230/src/meshTools/lnInclude -I/opt/openfoam230/src/OpenFOAM/lnInclude -IlnInclude -I. -I/opt/openfoam230/src/OpenFOAM/lnInclude -I/opt/openfoam230/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/fluidThermo.o
SOURCE=psiThermo/psiThermo.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam230/src/finiteVolume/lnInclude -I/root/OpenFOAM/root-2.3.0/src/thermophysicalModels/specie/lnInclude -I/opt/openfoam230/src/meshTools/lnInclude -I/opt/openfoam230/src/OpenFOAM/lnInclude -IlnInclude -I. -I/opt/openfoam230/src/OpenFOAM/lnInclude -I/opt/openfoam230/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/psiThermo.o
SOURCE=psiThermo/psiThermos.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam230/src/finiteVolume/lnInclude -I/root/OpenFOAM/root-2.3.0/src/thermophysicalModels/specie/lnInclude -I/opt/openfoam230/src/meshTools/lnInclude -I/opt/openfoam230/src/OpenFOAM/lnInclude -IlnInclude -I. -I/opt/openfoam230/src/OpenFOAM/lnInclude -I/opt/openfoam230/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/psiThermos.o
psiThermo/psiThermos.C:29:20: fatal error: specie.H: No such file or directory
compilation terminated.
make: *** [Make/linux64GccDPOpt/psiThermos.o] Error 1

chriss85 July 27, 2015 05:37

You need to run "wmakeLnInclude ." first, to generate the links in the lnInclude directory. This is a standard procedure for OpenFOAM. It should also suffice to simply execute wmake without any arguments, as the type of the build is determined by the makefile now.

sniggy June 1, 2023 14:30

Using thermo with customized TEqn
 
I am trying to develop a customized solver to solve some counter current packed bed and reaction problems. I am using rhosimpleFoam as the base solver on which I am trying to modify. I am interested to solve my own TEqn than the Eeqn . Can I still use thermo library to update rho?


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