Examples » Walker: Integrating the mass-fraction beta SDE

This example runs Walker to integrate the mass-fraction beta SDE (see DiffEq/MassFractionBeta.h) using constant coefficients. The mass-fraction beta SDE is based on the beta SDE, additionally computing two more stochastic variables that are functions of the beta variables integrated. For more detail on the beta SDE, see https://doi.org/10.1080/14685248.2010.510843.

Control file

title "Test Ray's closure ideas for <y^2> and <rho v>"

walker

  #nstep 1      # Max number of time steps
  term  25.0    # Max time
  dt    0.002    # Time step size
  npar  10000   # Number of particles
  ttyi  500      # TTY output interval

  rngs
    mkl_r250 end
  end

  massfracbeta  # Select the mass-fraction beta SDE
    depvar Y    # Dependent variable: Y, denoting mass fractions
    ncomp 15    # = 3x5 = 5 systems each computing 3 variables:
                #   Y - mass fraction,
                #   R - density,
                #   V - specific volume
    init zero
    coeff const
    # alpha = Sb/kappa, beta = (1-S)b/kappa
    kappa 2.0  0.76923  0.5  0.15873  0.1 end
    b     0.4  1.0      1.0  1.0    100.0 end
    S     0.5  0.53846  0.5  0.39683  0.5 end
    rng mkl_r250
    rho2 1.0 1.0 1.0 1.0 1.0 end
    #r 0.0101 0.0101 0.0101 0.0101 0.0101 end # low-A
    r 9.0 9.0 9.0 9.0 9.0 end   # high-A
  end

  statistics
    #precision 5
    #format    default
    # <Y>, mass fraction means
    <Y1>        # 3
    <Y2>        # 4
    <Y3>        # 5
    <Y4>        # 6
    <Y5>        # 7
    # <rho>, mean densities
    <Y6>        # 8
    <Y7>        # 9
    <Y8>        # 10
    <Y9>        # 11
    <Y10>       # 12
    # <V>, mean specific volumes
    <Y11>       # 13
    <Y12>       # 14
    <Y13>       # 15
    <Y14>       # 16
    <Y15>       # 17
    # <y^2>, mass fraction variances
    <y1y1>      # 23
    <y2y2>      # 24
    <y3y3>      # 25
    <y4y4>      # 26
    <y5y5>      # 27
     # <rho^2>, density variances
    <y6y6>      # 28
    <y7y7>      # 30
    <y8y8>      # 32
    <y9y9>      # 34
    <y10y10>    # 36
    # <v^2>, specific volume variances
    <y11y11>    # 38
    <y12y12>    # 39
    <y13y13>    # 40
    <y14y14>    # 41
    <y15y15>    # 42
     # <rho v>, density-specific-volume covariances
    <y6y11>     # 29
    <y7y12>     # 31
    <y8y13>     # 33
    <y9y14>     # 35
    <y10y15>    # 37
     # <rho v^2>
    <Y6y11y11>  # 18
    <Y7y12y12>  # 19
    <Y8y13y13>  # 20
    <Y9y14y14>  # 21
    <Y10y15y15> # 22
  end

  pdfs
    interval  100
    filetype  txt
    policy    overwrite
    centering elem
    format    scientific
    precision 4
    p1( Y1 : 1.0e-2 )
    p2( Y2 : 1.0e-2 )
    p3( Y3 : 1.0e-2 )
    p4( Y4 : 1.0e-2 )
    p5( Y5 : 1.0e-2 )
  end
end

Example run on 8 CPUs

./charmrun +p8 Main/walker -v -c ../../tmp/massfracbeta.q

Results

The rationale for these runs is to integrate the system in time, extract the time evolution of various statistics, and then test several different closure hypotheses among the statistics. Example gnuplot commands to plot and test some closure ideas are:

# vim: filetype=gnuplot:

# Nomenclature:
# -------------
# V - instantaneous specific volume
# R - instantaneous density
# v = V - <V>, fluctuating specific volume
# r = R - <R>, fluctuating density
# b = -<rv>, density-specific-volume covariance
# B - as postfix means the Bousinessq approximation
# nm - no-mix value

# <y^2> / <y^2>nm = <r^2> / <r^2>nm = b / bnm, low At
plot "stat.txt" u 2:($23/($3*(1.0-$3))) w l t "<y^2>/<y^2>nm", "stat.txt" u 2:($28/((0.0101**2)/((1.0+0.0101)**3)*$3*(1.0-$3))) w l t "<r^2>/<r^2>nm", "stat.txt" u 2:(-$29/($3*(1.0+$3)*0.0101*0.0101/(1.0+0.0101))) w l t "b/bnm" # no-mix
plot "stat.txt" u 2:($24/($4*(1.0-$4))) w l t "<y^2>/<y^2>nm", "stat.txt" u 2:($30/((0.0101**2)/((1.0+0.0101)**3)*$4*(1.0-$4))) w l t "<r^2>/<r^2>nm", "stat.txt" u 2:(-$31/($4*(1.0+$4)*0.0101*0.0101/(1.0+0.0101))) w l t "b/bnm"
plot "stat.txt" u 2:($25/($5*(1.0-$5))) w l t "<y^2>/<y^2>nm", "stat.txt" u 2:($32/((0.0101**2)/((1.0+0.0101)**3)*$5*(1.0-$5))) w l t "<r^2>/<r^2>nm", "stat.txt" u 2:(-$33/($5*(1.0+$5)*0.0101*0.0101/(1.0+0.0101))) w l t "b/bnm" # uniform
plot "stat.txt" u 2:($26/($6*(1.0-$6))) w l t "<y^2>/<y^2>nm", "stat.txt" u 2:($34/((0.0101**2)/((1.0+0.0101)**3)*$6*(1.0-$6))) w l t "<r^2>/<r^2>nm", "stat.txt" u 2:(-$35/($6*(1.0+$6)*0.0101*0.0101/(1.0+0.0101))) w l t "b/bnm"
plot "stat.txt" u 2:($27/($7*(1.0-$7))) w l t "<y^2>/<y^2>nm", "stat.txt" u 2:($36/((0.0101**2)/((1.0+0.0101)**3)*$7*(1.0-$7))) w l t "<r^2>/<r^2>nm", "stat.txt" u 2:(-$37/($7*(1.0+$7)*0.0101*0.0101/(1.0+0.0101))) w l t "b/bnm" # almost mixed

# <y^2> / <y^2>nm = <r^2> / <r^2>nm = b / bnm, high At
plot "stat.txt" u 2:($23/($3*(1.0-$3))) w l t "<y^2>/<y^2>nm", "stat.txt" u 2:($28/((9.0**2)/((1.0+9.0)**3)*$3*(1.0-$3))) w l t "<r^2>/<r^2>nm", "stat.txt" u 2:(-$29/($3*(1.0+$3)*9.0*9.0/(1.0+9.0))) w l t "b/bnm" # no-mix
plot "stat.txt" u 2:($24/($4*(1.0-$4))) w l t "<y^2>/<y^2>nm", "stat.txt" u 2:($30/((9.0**2)/((1.0+9.0)**3)*$4*(1.0-$4))) w l t "<r^2>/<r^2>nm", "stat.txt" u 2:(-$31/($4*(1.0+$4)*9.0*9.0/(1.0+9.0))) w l t "b/bnm"
plot "stat.txt" u 2:($25/($5*(1.0-$5))) w l t "<y^2>/<y^2>nm", "stat.txt" u 2:($32/((9.0**2)/((1.0+9.0)**3)*$5*(1.0-$5))) w l t "<r^2>/<r^2>nm", "stat.txt" u 2:(-$33/($5*(1.0+$5)*9.0*9.0/(1.0+9.0))) w l t "b/bnm" # uniform
plot "stat.txt" u 2:($26/($6*(1.0-$6))) w l t "<y^2>/<y^2>nm", "stat.txt" u 2:($34/((9.0**2)/((1.0+9.0)**3)*$6*(1.0-$6))) w l t "<r^2>/<r^2>nm", "stat.txt" u 2:(-$35/($6*(1.0+$6)*9.0*9.0/(1.0+9.0))) w l t "b/bnm"
plot "stat.txt" u 2:($27/($7*(1.0-$7))) w l t "<y^2>/<y^2>nm", "stat.txt" u 2:($36/((9.0**2)/((1.0+9.0)**3)*$7*(1.0-$7))) w l t "<r^2>/<r^2>nm", "stat.txt" u 2:(-$37/($7*(1.0+$7)*9.0*9.0/(1.0+9.0))) w l t "b/bnm" # almost mixed

# consistency test: <Rv^2> = b<V> = b(1+b)/<R>, both At
plot "stat.txt" u 2:18 w l t "<Rv^2>", "stat.txt" u 2:(-$29*$13) w p ps 1.0 pt 7 t "b<V>", "stat.txt" u 2:(-$29*(1.0-$29)/$8) w p ps 1.0 pt 7 t "b(1+b)/<R>" # no-mix
plot "stat.txt" u 2:19 w l t "<Rv^2>", "stat.txt" u 2:(-$31*$14) w p ps 1.0 pt 7 t "b<V>", "stat.txt" u 2:(-$31*(1.0-$31)/$9) w p ps 1.0 pt 7 t "b(1+b)/<R>"
plot "stat.txt" u 2:20 w l t "<Rv^2>", "stat.txt" u 2:(-$33*$15) w p ps 1.0 pt 7 t "b<V>", "stat.txt" u 2:(-$33*(1.0-$33)/$10) w p ps 1.0 pt 7 t "b(1+b)/<R>" # uniform
plot "stat.txt" u 2:21 w l t "<Rv^2>", "stat.txt" u 2:(-$35*$16) w p ps 1.0 pt 7 t "b<V>", "stat.txt" u 2:(-$35*(1.0-$35)/$11) w p ps 1.0 pt 7 t "b(1+b)/<R>"
plot "stat.txt" u 2:22 w l t "<Rv^2>", "stat.txt" u 2:(-$37*$17) w p ps 1.0 pt 7 t "b<V>", "stat.txt" u 2:(-$37*(1.0-$37)/$12) w p ps 1.0 pt 7 t "b(1+b)/<R>" # almost mixed

# b = <R>^2<v^2> [1 + <v^2>/<v^2>nm * (rho1rho2/<R>^2 - 1) ] where <v^2>nm = (r/rho_2)^2 <y^2>nm, <y^2>nm = <Y>(1-<Y>), low At
plot "stat.txt" u 2:(-$29) w l t "b", "stat.txt" u 2:($8*$8*$38*(1.0+$38/0.0101/0.0101/$3/(1.0+$3)*(0.99/$8/$8-1.0))) w p ps 1.0 pt 7 t "<R>^2<v^2> [1 + <v^2>/<v^2>nm * (rho_1rho_2/<R>^2 - 1) ]" # no-mix
plot "stat.txt" u 2:(-$31) w l t "b", "stat.txt" u 2:($9*$9*$39*(1.0+$39/0.0101/0.0101/$4/(1.0+$4)*(0.99/$9/$9-1.0))) w p ps 1.0 pt 7 t "<R>^2<v^2> [1 + <v^2>/<v^2>nm * (rho1_rho2/<R>^2 - 1) ]"
plot "stat.txt" u 2:(-$33) w l t "b", "stat.txt" u 2:($10*$10*$40*(1.0+$40/0.0101/0.0101/$5/(1.0+$5)*(0.99/$10/$10-1.0))) w p ps 1.0 pt 7 t "<R>^2<v^2> [1 + <v^2>/<v^2>nm * (rho_1rho2/<R>^2 - 1) ]" # uniform
plot "stat.txt" u 2:(-$35) w l t "b", "stat.txt" u 2:($11*$11*$41*(1.0+$41/0.0101/0.0101/$6/(1.0+$6)*(0.99/$11/$11-1.0))) w p ps 1.0 pt 7 t "<R>^2<v^2> [1 + <v^2>/<v^2>nm * (rho_1rho_2/<R>^2 - 1) ]"
plot "stat.txt" u 2:(-$37) w l t "b", "stat.txt" u 2:($12*$12*$42*(1.0+$42/0.0101/0.0101/$7/(1.0+$7)*(0.99/$12/$12-1.0))) w p ps 1.0 pt 7 t "<R>^2<v^2> [1 + <v^2>/<v^2>nm * (rho_1rho2/<R>^2 - 1) ]" # almost mixed

# b = <R>^2<v^2> [1 + <v^2>/<v^2>nm * (rho1rho2/<R>^2 - 1) ] where <v^2>nm = (r/rho_2)^2 <y^2>nm, <y^2>nm = <Y>(1-<Y>), high At
plot "stat.txt" u 2:(-$29) w l t "b", "stat.txt" u 2:($8*$8*$38*(1.0+$38/9.0/9.0/$3/(1.0+$3)*(0.1/$8/$8-1.0))) w p ps 1.0 pt 7 t "<R>^2<v^2> [1 + <v^2>/<v^2>nm * (rho_1rho_2/<R>^2 - 1) ]" # no-mix
plot "stat.txt" u 2:(-$31) w l t "b", "stat.txt" u 2:($9*$9*$39*(1.0+$39/9.0/9.0/$4/(1.0+$4)*(0.1/$9/$9-1.0))) w p ps 1.0 pt 7 t "<R>^2<v^2> [1 + <v^2>/<v^2>nm * (rho_1rho_2/<R>^2 - 1) ]"
plot "stat.txt" u 2:(-$33) w l t "b", "stat.txt" u 2:($10*$10*$40*(1.0+$40/9.0/9.0/$5/(1.0+$5)*(0.1/$10/$10-1.0))) w p ps 1.0 pt 7 t "<R>^2<v^2> [1 + <v^2>/<v^2>nm * (rho_1rho_2/<R>^2 - 1) ]" # uniform
plot "stat.txt" u 2:(-$35) w l t "b", "stat.txt" u 2:($11*$11*$41*(1.0+$41/9.0/9.0/$6/(1.0+$6)*(0.1/$11/$11-1.0))) w p ps 1.0 pt 7 t "<R>^2<v^2> [1 + <v^2>/<v^2>nm * (rho_1rho_2/<R>^2 - 1) ]"
plot "stat.txt" u 2:(-$37) w l t "b", "stat.txt" u 2:($12*$12*$42*(1.0+$42/9.0/9.0/$7/(1.0+$7)*(0.1/$12/$12-1.0))) w p ps 1.0 pt 7 t "<R>^2<v^2> [1 + <v^2>/<v^2>nm * (rho_1rho_2/<R>^2 - 1) ]" # almost mixed

# <r^2> = <R>^4<v^2> [1 + <v^2>/<v^2>nm * (rho1^3rho2/<R>^4 - 1) ] where <v^2>nm = (r/rho_2)^2 <y^2>nm, <y^2>nm = <Y>(1-<Y>), low At
plot "stat.txt" u 2:(-$29) w l t "b", "stat.txt" u 2:($8**4.0*$38*(1.0+$38/0.0101/0.0101/$3/(1.0+$3)*(0.99**2.0/$8**4.0-1.0))) w p ps 1.0 pt 7 t "<R>^4<v^2> [1 + <v^2>/<v^2>nm * (rho_1^3rho_2/<R>^4 - 1) ]" # no-mix
plot "stat.txt" u 2:(-$31) w l t "b", "stat.txt" u 2:($9**4.0*$39*(1.0+$39/0.0101/0.0101/$4/(1.0+$4)*(0.99**2.0/$9**4.0-1.0))) w p ps 1.0 pt 7 t "<R>^4<v^2> [1 + <v^2>/<v^2>nm * (rho_1^3rho_2/<R>^4 - 1) ]"
plot "stat.txt" u 2:(-$33) w l t "b", "stat.txt" u 2:($10**4.0*$40*(1.0+$40/0.0101/0.0101/$5/(1.0+$5)*(0.99**2.0/$10**4.0-1.0))) w p ps 1.0 pt 7 t "<R>^4<v^2> [1 + <v^2>/<v^2>nm * (rho_1^3rho_2/<R>^4 - 1) ]" # uniform
plot "stat.txt" u 2:(-$35) w l t "b", "stat.txt" u 2:($11**4.0*$41*(1.0+$41/0.0101/0.0101/$6/(1.0+$6)*(0.99**2.0/$11**4.0-1.0))) w p ps 1.0 pt 7 t "<R>^4<v^2> [1 + <v^2>/<v^2>nm * (rho_1^3rho_2/<R>^4 - 1) ]"
plot "stat.txt" u 2:(-$37) w l t "b", "stat.txt" u 2:($12**4.0*$42*(1.0+$42/0.0101/0.0101/$7/(1.0+$7)*(0.99**2.0/$12**4.0-1.0))) w p ps 1.0 pt 7 t "<R>^4<v^2> [1 + <v^2>/<v^2>nm * (rho_1^3rho_2/<R>^4 - 1) ]" # almost mixed

# <r^2> = <R>^4<v^2> [1 + <v^2>/<v^2>nm * (rho1^3rho2/<R>^4 - 1) ] where <v^2>nm = (r/rho_2)^2 <y^2>nm, <y^2>nm = <Y>(1-<Y>), high At
plot "stat.txt" u 2:(-$29) w l t "b", "stat.txt" u 2:($8**4.0*$38*(1.0+$38/9.0/9.0/$3/(1.0+$3)*(0.1**2.0/$8**4.0-1.0))) w p ps 1.0 pt 7 t "<R>^4<v^2> [1 + <v^2>/<v^2>nm * (rho_1^2rho_2^2/<R>^4 - 1) ]" # no-mix
plot "stat.txt" u 2:(-$31) w l t "b", "stat.txt" u 2:($9**4.0*$39*(1.0+$39/9.0/9.0/$4/(1.0+$4)*(0.1**2.0/$9**4.0-1.0))) w p ps 1.0 pt 7 t "<R>^4<v^2> [1 + <v^2>/<v^2>nm * (rho_1^2rho_2^2/<R>^4 - 1) ]"
plot "stat.txt" u 2:(-$33) w l t "b", "stat.txt" u 2:($10**4.0*$40*(1.0+$40/9.0/9.0/$5/(1.0+$5)*(0.1**2.0/$10**4.0-1.0))) w p ps 1.0 pt 7 t "<R>^4<v^2> [1 + <v^2>/<v^2>nm * (rho_1^2rho_2^2/<R>^4 - 1) ]" # uniform
plot "stat.txt" u 2:(-$35) w l t "b", "stat.txt" u 2:($11**4.0*$41*(1.0+$41/9.0/9.0/$6/(1.0+$6)*(0.1**2.0/$11**4.0-1.0))) w p ps 1.0 pt 7 t "<R>^4<v^2> [1 + <v^2>/<v^2>nm * (rho_1^2rho_2^2/<R>^4 - 1) ]"
plot "stat.txt" u 2:(-$37) w l t "b", "stat.txt" u 2:($12**4.0*$42*(1.0+$42/9.0/9.0/$7/(1.0+$7)*(0.1**2.0/$12**4.0-1.0))) w p ps 1.0 pt 7 t "<R>^4<v^2> [1 + <v^2>/<v^2>nm * (rho_1^2rho_2^2/<R>^4 - 1) ]" # almost mixed