ttried to fix the carpet - granular-basin - tectonic deformation experiments with Granular.jl
 (HTM) git clone git://src.adamsgaard.dk/granular-basin
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
       ---
 (DIR) commit 3e8210c86b044cdc74ad726b0372612c7601f428
 (DIR) parent 96bd0ac1de86f9607c0d7a31e41dad321cd06761
 (HTM) Author: esbenpalmstrom <esbenpalmstroem@gmail.com>
       Date:   Fri, 26 Nov 2021 15:39:07 +0100
       
       ttried to fix the carpet
       
       Diffstat:
         M compact_basin.jl                    |      14 +++++++-------
         M deform_basin.jl                     |       4 +++-
         M init_basin.jl                       |      35 +++++++++++++++++++++++--------
         M layer_basin.jl                      |      54 ++++++++++++-------------------
       
       4 files changed, 57 insertions(+), 50 deletions(-)
       ---
 (DIR) diff --git a/compact_basin.jl b/compact_basin.jl
       t@@ -8,7 +8,7 @@ t_start = Dates.now() # Save the start time, print the end time later.
        # lav en lille test? se om dit appendede carpet stadig er forbundet til hoved-
        # simulationsobjektet
        
       -id = "simulation500"    # id of simulation to load
       +id = "simulation250"    # id of simulation to load
        N = 20e3                # amount of stress to be applied
        t_comp = 3.0            # compaction max duration [s]
        
       t@@ -49,12 +49,12 @@ for grain in sim.grains
            end
        end
        
       -fixed_thickness = 2. * SimSettings["r_max"]
       -for grain in sim.grains
       -    if grain.lin_pos[2] <= fixed_thickness
       -        grain.fixed = true  # set x and y acceleration to zero
       -    end
       -end
       +#fixed_thickness = 2. * SimSettings["r_max"]
       +#for grain in sim.grains
       +#    if grain.lin_pos[2] <= fixed_thickness
       +#        grain.fixed = true  # set x and y acceleration to zero
       +#    end
       +#end
        
        Granular.resetTime!(sim)
        Granular.setTotalTime!(sim,t_comp)
 (DIR) diff --git a/deform_basin.jl b/deform_basin.jl
       t@@ -6,7 +6,7 @@ t_start = Dates.now()
        
        # User defined settings
        
       -id = "simulation500"   # folder name of simulation
       +id = "simulation250"   # folder name of simulation
        
        hw_ratio = 0.2          # height/width ratio of indenter
        grain_radius = 0.05     # grain radius of grains in indenter
       t@@ -116,6 +116,8 @@ Granular.addWallLinearFrictionless!(sim, [0.,1.],
                                            y_bot_pre,
                                            bc = "fixed")
        
       +
       +
        while sim.time < sim.time_total
        #    for grain in sim.grains
        #
 (DIR) diff --git a/init_basin.jl b/init_basin.jl
       t@@ -7,12 +7,12 @@ t_start = Dates.now()           # Save the start time, print the end time later.
        
        ############# Initialization Settings #############
        
       -t_init = 0.8                    # duration of initialization [s]
       -t_stack = 0.8                   # duration for each stack to settle [s]
       +t_init = 0.5                    # duration of initialization [s]
       +t_stack = 0.5                   # duration for each stack to settle [s]
        
        g = [0.,-9.8]                   # vector for direction and magnitude of gravitational acceleration of grains
        
       -ngrains = 500                  # total number of grains
       +ngrains = 250                  # total number of grains
        aspect_ratio = 4                # should be x times as wide as it is tall
        
        mkpath("simulation$(ngrains)")
       t@@ -51,7 +51,7 @@ SimSettings["ngrains"] = ngrains
        SimSettings["r_min"] = r_min
        SimSettings["r_max"] = r_max
        
       -
       +# this section has been moved further up
        
        ############# Initialize simulation and grains #############
        
       t@@ -121,7 +121,6 @@ for i = 1:stacks
                end
            end
        
       -
            # add duplicate grains above the initialized grains
            for grain in temp.grains
        
       t@@ -173,6 +172,7 @@ end
        
        
        
       +
        ############# Lay a carpet #############
        
        carpet = Granular.createSimulation(id="init_carpet") # new simulation object for the carpet
       t@@ -198,18 +198,29 @@ for i = left_edge+(bot_r/2):bot_r*1.99:left_edge+length
                                        verbose = false,
                                        tensile_strength = Inf,
                                        shear_strength = Inf,
       -                                contact_stiffness_normal = Inf,
       -                                contact_stiffness_tangential = Inf,
       -                                fixed = true,
       +                                #contact_stiffness_normal = Inf,
       +                                #contact_stiffness_tangential = Inf,
       +                                fixed = false,
                                        color = 1)
        end
        
       +#Granular.fitGridToGrains!(carpet,carpet.ocean,verbose=false)
       +
       +
       +
        Granular.findContactsAllToAll!(carpet) # find the grain contacts
        
       +
       +
        append!(sim.grains,carpet.grains) # add the carpet grains to the main simulation object
        # since the assignment will point to the carpet object, changes made to the carpet
        # object will appear in the main simulation object
        
       +
       +
       +#reset the grain contacts and make them very old
       +
       +
        for grain in sim.grains
            grain.contacts[:] .= 0
            grain.n_contacts = 0
       t@@ -223,10 +234,16 @@ for grain in sim.grains
            grain.strength_heal_rate = 1 # new bond stengthening
        end
        
       -#Granular.findContactsAllToAll!(carpet) # find the grain contacts
        
        Granular.fitGridToGrains!(sim,sim.ocean,verbose=false)  # fit the ocean to the added grains
        
       +Granular.setGridBoundaryConditions!(sim.ocean, "impermeable", "north south",
       +                                                                                                                                verbose=false)
       +Granular.setGridBoundaryConditions!(sim.ocean, "impermeable", "east west",
       +                                                                                                                                verbose=false)
       +
       +#Granular.findContacts!(sim,method="ocean grid")
       +
        # run the simulation shortly, to let the stacked grains settle on the carpet
        sim.time_iteration = 0
        sim.time = 0.0
 (DIR) diff --git a/layer_basin.jl b/layer_basin.jl
       t@@ -3,7 +3,7 @@ import JLD2
        import PyPlot
        import Dates
        
       -id = "simulation500"    # id of simulation to load, just write the folder
       +id = "simulation250"    # id of simulation to load, just write the folder
                                # name here
        
        # Layer interface positions
       t@@ -22,12 +22,14 @@ contact_dynamic_friction = [0.4,0.05,0.4]   # friction between grains
        rotating = [true,true,true]                 # can grains rotate or not
        color = [0,0,0]
        
       -carpet_youngs_modulus = 2e7
       -carpet_poissons_ratio = 0.185
       -carpet_tensile_strength = 1e16
       -carpet_contact_dynamic_friction = 0.4
       -carpet_rotating = true
       -carpet_shear_strength = 1e16
       +#carpet_youngs_modulus = 2e7
       +#carpet_poissons_ratio = 0.185
       +#carpet_tensile_strength = 1e16
       +#carpet_contact_dynamic_friction = 0.4
       +#carpet_rotating = true
       +#carpet_shear_strength = 1e16
       +
       +carpet
        
        sim = Granular.readSimulation("$(id)/comp.jld2")
        SimSettings = SimSettings = JLD2.load("$(id)/SimSettings.jld2")
       t@@ -78,18 +80,18 @@ for grain in sim.grains
                    grain.contact_dynamic_friction = contact_dynamic_friction[i-1]
                    grain.rotating = rotating[i-1]
                    grain.color = color[i-1]
       -        elseif grain.color == 1
       -            grain.youngs_modulus = carpet_youngs_modulus
       -            grain.poissons_ratio = carpet_poissons_ratio
       -            grain.tensile_strength = carpet_tensile_strength
       -            grain.shear_strength = carpet_shear_strength
       -            grain.contact_dynamic_friction = carpet_contact_dynamic_friction
       -            grain.rotating = carpet_rotating
       +#        elseif grain.color == 1
       +#            grain.youngs_modulus = carpet_youngs_modulus
       +#            grain.poissons_ratio = carpet_poissons_ratio
       +#            grain.tensile_strength = carpet_tensile_strength
       +#            grain.shear_strength = carpet_shear_strength
       +#            grain.contact_dynamic_friction = carpet_contact_dynamic_friction
       +#            grain.rotating = carpet_rotating
                end
            end
        end
        
       -# Create the contacs between grains by expanding all grains by a small amount
       +# Create the bonds between grains by expanding all grains by a small amount
        # then search and establish contacts and then reduce the size of the grains again
        
        size_increasing_factor = 1.10   # factor by which contact radius should be increased
       t@@ -107,6 +109,7 @@ for grain in sim.grains
            end
        end
        
       +Granular.findContacts!(sim,method="ocean grid")
        #Granular.findContactsAllToAll!(sim) # find the grain contacts
        #Granular.run!(sim,single_step=true)
        
       t@@ -115,28 +118,13 @@ for i = 1:size(sim.grains,1)
            sim.grains[i].contact_radius -= increase_array[i]
        end
        
       -"""
       -for grain in sim.grains
       -    grain.contacts[:] .= 0
       -    grain.n_contacts = 0
       -end
       -
       -#vil det ikke være nødvendigt at køre et enkelt timestep her?
       -
       -for grain in sim.grains
       -        for ic=1:size(grain.contact_age,1)
       -                grain.contact_age[ic] = 1e16
       -        end
       -    grain.strength_heal_rate = 1 # new bond stengthening
       -end
       -"""
        
        cd("$id")
        sim.id = "layered"
        
       -Granular.resetTime!(sim)
       -Granular.setTotalTime!(sim,1.0)
       -Granular.run!(sim)
       +#Granular.resetTime!(sim)
       +#Granular.setTotalTime!(sim,0.5)
       +#Granular.run!(sim)
        
        cd("..")