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

Is it a bug of Lee.C in icoReactingMultiphaseInterFoam?

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

Like Tree6Likes
  • 4 Post By MamoruTamura
  • 2 Post By MamoruTamura

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 10, 2020, 15:56
Default Is it a bug of Lee.C in icoReactingMultiphaseInterFoam?
  #1
New Member
 
Mamoru Tamura
Join Date: Sep 2019
Posts: 2
Rep Power: 0
MamoruTamura is on a distinguished road
Hello everyone,

I am trying a simulation of melting and solidification of matter, using icoReactingMultiphaseInterFoam in OpenFOAM v2006.
However, I found a phenomenon which seems to be a bug.
Since I'm a beginner of OpenFOAM, please let me consult about this.
To come to the point, I guessed there is a quite simple bug of a minus sign in Lee.C.
My simulation files are attached.
solidMelting2D_heating_cooling.zip

To try a simulation, I refered a tutorial of solidMelting2D, and changed its parameters, as follows.

In system/controlDict, endTime and writeInterval were changed,
Code:
endTime         200;
writeInterval   2;
In 0/T, left and right boundaryField were changed,
Code:
internalField   uniform 301.3;

boundaryField
{
    left
    {
    	type externalWallHeatFluxTemperature;
        mode power;
        Q table
        (
            (0      1000)
            (50     1000)
            (50.01  -1000)
            (100    -1000)
        );
        kappaMethod fluidThermo;
        value $internalField;
    }

    right
    {
        type           fixedValue;
        value          $internalField;
    }
In constant/phaseProperties, massTransferModel for a phase change from liquid to solid was add,
Code:
massTransferModel
(
    (solid to liquid)
    {
        type            Lee;
        C               40;
        Tactivate       302.78;
    }
    (liquid to solid)
    {
        type            Lee;
        C               -40;
        Tactivate       302.78;
    }
);
I changed the left boundary condition of T, to heat their with 1000W for the first 50 seconds, and after that, cool their with -1000W.
Thus, we can expect the melt and solidification of matter.

This is a result of simuation, alpha.solid is shown.
by default Lee.gif

First, as expected, the matter showed a melt.
However, in the middle of simulation (after t = 36s), the simulation showed a strange behavior.

I think there is a bug in the KSu function of Lee.C, because of the following reason.
For a different purpose, I investigated the latent heat calculation in icoReactingMultiphaseInterFoam.
It is calculated in the heatTransfer function of MassTransferPhaseSystem.C, whose line 294 is,
Code:
                eqn -= fvm::Sp(Sp*L.ref(), T) + Su*L.ref();
these Sp and Su would be from Lee class.

In Lee.C, KSp function calculates,
Code:
         volScalarField from
         (
             min(max(this->pair().from(), scalar(0)), scalar(1))
         );
  
         const volScalarField coeff
         (
             C_*from*this->pair().from().rho()*pos(from - alphaMin_)
             /Tactivate_
         );
  
         if (sign(C_.value()) > 0)
         {
             return
             (
                 coeff*pos(refValue - Tactivate_)
             );
         }
         else
         {
             return
             (
                 coeff*pos(Tactivate_ - refValue)
             );
         }
and KSu function calculates,
Code:
         volScalarField from
         (
             min(max(this->pair().from(), scalar(0)), scalar(1))
         );
  
         const volScalarField coeff
         (
             C_*from*this->pair().from().rho()*pos(from - alphaMin_)
         );
  
         if (sign(C_.value()) > 0)
         {
             return
             (
                 -coeff*pos(refValue - Tactivate_)
             );
         }
         else
         {
             return
             (
                 coeff*pos(Tactivate_ - refValue)
             );
         }

For C > 0 (phase change from solid to liquid), these functions are,

S_p = C\alpha\rho/T_A
S_u = -C\alpha\rho
for T_A < T
Thus, the above mentioned MassTransferPhaseSystem.C line 294 would be,

eqn -= \dot{m}L
\dot{m}L = (S_p T+S_u)L = C\rho\alpha\frac{T-T_A}{T_A}L
which describes the energy source due to the mass change of phase change, and the mass change \dot{m} corresponds to the Lee model explained in,
https://www.openfoam.com/releases/op...nd-physics.php

On the other hand, for C < 0 (phase change from liquid to solid), from above Lee.C code, Sp and Su are calculated as,

S_p = C\alpha\rho/T_A
S_u = C\alpha\rho
for T < T_A
There is not a minus sign in Su calculation, thus, the sign of Sp and Su are identical; MassTransferPhaseSystem.C line 294 would be,

eqn -= \dot{m}L
\dot{m}L = (S_p T+S_u)L = C\rho\alpha\frac{T+T_A}{T_A}L
which is different with the Lee model shown in above link.
I guessed a minus sign is required in Su also for C < 0, like as,

S_u = -C\alpha\rho
and the C < 0 case of KSu function should be,
Code:
         else
         {
             return
             (
                 -coeff*pos(Tactivate_ - refValue)
             );
         }
After this modification, I compiled icoReactingMultiphaseInterFoam, and retried the simulation.
This is a result.
by modified Lee.gif
As expected initially, the matter showed the melt and solidification.
I think the simulation was successful.

Let me hear what you think.

Best regards,
Mamoru

Last edited by MamoruTamura; November 12, 2020 at 22:32.
MamoruTamura is offline   Reply With Quote

Old   December 2, 2020, 21:51
Default
  #2
New Member
 
Mamoru Tamura
Join Date: Sep 2019
Posts: 2
Rep Power: 0
MamoruTamura is on a distinguished road
For this topic, I reported on

https://develop.openfoam.com/Develop.../-/issues/1934

It was solved.

Thanks!
olesen and TeresaT like this.
MamoruTamura is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
mapFields major bug alchem OpenFOAM Bugs 11 November 28, 2019 05:24
Bug in Workbench CFX Pierre1 CFX 6 August 2, 2017 00:18
Serious bug in LES interface fs82 OpenFOAM Bugs 21 November 16, 2009 08:15
Bug reports Mattijs Janssens (Mattijs) OpenFOAM 0 January 10, 2005 10:05
Forum y2k Bug Jonas Larsson Main CFD Forum 1 January 5, 2000 10:22


All times are GMT -4. The time now is 14:16.