Saturday, 19 December 2015

First to Higher Order Blending

This is just a quick post on first-to-higher-order blending. First-to-higher-order blending is used when you want something in between a first order upwind and a second order upwind scheme in your simulation. Say you are trying to solve, and you get good convergence in first order, but when you move to second order you have trouble getting a converged solution - you can use first-to-higher-order blending to make this change gradually.

I've written a scheme journal file that'll do this gradual ramp-up. Scheme can be used just like a normal journal file. I've found the main difference between scheme and journal files is that scheme code gives you more options. Here I'm using scheme to do a loop (which to my knowledge isn't possible in an ordinary journal file). I've found that one downside is that scheme is more difficult to cancel & quit halfway through a calculation. It can also be more difficult to write.  

This scheme file slowly ramps up the first-to-higher-order blending value from 0 to 1, linearly over 1000 iterations (0,0.001,0.002,...). It'll then run the full second (or whatever) order sim. for another 1000 iterations. To use it take your first order case file, then change the "solution methods" from first order upwind to the new discretisation you want, then read the scheme file. You'll first need the scheme code saved as a .scm file in the directory. I do this using notepad & recommend it (copy and paste the code, go to save as, type: all files, add .scm to the end of the file name).

;;------------------------------------------------------------------
;;scheme function for ramping-up to second order
;;ramps up over 1000 iterations
;;JRH 18_12_15 cfdyourself.blogspot.co.uk
;;------------------------------------------------------------------
(do ((i 0 (+ i 1)) ) ((> i 999.1));;do loop for 1000 iterations
(define r (/ i 1000))
(ti-menu-load-string (format #f "/solve/set/numerics no yes no no no ~a " r));;
(ti-menu-load-string "/solve/iterate 1 ");;run the simulation for 1 iteration
);;end of the do loop
(ti-menu-load-string "solve/set/numerics no yes no no no 1 ")
(ti-menu-load-string "solve/iterate 1000 ")

No comments:

Post a Comment