Solid/liquid phase change
Dear Foamers
For a project I am trying to get a solid/liquid phase change simulation running in OF 1.5dev. A paraffin with non isothermal phase change is molten in a 2D rectangular test case scenario. I started from interFoam solver by changing especially the gamma equation to my needs: Gamma equation: dimensionedScalar pi = mathematicalConstant::pi; dimensionedScalar alpha = (TlTs)/(scalar(2)*tan(scalar(0.49)*pi)); gamma = atan(scalar(1)/alpha*(T(Tl+Ts)/scalar(2)))/pi+scalar(0.5); Changig gamma from 0 (solid) to 1 (liquid) depending on the temperatures Tl (upper phase change temperature) Ts (lower phase change temperature) Momentum equation: fvVectorMatrix UEqn ( fvm::ddt(rho, U) + fvm::div(rhoPhi, U)  fvm::laplacian(muf, U)  (fvc::grad(U) & fvc::grad(muf)) ); UEqn.relax(); if (momentumPredictor) { solve ( UEqn == fvc::reconstruct ( (  ghf*fvc::snGrad(rho)  fvc::snGrad(pd) ) * mesh.magSf() ) ); } No changes at all, however no surface tension left Energy equation: volScalarField rhoCp("rhoCp", rho*cp); surfaceScalarField rhoPhiCp("rhoPhiCp", rhoPhi*fvc::interpolate(cp)); fvScalarMatrix hEqn ( fvm::ddt(rhoCp, T) + fvm::div(rhoPhiCp, T)  fvm::laplacian(lambda, T) ); solve ( hEqn ==  hs*fvc::ddt(rho, gamma) //Source term from Stefan condition ); The source term derived from the Stefan condition takes care of the temperature gradient at the interface induced by the phase change. Solver: Like in interFoam, the solver works as follows:
Is it really the coupling of gamma and energy, making the solver instable? Is there a way to solve the coupled equations (relaxation)? Thanks allot for your replies. Best regards Fabian 
Simulation stops
Hallo Foamers
I managed to get my model running. I substituted the gamma equation into the energy conservation equation and it worked. No I encountered another problem. The solver runs fine until a certain time, where all iteration numbers equal zero and the results do not change anymore. The solver continues running until endTime but nothing changes anymore. Here are the two time steps from the log file where the error occurred in between: PBiCG: Solving for T, Initial residual = 1.00244e05, Final residual = 8.71675e11, No Iterations 1 Liquid phase volume fraction = 0.00105084 Min(gamma) = 0.000769482 Max(gamma) = 0.998571 PBiCG: Solving for Ux, Initial residual = 0.000224831, Final residual = 1.0262e16, No Iterations 1 PBiCG: Solving for Uy, Initial residual = 0.000162936, Final residual = 7.40847e17, No Iterations 1 PCG: Solving for pd, Initial residual = 0.000982493, Final residual = 1.25233e05, No Iterations 2 PCG: Solving for pd, Initial residual = 1.25111e05, Final residual = 4.69217e07, No Iterations 23 PCG: Solving for pd, Initial residual = 4.69216e07, Final residual = 7.52164e08, No Iterations 25 PCG: Solving for pd, Initial residual = 7.55978e08, Final residual = 7.55978e08, No Iterations 0 PCG: Solving for pd, Initial residual = 7.55978e08, Final residual = 7.55978e08, No Iterations 0 PCG: Solving for pd, Initial residual = 7.55978e08, Final residual = 7.55978e08, No Iterations 0 time step continuity errors : sum local = 2.05188e15, global = 1.44131e30, cumulative = 4.99715e30 ExecutionTime = 287.72 s ClockTime = 288 s Courant Number mean: 2.76148e12 max: 7.1681e10 velocity magnitude: 2.51386e11 deltaT = 0.00990099 Time = 11.7822 PBiCG: Solving for T, Initial residual = 9.99292e06, Final residual = 9.99292e06, No Iterations 0 Liquid phase volume fraction = 0.00105084 Min(gamma) = 0.000769482 Max(gamma) = 0.998571 PBiCG: Solving for Ux, Initial residual = 1.10625e12, Final residual = 1.10625e12, No Iterations 0 PBiCG: Solving for Uy, Initial residual = 6.0714e13, Final residual = 6.0714e13, No Iterations 0 PCG: Solving for pd, Initial residual = 7.55979e08, Final residual = 7.55979e08, No Iterations 0 PCG: Solving for pd, Initial residual = 7.55979e08, Final residual = 7.55979e08, No Iterations 0 PCG: Solving for pd, Initial residual = 7.55979e08, Final residual = 7.55979e08, No Iterations 0 PCG: Solving for pd, Initial residual = 7.55979e08, Final residual = 7.55979e08, No Iterations 0 PCG: Solving for pd, Initial residual = 7.55979e08, Final residual = 7.55979e08, No Iterations 0 PCG: Solving for pd, Initial residual = 7.55979e08, Final residual = 7.55979e08, No Iterations 0 time step continuity errors : sum local = 2.05188e15, global = 4.11243e31, cumulative = 5.40839e30 ExecutionTime = 287.81 s ClockTime = 288 s Courant Number mean: 2.76148e12 max: 7.16811e10 velocity magnitude: 2.51386e11 deltaT = 0.00990099 Time = 11.7921 I think all residuals are OK and the Courant number is way to small to have an effect. Any ideas what could cause this problem? Thanks in advance for your replies. Regards 
Hi Fabian,
My guess is that the reducing the number of pd iterations might solve the issue. I guess its the nonorthogonal pressure corrections. In case this does not work, consider reducing the residual to say e10 or relTol parameters. Regards Rachel 
PISO in multiphase phase change problems
Hi Rachel
Thank you for your reply. You are right: It's the residual causing this problem. The initial residual PBiCG: Solving for T, Initial residual = 9.99292e06, Final residual = 9.99292e06, No Iterations 0 is allready below the one beeing requested by fvSolution. I set the residual to 1e10 and the simulation runs without problems. However I have still some problems with continuity. Like in the cavitation multiphase solvers, the PISO pressure equation has to be changed in a certain way. In interPhaseChange Foam for example, pEqn is changed from fvScalarMatrix pdEqn ( fvc::div(phi)  fvm::laplacian(rUAf, pd) ); to fvScalarMatrix pdEqn ( fvc::div(phi)  fvm::laplacian(rUAf, pd) + (vDotvP  vDotcP)*(rho*gh  pSat) + fvm::Sp(vDotvP  vDotcP, pd) ); I have to have a closer look on the PISO scheme and the pressure equation to learn how to derive the equation suited to my model. Does anybody have some tips on how to use PISO in phase change multiphase problems? Thanks allot in advance. Regards Fabian 
substitution of equation into the energy conservation equation
Dear Fabian,
Would you please let me know, how do you substituted the gamma equation into the energy conservation equation. Please drop some lines, how this could solve the problem arose? Thanks in advance, Hamed 
Hi Fabian,
I'm also interested in solidification simulation, but i have some problems in defining gamma as a function of temperature. Can you tell me how you did? Dario 
Continuous gamma function
Hi Hamed, hi Dario
My gamma equation is in contrast to the literature a continuous function. The literature defines gamma as 0 in the solid phase, 1 in the liquid phase and linear in between. I am using a arcus tangent function. dimensionedScalar alpha = (TlTs)/(scalar(2)*tan(scalar(0.49)*pi)); gamma = atan(scalar(1)/alpha*(T(Tl+Ts)/scalar(2)))/pi+scalar(0.5); The source term in the energy equation  hs*fvc::ddt(rho, gamma) can be written as  hs* ( rho*fvc::ddt(gamma) + gamma*fvc::ddt(rho) ); the time derivative of gamma can be directly included here so the two coupled equations form one equation. The gamma field can be calculated after solving the energy equation, however this is not necessary for the solver any more. Anybody can tell me more about the PISO scheme in multiphase solvers? Regards Fabian 
Quote:
Hi Fabian, I am trying to simulate melt filling process in injcetion molding. The polymer melt solidifies and stops flowing at cavity wall due to the cooling effect of cold cavity. As a result, the melt/air and melt/solid interfaces need to be fixed in simulation. I have added the energy equation into interFoam. The nonnewtonian viscosity is take into account, too. The problem is that how can I determine the varied melt/solid interface. Please give me some tips. Thanks in advance. Best regards, Jitao 
Gamma function for injection molding
Hi Jitao
the phase change is taken into account by adding a source term to the energy conservation equation. Internal energy is no longer cp*T but cp*T + gamma*hs where gamma is the phase fraction and hs is the latent heat of fusion. The method is called the enthalpy method. It can be used when phase change occurs over a temperature range and without crystallisation effect. Regards Fabian 
Hi Fabian,
First of all Thank you for sharing your information. Second, I have some question regarding the solidification (Ice accretion ) with interFoam. 1 does your mesh update in each iteration? 2 have you managed to get good result? 3 can you explain it to how does it works, I mean I did not see any condition in your solid liquid phase for temperature. I guess you involve the condition in your gamma, am I right?? Finally would you please give me some hint or any progress in your implementation? Thanks Mehran Quote:

hi
Have you succeeded in solidification in OpenFoam? I am facing a similar problem and I want to model the aircraft infight ice accretion using openfoam or fluent please help me about this problem ThankS 
All times are GMT 4. The time now is 21:20. 