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

Manual limiter of velocity doesn't work

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

Like Tree12Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 6, 2013, 18:38
Default
  #41
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
saying better i have a total pressure inflow bc that U goes very high(supersonic) on it.
May limitation of U have bad effect on totalpressure result?mean p0 may change indirectly?
immortality is offline   Reply With Quote

Old   April 7, 2013, 02:45
Default
  #42
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
dear Simone and others whats your opinion about this?
Does anyone has experience in limiting on velocity?whats its effect?when we can(its true)to do that?
immortality is offline   Reply With Quote

Old   April 7, 2013, 10:22
Default
  #43
Senior Member
 
Join Date: Nov 2009
Location: Michigan
Posts: 135
Rep Power: 16
doubtsincfd is on a distinguished road
In my experience, manually limiting of the velocity destroyed the continuity conservation, which always caused the solution to blow up. This is just a guess though. Have you tried running the same case in commercial software like fluent? The compressible solver of fluent is much more stable.
doubtsincfd is offline   Reply With Quote

Old   April 7, 2013, 14:00
Default
  #44
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
what if only constraint velocity on inflow patch in your opinion?
I have set a total pressure in inflow patch but velocity goes very high.
immortality is offline   Reply With Quote

Old   April 8, 2013, 15:04
Default
  #45
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
why total pressure is unstable in inflow as well as outflow?
pressure after inflow patch goes low but velocity turns very high.
has anyone had any experience related?
immortality is offline   Reply With Quote

Old   April 9, 2013, 16:58
Default
  #46
Member
 
Simone
Join Date: Sep 2012
Posts: 95
Rep Power: 13
batta31 is on a distinguished road
I'm sorry I haven't.
batta31 is offline   Reply With Quote

Old   April 16, 2013, 04:07
Default
  #47
Senior Member
 
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 249
Rep Power: 16
fredo490 is on a distinguished road
Hello,
To answer your question about limiting the velocity or other variable, I would say that it can be a helpful thing to go through the first iterations. It can help to avoid some crazy values leading to divergence. However, as many people said, limiting the velocity can lead to continuity error (and many others).

The limitation of a value is only good to help you to reach the actual state of your problem. The limitation of any variable can only be temporary ! It cannot be used during your computation. So, once you converge your case, you must use a solver that doesn't have any fake limiting process.


I see that you use rhoPimpleFoam. I had lots of trouble to use this solver so the best is to share some cases. For subsonic flow, I use a fixedValue for the velocity at the intet and a fixeValue of pressure at the outlet.

Usually, I use this technic:

1) I run my case with rhoSimplecFoam with very small relaxation number if needed (can go down to 0.1 or even 0.01). This is just to get a first field. You have to know that those low relaxation numbers will lead to unphysical results because it doesn't satisfy continuity and other. I usually run for few hundred or thousand of iterations.
http://www.fredo490.fr/public/rhoSim...aca12-AOA4.zip

2) I run the previous case with higher relaxation number. So I use the final results from the previous solver as initialization of this solver. I usually increase all the relaxation numbers over 0.5. This should immediately converge your case and remove all unphysical behavior.
http://www.fredo490.fr/public/rhoSim...a12-AOA4_2.zip

3) Finally, I use the second solver data to initialize the unsteady solver. I have found that rhoLTSPimpleFoam is more stable that rhoPimpleFoam. If you run OpenFoam 2.2, rhoLTSPimpleFoam is now a solver. If you run OpenFoam 2.1, you can use rhoPorousMRFLTSPimpleFoam where you remove all Porous zones.
http://www.fredo490.fr/public/rhoLTS...aca12-AOA4.zip

I have another case with a cylinder which is already in an unsteady solver:
http://www.fredo490.fr/public/rhoLTS...m-Cylinder.zip

I have found that for "coarse" mesh, this strategy is quite robust. However, for fine mesh you might have to play with the different relaxation number to get the data you want. Also, don't be afraid to use paraview to choose the best (the most realistic I would say) timeStep between the 1 and 2 solver.



By the way, I've found your topic because I'm also looking for a velocity limiter (for a custom solver) but I don't like the hard coding you have made.

I want to get something like
Code:
U[cellI].component(0)=min(U[cellI].component(0), Umax);
Instead of
Code:
U[cellI].component(0)=min(U[cellI].component(0), T[cellI]);
Where Umax would be defined in fvSolution and read by createfield:
Code:
dimensionedScalar Umax(pimple.dict().lookup("Umax"));
But this code leads to a compiling error... Does anyone know why ?
immortality likes this.
fredo490 is offline   Reply With Quote

Old   April 18, 2013, 13:19
Default
  #48
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
hi
thank you very much.did you resolve it?
how can change the solver code to limit velocity in a few first time steps?what the loop looks like?
and also what are:
Code:
rDeltaTSmoothingCoeff 0.1;
    rDeltaTDampingCoeff 1;
in rhoLTSPimpleFoam?
immortality is offline   Reply With Quote

Old   April 18, 2013, 13:50
Default
  #49
Senior Member
 
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 249
Rep Power: 16
fredo490 is on a distinguished road
No I didn't think about it.

You can set a condition over iterations but I don't think it is good. The best is to use two different solver. Or you can also plot a warning if the velocity is too high.

The two variables you showed are used in the local Euler theory. You have to study the code to see what they do.
fredo490 is offline   Reply With Quote

Old   April 18, 2013, 14:00
Default
  #50
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
I had seen the code before but didn't figure out what they do.then they use in steady problems,right?
if its so so i don't need them.
immortality is offline   Reply With Quote

Old   April 18, 2013, 14:30
Default
  #51
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
could you tell me briefly what does "Flow time scale min/max"do?
Code:
Courant Number mean: 2.352854271e-05 max: 0.01998727105
deltaT = 2.350645117e-09
Time = 2.68031e-06

Flow time scale min/max = 9.408568525e-08, 1019064460
Smoothed flow time scale min/max = 9.408568525e-08, 6.914500696e-06
PIMPLE: iteration 1
DILUPBiCG:  Solving for Ux, Initial residual = 0.000465510346, Final residual = 7.623530914e-21, No Iterations 3
DILUPBiCG:  Solving for Uy, Initial residual = 0.0005414832991, Final residual = 1.15211825e-21, No Iterations 3
DILUPBiCG:  Solving for h, Initial residual = 0.001983528539, Final residual = 1.406106776e-21, No Iterations 3
DICPCG:  Solving for p, Initial residual = 0.0009278382132, Final residual = 1.999995682e-21, No Iterations 2
diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
my case is unsteady.doesn't have it any bad effect on the problem?
immortality is offline   Reply With Quote

Old   April 18, 2013, 15:16
Default
  #52
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
and why did you use localEuler in unsteady cases?isn't it only for steady state cases?
immortality is offline   Reply With Quote

Old   April 19, 2013, 01:58
Default
  #53
Senior Member
 
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 249
Rep Power: 16
fredo490 is on a distinguished road
With the localEuler, the time becomes a variable. You can see a rDeltaT in the output files. This allows to "slow down" the time step in the area where the cells are very small.

The flow scale is relative to the local time step of the cell. It's like each cell has its own time step. The number is 1/LocalTimeStep.

By the way, I think your settings have some problems. It looks like the simulation you show has a modifiable time step (or do you really use "deltaT = 2.350645117e-09" ?!). You can remove it and use a fixed time step because it is the localEuler that manage the time stepping (not anymore the solver based on the Courant Number).

The localEuler is an unsteady method that helps you to reach the steady state of your simulation. It is different from a steady solver because you still have the unsteady terms in the equation. But the unsteady term is modified/smoothed to reach the steady state. It's not right to use the localEuler scheme for a real unsteady case but if your settings are good, it is a very good approximation for a low computer power cost.
fredo490 is offline   Reply With Quote

Old   April 19, 2013, 09:54
Default
  #54
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
thanks.yes I use modifiable with low Co (almost .02) to residuals be small(is this work correct?)
could you briefly explain me about what does the coefficients do?
Code:
rDeltaTSmoothingCoeff 0.1;
    rDeltaTDampingCoeff 1;
which values is more appropriate for a real unsteady problem that accuracy be acceptable?
(isn't it more appropriate to set rDeltaTSmoothingCoeff to .9 rather than .1 and damping to 1 in my case thats really unsteady?)
and also do these coeffs work if i select another time scheme except of localEuler?
thanks

Last edited by immortality; April 19, 2013 at 10:20.
immortality is offline   Reply With Quote

Old   April 21, 2013, 16:13
Default
  #55
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
dear Heckmann my case is like shock tube but some essential differences:
1)flow in the tube is the same and homogenous everywhere at rest at start.
2)left wall starts gradually(cell by cell) to open and a high pressure flow(by boundary condition) starts to flowing in the rest flow in tube.so a shock is originated.
(in fact diaphragm is replaced by gradually opening wall)
so in spite of your nice algorithm I don't know how to perform that in my case.
do you or anybody have some piece of advice related this subject?
thanks.
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   April 22, 2013, 12:51
Default
  #56
Senior Member
 
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 249
Rep Power: 16
fredo490 is on a distinguished road
People usually use SonicFoam to run simulation of ChockTube. You need to run with small time step and try to avoid the adaptive time stepping. Choose a small enough time step and keep it constant (at least at the beginning).
fredo490 is offline   Reply With Quote

Old   April 22, 2013, 13:34
Default
  #57
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
sonicFoam doesn't have control options that rhoPimpleFoam has.
I now using rhoLTSPimpleFoam does it use adaptive time step?I have disabled rDeltaT damping and smoothing coeffs.(or do you mean maxCo by adaptive time?)
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.

Last edited by immortality; April 22, 2013 at 14:02.
immortality is offline   Reply With Quote

Old   April 22, 2013, 13:52
Default
  #58
Senior Member
 
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 249
Rep Power: 16
fredo490 is on a distinguished road
You've mixed everything
1) rhoPimpleFoam: has one time step for all your domain. This time step can be dynamically controlled to match a criteria. In your case you use the Courant Number. So Openfoam will try to get the biggest time step possible while respecting your maximum Courant Number at the same time. (cf. Definition of Courant Number).

2) rhoLTSPimpleFoam: has many time step in your domain. Basically each cell has it own time step... You don't have one time step but many. Each local time step is automatically computed to respect a given Courant Number (different from the maxCo of rhoPimpleFoam). It is why you get the rDeltaT variable in your output which is actually your local time step value. The LTS algorithm takes 1 global time step as reference and then from this one creates many local time steps. It is stupid to ask the LTS to respect the maxCo of rhoPimpleFoam because it already respect this criteria using the local time steps. Plus, if you do so, OpenFoam is lost and it doesn't know what to do... You often finish with crazy time step (infinitely small).

So in the LTS algorithm, DO NOT PUT THE ADAPTIVE TIME STEP !
immortality likes this.
fredo490 is offline   Reply With Quote

Old   April 23, 2013, 02:56
Default
  #59
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
thanks.but i'm still mixed up about rhoLTSFoam.
1)if i use cranckNicolson .5
Then still local time step is used?or only when use localEuler?
2)is using local time step good or bad for my case that's really unsteady and because of change of BC's it doesn't reach a steady-state at all and shouldn't reach.
3)how to assign damping and smoothing(and maybe other related) coefficients?
It'll be very valuable for me if clarify these for me.
Thanks.
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   April 23, 2013, 04:29
Default
  #60
Senior Member
 
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 249
Rep Power: 16
fredo490 is on a distinguished road
1) The LTS algorithm is only used if you set the ddt scheme a localEuler. For example in my custom mutiphase solver, I have:
Code:
ddtSchemes
{
    default        		none;
    ddt(rho,h)         		localEuler rDeltaT;
    ddt(rho,e)         		localEuler rDeltaT;
    ddt(rho,K)         		localEuler rDeltaT;
    ddtPhiCorr(rAU,rho,U,phi)	localEuler rDeltaT;
    ddt(thermo:psi,p)        		localEuler rDeltaT;
    ddt(p)         		localEuler rDeltaT;
    ddt(rho)         		localEuler rDeltaT;
    ddt(rho,epsilon)         	localEuler rDeltaT;
    ddt(rho,k)         		localEuler rDeltaT;
    ddt(rho,U)         		localEuler rDeltaT;
    ddt(alphap)			CrankNicolson 0.5;
    ddt(alphap,Up)		CrankNicolson 0.5;
}
Therefor, all my air equations will be solved using the LTS algorithm but my second phase (alphap) will be solved using CrankNicholson. But be careful, I think that if your equations are coupled, you cannot mixed schemes like that (need to check). It is why all my first phase (air) uses the same scheme and my second phase (partially uncoupled) can use another scheme.

2) local time stepping has the same effect as a relaxation number. When you use it, you actually make mistakes on your fields because continuity is no guaranty ! The quantity of mistake you get is somehow related to the reference time step you choose. If your reference time step is small enough, the LTS actually becomes close to a simple Euler and so you don't get extra mistake (continuity is respected).

The idea while using LTS is that you need to balance the Stability vs Accuracy vs Time Step Length. The goal of LTS is to give a very good stability in your computation. The solver is so stable that it will not crash but it will give you nonphysical results. If you use a reference time step lower than the required (based on Courant Number < 0.2), the algorithm will work almost like a Euler and your results will be good. The advantage over a pure Euler, it is that your simulation will not blow up if the Courant Number temporary goes over 1.

3) those factors are based on your feeling and your case It is like the relaxation number, there is no universal rule. The tutorial values are usually given as "well balanced".


Ps. if your goal is to get a great unsteady accuracy, definitely forget localEuler ! You need to find good global settings and a specific convergence strategy.
fredo490 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
UDF error - parabolic velocity profile - 3D turbine Zaqie Fluent UDF and Scheme Programming 9 June 25, 2016 19:08
unable to get parabolic velocity profile with pimplefoam houkensjtu OpenFOAM 4 October 8, 2012 04:41
Emergency:UDF for a time dependent parabolic velocity zumaqiong Fluent UDF and Scheme Programming 12 March 25, 2010 12:00
Neumann pressure BC and velocity field Antech Main CFD Forum 0 April 25, 2006 02:15
what the result is negatif pressure at inlet chong chee nan FLUENT 0 December 29, 2001 05:13


All times are GMT -4. The time now is 16:55.