tfix boundary geometry - Granular.jl - Julia package for granular dynamics simulation
 (HTM) git clone git://src.adamsgaard.dk/Granular.jl
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit b05635d19efceb2ba3f3dc3d4992777adda08d62
 (DIR) parent 276e83a4056702bb27726ab6018f5536c1435d9e
 (HTM) Author: Anders Damsgaard <andersd@riseup.net>
       Date:   Thu, 27 Apr 2017 21:22:23 -0400
       
       fix boundary geometry
       
       Diffstat:
         M examples/nares_strait.jl            |      31 +++++++++++++------------------
       
       1 file changed, 13 insertions(+), 18 deletions(-)
       ---
 (DIR) diff --git a/examples/nares_strait.jl b/examples/nares_strait.jl
       t@@ -5,9 +5,9 @@ sim = createSimulation(id="nares_strait")
        
        # Initialize ocean
        Lx = 50.e3
       -Lx_constriction = Lx*.33
       -L = [Lx, Lx, 1e3]
       -Ly_constriction = L[2]/2.
       +Lx_constriction = Lx*.25
       +L = [Lx, Lx*1.5, 1e3]
       +Ly_constriction = L[2]*.33
        n = [100, 100, 2]
        sim.ocean = createRegularOceanGrid(n, L, name="poiseuille_flow")
        sim.ocean.v[:, :, 1, 1] = 1e-8*((sim.ocean.xq - Lx/2.).^2 - Lx^2./4.)
       t@@ -17,7 +17,7 @@ r = .5e3
        h = 1.
        
        ## N-S segments
       -for y in linspace((Lx - Lx_constriction)/2.,
       +for y in linspace((L[2] - Ly_constriction)/2.,
                          Ly_constriction + (L[2] - Ly_constriction)/2., 
                          Int(floor(Ly_constriction/(r*2))))
            addIceFloeCylindrical(sim, [(Lx - Lx_constriction)/2., y], r, h, fixed=true, 
       t@@ -26,47 +26,42 @@ end
        for y in linspace((L[2] - Ly_constriction)/2.,
                          Ly_constriction + (L[2] - Ly_constriction)/2., 
                          Int(floor(Ly_constriction/(r*2))))
       -    addIceFloeCylindrical(sim, [Ly_constriction + (L[2] - Ly_constriction)/2., 
       -y], r, h, fixed=true, verbose=false)
       +    addIceFloeCylindrical(sim, [Lx_constriction + (L[1] - Lx_constriction)/2., 
       +                                y], r, h, fixed=true, verbose=false)
        end
        
       -dx = r*cos(deg2rad(atan(Ly_constriction/Lx_constriction)))*2.
       -dy = r*cos(deg2rad(atan(Lx_constriction/Ly_constriction)))*2.
       +dx = 2.*r*sin(atan((Lx - Lx_constriction)/(L[2] - Ly_constriction)))
        
        ## NW diagonal
        x = r:dx:((Lx - Lx_constriction)/2.)
       -#y = (L[2] - r):(-dy):((L[2] - Ly_constriction)/2. + Ly_constriction)
       -y = linspace(L[2] - r, (L[2] - Ly_constriction)/2. + Ly_constriction, length(x))
       +y = linspace(L[2] - r, (L[2] - Ly_constriction)/2. + Ly_constriction + r, 
       +             length(x))
        for i in 1:length(x)
            addIceFloeCylindrical(sim, [x[i], y[i]], r, h, fixed=true, verbose=false)
        end
        
        ## NE diagonal
        x = (L[1] - r):(-dx):((Lx - Lx_constriction)/2. + Lx_constriction)
       -#y = (L[2] - r):(-dy):((L[2] - Ly_constriction)/2. + Ly_constriction)
       -y = linspace(L[2] - r, (L[2] - Ly_constriction)/2. + Ly_constriction, length(x))
       +y = linspace(L[2] - r, (L[2] - Ly_constriction)/2. + Ly_constriction + r, 
       +             length(x))
        for i in 1:length(x)
            addIceFloeCylindrical(sim, [x[i], y[i]], r, h, fixed=true, verbose=false)
        end
        
        ## SW diagonal
        x = r:dx:((Lx - Lx_constriction)/2.)
       -#y = (r):(dy):((L[2] - Ly_constriction)/2.)
       -y = linspace(r, (L[2] - Ly_constriction)/2., length(x))
       +y = linspace(r, (L[2] - Ly_constriction)/2. - r, length(x))
        for i in 1:length(x)
            addIceFloeCylindrical(sim, [x[i], y[i]], r, h, fixed=true, verbose=false)
        end
        
        ## SE diagonal
        x = (L[1] - r):(-dx):((Lx - Lx_constriction)/2. + Lx_constriction)
       -#y = (r):(dy):((L[2] - Ly_constriction)/2.)
       -y = linspace(r, (L[2] - Ly_constriction)/2., length(x))
       +y = linspace(r, (L[2] - Ly_constriction)/2. - r, length(x))
        for i in 1:length(x)
            addIceFloeCylindrical(sim, [x[i], y[i]], r, h, fixed=true, verbose=false)
        end
        
       -
       -
        info("added $(length(sim.ice_floes)) fixed ice floes as walls")
        writeVTK(sim)