tFixed coloring. Tried to add walls to simulate shortening. - granular-basin - … | |
git clone git://src.adamsgaard.dk/granular-basin | |
Log | |
Files | |
Refs | |
README | |
--- | |
commit 845a5bc453c83e6d59a61d86b9511575b001085d | |
parent a242f581c0e00bf87dbc3fccbfbb7b6485576b59 | |
Author: esbenpalmstrom <[email protected]> | |
Date: Mon, 29 Nov 2021 17:05:23 +0100 | |
Fixed coloring. Tried to add walls to simulate shortening. | |
Diffstat: | |
M deform_basin.jl | 49 +++++++++++++++++++++++------… | |
M init_basin.jl | 6 +++--- | |
M layer_basin.jl | 8 ++++---- | |
M runfullstack.jl | 2 +- | |
4 files changed, 44 insertions(+), 21 deletions(-) | |
--- | |
diff --git a/deform_basin.jl b/deform_basin.jl | |
t@@ -10,6 +10,7 @@ id = "simulation500" # folder name of simulation | |
hw_ratio = 0.2 # height/width ratio of indenter | |
grain_radius = 0.05 # grain radius of grains in indenter | |
+def_time = 2.0 # time spent deforming | |
deformation_type = "shortening" # "diapir" or "shortening" | |
# diapir will only introduce an indenter while | |
t@@ -47,6 +48,8 @@ grain_radius = 0.05 | |
vertex_x = init_vertex_pos[1] | |
vertex_y = width*hw_ratio*sin((pi/width)*vertex_x) | |
+boomerang_vel = 0.5 # upward velocity of the indeter | |
+ | |
for i = 0:grain_radius*2:width#manipulate the ocean grid | |
x_pos = i | |
t@@ -58,7 +61,8 @@ for i = 0:grain_radius*2:width#manipulate the ocean grid | |
grain_radius, | |
0.1, | |
fixed = true, | |
- lin_vel = [0.0,0.5]) | |
+ lin_vel = [0.0,boomerang_vel], | |
+ color = -1) | |
end | |
append!(sim.grains,temp_indent.grains) | |
t@@ -78,7 +82,7 @@ for grain in sim.grains | |
global y_bot = grain.lin_pos[2] - grain.contact_radius | |
end | |
end | |
-Granular.setTotalTime!(sim,2.0) | |
+Granular.setTotalTime!(sim,def_time) | |
Granular.setTimeStep!(sim) | |
Granular.setOutputFileInterval!(sim, .01) | |
Granular.resetTime!(sim) | |
t@@ -93,22 +97,34 @@ right_edge = Inf | |
for i = 1:size(sim.grains,1) | |
if left_edge < sim.grains[i].lin_pos[1] + sim.grains[i].contact_radius | |
global left_edge = sim.grains[i].lin_pos[1] + sim.grains[i].contact_ra… | |
- left_edge_index = deepcopy(i) | |
+ global left_edge_index = deepcopy(i) | |
end | |
- if right_edge >sim.grains[i].lin_pos[1] - sim.grains[i].contact_radius | |
+ if right_edge > sim.grains[i].lin_pos[1] - sim.grains[i].contact_radius | |
global right_edge = sim.grains[i].lin_pos[1] - sim.grains[i].contact_r… | |
- right_edge_index = deepcopy(i) | |
+ global right_edge_index = deepcopy(i) | |
end | |
end | |
+""" | |
+carpet_index = [] | |
+# find the center grain of the carpet | |
+for i = 1:size(sim.grains,1) | |
+ if sim.grains[i].color == 0 | |
+ append!(carpet_index,i) | |
+ end | |
+end | |
+c_i = size(carpet_index)/2 | |
+""" | |
+ | |
+ | |
#add walls to the east and west | |
Granular.addWallLinearFrictionless!(sim,[1.,0.], | |
left_edge, | |
- bc = "fixed") | |
+ bc = "velocity") | |
Granular.addWallLinearFrictionless!(sim,[1.,0.], | |
right_edge, | |
- bc = "fixed") | |
+ bc = "velocity") | |
#add wall beneath the carpet | |
t@@ -118,13 +134,20 @@ Granular.addWallLinearFrictionless!(sim, [0.,1.], | |
+ | |
+global checked_done = false | |
+ | |
while sim.time < sim.time_total | |
-# for grain in sim.grains | |
-# | |
-# if grain.lin_vel[2] < 0 && grain.color == 1 | |
-# grain.lin_vel[2] = 0 | |
-# end | |
-# end | |
+ | |
+ if sim.grains[left_edge_index].lin_vel[1] > boomerang_vel/2 && checked_don… | |
+ sim.walls[1].vel = boomerang_vel | |
+ sim.walls[2].vel = -boomerang_vel | |
+ global checked_done = true | |
+ end | |
+ | |
+ #sim.walls[1].vel = sim.grains[left_edge_index].lin_vel[1] | |
+ #sim.walls[2].vel = -sim.grains[right_edge_index].lin_vel[1] | |
+ | |
Granular.run!(sim,single_step = true) | |
end | |
diff --git a/init_basin.jl b/init_basin.jl | |
t@@ -186,8 +186,8 @@ right_edge = left_edge+length # east edg… | |
# Now loop over the carpet grain positions, the loop will create grains that o… | |
# in order to create the bonds needed | |
-# color = 1 is used as a flag for the grains in the carpet | |
-for i = left_edge+(bot_r/2):bot_r*1.99:left_edge+length | |
+# color = 0 is used as a flag for the grains in the carpet | |
+for i = left_edge+(bot_r/2):bot_r*1.999:left_edge+length | |
bot_pos = [i,round(sim.ocean.origo[2]-bot_r,digits=2)] # position of grain | |
t@@ -201,7 +201,7 @@ for i = left_edge+(bot_r/2):bot_r*1.99:left_edge+length | |
#contact_stiffness_normal = Inf, | |
#contact_stiffness_tangential = Inf, | |
fixed = false, | |
- color = 1) | |
+ color = 0) | |
end | |
#Granular.fitGridToGrains!(carpet,carpet.ocean,verbose=false) | |
diff --git a/layer_basin.jl b/layer_basin.jl | |
t@@ -20,7 +20,7 @@ tensile_strength = [0.3,0.05,0.3] # strength of bo… | |
shear_strength = [0.3,0.05,0.3] # shear stregth of bonds | |
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] | |
+color = [1,2,1] | |
#carpet_youngs_modulus = 2e7 | |
#carpet_poissons_ratio = 0.185 | |
t@@ -58,7 +58,7 @@ end | |
""" | |
for grain in sim.grains | |
if grain.lin_pos[2] == -0.05 | |
- grain.color = 1 | |
+ grain.color = 0 | |
end | |
end | |
""" | |
t@@ -100,11 +100,11 @@ increase_array = [] | |
#increase the contact radius | |
for grain in sim.grains | |
- if grain.color == 0 | |
+ if grain.color != 0 | |
contact_radius_increase = (grain.contact_radius*size_increasing_factor… | |
grain.contact_radius += contact_radius_increase | |
append!(increase_array,contact_radius_increase) | |
- elseif grain.color == 1 | |
+ elseif grain.color == 0 | |
append!(increase_array,0) | |
end | |
end | |
diff --git a/runfullstack.jl b/runfullstack.jl | |
t@@ -8,4 +8,4 @@ include("deform_basin.jl") | |
stack_t_now = Dates.now() | |
stack_dur = Dates.canonicalize(stack_t_now-stack_t_start) | |
-print("Time elapsed: ",stack_dur) | |
+print("Total full stack time elapsed: ",stack_dur) |