## Enthalpy as function

Numerical methods and mathematical models of Elmer
SG_from_Russia
Posts: 9
Joined: 29 Oct 2013, 06:25
Antispam: Yes
Location: Komsomolsk-on-Amur, Russian Federation

### Enthalpy as function

Hi2all.
First of all, excuse me for my english Recently I needed to calculate silumin (Al-Si alloy) ingot solidification in a continuous casting mold of cylindrical shape.
Calculation area is the inner cylinder (ingot), nested to the outer hollow cylinder (crystallizing dish).
In essence, the problem is the resolution of the Fourier-Kirchhoff equation (the equation of heat and mass transfer)
with internal heat sources, the presence of which is due latent heat of crystallization, at the inner area
and the Fourier heat conduction equation at the outer.
The process is stationary, convective heat transfer is present at the inner area.
The problem is closed by boundary conditions of a particular type (by heat flow).
For this problem I have written small program in Fortran90, which uses a finite-difference representation of the original
partial differential equations, and was pleased with the result.
Soon, however, it took me to complicate the geometry, and I was faced with the need to use the apparatus of the finite element method.
By chance I came across Elmer FEM and had very pleasantly surprised. At first glance, it seems to me this is what I need.
To begin, I decided to implement my already solved problem (it's interesting to have the opportunity to compare the results of my calculations and calculations in Elmer).
I installed Elmer7.0-rev6064-2013-02-15 for Windows, imported geometry files, prepared in Salome, and began to assigning of model parameters.
And faced with a problem. The function of the enthalpy for Al-Si alloy is nonlinear.
In my program, I approximated it piecewise by polynomials 2 and 4 degrees in the two-phase crystallization range.
In Elmer I want to do the same, by using the MATC description. Of course, I think I can do this by using the table, I don't want.
It is not convenient. Elmer Solver give an error "ERROR:: ListGetDerivValue: No automated derivation possible for > Enthalpy <".
A similar error has been discussed at viewtopic.php?f=3&t=2345.
But I can't understand, have panellists come to any meaningful conclusions about the cause of the problem and how to resolve it normally?
Is the only way to solve it to remove solidification from the model and try to somehow simulate it directly by specifying "effective" heat capacity of the material?

Best regards, George.
raback
Posts: 3830
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

### Re: Enthalpy as function

Hi George

The algorithm needs a derivative of the enthalpy. Currently ElmerSolver only knows how to compute it from given (x,y) table. For example using cubic spline

Code: Select all

``````  Enthalpy = Variable Temperature
Real Cubic
include ent.dat
End
``````
where ent.dat is an ascii table with values of temperature in the 1st column and values of enthalpy in the second one.

-Peter
SG_from_Russia
Posts: 9
Joined: 29 Oct 2013, 06:25
Antispam: Yes
Location: Komsomolsk-on-Amur, Russian Federation

### Re: Enthalpy as function

Hi Peter.

Thank you for precise answer. In any case, it is enough to solve my current problem. The more so that in most cases Entalpy(T) is really determined by the set points by analyzing the phase diagram of the material, and not as an analytical function.
I would like to clarify some more things.

1) Do I understand correctly that Elmer enthalpy is defined as the integral from 0 to T the function rho(t)*(C(t)+L*(df/dt)), respectively, and measured by J/m3 (not kJ/m3?).

2) In what units is specified coefficient alpha for boundary conditions by the heat flow (Newton-Richman's law q=alpha*(Tsurface-Tenvironment))? Is it W/(m2*K) or yet kW/(m2*K) as it seemed to me when I was looking through the results of a simple little test problem.

3) In Elmer, I saw, the possibility of defining the boundary condition q=alpha*DeltaT is available (DeltaT=Tsurface-Tenvironment).
Also, relation of radiative heat transfer separately available. And what about some other boundary conditions?
For example, when liquid boiling in a large volume expression for the heat flux is given by q=С*(DeltaT)^3. Can I "wiggle out" and write q=alpha(T)*DeltaT,
where alpha(T)=C*DeltaT^2 and use Elmer's opportunity, which described above?
Are there any "the pitfalls" in this case? (well, apart from the obvious, like a more slow convergence and the need for more care in choosing the time step).

4) Since df/dt can be quite large value may be some difficulties with the convergence of iterations in the nonlinearity (even if the rest of the coefficients in Fourier-Kirchhoff's equation are constants). For transient problem we can dynamically change the size of the time step, but what about the steady-state case? It looks like Elmer enables the use of under-relaxation method (I think it is a good idea in this case).
In own program (for the stationary case) I used directly the value of the enthalpy, did not use the value of the derivative, when formed the finite difference equations. In fact I had to solve a nonlinear equation for each control volume, and the decision of the whole system of nonlinear equations in general was found by using relaxation techniques. Unfortunately it is not as effective as GMRES (preconditioned by incomplete LU decomposition), but it do its thing, in at least for 2D tasks.
So why am I writing this, I thought that Elmer's "spartial 2" just use only the value of the enthalpy (not derived from it), but it seems I was wrong. Is that right?

Best regards, George.
raback
Posts: 3830
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

### Re: Enthalpy as function

Hi

1) Yes. Of course the lower integration limit does not play any role though, only derivatives are of relevance.

2) W/m^2K

3) Yes, you could use user function (f90) or use MATC as in

Code: Select all

``````\$t0=300.0
\$alpha=1.23
External Temperature = \$t0
Heat Transfer Coefficient = Variable Temperature
Real MATC "alpha*(tx*tx+tx*t0+t0*t0)"
``````
If you know that the heating will always consume the excess energy you could use a soft upper limiter that introduces just the right amount of drain.

4) I don't remeber by heart the exact details of the different formulations. However, I think that enthalpy is used because if one would use some direct efficient heat capacity with a delta peak it is almost impossible to integrate it numerically. When you use enthalpy the efficient heat capacity is computed internally for each element and the problem of numerical integration is partly eliminated.

Also in s-s one might use step size control with Armijo-Goldstein criterion. I implemented this as a library functionality but haven't taken it into use in many solvers. It would make divergence prone problems more robust. Now underrelaxation is often the best option.

-Peter
SG_from_Russia
Posts: 9
Joined: 29 Oct 2013, 06:25
Antispam: Yes
Location: Komsomolsk-on-Amur, Russian Federation

### Re: Enthalpy as function

Hi Peter

Thanks for the useful information. Gradually, everything falls into place. I'd like to continue a bit in this thread if you don't mind.
As I wrote above, the contact boundary between two different bodies is in my problem. At the forum, I found a few topics related to the peculiarities of Elmer's work with the contact boundaries, for example viewtopic.php?f=3&t=95 and an example at \tests\HeatGap.
However, these cases that are dealt aren't suitable for me. In these topics is a speech about presence of an additional thermal resistance (for example, the air gap), which implies a rupture of the temperature field. Then it's natural specify the option "heat gap" with the such heat transfer coefficient which corresponds to the physical conditions of the process. It doesn't cause questions.
But what about the ideal contact when in theory need to put the contact conditions of the form T- = T+ and q- = q+ (- and + correspond to left and right from the border contact)? At first I thought that doesn't need to put any conditions on the contact boundary in the simulation of such problem. At least it would be strange specify at this border "heat gap" because physically it doesn't exist there, and also in this case I don't know "Heat Transfer Coefficient" (if we consider the heat transfer in this way).
Maybe, Elmer automatically satisfies these contact conditions?
Just as in "the mesh method" for uniform Cartesian 1D-grid "effective thermal conductivity" lambda* at boundary node is defined as the harmonic mean (lambda*=2*lambda1*lambda2/(lambda1+lambda2)), where lambda1 and lambda2 are thermal conductivities of the body1 and body2, respectively.

Best regards, George.
raback
Posts: 3830
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

### Re: Enthalpy as function

Hi

For the ideal contact between nonconforming meshes see, for example
viewtopic.php?f=7&t=3264&hilit=mortar#p10380

The ideal contact between conforming meshes should be automatically met.

-Peter
SG_from_Russia
Posts: 9
Joined: 29 Oct 2013, 06:25
Antispam: Yes
Location: Komsomolsk-on-Amur, Russian Federation

### Re: Enthalpy as function

Hi Peter!

This is very useful information. Thank you.
I am pleased to note that everything worked out. Comparison of Elmer's results with my results did not reveal any visible differences.
Another small (newbie) question: how can I add a second solver by ElmerGUI?

Best regards, George.
mzenker
Posts: 1998
Joined: 07 Dec 2009, 11:49
Location: Germany

### Re: Enthalpy as function

Hi,

to add more solvers just check "active" in the corresponding tab(s) in Model->Equation.

HTH,

Matthias
SG_from_Russia
Posts: 9
Joined: 29 Oct 2013, 06:25
Antispam: Yes
Location: Komsomolsk-on-Amur, Russian Federation

### Re: Enthalpy as function

Thanks a lot, Matthias, is what I need
SG_from_Russia
Posts: 9
Joined: 29 Oct 2013, 06:25
Antispam: Yes
Location: Komsomolsk-on-Amur, Russian Federation

### Re: Enthalpy as function

It seems that this is not exactly what I thought. The problem remains: can I somehow connect SaveLine Solver by ElmerGUI?
Unfortunately, I could not find the answer by yourself.

Best regards, George.