Granular.jl

Julia package for granular dynamics simulation
git clone git://src.adamsgaard.dk/Granular.jl
Log | Files | Refs | README | LICENSE

commit 5d42f7db81bf61b204edebb53e9d07b164463f33
parent 985ca340ec43f3bc4c581503513756d2bd60083e
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Mon, 11 Mar 2019 12:52:44 +0100

Fix Julia 1.0+ formatting errors

Diffstat:
Mexamples/double_gyre.jl | 38+++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/examples/double_gyre.jl b/examples/double_gyre.jl @@ -14,28 +14,28 @@ sim.ocean = Granular.createRegularOceanGrid(n, L, name="double_gyre") epsilon = 0.25 # amplitude of periodic oscillations t = 0. -a = epsilon*sin(2.*pi*t) -b = 1. - 2.*epsilon*sin(2.*pi*t) +a = epsilon*sin(2.0*pi*t) +b = 1.0 - 2.0*epsilon*sin(2.0*pi*t) for i=1:size(sim.ocean.u, 1) for j=1:size(sim.ocean.u, 2) - x = sim.ocean.xq[i, j]/(L[1]*.5) # x in [0;2] + x = sim.ocean.xq[i, j]/(L[1]*0.5) # x in [0;2] y = sim.ocean.yq[i, j]/L[2] # y in [0;1] - f = a*x^2. + b*x - df_dx = 2.*a*x + b + f = a*x^2.0 + b*x + df_dx = 2.0*a*x + b - sim.ocean.u[i, j, 1, 1] = -pi/10.*sin(pi*f)*cos(pi*y) * 1e1 - sim.ocean.v[i, j, 1, 1] = pi/10.*cos(pi*f)*sin(pi*y)*df_dx * 1e1 + sim.ocean.u[i, j, 1, 1] = -pi/10.0*sin(pi*f)*cos(pi*y) * 1e1 + sim.ocean.v[i, j, 1, 1] = pi/10.0*cos(pi*f)*sin(pi*y)*df_dx * 1e1 end end # Initialize confining walls, which are ice floes that are fixed in space -r = minimum(L[1:2]./n[1:2])/2. +r = minimum(L[1:2]./n[1:2])/2.0 h = 1. ## N-S wall segments -for y in range(r, stop=L[2]-r, length=Int(round((L[2] - 2.*r)/(r*2)))) +for y in range(r, stop=L[2]-r, length=Int(round((L[2] - 2.0*r)/(r*2)))) Granular.addGrainCylindrical!(sim, [r, y], r, h, fixed=true, verbose=false) Granular.addGrainCylindrical!(sim, [L[1]-r, y], r, h, fixed=true, @@ -43,8 +43,8 @@ for y in range(r, stop=L[2]-r, length=Int(round((L[2] - 2.*r)/(r*2)))) end ## E-W wall segments -for x in range(3.*r, stop=L[1]-3.*r, - length=Int(round((L[1] - 6.*r)/(r*2)))) +for x in range(3.0*r, stop=L[1]-3.0*r, + length=Int(round((L[1] - 6.0*r)/(r*2)))) Granular.addGrainCylindrical!(sim, [x, r], r, h, fixed=true, verbose=false) Granular.addGrainCylindrical!(sim, [x, L[2]-r], r, h, fixed=true, @@ -57,14 +57,14 @@ n_walls = length(sim.grains) # Initialize ice floes everywhere -floe_padding = .5*r -noise_amplitude = .8*floe_padding +floe_padding = 0.5*r +noise_amplitude = 0.8*floe_padding Random.seed!(1) -for y in (4.*r + noise_amplitude):(2.*r + floe_padding):(L[2] - 4.*r - - noise_amplitude) +for y in (4.0*r + noise_amplitude):(2.0*r + floe_padding):(L[2] - 4.0*r - + noise_amplitude) - for x in (4.*r + noise_amplitude):(2.*r + floe_padding):(L[1] - 4.*r - - noise_amplitude) + for x in (4.0*r + noise_amplitude):(2.0*r + floe_padding):(L[1] - 4.0*r - + noise_amplitude) #if iy % 2 == 0 #x += 1.5*r #end @@ -94,8 +94,8 @@ for i=1:length(sim.grains) end # Set temporal parameters -Granular.setTotalTime!(sim, 12.*60.*60.) -Granular.setOutputFileInterval!(sim, 60.) +Granular.setTotalTime!(sim, 12.0*60.0*60.0) +Granular.setOutputFileInterval!(sim, 60.0) Granular.setTimeStep!(sim) Granular.run!(sim)