transient convergence criteria
Hi,
I'm working on a periodic simulation and I'd like to set up a temporal convergence criteria. It would be something like if variable(t+T)=variable(t) then stop simulation In the swak4foam library there are tools to stop a simulation if a criteria is reached, something like (in controlDict) : Code:
stopHighVel Regards, Florian |
Quote:
|
Thank you for writeAndEndSwakExpression, I didn't know this one. I'm still wondering how to access data at a specified time. oldTime only works for one timeStep in the past...
Any idea ? Regards, Florian |
Quote:
|
Thank you very much, a mix of delayedVariables and writeAndEndSwakExpression works perfectly !
Regards, Florian. |
Quote:
|
Quote:
|
Quote:
|
Quote:
Test case : one intlet with a sinusoidal pressure, 2 free outlets. Code:
stopIfCrit { http://uppix.net/VXLVj8l.png With : blue = p(inlet), pink = 5% threshold, red and green : convergence criteria on both outlets. I was wondering : how can I add the period as a parameter ? Florian |
Quote:
Quote:
Code:
defaultDelay 0.7; Code:
delay $defaultDelay; |
Quote:
Code:
convcrit1 Quote:
Florian |
Quote:
|
Hi everyone,
I am not understanding well the use of this wonderful tool. I would like to stop my (steady) simulation when Residuals are below a given threshold (let's say 1e-4) and outlet velocity remains unchanged with iterations, so, I have included this in my controDict file: velocity_outlet { type patchExpression; accumulations ( average ); patches ( out ); expression "mag(U)"; verbose true; outputControl timeStep; outputInterval 1; } This computes averaged outlet velocity as I desired. But now I am not sure how to compare old and present values. I would like to: if |uaveraged(iteration n)-uaveraged(iteration n-1)|<0.1 and Residuals<1e-4 then STOP Based on the code I have seen here, I have tried something like this( forget about the Residuals in this first try) stopIfCrit { type writeAndEndSwakExpression; valueType internalField; logicalExpression "(tol < threshold)"; logicalAccumulation and; variables ( "UA1fter=velocity_outlet;" //delayed criteria on outlet1 "Ub41=velocity_outlet;" "tol=mag(UA1fter-Ub41);" "threshold=0.5;" "test=((tol < threshold) )? 1 : 0;" ); delayedVariables ( { name UA1fter; delay 1; storeInterval 1; startupValue "1"; } { name test; delay 1; storeInterval 1; startupValue "0"; } ); verbose true; outputControlMode timestep; outputInterval 1; } But nothing happens. It seems that I am not telling OpenFOAM when it has to stop .This definition I have tried looks so weird: "UA1fter=velocity_outlet;" //delayed criteria on outlet1 "Ub41=velocity_outlet;" Does anybody know how I have to proceed to compare a computed value in the previous iteration with this value in the current iteration? Thanks in advance!:) |
Quote:
Hi, you can look at the variables values that are stored during the simulation to check if they are what you expect (in the swak4Foam folder at each timeStep). You can use the [CODE ] [/CODE ] bracket to make the code readable. |
Hi Hiroshiman,
The values of: velocity_outlet { type patchExpression; accumulations ( average ); patches ( out ); expression "mag(U)"; verbose true; outputControl timeStep; outputInterval 1; } are written in postProcessing folder (no swak4foam folder in my case) The problem is I don't know how to use this values to stop my simulation when differences between consecutive iterations is small. Some more help will be much aprecciated. |
All times are GMT -4. The time now is 16:10. |