Skip to content

Commit 695eaaf

Browse files
authored
Merge pull request #51 from MultiSimOLab/evol
2 parents 0bc8b3b + 5bda60b commit 695eaaf

4 files changed

Lines changed: 21 additions & 5 deletions

File tree

src/ComputationalModels/EvolutionFunctions.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11

2+
"The evolution functions have been designed to apply variable boundary conditions."
3+
module EvolutionFunctions
4+
5+
export ramp
6+
export triangular
7+
export step
8+
export sigmoid
9+
export constant
10+
11+
"Return an unbounded ramp function. By default, it is the identity. Otherwise, the scaling factor is 1/T."
12+
function ramp(T::Float64=1.0)
13+
t::Float64 -> t/T
14+
end
215

316
"Return a triangular evolution function ranging from 0 to 1, centered at T, having edges at 0 and 2T."
417
function triangular(T::Float64)
@@ -40,3 +53,5 @@ end
4053
function constant()
4154
t::Float64 -> 1.0
4255
end
56+
57+
end

test/data/StaticMechanicalDirichletSimulation.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ using TimerOutputs
55
using Gridap.FESpaces
66
using HyperFEM
77
using HyperFEM.ComputationalModels.CartesianTags
8+
using HyperFEM.ComputationalModels.EvolutionFunctions
89

910

1011
function static_mechanical_dirichlet_simulation(;writevtk=true, verbose=true)
@@ -32,7 +33,7 @@ function static_mechanical_dirichlet_simulation(;writevtk=true, verbose=true)
3233
# Dirichlet boundary conditions
3334
dir_u_tags = ["fixed", "moving"]
3435
dir_u_values = [[0.0, 0.0, 0.0], [0.08, 0.0, 0.0]]
35-
dir_u_timesteps = [Λ -> 1.0, Λ -> Λ]
36+
dir_u_timesteps = [constant(), ramp()]
3637
D_bc = DirichletBC(dir_u_tags, dir_u_values, dir_u_timesteps)
3738

3839
# FE spaces

test/data/StaticMechanicalNeumannSimulation.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ using TimerOutputs
55
using Gridap.FESpaces
66
using HyperFEM
77
using HyperFEM.ComputationalModels.CartesianTags
8+
using HyperFEM.ComputationalModels.EvolutionFunctions
89

910

1011
function static_mechanical_neumann_simulation(;writevtk=true, verbose=true)
@@ -32,13 +33,13 @@ function static_mechanical_neumann_simulation(;writevtk=true, verbose=true)
3233
# Dirichlet conditions
3334
dir_u_tags = ["fixed"]
3435
dir_u_values = [[0.0, 0.0, 0.0]]
35-
dir_u_timesteps = [Λ -> 1.0]
36+
dir_u_timesteps = [constant()]
3637
D_bc = DirichletBC(dir_u_tags, dir_u_values, dir_u_timesteps)
3738

3839
# Neumann conditions
3940
neu_F_tags = ["force"]
4041
neu_F_values = [[0.0, 0.0, -1e-3]]
41-
neu_F_timesteps = [Λ -> Λ]
42+
neu_F_timesteps = [ramp()]
4243
N_bc = NeumannBC(neu_F_tags, neu_F_values, neu_F_timesteps)
4344
= get_Neumann_dΓ(geometry, N_bc, degree)
4445

test/data/ViscoElasticSimulation.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ using GridapSolvers
44
using GridapSolvers.NonlinearSolvers
55
using HyperFEM
66
using HyperFEM.ComputationalModels.CartesianTags
7-
using HyperFEM.ComputationalModels:constant
8-
using HyperFEM.ComputationalModels:triangular
7+
using HyperFEM.ComputationalModels.EvolutionFunctions
98
using HyperFEM.ComputationalModels.PostMetrics
109

1110
function visco_elastic_simulation(;t_end=15, writevtk=true, verbose=true)

0 commit comments

Comments
 (0)