Solver - Functions
Index
PeriLab.Solver_Manager.Boundary_Conditions.BoundaryConditionPeriLab.Solver_Manager.Static_Solver.StaticWorkspacePeriLab.Solver_Manager.Verlet_Solver.VerletWorkspacePeriLab.Solver_Manager.Boundary_Conditions.apply_bc_dirichletPeriLab.Solver_Manager.Boundary_Conditions.apply_bc_neumannPeriLab.Solver_Manager.Boundary_Conditions.boundary_conditionPeriLab.Solver_Manager.Boundary_Conditions.check_valid_bcsPeriLab.Solver_Manager.Boundary_Conditions.clean_upPeriLab.Solver_Manager.Boundary_Conditions.eval_bc!PeriLab.Solver_Manager.Boundary_Conditions.eval_bc!PeriLab.Solver_Manager.Boundary_Conditions.find_bc_free_dofPeriLab.Solver_Manager.Boundary_Conditions.init_BCsPeriLab.Solver_Manager.Influence_Function.build_influence_functionPeriLab.Solver_Manager.Influence_Function.influence_function_1_div_xi_squared!PeriLab.Solver_Manager.Influence_Function.influence_function_from_string!PeriLab.Solver_Manager.Influence_Function.init_influence_functionPeriLab.Solver_Manager.Solver_Common.prepare_solverPeriLab.Solver_Manager.Solver_Common.prepare_solverPeriLab.Solver_Manager.Solver_Common.time_step!PeriLab.Solver_Manager.Solver_Common.time_step!PeriLab.Solver_Manager.Static_Solver.init_solverPeriLab.Solver_Manager.Verlet_Solver.calculate_strainPeriLab.Solver_Manager.Verlet_Solver.calculate_stressesPeriLab.Solver_Manager.Verlet_Solver.calculate_von_mises_stressPeriLab.Solver_Manager.Verlet_Solver.finish_velocity!PeriLab.Solver_Manager.Verlet_Solver.get_forces_from_force_densityPeriLab.Solver_Manager.Verlet_Solver.get_integration_stepsPeriLab.Solver_Manager.Verlet_Solver.get_partial_stressesPeriLab.Solver_Manager.Verlet_Solver.init_solverPeriLab.Solver_Manager.initPeriLab.Solver_Manager.remove_modelsPeriLab.Solver_Manager.set_anglesPeriLab.Solver_Manager.set_densityPeriLab.Solver_Manager.set_fem_blockPeriLab.Solver_Manager.set_horizonPeriLab.Solver_Manager.solver
Solver
PeriLab.Solver_Manager.init — Method
init(input::PeriLabInput, step_id::Int64)Initialize the solver
Arguments
input::PeriLabInput: The typed inputstep_id::Int64: The solver step (-1: singleSolver)
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.
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
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 deckblock_nodes::Dict: A dictionary mapping block IDs to collections of nodes
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 deckblock_nodes::Dict: A dictionary mapping block IDs to collections of nodesdensity::NodeScalarField{Float64}: The density
Returns
density::NodeScalarField{Float64}: The density
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 deckblock_nodes::Dict: A dictionary mapping block IDs to collections of nodesfem_block::Vector{Bool}: The fem_block
Returns
fem_block::Vector{Bool}: The fem_block
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 deckblock_nodes::Dict: A dictionary mapping block IDs to collections of nodeshorizon::NodeScalarField{Float64}: The horizon
Returns
horizon::NodeScalarField{Float64}: The horizon
PeriLab.Solver_Manager.solver — Method
solver(run::SolverRun, ctx::SolverContext)Runs the solver step run; returns the updated result files.
Verlet_Solver
PeriLab.Solver_Manager.Solver_Common.prepare_solver — Method
prepare_solver(run::SolverRun{VerletParams}, ctx::SolverContext)Fetches the fields the Verlet steps read.
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.
PeriLab.Solver_Manager.Verlet_Solver.calculate_strain — Method
calculate_strain(nodes::AbstractVector{Int64}, hooke_matrix::Matrix{Float64})Calculate the von Mises stress.
Arguments
nodes::AbstractVector{Int64}: The nodes.hooke_matrix::Matrix{Float64}: The hooke matrix.
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.
PeriLab.Solver_Manager.Verlet_Solver.calculate_von_mises_stress — Method
calculate_von_mises_stress(nodes::AbstractVector{Int64})Calculate the von Mises stress.
Arguments
nodes::AbstractVector{Int64}: The nodes.
PeriLab.Solver_Manager.Verlet_Solver.finish_velocity! — Method
finish_velocity!(dt, active_nodes, bcs, time, step_time)Second half step of the velocity Verlet scheme, v_{n+1} = v_{n+1/2} + dt/2 a_{n+1} (the first half step and the numerical damping are in update_velocity_and_position!).
PeriLab.Solver_Manager.Verlet_Solver.get_forces_from_force_density — Method
get_forces_from_force_density()Computes the forces from the force densities.
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
dtis less than or equal to zero.
PeriLab.Solver_Manager.Verlet_Solver.get_partial_stresses — Method
get_partial_stresses(nodes::Vector{Int64})Computes the partial stresses.
Arguments
nodes::Vector{Int64}: List of block nodes.
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 conditionsblock_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_timeand the fields ofparams(final time, safety factor, fixed time step): The simulation parameters.compute_crititical_time_step: Used to calculate the critical time step ifdtis not fixed.get_integration_steps: Used to determine the number of integration steps and adjust the time step.find_and_set_core_value_minandfind_and_set_core_value_max: Used to set core values in a distributed computing environment.
PeriLab.Solver_Manager.Verlet_Solver.VerletWorkspace — Type
VerletWorkspaceFields Verlet reads in every step.
Static_Solver
PeriLab.Solver_Manager.Solver_Common.prepare_solver — Method
prepare_solver(run::SolverRun{StaticParams}, ctx::SolverContext)Fetches the fields and the nlsolve settings of the static steps.
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.
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 conditionsblock_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 fromoptions.
Dependencies
This function may depend on the following functions:
start_timeand the fields ofparams(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.
PeriLab.Solver_Manager.Static_Solver.StaticWorkspace — Type
StaticWorkspaceFields and nlsolve settings of the static solver; start_u is the start value of the next step.
Boundary_Conditions
PeriLab.Solver_Manager.Boundary_Conditions.apply_bc_dirichlet — Method
apply_bc_dirichlet(allowed_variables::Vector{String}, bcs::Dict{String,BoundaryCondition}, time::Float64, step_time::Float64)Apply the boundary conditions
Arguments
bcs::Dict{String,BoundaryCondition}: The boundary conditionstime::Float64: The current time
PeriLab.Solver_Manager.Boundary_Conditions.apply_bc_neumann — Method
apply_bc_neumann(bcs::Dict{String,BoundaryCondition}, time::Float64, step_time::Float64)Apply the boundary conditions
Arguments
bcs::Dict{String,BoundaryCondition}: The boundary conditionstime::Float64: The current time
PeriLab.Solver_Manager.Boundary_Conditions.boundary_condition — Method
boundary_condition(bcs_in)Local node ids of every boundary condition (all node sets of its Node Set list, in order). Aborts if a node set does not exist.
PeriLab.Solver_Manager.Boundary_Conditions.check_valid_bcs — Method
check_valid_bcs(bcs_in, node_sets)The boundary conditions active in the current solver step, with their field resolved. A z condition in a 2D run is skipped with a warning; a missing Type means Dirichlet. Aborts if the field does not exist.
PeriLab.Solver_Manager.Boundary_Conditions.clean_up — Method
clean_up(bc::String)Clean up the boundary condition
Arguments
bc::String: The boundary condition
Returns
bc::String: The cleaned up boundary condition
PeriLab.Solver_Manager.Boundary_Conditions.eval_bc! — Function
eval_bc!(field_values::Union{NodeScalarField{Float64},NodeScalarField{Int64}}, bc::Function, coordinates::AbstractMatrix{Float64}, time::Float64, dof::Int64)uses the already created bc function"
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)"
PeriLab.Solver_Manager.Boundary_Conditions.find_bc_free_dof — Method
find_bc_free_dof(bcs)Finds all dof without a displacement boundary condition and stores them in the Data_Manager.
PeriLab.Solver_Manager.Boundary_Conditions.init_BCs — Method
init_BCs(bcs_in)The boundary conditions of the current solver step.
PeriLab.Solver_Manager.Boundary_Conditions.BoundaryCondition — Type
BoundaryConditionA 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.
Influence_Function
PeriLab.Solver_Manager.Influence_Function.build_influence_function — Method
Parses expr_str once into a compiled RuntimeGeneratedFunction with signature f(xi, xiX, xiY, xiZ).
PeriLab.Solver_Manager.Influence_Function.influence_function_1_div_xi_squared! — Method
Fast hard-coded path for 1/xi^2.
PeriLab.Solver_Manager.Influence_Function.influence_function_from_string! — Method
Generic path: builds a compiled function from the given expression once, then evaluates it per bond. Variables available in the expression: xi, xiX, xiY, xiZ (xiZ only if dof==3).
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"