CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Solve continuity equation for one dimensional mesh motion velocity. Need derivative i

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 5, 2024, 11:30
Question Solve continuity equation for one dimensional mesh motion velocity. ddz derivative
  #1
New Member
 
Join Date: Jan 2024
Posts: 8
Rep Power: 2
danylo is on a distinguished road
Hello everyone,


I am trying to model a fluid to solid phase change with mesh motion caused by the phase change. Now the Mesh deforms with the velocity U_m, but only in z direction. Therefore it should be mathematically possible to solve the following continuity equation for U_m:


\frac{d(\rho(1-\alpha))}{dt} + \rho_{ice}*\frac{d\alpha}{dt} + \nabla\cdot(\rho*U_r) -  \rho_{ice} \nabla\cdot(\alpha*    U_m) = 0


where

\alpha = volume fraction of solid
\rho = density of liquid solution
\rho_{ice} = density of solid
U_r = fluid velocity without Mesh velocity


Now I can not solve this scalar Equation for a vector, but since only the z-component of U_m can be non-zero, I can write it like this:


\frac{d(\rho(1-\alpha))}{dt} + \rho_{ice}*\frac{d\alpha}{dt} +  \nabla\cdot(\rho*U_r) -  \rho_{ice} \frac{d\alpha    U_{mz}}{dz}= 0


Mathematically that should make sense, but I lack the OpenFoam tools and knowledge to solve this in my program. Since there is no fvm::ddz method. I know that I can get the derivation of the z-component in the z direction by using:


Code:
volScalarField Umz = Um.component(2);
volVectorField gradUmz = fvc::grad(Umz);
volScalarField gradUmzz = gradUmz.component(2);
But I have no idea how to incorporate this in my fvScalarMatrix, so that it solves for Umz.


What I also tried was defining an alphaz vector field, which is 0 in his x and y component and has the alpha values in the z component. I calculated the dot product with the face normals, the same way phi gets calculated, to get a surfaceScalarField, and tried to solve for Umz. This is how it looks:



Code:
forAll(alphaz,i)
{
    alphaz[i].component(2) = alphaice[i];
}

forAll(alphaz.boundaryField(), patchI)
   {
   forAll(alphaz.boundaryField()[patchI], faceI)
      {
          alphaz.boundaryFieldRef()[patchI][faceI].component(2) = alphaice.boundaryField()[patchI][faceI];
      }
   }


surfaceScalarField surfacealphaz
(
    IOobject
    (
        "phialphaz",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::AUTO_WRITE
    ),
    linearInterpolate(alphaz) & mesh.Sf()
);





tmp<fvScalarMatrix> tUmEqn
(
    fvc::ddt(rhomix,alphawater) 
  + rhoice*fvc::ddt(alphaice)
  + fvc::div(rhomixUrel)
  + rhoice*fvm::div(surfacealphaz,Umz)
);
The solver compiles, but I can not get it to run on my case. I get following error:


#0 Foam::error::printStack(Foam::Ostream&) at ??:?
#1 Foam::sigFpe::sigHandler(int) at ??:?
#2 ? in "/lib/x86_64-linux-gnu/libc.so.6"
#3 Foam::symGaussSeidelSmoother::smooth(Foam::word const&, Foam::Field<double>&, Foam::lduMatrix const&, Foam::Field<double> const&, Foam::FieldField<Foam::Fie


I suppose my method is not very physical, hence a lot of problems occurr.


If anyone knows, how to incorporate a derivative in only one direction of space in the solver Matrix, that would be great. Any help would be appreciated.


Thank you

Last edited by danylo; February 6, 2024 at 03:17.
danylo is offline   Reply With Quote

Old   February 13, 2024, 05:09
Default Any ideas?
  #2
New Member
 
Join Date: Jan 2024
Posts: 8
Rep Power: 2
danylo is on a distinguished road
Does anyone have any idea how i could solve this issue? I did not make any progress yet

Thank you
danylo is offline   Reply With Quote

Old   February 22, 2024, 05:01
Default
  #3
New Member
 
Join Date: Jan 2024
Posts: 8
Rep Power: 2
danylo is on a distinguished road
Update:
I can get the code for the alphaz surfaceScalarField to run but I get nonsense values. Problem was that alphaice was 0 at the start, and so it was impossible to solve for Um. I set alphaice to a small starting value, but the value Um just spirals out of control up to extremely high values.
danylo is offline   Reply With Quote

Reply

Tags
continuity, differentiation, equation, onedimension, solve error


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
SU2-7.0.1 on ubuntu 18.04 hyunko SU2 Installation 7 March 16, 2020 04:37
Difficulty in calculating angular velocity of Savonius turbine simulation alfaruk CFX 14 March 17, 2017 06:08
Upgraded from Karmic Koala 9.10 to Lucid Lynx10.04.3 bookie56 OpenFOAM Installation 8 August 13, 2011 04:03
continuity equation Rafal Main CFD Forum 4 November 29, 2006 09:27
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 18:07


All times are GMT -4. The time now is 07:23.