
[Sponsors] 
April 6, 2013, 18:38 

#41 
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,205
Rep Power: 18 
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? 

April 7, 2013, 02:45 

#42 
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,205
Rep Power: 18 
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? 

April 7, 2013, 10:22 

#43 
Senior Member
Join Date: Nov 2009
Location: Michigan
Posts: 135
Rep Power: 7 
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.


April 7, 2013, 14:00 

#44 
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,205
Rep Power: 18 
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. 

April 8, 2013, 15:04 

#45 
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,205
Rep Power: 18 
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? 

April 9, 2013, 16:58 

#46 
Member
Simone
Join Date: Sep 2012
Posts: 95
Rep Power: 5 
I'm sorry I haven't.


April 16, 2013, 04:07 

#47 
Senior Member
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 236
Rep Power: 8 
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...aca12AOA4.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...a12AOA4_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...aca12AOA4.zip I have another case with a cylinder which is already in an unsteady solver: http://www.fredo490.fr/public/rhoLTS...mCylinder.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); Code:
U[cellI].component(0)=min(U[cellI].component(0), T[cellI]); Code:
dimensionedScalar Umax(pimple.dict().lookup("Umax")); 

April 18, 2013, 13:19 

#48 
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,205
Rep Power: 18 
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; 

April 18, 2013, 13:50 

#49 
Senior Member
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 236
Rep Power: 8 
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. 

April 18, 2013, 14:00 

#50 
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,205
Rep Power: 18 
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. 

April 18, 2013, 14:30 

#51 
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,205
Rep Power: 18 
could you tell me briefly what does "Flow time scale min/max"do?
Code:
Courant Number mean: 2.352854271e05 max: 0.01998727105 deltaT = 2.350645117e09 Time = 2.68031e06 Flow time scale min/max = 9.408568525e08, 1019064460 Smoothed flow time scale min/max = 9.408568525e08, 6.914500696e06 PIMPLE: iteration 1 DILUPBiCG: Solving for Ux, Initial residual = 0.000465510346, Final residual = 7.623530914e21, No Iterations 3 DILUPBiCG: Solving for Uy, Initial residual = 0.0005414832991, Final residual = 1.15211825e21, No Iterations 3 DILUPBiCG: Solving for h, Initial residual = 0.001983528539, Final residual = 1.406106776e21, No Iterations 3 DICPCG: Solving for p, Initial residual = 0.0009278382132, Final residual = 1.999995682e21, No Iterations 2 diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0 

April 18, 2013, 15:16 

#52 
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,205
Rep Power: 18 
and why did you use localEuler in unsteady cases?isn't it only for steady state cases?


April 19, 2013, 01:58 

#53 
Senior Member
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 236
Rep Power: 8 
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.350645117e09" ?!). 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. 

April 19, 2013, 09:54 

#54 
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,205
Rep Power: 18 
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; (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. 

April 21, 2013, 16:13 

#55 
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,205
Rep Power: 18 
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. 

April 22, 2013, 12:51 

#56 
Senior Member
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 236
Rep Power: 8 
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).


April 22, 2013, 13:34 

#57 
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,205
Rep Power: 18 
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. 

April 22, 2013, 13:52 

#58 
Senior Member
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 236
Rep Power: 8 
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 ! 

April 23, 2013, 02:56 

#59 
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,205
Rep Power: 18 
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 steadystate 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. 

April 23, 2013, 04:29 

#60 
Senior Member
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 236
Rep Power: 8 
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; } 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. 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
UDF error  parabolic velocity profile  3D turbine  Zaqie  Fluent UDF and Scheme Programming  8  May 11, 2014 08:34 
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 13: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 06:13 