CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   How to implement new thermotype? (https://www.cfd-online.com/Forums/openfoam/239150-how-implement-new-thermotype.html)

foxcfd October 22, 2021 11:36

How to implement new thermotype?
 
1 Attachment(s)
Hey everyone,



do you happen to know how to add a thermotype to the possible list of combinations? I have created the type thermo: hSolidLiquidPolynomial which is a copy of hPolynomial for testing. There are already a few threads on this topic e.g. https://www.cfd-online.com/Forums/op...hermotype.html but not for openfoam 9.



An existing possible combination of thermotypes is:



type heRhoThermo

mixture pureMixture

transport polynomial

thermo hPolynomial

equationOfState icoPolynomial

specie specie

energy sensibleEnthalpy



When i change hPolynomial to my hSolidLiquidPolynomial I get the following error message. See attached screenshot. Does anyone know a solution to this, how to add custom thermotypes to the possible combination list?


Thanks in advance.

elBombastico April 13, 2023 11:31

Hi,


Sorry to resucitate this relatively old post.

I am also working on the validation of the stefan problem with ice/water, and your post was the most similar I could find.

I have managed to validate solidificationMeltingSource for the case in which the thermal properties are the same at both sides of the phase transition temperature. Nevertheless, I have come to the conclusion that the only way to use this source term with different material properties is to have them be a function of temperature. This is a bit cumbersome because of the sharp jump at 273.15 K, specially for the specific heat. I tried with hTabulated, but I get strange errors, in function of how the table is written in (OF8). Something similar to this bug (??) reported here.



Do you happen to know if it is possible to configure solidificationMeltingSource to have different properties for the solid and the liquid? I have seen that, in the documentation, there is a rhoRef, defined as "density of the solid", and a CpRef, but as far as I understand, they should only work on lookup, and not thermo modes ?


Thanks in advance :)

sniggy June 2, 2023 02:30

Using therno to calculate rho 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?

Tobi June 7, 2023 08:58

Probably yes, but you need to create a new thermo-library because we commonly (and this is the physical correct behavior) an energy equation such as the enthalpy or energy equation. Based on h or e we derive the temperature. If you donīt want to solve any energy equation, you need to built your own thermo-librarry and avoid calculating T based on h.

To the others:

- Starting point of building a new thermo-library is to copy an existing one (rhoThermo or psiThermo) and change the Typename as well as the class name.
- Compile the new code and run a tutorial case with the new library
- The results should be identically to the former version
- Now you can start modifying what ever you want

elBombastico June 12, 2023 05:36

Hi Tobi,


Thanks for your reply :)
I tried to implement a new thermo type around a couple months ago. I did proceed as you suggest, and I managed to copy and recompile a thermo library without any modifications.
Then, I taylored a specific heat capacity, equation of state and transport models to my needs and recompiled. Success again, they showed as a possible combination in the thermo types list.
Unfortunately, it was not possible to run a case using any of those models. The solver crashes right at the start, complaining about something was missing. Deciphering the error message with c++ filt, showed that something necessary was left out of the compilation process. I did not manage to find out how to fix this problem by addition and removal of lines in the make files.
All this was done in OF8, so I decided to downgrade to OF7, where I did manage to get it done at first try :)


I can post the entire problem with the error messages and the like, but I do not expect anybody to have the time to look at them.



Would you happen to have an example where you have implemented those models (Cp, rho, kappa and mu) in a new thermo library for OF8? I am particularly interested in an example of the make and option files, as well as how the typedef files have to be modified.


Thanks anyway :)


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