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

Reinitialize velocity field during simulation

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 18, 2013, 06:28
Default Reinitialize velocity field during simulation
  #1
Member
 
Join Date: Sep 2012
Posts: 30
Rep Power: 13
emirust is on a distinguished road
Dear Foamers,

I am using the interFoam solver to simulate the fall of a water drop in an oil phase.

For small droplets, I have trouble with initializing the case: I am using the funkySetFields to create the initial drop:

Code:
funkySetFields -field alpha1 -expression 1 -time 0 -keepPatches -condition "pow(pos().x-(20*0.000100/2),2)+pow(pos().y-(0.9*60*0.000100),2)<=pow((0.000100/2),2)"
During the first time steps, the drop will snap into a position which is more spherical than what the resolution of the mesh can offer (see attached screenshots). This initial field will greatly affect the trajectory of the drop, as it is very small, and in some cases it will often "eject" it out of the mesh.

My idea was to simulate the first time step, keep the field for the phase fraction alpha1 but set the velocity field back to zero so gravity can act on the drop undisturbed. Does anyone know how to procede?

Thank you a lot!
Attached Images
File Type: jpg alpha.jpg (94.7 KB, 38 views)
File Type: jpg snapping.jpg (96.4 KB, 35 views)
emirust is offline   Reply With Quote

Old   March 19, 2013, 10:48
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by emirust View Post
Dear Foamers,

I am using the interFoam solver to simulate the fall of a water drop in an oil phase.

For small droplets, I have trouble with initializing the case: I am using the funkySetFields to create the initial drop:

Code:
funkySetFields -field alpha1 -expression 1 -time 0 -keepPatches -condition "pow(pos().x-(20*0.000100/2),2)+pow(pos().y-(0.9*60*0.000100),2)<=pow((0.000100/2),2)"
During the first time steps, the drop will snap into a position which is more spherical than what the resolution of the mesh can offer (see attached screenshots). This initial field will greatly affect the trajectory of the drop, as it is very small, and in some cases it will often "eject" it out of the mesh.

My idea was to simulate the first time step, keep the field for the phase fraction alpha1 but set the velocity field back to zero so gravity can act on the drop undisturbed. Does anyone know how to procede?

Thank you a lot!
Sounds dirty. But I've also got a dirty solution. Using swak4Foam.

Add this function object:
Code:
clearVelocity {
    type manipulateField;
    variables (
       "startTime=0.1;"
    );
    mask "time()<startTime";
    expression "vector(0,0,0)";
    fieldName U;
}
This should clear the field until t=0.1 and then do nothing. I'm doing this from memory, so there may be parameters missing. Not sure, but it may also be necessary to clear phi
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   March 19, 2013, 12:00
Default
  #3
Member
 
Join Date: Sep 2012
Posts: 30
Rep Power: 13
emirust is on a distinguished road
Thank you!

Another idea I got was to initialize the pressure field to be what is expected from theory, by using the formula for pressure difference due to surface tension:

Young Laplace Equation

I believe this can easily be done with funkySetFields for cells within the drop. I suspect it will avoid the snapping of the drop into place, but haven't implemented any of those suggestions yet.

I'll keep this post up to date ;-)
emirust is offline   Reply With Quote

Old   March 19, 2013, 12:15
Default
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by emirust View Post
Thank you!

Another idea I got was to initialize the pressure field to be what is expected from theory, by using the formula for pressure difference due to surface tension:

Young Laplace Equation

I believe this can easily be done with funkySetFields for cells within the drop. I suspect it will avoid the snapping of the drop into place, but haven't implemented any of those suggestions yet.

I'll keep this post up to date ;-)
Also have a look at http://openfoamwiki.net/index.php/Co...on_Sloping_Bed and the discussion referenced from it. That might help by making the field a little bit more "blurry" (not so 0/1) on the border. Maybe this at least reduces the snapping
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   March 20, 2013, 13:56
Default
  #5
Member
 
Join Date: Sep 2012
Posts: 30
Rep Power: 13
emirust is on a distinguished road
For your information:

it is possible to reinitialize the velocity field by using funkySetFields:
Code:
funkySetFields -field U -expression 'vector(0,0,0)' -time 0.01 -keepPatches

One can also force the initial pressure difference to be 28 for example:

Code:
funkySetFields -field p_rgh -expression 28 -time 0 -keepPatches -condition "alpha1==1"
Results are not greatly improved however, probably due to the smallness of the drop.

Best of luck!
emirust is offline   Reply With Quote

Old   March 31, 2013, 22:42
Default
  #6
Member
 
Guifan Li
Join Date: Apr 2011
Location: New York City, U.S.
Posts: 96
Rep Power: 14
liguifan is on a distinguished road
Hi emirust,

I am currently working on a similar project like yours, simulating a droplet of oil phase (radius is around 2mm) fall into a water tank. However, the results seems to be bad since when I use setFields to initialise the droplet; it seems to be out of its capacilty to generate such a small droplet. I am trying to use funkySetFields to do it, but the resource, where funkySetFields package can be downloaded, has been removed from OpenFOAMWiki. Just wondering, where did you get your funkySetFields package if you can tell me? Thanks in advance and hope we can have further discussion later.

BTW, have you successfully used the snapphyHexMesh to refine the area around your droplet?

Best,
Quote:
Originally Posted by emirust View Post
For your information:

it is possible to reinitialize the velocity field by using funkySetFields:
Code:
funkySetFields -field U -expression 'vector(0,0,0)' -time 0.01 -keepPatches
One can also force the initial pressure difference to be 28 for example:

Code:
funkySetFields -field p_rgh -expression 28 -time 0 -keepPatches -condition "alpha1==1"
Results are not greatly improved however, probably due to the smallness of the drop.

Best of luck!
liguifan is offline   Reply With Quote

Old   April 1, 2013, 04:51
Default
  #7
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
see this thread of mine to download swak4foam.inside swak4foam there is funkysetfiels.↲http://www.cfd-online.com/Forums/ope...ybc-of220.html
immortality is offline   Reply With Quote

Old   April 7, 2013, 10:20
Default
  #8
Member
 
Join Date: Sep 2012
Posts: 30
Rep Power: 13
emirust is on a distinguished road
Hey!

What do you mean by out of capacity? Have you looked at the interface tension and viscosity ratio of the two phases? This may be the reason for the bubble disapearing, if you are still in a test phase..

To initialize the fields, you must install the swak4foam package (groovyBC, funkySetFields and others have now been put together in swak4Foam). funkySetFields is included in it, and I believe you can find information on how to install it

Here is my blockMeshDict:

Code:
convertToMeters 1;
vertices        
(
    (  0  0  0 )          //0
    (  0.01  0  0 )          //1
    (  0.01  0.04  0 )          //2
    (  0  0.04  0 )          //3
    (  0  0  5e-07 )          //4
    (  0.01  0  5e-07 )        //5
    (  0.01  0.04  5e-07 )               //6
    (  0  0.04  5e-07 )        //7
    
  
); 

blocks          
(
    hex (0 1 2 3 4 5 6 7) (30 120 1) simpleGrading (1 1 1)          //1
  
);
 
 edges           
 (
 );
boundary
(
    topWall
    {
        type patch;
        faces
        (
            (3 7 6 2)
        );
    }
    leftWall
    {
        type wall;
        faces
        (
            (0 4 7 3)
        );
    }
    rightWall
    {
        type wall;
        faces
        (
            (2 6 5 1)
        );
    }
    bottomWall
    {
        type wall;
        faces
        (
            (1 5 4 0)
        );
    }
    front
    {
        type empty;
        faces
        (
            (4 5 6 7)
        );
    }
    back
    {
        type empty;
        faces
        (
            (0 3 2 1)
            
        );
    }
And here is the topoSetDict (I run refineMesh two times on the same area created by the topoSet utility), so that the cells are divided by 4 smaller cells:

Code:
actions
(
    	
	{
        name    c0;
        type    cellSet;
        action  clear;
        
    	}	

	{
        name    c0;
        type    cellSet;
        action  new;
        source  boxToCell;
        sourceInfo
        {
            box (0.0028 0 -1) (0.0072 0.04 1);
        }
    	}	
    

);
Hope this helps!

E.
emirust is offline   Reply With Quote

Old   April 7, 2013, 23:14
Default
  #9
Member
 
Guifan Li
Join Date: Apr 2011
Location: New York City, U.S.
Posts: 96
Rep Power: 14
liguifan is on a distinguished road
Hi Emirust,

Thanks for your reply and your code.

I have implement my mesh and gave it a try. But when the mesh size is small, like droplet in mm, the simulation seems to be quite bad. The time step Delta T goes to some number like 1.5e-21 or even smaller. If I use a constant time step like 0.0001, the courant number would go to very large.

My case is actually 3D, I built up a cylinder and define bottom half is water, and funkySet to create a droplet on top of the water surface( inside the upper air phase)

Besides, I am not using MultiphaseInterFoam, so I think I don't need to take viscosity ratio into consideration( correct me if i am wrong), for the interfacial tension, I gave it a value (water oil) 0.025 (air water) 0.07 (air oil) 0.045.

Not sure whether you have met the same problem as mine, if yes, could you please give some suggestions? Appreciated that.

Best,
liguifan is offline   Reply With Quote

Old   April 8, 2013, 06:03
Default
  #10
Member
 
Join Date: Sep 2012
Posts: 30
Rep Power: 13
emirust is on a distinguished road
Hello,

I based my case on the damBreak tutorial, so I am using the interFoam solver. The fact that the Courant number gets so small is probably a sign that the phases are changing a lot, and thus require smaller time step: for my case the time step is adjusting itself automatically (adjustTimeStep in controlDict). Typically this happened to me when I used a interfacial tension far too small, which caused by drop to "pop" and disapear.

Regarding the properties of the fluids: I specify it in the transportProperties file. There I need to specify both the viscosities of the phases and the interfacial tension between the two phases.
emirust 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
Editing chtMultiRegionFoam to not solve velocity field tH3f0rC3 OpenFOAM 18 January 24, 2020 17:39
interpreting velocity field asharma OpenFOAM Post-Processing 2 October 9, 2010 02:19
Neumann pressure BC and velocity field Antech Main CFD Forum 0 April 25, 2006 03:15
velocity field divergence? gh FLUENT 0 July 6, 2005 12:10
Variables Definition in CFX Solver 5.6 R P CFX 2 October 26, 2004 03:13


All times are GMT -4. The time now is 17:01.