CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Thermal+Vof+DynamicRefineMesh (https://www.cfd-online.com/Forums/openfoam-programming-development/149449-thermal-vof-dynamicrefinemesh.html)

kebsiali March 4, 2015 10:58

Thermal+Vof+DynamicRefineMesh
 
Hello to all

Im trying to simulate the creation of polyurethane foam, modelled as mold filling process. where i want to use vof method to follow the formation of the foam.
The reaction is exothermic which can be modeled by adding a source term to the energy equation.

my question is can this be done and with what solver
and how can i use the benefits of daynamic refining mesh if possible.

Thanks in advance,

kebsiali March 11, 2015 10:09

precise question
 
Well, since no one responded, i will, with another more precise question.

my problem reduces to adding many scalar transport equations to (interFoam), the results of these, will affect the density, viscosity, and every single characteristic appearing in all the equations.

I started by a small transport equation that looks like (sorry for the format)
d/dt(rho1 alpha1 C)+div(rho1 alpha1 U1 C)=0 (I'll have to add source term later)

the reason alpha1 appears is that C is transported through phase 1 only.

I made a CEqn.H which i include (after the pressure equation OR after the pimple loop) which contains
______________________________________
rhoAlpha1 == alpha1*rho1;
rhoAlpha1Phi=fvc::interpolate(rhoAlpha1)*phi;

fvScalarMatrix CEqn
(
fvm::ddt(rhoAlpha1, C)
+ fvm::div(rhoAlpha1Phi, C)
);
CEqn.solve();
_______________________________________


I added in creatFields.H the following

_______________________________________
volScalarField rhoAlpha1
(
IOobject
(
"rhoAlpha1",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT
),
alpha1*rho1,
alpha1.boundaryField().types()
);
rhoAlpha1.oldTime();

surfaceScalarField rhoAlpha1Phi
(
IOobject
(
"rhoAlpha1Phi",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
fvc::interpolate(rhoAlpha1)*phi
);
_______________________________________

but it gives me crazy results (unstable, unrealistic, diffusive)

Could anyone please give me a hint or direct me what to do or where to look
Thanks in advance.

Cyp March 11, 2015 11:58

Dear Ali,

You probably want to read some topic regarding mass transfer with VOF:

http://www.cfd-online.com/Forums/ope...interface.html

http://www.cfd-online.com/Forums/ope...one-phase.html

Also, I recommend you the very good paper by Yacine Haroun and Dominique Legendre about the implementation of mass transfer equation with partitioning at the fluids interface in a VOF solver. (There is much more details in Yacine Haroun PhD dissertation, it is in French, but I guess you can read it!)
http://www.sciencedirect.com/science...09250910000291

In your case, you can play with the value of the partitioning coefficient to force 0 concentration in the other phase. Actually, it is not only "play" since the real value will satisfy the thermodynamics.

best,
Cyprien

kebsiali March 12, 2015 02:35

Dear Cyprien.

I will look into all those links and the PhD,
Thank you very much,

kebsiali March 16, 2015 02:27

Dear Cyprien,
I've looked into what you proposed but haven't tried it yet.
What do you mean by the partitioning coefficient? is it the (Ceq)?


\frac{\partial C}{\partial t}+\nabla \cdot \phi C + \nabla\cdot D \nabla C = \nabla \cdot D C_{eq}\nabla \alpha[LaTeX Error: Syntax error]

and one more thing, i had to show to my profs that the normal method doesn't work, so i tried to debug it to know where the crazy things start to appear. (my problem is not only the diffusion).
and apparantely in my code in CEqn.H where i do
rhoAlpha1Phi=fvc::interpolate(rhoAlpha1)*phi; or rhoAlpha1Phi=fvc::interpolate(alpha1)*rhoPhi;

the code does not do what i intend it to do.
I need to interpolate the values of alpha1 from volScalarField to surface....., otherwise i cant multiply it by phi or rhoPhi which are surfacique.
but what the code does is it returns the same value of rhoPhi, as if the result of fvc::interpolate(alpha1) is equal to (1) everywhere.

I have to show how much diffusive the method would be.

Thanks in advance.

Cyp March 16, 2015 10:08

Hi Ali,

I am not this solution work. The one on the first post, however, works for sure. Look at this post:

http://www.cfd-online.com/Forums/ope...tml#post392947

The partionning coefficient is H (Henry's law)

kebsiali March 20, 2015 10:29

Dear Cyprien,

It took sometime to implement, but here is how it looks


B=Dtt*(1-Henry)/(alpha1*Henry +1-alpha1)*C;


fvScalarMatrix CEqn
(
fvm::ddt( C)
+ fvm::div(phi, C)
+ fvm::laplacian(Dtt, C)
== fvc::laplacian(B, alpha1)
);

I tried to play with the value of Dtt( between 1e-9 and 1e-12)
and I played with Henry ( from 1e-6 to 100)
but the diffusion is still present.

Do I have a missed sign anywhere, are the values of Dtt not realistic (For polyurethane Foam) or what suggestions might you have?

Thank you in advancehttp://i.imgur.com/RnTagGB.png?1

Cyp March 20, 2015 11:32

try a van Leer scheme for fvm::div(phi, C)

also, use a smaller time step.

The spurious fluxes are known (cf the paper of Yacine Haroun), and you can minimize them with smart interpolation, altough I never tried that.

kebsiali March 23, 2015 04:46

Dear Cyprien,

Actually the vanLeer, small dt, higher nAlphaSubCycle combination elimenated the spruious fluxes without the need of H; in other words even if H=1 the the C 'species concentration' is held in phase 1 with no fluxes at all.
The interphase thickness is also non-dependant on H. However, the interphase for C is more smeared -thicker- than that of alpha.
One more thing, the case i'm treating now is non-realistic, im just adding the transport equation to a water-air system, so maybe when i treat my system the effect of H will appear.

kebsiali March 26, 2015 05:49

Dear Cyprien,

Thanks you all your help, i got over this part of my problem
I have a stupid question,
In the species conservation equation, if my density is not constant rho=f(C1,C2,.....Cn,T,P)
is it ok if i write the species conservation equation as ddt(C)+ div(phi,C)....... without the rho appearing inside the derivatives

Cyp March 30, 2015 16:39

You either have,

\frac{\partial C}{\partial t} + \nabla . \left( \mathbf{v} C \right)

or

\frac{\partial \rho \omega }{\partial t} + \nabla . \left(  \rho  \mathbf{v} \omega \right)

where \omega is the mass fraction of your species. So yes, the first equation is correct, regardless the dependence of rho on the other species.

Best,

kebsiali April 14, 2015 02:52

Dear Cyprien,

Sorry to bring this up again,
I had a discussion with my prof. about adding the rho into the transport equation
what im transporting is the chemical conversion

x=\frac {c_0 - c}{c_0}

so i expect the rho to not appear simply because c=c0(1-x)
while my prof expects to see the rho as x can be seen to represent a weight fraction(to the initial state)
What do you suggest or think


All times are GMT -4. The time now is 09:05.