Solver - Functions

Index

Solver

PeriLab.Solver_Manager.init — Method
init(input::PeriLabInput, step_id::Int64)

Initialize the solver

Arguments

  • input::PeriLabInput: The typed input
  • step_id::Int64: The solver step (-1: single Solver)

Returns

  • block_nodes::Dict{Int64,Vector{Int64}}: A dictionary mapping block IDs to collections of nodes.
  • bcs::Dict{String,BoundaryCondition}: A dictionary containing boundary conditions.
  • solver_run::SolverRun: the initialized solver step.
source
PeriLab.Solver_Manager.remove_models — Method
remove_models(models::Vector{String})

Sets the active models to false if they are deactivated in the solver. They can be active, because they are defined as model and in the blocks.

Arguments

  • models::Vector{String}: The model categories of the step
source
PeriLab.Solver_Manager.set_angles — Method
set_angles(blocks::Dict{String,BlockParams}, block_nodes::Dict)

Sets the density of the nodes in the dictionary.

Arguments

  • blocks::Dict{String,BlockParams}: The blocks of the input deck
  • block_nodes::Dict: A dictionary mapping block IDs to collections of nodes
source
PeriLab.Solver_Manager.set_density — Method
set_density(blocks::Dict{String,BlockParams}, block_nodes::Dict, density::NodeScalarField{Float64})

Sets the density of the nodes in the dictionary.

Arguments

  • blocks::Dict{String,BlockParams}: The blocks of the input deck
  • block_nodes::Dict: A dictionary mapping block IDs to collections of nodes
  • density::NodeScalarField{Float64}: The density

Returns

  • density::NodeScalarField{Float64}: The density
source
PeriLab.Solver_Manager.set_fem_block — Method
set_fem_block(blocks::Dict{String,BlockParams}, block_nodes::Dict, fem_block::Vector{Bool})

Sets the fem_block of the nodes in the dictionary.

Arguments

  • blocks::Dict{String,BlockParams}: The blocks of the input deck
  • block_nodes::Dict: A dictionary mapping block IDs to collections of nodes
  • fem_block::Vector{Bool}: The fem_block

Returns

  • fem_block::Vector{Bool}: The fem_block
source
PeriLab.Solver_Manager.set_horizon — Method
set_horizon(blocks::Dict{String,BlockParams}, block_nodes::Dict, horizon::NodeScalarField{Float64})

Sets the horizon of the nodes in the dictionary.

Arguments

  • blocks::Dict{String,BlockParams}: The blocks of the input deck
  • block_nodes::Dict: A dictionary mapping block IDs to collections of nodes
  • horizon::NodeScalarField{Float64}: The horizon

Returns

  • horizon::NodeScalarField{Float64}: The horizon
source

Verlet_Solver

PeriLab.Solver_Manager.Solver_Common.time_step! — Method
time_step!(ws::VerletWorkspace, run::SolverRun{VerletParams}, ctx::SolverContext, clock::StepClock)

One explicit Verlet step following [1] and [3]: velocities and displacements, Dirichlet conditions, models, stresses and forces. Writing results, the damage limit, NP1 → N and the time are done by the shared loop.

source
PeriLab.Solver_Manager.Verlet_Solver.calculate_stresses — Method
calculate_stresses(block_nodes::Dict{Int64,Vector{Int64}}, options::CalculationOptions)

Computes the stresses.

Arguments

  • block_nodes::Dict{Int64,Vector{Int64}}: List of block nodes.
  • options::CalculationOptions: Which stress and strain fields to compute.
source
PeriLab.Solver_Manager.Verlet_Solver.get_integration_steps — Method
get_integration_steps(initial_time::Float64, end_time::Float64, dt::Float64)

Calculate the number of integration steps and the adjusted time step for a numerical integration process.

Arguments

  • initial_time::Float64: The initial time for the integration.
  • end_time::Float64: The final time for the integration.
  • dt::Float64: The time step size.

Returns

A tuple (nsteps, dt) where:

  • nsteps::Int64: The number of integration steps required to cover the specified time range.
  • dt::Float64: The adjusted time step size to evenly divide the time range.

Errors

  • Throws an error if the dt is less than or equal to zero.
source
PeriLab.Solver_Manager.Verlet_Solver.init_solver — Method
init_solver(options::VerletParams, params::SolverParams, models::Vector{String}, bcs::Dict{String,BoundaryCondition}, block_nodes::Dict{Int64,Vector{Int64}})

Initialize the Verlet solver for a simulation.

This function sets up the Verlet solver for a simulation by initializing various parameters and calculating the time step based on provided parameters or critical time step calculations.

Arguments

  • options::VerletParams: The Verlet options of the step.
  • params::SolverParams: The solver parameters of the current step.
  • models::Vector{String}: The model categories of the step.
  • bcs::Dict{String,BoundaryCondition}: Boundary conditions
  • block_nodes::Dict{Int64,Vector{Int64}}: A dictionary mapping block IDs to collections of nodes.

Returns

  • TimeWindow: initial and final time, time step and number of steps.
  • nothing: Verlet has no derived state.

Dependencies

This function may depend on the following functions:

  • start_time and the fields of params (final time, safety factor, fixed time step): The simulation parameters.
  • compute_crititical_time_step: Used to calculate the critical time step if dt is not fixed.
  • get_integration_steps: Used to determine the number of integration steps and adjust the time step.
  • find_and_set_core_value_min and find_and_set_core_value_max: Used to set core values in a distributed computing environment.
source

Static_Solver

PeriLab.Solver_Manager.Solver_Common.time_step! — Method
time_step!(ws::StaticWorkspace, run::SolverRun{StaticParams}, ctx::SolverContext, clock::StepClock)

One static step: Dirichlet conditions, then the equilibrium solved with nlsolve (Anderson). Returns StepFailed if nlsolve does not converge.

source
PeriLab.Solver_Manager.Static_Solver.init_solver — Method
init_solver(options::StaticParams, params::SolverParams, models::Vector{String}, bcs::Dict{String,BoundaryCondition}, block_nodes::Dict{Int64,Vector{Int64}})

Initialize the Static solver for a simulation.

This function sets up the Static solver for a simulation by initializing various parameters.

Arguments

  • options::StaticParams: The Static options of the step (tolerances, iterations, start values).
  • params::SolverParams: The solver parameters of the current step.
  • models::Vector{String}: The model categories of the step.
  • bcs::Dict{String,BoundaryCondition}: Boundary conditions
  • block_nodes::Dict{Int64,Vector{Int64}}: A dictionary mapping block IDs to collections of nodes.

Returns

  • TimeWindow: initial and final time, time step and number of steps.
  • nothing: the run reads its settings from options.

Dependencies

This function may depend on the following functions:

  • start_time and the fields of params (final time, safety factor, fixed time step): The simulation parameters.
  • get_integration_steps: Used to determine the number of integration steps and adjust the time step.
source

Boundary_Conditions

PeriLab.Solver_Manager.Boundary_Conditions.eval_bc! — Function
eval_bc!(field_values::Union{NodeScalarField{Float64},NodeScalarField{Int64}}, bc::Union{Float64,Float64,Int64,String}, coordinates::AbstractMatrix{Float64}, time::Float64, dof::Int64)

Working with if-statements "if t>2 0 else 20 end" works for scalars. If you want to evaluate a vector, please use the Julia notation as input "ifelse.(x .> y, 10, 20)"

source
PeriLab.Solver_Manager.Boundary_Conditions.BoundaryCondition — Type
BoundaryCondition

A boundary condition prepared for one solver step: the resolved field (variable, time = "NP1" or "Constant"), its type, the local nodes it acts on, and its value — a number or an expression string from the input deck, replaced by the compiled expression after the first evaluation.

source

Influence_Function

PeriLab.Solver_Manager.Influence_Function.init_influence_function — Method
init_influence_function(nodes::AbstractVector{Int64}, expr_str::Union{Nothing,String})

Initializes the influence function field based on the user-specified parameter "Influence Function". Supports:

  • predefined names (fast path), e.g. "1/xi^2"
  • arbitrary string expressions using the variables xi, xiX, xiY, xiZ, e.g. "1/xi^2", "exp(-xi/3)", "xiX^2 + xiY^2"
source