tprepare for contact model with tangential frictional elasticity - Granular.jl … | |
git clone git://src.adamsgaard.dk/Granular.jl | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit b1fabb456a57be43391034d91970559ce6160a8b | |
parent 77c8b15eeb9d42f89cad9ac7ff53c8b8c39dd0c0 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Tue, 2 May 2017 08:40:06 -0400 | |
prepare for contact model with tangential frictional elasticity | |
Diffstat: | |
M src/interaction.jl | 29 ++++++++++++++++------------- | |
M src/simulation.jl | 4 +++- | |
2 files changed, 19 insertions(+), 14 deletions(-) | |
--- | |
diff --git a/src/interaction.jl b/src/interaction.jl | |
t@@ -4,7 +4,8 @@ export interact! | |
""" | |
Resolve mechanical interaction between all particle pairs. | |
""" | |
-function interact!(simulation::Simulation) | |
+function interact!(simulation::Simulation; | |
+ contact_model::String = "Linear Elastic No Tangential") | |
# IceFloe to grain collisions | |
while !isempty(simulation.contact_pairs) | |
t@@ -13,7 +14,8 @@ function interact!(simulation::Simulation) | |
contact_parallel_displacement = | |
pop!(simulation.contact_parallel_displacement) | |
interactIceFloes!(simulation, contact_pair[1], contact_pair[2], | |
- overlap_vector, contact_parallel_displacement) | |
+ overlap_vector, contact_parallel_displacement, | |
+ contact_model=contact_model) | |
end | |
end | |
t@@ -27,25 +29,27 @@ function interactIceFloes!(simulation::Simulation, | |
i::Integer, j::Integer, | |
overlap_vector::Array{Float64, 1}, | |
contact_parallel_displacement::Array{Float64, 1}; | |
- contact_normal::String = "LinearElasticNoTangential… | |
+ contact_model::String = | |
+ "Linear Elastic No Tangential") | |
force = zeros(2) | |
- if contact_normal == "None" | |
+ if contact_model == "None" | |
return nothing | |
- elseif contact_normal == "LinearElasticNoTangential" || | |
- contact_normal == "LinearElastic" | |
+ elseif contact_model == "Linear Elastic No Tangential" || | |
+ contact_model == "LinearElastic" | |
force_n = interactNormalLinearElastic(simulation, i, j, overlap_vector) | |
- if contact_normal == "LinearElastic" | |
- force_t, torque = interactTangentialLinearElastic(simulation, i, j, | |
- overlap_vector, | |
- contact_parallel… | |
+ if contact_model == "Linear Elastic" | |
+ force_t, torque = interactTangentialLinearElasticFrictional( | |
+ simulation, i, j, | |
+ overlap_vector, | |
+ contact_parallel_displacement) | |
end | |
else | |
- error("Unknown contact_normal interaction model '$contact_normal'") | |
+ error("Unknown contact_model interaction model '$contact_model'") | |
end | |
simulation.ice_floes[i].force += force_n; | |
t@@ -78,7 +82,7 @@ export interactTangentialLinearElastic | |
Resolves linear-elastic interaction between two ice floes in the | |
contact-parallel (tangential) direction. | |
""" | |
-function interactTangentialLinearElastic(simulation::Simulation, | |
+function interactTangentialLinearElasticFrictional(simulation::Simulation, | |
i::Integer, j::Integer, | |
overlap_vector::vector, | |
contact_parallel_displacement::vector) | |
t@@ -91,7 +95,6 @@ function interactTangentialLinearElastic(simulation::Simulat… | |
n = overlap_vector/norm(overlap_vector) | |
contact_parallel_displacement -= (n * dot(n, contact_parallel_displacement… | |
- | |
force_t = k_t_harmonic_mean * contact_parallel_displacement | |
return force, torque, contact_parallel_displacement | |
diff --git a/src/simulation.jl b/src/simulation.jl | |
t@@ -88,7 +88,9 @@ function run!(simulation::Simulation; | |
status_interval::Int=100, | |
show_file_output::Bool=true, | |
single_step::Bool=false, | |
- temporal_integration_method::String="Three-term Taylor") | |
+ temporal_integration_method::String="Three-term Taylor", | |
+ contact_model::String="Three-term Taylor", | |
+ ) | |
if single_step && simulation.time >= simulation.time_total | |
simulation.time_total += simulation.time_step |