Structured Adaptive Mesh Refinement, and KRANC - "UFL for finite difference"
I'm reading about structured adaptive mesh refinement (SAMR). I found this useful overview: http://irfu.cea.fr/Projets/COAST/amr_lecture2.pdf (Lecture 1 is interesting too but more about the numerical analysis). There are lots of SAMR codes. The applications are dominated by astrophysics - presumably because they have huge dynamic ranges but no tricky boundary geometry ("We have simulated half of the observable universe, with “resolved” dark matter halos as small as the Milky Way"). Along the way I discovered KRANC (http://kranccode.org/documentation.html), automatic code generation tool based on a DSL embedded in Mathematica. Here's an example: << "KrancThorn.m"; groups = {{"evolved_group", {phi, pi}}}; derivatives = { PDstandard2nd[i_] -> StandardCenteredDifferenceOperator[1,1,i], PDstandard2nd[i_, i_] -> StandardCenteredDifferenceOperator[2,1,i] }; PD = PDstandard2nd; initialSineCalc = { Name -> "initial_sine", Schedule -> {"AT INITIAL"}, Equations -> { phi -> Sin[2 Pi (x - t)], pi -> -2 Pi Cos[2 Pi (x - t)] } }; evolveCalc = { Name -> "calc_rhs", Schedule -> {"in MoL_CalcRHS"}, Equations -> { dot[phi] -> pi, dot[pi] -> Euc[ui,uj] PD[phi,li,lj] } }; CreateKrancThornTT[groups, ".", "SimpleWave", Calculations -> {initialSineCalc, evolveCalc}, PartialDerivatives -> derivatives, DeclaredGroups -> {"evolved_group"}]; The generated finite-difference stencil code is linked off the site above, here http://kranccode.org/SimpleWave.tar.gz More detail with another example and how it fits into the larger AMR systemcontext is here: https://bluewaters.ncsa.illinois.edu/c/document_library/get_file?uuid=a32a5c... There are references to the use in the generated code of a CARPET package called loopcontrol to do openMP parallelisation and tiling for cache but I couldn't find any systematic study on this - which is a pity as it should be possible to do something very nice compared to the many stencil code generators out there. Or plug into them, eg into PPCG. Paul
participants (1)
- 
                
                Kelly, Paul H J