CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Please help How is delta t determined in interFoam (https://www.cfd-online.com/Forums/openfoam-solving/60419-please-help-how-delta-t-determined-interfoam.html)

Pei-Ying Hsieh (Hsieh) February 23, 2005 21:44

Hi, Yesterday, I ran a tes
 
Hi,

Yesterday, I ran a test case:

Cloned the damBreak case.
Axi-symmetric (so, a wedge was built).
radius = 2 mm (set to 2, with 0.001 scaling factor).
length = 5 mm (set to 5, with 0.001 scaling factor).
4 degree wedge.

inlet flow rate set o 0.001 m/sec.
Wall contact angle = 90 degree
one outlet.
fluids properties are the same as in the damBreak case (water and air?)

in FoamX, set initial delta t to 1e-5 seconds.
Set delta t to autoadjustable.

Very quickly, the delta t was adjusted automatically to about 3.7e-7 seconds. This seem a little bit small given the conditions I set. Can anyone tell me why this is so small? How is delta t determined by the code? Thanks!

Pei

Mattijs Janssens (Mattijs) February 24, 2005 04:25

The deltat is determined from
 
The deltat is determined from the max Courant number. This in turn is determined on a face by face basis using the local velocity (from the face flux) and the distance to the cell centre.
(CourantNo.H in cfdTools)

The time step is then adjusted given the ratio between wanted Co and calculated Co. The time step can decrease unlimited but the increase is limited to prevent oscillations.
(setDeltat.H in cfdTools)

Eugene de Villiers (Eugene) February 24, 2005 07:49

I can tell you with 99.9% cer
 
I can tell you with 99.9% certainty that there is a problem with your setup Pei.

Some ideas,
Do not use wedges unless you have periodic rotational flow.
Do not allow the inlet to become "dry" (i.e. use a additional pipe length.)

Pei-Ying Hsieh (Hsieh) February 24, 2005 07:49

Hi, Mattijs, Thanks! This
 
Hi, Mattijs,

Thanks! This is what I thought.

Given these BCs, a rough calculation,

delta t = CFL * delta x/ Velocity
= 0.5 * 5 mm/40 / 1 mm/sec
~ 0.06 seconds

So, I will expect delta t to be on the order of 0.01 seconds. But, OpenFOAM adjusted it to 3e-7 seconds. What could be the reason? Is there any way to print out all the courant numbers on each cell calulcated by the code?

Can anyone run a quick simple axi-symmetric (tube) calculation (20X40 cells in X-Y axis) to confirm this?

Pei

Pei-Ying Hsieh (Hsieh) February 24, 2005 09:27

Hi, Eugene, Thanks for the
 
Hi, Eugene,

Thanks for the reply. I suspect this problem could be due to my setup, but, this is such a simple problem.

Let me describe my steps again:

1. cloned the case from the damBreak case.
(so, this is a 2-phase flow problem with air/water, with surface tension and contact angle).
2. computational domain is axi-symmetric. In the user manual, it mentioned using wedge for the two side faces.
3. revised the BlockMeshDict so that domain is 2 mm by 5 mm (with 20 by 40 cells in X-dir and Y-dir).
4. generated mesh, checked using paraFoam - no obvious problem found.
5. runFoamX, set the boundary conditions, inlet velocity is set to 0.001 in Y-dir. For inlet, gamma set to 1, so that water starts to flow into the domain when simulation starts.
6. setup start time, end time, initial delta t to 1e-5.
7. at time t=0, computation domain is set to gamma = 0 (that is, no special initialized done - no setgammaDamBreak type thing).

Pei

Eugene de Villiers (Eugene) February 24, 2005 09:45

2. The dambreak geometry is n
 
2. The dambreak geometry is not axi-symmetric. It is a very flat 3D case (move it around in paraview and you will see). So you cant use wedge BCs on the side patches unless you collapse one side of the domain to an edge. Anyway, if the problem is still 2D, there is little point in using wedge patches since they are for rotating flows.

5. That flow speed is awfully slow. Given that gravity is switched on in the dambreak case, your inlet is likely to run "dry" (fluid moves away from the inlet faster than it enters). This will cause the code to diverge, because of a surface tension-gamma gradient related problem (check old posts for details). If the inlet is from below, none of this matters of course.

To aid diagnostics, dump the results very frequently and look where the high velocities are originating.

Pei-Ying Hsieh (Hsieh) February 24, 2005 10:57

Hi, Eugene, I cloned the d
 
Hi, Eugene,

I cloned the damBreak case because I am doing 2-fluid VOF simulation. The BlockMeshDict was re-built for an axi-symmetric geometry (a tube). According to the user manual, wedge type BC should be used for the two sides (circular).

X-dir is the radial direction and Y-direction is the axial direction. Flow inlet is located below and outlet on top. In this case, gravity should have no impact on velocity because the inlet velocity was specified. Gamma = 1 was specified at the inlet, so, the inlet should never run dry.

Thanks!

Pei

PS: this is a very simple test problem. An axi-symmetric tube, initially empty (fill with air with 0 verocity everywhere). At time 0, water starts to flow into the tube (from below) at 0.001 m/s. Tube length = 5 mm and tube radius = 2 mm. Surface tension turned on (same as the damBreak case). Wall contact angle set to 90 degree.

Ali (Ali) February 24, 2005 11:38

Pei, As Eugene mentioned,
 
Pei,

As Eugene mentioned, usually, for liquid jet problem only setting gamma=1 at inlet is not enough. if you just extend the inlet and fill three or four cells with liquid (instead of just 1 cell), your problem may be resolved.

PS: A stupid question, but are you sure your scaling is right. i.e. the value of 'convertToMeters' in blockMeshDict should be in order of 1 in your case)

Ali (Ali) February 24, 2005 11:42

Plus, in very small velocites
 
Plus, in very small velocites and small scales (higher curvature), you may get spurious velocities due to surface tension) higher than jet velocity and that screws up everything.

To make sure this is not happenning, try this:

1 m/s. Tube length = 5 m and tube radius = 2 m

I know if you do this Reynolds changes a lot, but 'delta-t' again should be in the same range as you want.

Pei-Ying Hsieh (Hsieh) February 24, 2005 13:10

Hi, Ali, Great! I basical
 
Hi, Ali,

Great! I basicaly set the ConvertToMeters to 1 (so, the geometry is 2 m and 5 m, respectively).
Set inlet velocity to 1 m/s. I got qood results.

OK, so, for small ID tube (2 mm), surface tension has a strong effect on stability. I have similar simulation using Fluent and did not have the same problem. I am going to repeat exactly the same problem using Fluent today. I will report back my results.

Ali, why did you say the ConvertToMeters should be 1 in my previous case? The values were for mm, so, I set ConvertToMeters to 0.001 so that it converts to meter, correct?

Pei

Pei-Ying Hsieh (Hsieh) February 24, 2005 13:13

By the way, in the previous t
 
By the way, in the previous testing suggested by Ali ( 2 m by 5 m, and 1 m/s inlet vel), I did NOT fill any cells next to the inlet to fluid (and still got good results).

Pei

Pei-Ying Hsieh (Hsieh) February 24, 2005 14:37

HI, I just ran my original
 
HI,

I just ran my original case (2 mm by 5 mm tube) and set the surface tension constant, sigma, to 0.001 (it was 0.07), inlet vel is 0.001 m/s. In this case, the effect of surface tension force is minimized. I got 6.9e-7 detal t still. So, does it mean that the surface tension force is not the problem?

Pei

Ali (Ali) February 24, 2005 14:50

Qoute from Pei:"Ali, why did
 
Qoute from Pei:"Ali, why did you say the ConvertToMeters should be 1 in my previous case? The values were for mm, so, I set ConvertToMeters to 0.001 so that it converts to meter, correct?
"

Yeah sorry you're right I meant 1e-3 not 1.

---------------------------
1) Why don't you turn off the gravity and see if there is any difference.

2) How you tried 0 (zero) surface tension? What you get then?

3) I still think the problem decreases if you fill the inlet with some cells.

4) It may not be solely surface tension, it can be the interFoam tracking and pressure-velocity coupling. So, fill the inlet with some fluid and see what happens.

Low velocity jets are still difficult to deal with.

Pei-Ying Hsieh (Hsieh) February 24, 2005 21:40

Hi, Ali, I will try turnin
 
Hi, Ali,

I will try turning off the gravity next.

I set surface tension constant from 0.07 to 0.0001 and contact angle to 1 degree -> surface tension force should be small enough.

I will try filling few cells with water near the inlet also. How to do this the easy way?

I started a Fluent run tonight. At the early stage, it seems holding up.

Regards,

Pei

Pei-Ying Hsieh (Hsieh) March 2, 2005 08:09

Hi, Problem solved by Hen
 
Hi,

Problem solved by Henry. In the BlockMeshDict set up, I only had one wedge (I put all the wedge faces into one) BC. This needs to be paired.

Also, Ali was correct, I do need to initialize some cells close to the entrance with liquid.

Thanks!

Pei

Ali (Ali) March 2, 2005 08:30

But, still the bad thing is t
 
But, still the bad thing is that if you fill some cells with liquid but your inlet is not perpendicular to the patch (i.e. inclined inlet, say you have inlet flow from the left boundary but it is not exactly from left to right, it also makes an angle with bottom boundary), it has problems with that too. This is one of the problems to be solved.

hjasak November 23, 2005 10:06

setFields: works for me every
 
setFields: works for me every time. It's worth checking whether your specification makes sense, e.g. whether the box you have given falls into the actual mesh and similar. Try it on the dam break tutorial and you will see it working.

(do you use a scaling factor in blockMesh?)


Enjoy,

Hrv


All times are GMT -4. The time now is 19:22.