Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/ComputationalModels/EvolutionFunctions.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@

"The evolution functions have been designed to apply variable boundary conditions."
module EvolutionFunctions

export ramp
export triangular
export step
export sigmoid
export constant

"Return an unbounded ramp function. By default, it is the identity. Otherwise, the scaling factor is 1/T."
function ramp(T::Float64=1.0)
t::Float64 -> t/T
end

"Return a triangular evolution function ranging from 0 to 1, centered at T, having edges at 0 and 2T."
function triangular(T::Float64)
Expand Down Expand Up @@ -40,3 +53,5 @@ end
function constant()
t::Float64 -> 1.0
end

end
3 changes: 2 additions & 1 deletion test/data/StaticMechanicalDirichletSimulation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ using TimerOutputs
using Gridap.FESpaces
using HyperFEM
using HyperFEM.ComputationalModels.CartesianTags
using HyperFEM.ComputationalModels.EvolutionFunctions


function static_mechanical_dirichlet_simulation(;writevtk=true, verbose=true)
Expand Down Expand Up @@ -32,7 +33,7 @@ function static_mechanical_dirichlet_simulation(;writevtk=true, verbose=true)
# Dirichlet boundary conditions
dir_u_tags = ["fixed", "moving"]
dir_u_values = [[0.0, 0.0, 0.0], [0.08, 0.0, 0.0]]
dir_u_timesteps = [Λ -> 1.0, Λ -> Λ]
dir_u_timesteps = [constant(), ramp()]
D_bc = DirichletBC(dir_u_tags, dir_u_values, dir_u_timesteps)

# FE spaces
Expand Down
5 changes: 3 additions & 2 deletions test/data/StaticMechanicalNeumannSimulation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ using TimerOutputs
using Gridap.FESpaces
using HyperFEM
using HyperFEM.ComputationalModels.CartesianTags
using HyperFEM.ComputationalModels.EvolutionFunctions


function static_mechanical_neumann_simulation(;writevtk=true, verbose=true)
Expand Down Expand Up @@ -32,13 +33,13 @@ function static_mechanical_neumann_simulation(;writevtk=true, verbose=true)
# Dirichlet conditions
dir_u_tags = ["fixed"]
dir_u_values = [[0.0, 0.0, 0.0]]
dir_u_timesteps = [Λ -> 1.0]
dir_u_timesteps = [constant()]
D_bc = DirichletBC(dir_u_tags, dir_u_values, dir_u_timesteps)

# Neumann conditions
neu_F_tags = ["force"]
neu_F_values = [[0.0, 0.0, -1e-3]]
neu_F_timesteps = [Λ -> Λ]
neu_F_timesteps = [ramp()]
N_bc = NeumannBC(neu_F_tags, neu_F_values, neu_F_timesteps)
dΓ = get_Neumann_dΓ(geometry, N_bc, degree)

Expand Down
3 changes: 1 addition & 2 deletions test/data/ViscoElasticSimulation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ using GridapSolvers
using GridapSolvers.NonlinearSolvers
using HyperFEM
using HyperFEM.ComputationalModels.CartesianTags
using HyperFEM.ComputationalModels:constant
using HyperFEM.ComputationalModels:triangular
using HyperFEM.ComputationalModels.EvolutionFunctions
using HyperFEM.ComputationalModels.PostMetrics

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