Walker: Integrating the skew-normal SDE
This example runs Walker to integrate the skew-normal SDE (see DiffEq/SkewNormal.h) using constant coefficients.
Control file
title "Example problem" walker term 10.0 # Max time dt 0.001 # Time step size npar 10000 # Number of particles ttyi 1000 # TTY output interval rngs mkl_r250 seed 1 end end skew-normal depvar m init zero coeff const ncomp 2 T 1.0 3.5 end sigmasq 0.04 0.25 end lambda 100.0 -50.0 end rng mkl_r250 end statistics interval 2 <m1m1> <m2m2> end pdfs interval 10 filetype txt policy overwrite centering elem format scientific precision 4 p1( M1 : 1.0e-2 ) p2( M2 : 1.0e-2 ) end end
Example run on 4 CPUs
./charmrun +p4 Main/walker -v -c ../../tmp/test.q -u 0.9
Results
The left figure shows the first two moments indicating convergence to a statistically stationary state. The right one shows the estimated PDFs with their analytical solution (see DiffEq/SkewNormal.h).
Gnuplot commands to reproduce the above plots:
plot "stat.txt" u 2:3 w l t "<M1>", "stat.txt" u 2:4 w l t "<M2>", "stat.txt" u 2:5 w l t "<m1m1>", "stat.txt" u 2:6 w l t "<m2m2>" plot "pdf_p1.txt" w p, "pdf_p2.txt" w p, exp(-x*x/2/0.2/0.2)*(1+erf(100.0*x/sqrt(2)))/0.2/sqrt(2*pi) lt 1, exp(-x*x/2/0.5/0.5)*(1+erf(-50.0*x/sqrt(2)))/0.5/sqrt(2*pi) lt 2