IO - Functions
Index
PeriLab.IO.Geometry.bond_geometry
PeriLab.IO.Geometry.compute_deformation_gradient
PeriLab.IO.Geometry.compute_strain
PeriLab.IO.Geometry.rotation_tensor
PeriLab.IO.Geometry.shape_tensor
PeriLab.IO.Parameter_Handling.check_for_duplicates
PeriLab.IO.Parameter_Handling.get_all_keys
PeriLab.IO.Parameter_Handling.get_block_models
PeriLab.IO.Parameter_Handling.get_bond_filters
PeriLab.IO.Parameter_Handling.get_computes
PeriLab.IO.Parameter_Handling.get_computes_names
PeriLab.IO.Parameter_Handling.get_density
PeriLab.IO.Parameter_Handling.get_final_time
PeriLab.IO.Parameter_Handling.get_fixed_dt
PeriLab.IO.Parameter_Handling.get_flush_file
PeriLab.IO.Parameter_Handling.get_header
PeriLab.IO.Parameter_Handling.get_heat_capacity
PeriLab.IO.Parameter_Handling.get_horizon
PeriLab.IO.Parameter_Handling.get_initial_time
PeriLab.IO.Parameter_Handling.get_max_damage
PeriLab.IO.Parameter_Handling.get_mesh_name
PeriLab.IO.Parameter_Handling.get_model_options
PeriLab.IO.Parameter_Handling.get_model_parameter
PeriLab.IO.Parameter_Handling.get_models_option
PeriLab.IO.Parameter_Handling.get_node_sets
PeriLab.IO.Parameter_Handling.get_number_of_blocks
PeriLab.IO.Parameter_Handling.get_numerical_damping
PeriLab.IO.Parameter_Handling.get_output_fieldnames
PeriLab.IO.Parameter_Handling.get_output_filenames
PeriLab.IO.Parameter_Handling.get_output_frequency
PeriLab.IO.Parameter_Handling.get_output_type
PeriLab.IO.Parameter_Handling.get_output_variables
PeriLab.IO.Parameter_Handling.get_outputs
PeriLab.IO.Parameter_Handling.get_safety_factor
PeriLab.IO.Parameter_Handling.get_solver_name
PeriLab.IO.Parameter_Handling.get_values
PeriLab.IO.Parameter_Handling.get_write_after_damage
PeriLab.IO.Parameter_Handling.validate_structure_recursive
PeriLab.IO.Parameter_Handling.validate_yaml
PeriLab.IO._init_overlap_map_
PeriLab.IO.apply_bond_filters
PeriLab.IO.area_of_polygon
PeriLab.IO.bond_intersect_infinite_plane
PeriLab.IO.bond_intersect_rectangle_plane
PeriLab.IO.bond_intersects_disc
PeriLab.IO.calculate_block
PeriLab.IO.calculate_nodelist
PeriLab.IO.check_for_duplicate_in_dataframe
PeriLab.IO.check_mesh_elements
PeriLab.IO.check_types_in_dataframe
PeriLab.IO.clearNP1
PeriLab.IO.close_result_file
PeriLab.IO.close_result_files
PeriLab.IO.create_and_distribute_bond_norm
PeriLab.IO.create_distribution
PeriLab.IO.create_distribution_neighbor_based
PeriLab.IO.create_distribution_node_based
PeriLab.IO.create_neighborhoodlist
PeriLab.IO.create_overlap_map
PeriLab.IO.create_result_file
PeriLab.IO.define_nsets
PeriLab.IO.delete_files
PeriLab.IO.disk_filter
PeriLab.IO.distribute_neighborhoodlist_to_cores
PeriLab.IO.distribution_to_cores
PeriLab.IO.find_global_core_value!
PeriLab.IO.get_block_nodes
PeriLab.IO.get_bond_geometry
PeriLab.IO.get_file_size
PeriLab.IO.get_global_values
PeriLab.IO.get_local_element_topology
PeriLab.IO.get_local_neighbors
PeriLab.IO.get_local_overlap_map
PeriLab.IO.get_number_of_neighbornodes
PeriLab.IO.get_paraview_coordinates
PeriLab.IO.get_results_mapping
PeriLab.IO.glob_to_loc
PeriLab.IO.global_value_avg
PeriLab.IO.global_value_max
PeriLab.IO.global_value_min
PeriLab.IO.global_value_sum
PeriLab.IO.init_data
PeriLab.IO.init_orientations
PeriLab.IO.init_results_in_exodus
PeriLab.IO.init_write_results
PeriLab.IO.initialize_data
PeriLab.IO.load_and_evaluate_mesh
PeriLab.IO.local_nodes_from_dict
PeriLab.IO.merge_exodus_file
PeriLab.IO.merge_exodus_files
PeriLab.IO.neighbors
PeriLab.IO.node_distribution
PeriLab.IO.open_result_file
PeriLab.IO.paraview_specifics
PeriLab.IO.read_input
PeriLab.IO.read_input_file
PeriLab.IO.read_mesh
PeriLab.IO.rectangular_plane_filter
PeriLab.IO.set_dof
PeriLab.IO.show_block_summary
PeriLab.IO.write_global_results_in_csv
PeriLab.IO.write_global_results_in_exodus
PeriLab.IO.write_nodal_results_in_exodus
PeriLab.IO.write_results
PeriLab.IO.write_step_and_time
PeriLab.Logging_module.init_logging
PeriLab.Logging_module.print_table
PeriLab.Logging_module.progress_filter
PeriLab.Logging_module.set_result_files
PeriLab.Solver.Helpers.check_inf_or_nan
PeriLab.Solver.Helpers.find_active
PeriLab.Solver.Helpers.find_files_with_ending
PeriLab.Solver.Helpers.find_indices
PeriLab.Solver.Helpers.find_inverse_bond_id
PeriLab.Solver.Helpers.get_active_update_nodes
PeriLab.Solver.Helpers.get_fourth_order
PeriLab.Solver.Helpers.matrix_style
PeriLab.Solver.Helpers.progress_bar
PeriLab.Solver.Helpers.rotate
PeriLab.Solver.Helpers.rotate_second_order_tensor
PeriLab.Solver.Model_Factory.Material.Set_modules.create_module_specifics
PeriLab.Solver.Model_Factory.Material.Set_modules.find_jl_files
PeriLab.Solver.Model_Factory.Material.Set_modules.find_module_files
PeriLab.Solver.Model_Factory.Material.Set_modules.include_files
PeriLab.Solver.Model_Factory.Pre_Calculation.check_dependencies
PeriLab.Solver.Model_Factory.Pre_Calculation.compute_model
PeriLab.Solver.Model_Factory.Pre_Calculation.fields_for_local_synchronization
PeriLab.Solver.Model_Factory.Pre_Calculation.init_fields
PeriLab.Solver.Model_Factory.Pre_Calculation.init_model
IO
PeriLab.IO.merge_exodus_files
— Functionmerge_exodus_files(result_files::Vector{Any}, output_dir::String)
Merges exodus output files
Arguments
result_files::Vector{Any}
: The result filesoutput_dir::String
: The file directory
PeriLab.IO.open_result_file
— Functionopen_result_file(result_file::Dict)
Opens the result file
Arguments
result_file::Dict
: The result file
PeriLab.IO.close_result_file
— Functionclose_result_file(result_file::Dict)
Closes the result file
Arguments
result_file::Dict
: The result file
PeriLab.IO.close_result_files
— Functionclose_result_files(result_files::Vector{Dict})
Closes the result files
Arguments
result_files::Vector{Dict}
: The result files
Returns
true
: File is closedfalse
: File was already closed
close_result_files(result_files::Vector{Dict}, outputs::Dict{Int64,Dict{}})
Closes the result files if the flush_file flag is not set
Arguments
result_files::Vector{Dict}
: The result filesoutputs::Dict{Int64,Dict{}}
: The output settings
PeriLab.IO.delete_files
— Functiondelete_files(result_files::Vector{Dict})
Deletes the result files
Arguments
result_files
: The result files
PeriLab.IO.get_file_size
— Functionget_file_size(result_files::Vector{Dict})
Gets the file size of the result files
Arguments
result_files
: The result files
Returns
total_file_size
: The total file size
PeriLab.IO.clearNP1
— FunctionclearNP1(name::String)
Clears the NP1 from the name
Arguments
name::String
: The name
Returns
name::String
: The cleared name
PeriLab.IO.get_results_mapping
— Functionget_results_mapping(params::Dict, path::String, datamanager::Module)
Gets the results mapping
Arguments
params::Dict
: The parameterspath::String
: The pathdatamanager::Module
: The datamanager
Returns
output_mapping::Dict{Int64,Dict{}}
: The results mapping
PeriLab.IO.initialize_data
— Functioninitialize_data(filename::String, filedirectory::String, datamanager::Module, comm::MPI.Comm, to::TimerOutputs.TimerOutput)
Initialize data.
Arguments
filename::String
: The name of the input file.filedirectory::String
: The directory of the input file.datamanager::Module
: The datamanagercomm::MPI.Comm
: The MPI communicatorto::TimerOutputs.TimerOutput
: The TimerOutput
Returns
data::Dict
: The data
PeriLab.IO.init_orientations
— Functioninit_orientations(datamanager::Module)
Initialize orientations.
Arguments
datamanager::Module
: The datamanager
PeriLab.IO.init_write_results
— Functioninit_write_results(params::Dict, output_dir::String, path::String, datamanager::Module, nsteps::Int64, PERILAB_VERSION::String)
Initialize write results.
Arguments
params::Dict
: The parametersoutput_dir::String
: The output directory.path::String
: The pathdatamanager::Module
: The datamanagernsteps::Int64
: The number of steps
Returns
result_files::Array
: The result filesoutputs::Dict
: The outputs
PeriLab.IO.write_results
— Functionwrite_results(result_files::Vector{Any}, time::Float64, max_damage::Float64, outputs::Dict, datamanager::Module)
Write results.
Arguments
result_files::Vector{Any}
: The result filestime::Float64
: The timemax_damage::Float64
: The maximum damageoutputs::Dict
: The outputsdatamanager::Module
: The datamanager
Returns
result_files::Vector{Any}
: The result files
PeriLab.IO.get_global_values
— Functionget_global_values(output::Dict, datamanager::Module)
Get global values.
Arguments
output::Dict
: The outputdatamanager::Module
: The datamanager
Returns
global_values::Vector
: The global values
PeriLab.IO.find_global_core_value!
— Functionfind_global_core_value!(global_value::Union{Int64,Float64}, calculation_type::String, nnodes::Int64, datamanager::Module)
Find global core value.
Arguments
global_value::Union{Int64,Float64}
: The global valuecalculation_type::String
: The calculation typennodes::Int64
: The number of nodesdatamanager::Module
: The datamanager
Returns
global_value::Union{Int64,Float64}
: The global value
PeriLab.IO.show_block_summary
— Functionshow_block_summary(solver_options::Dict, params::Dict, log_file::String, silent::Bool, comm::MPI.Comm, datamanager::Module)
Show block summary.
Arguments
solver_options::Dict
: The solver optionsparams::Dict
: The paramslog_file::String
: The log filesilent::Bool
: The silent flagcomm::MPI.Comm
: The commdatamanager::Module
: The datamanager
PeriLab.IO.calculate_nodelist
— Functioncalculate_nodelist(datamanager::Module, field_key::String, dof::Union{Int64,Vector{Int64}}, calculation_type::String, local_nodes::Vector{Int64})
Calculate the global value of a field for a given set of nodes.
Arguments
datamanager::Data_manager
: Datamanager.field_key::String
: Field key.dof::Union{Int64,Vector{Int64}}
: Degree of freedomcalculation_type::String
: Calculation type.local_nodes::Vector{Int64}
: Node set.
Returns
value::Vector
: Global value.nnodes::Int64
: Number of nodes.
PeriLab.IO.calculate_block
— Functioncalculate_block(datamanager::Module, field_key::String, dof::Int64, calculation_type::String, block::Int64)
Calculate the global value of a field for a given block.
Arguments
datamanager::Data_manager
: Datamanager.field_key::String
: Field key.dof::Union{Int64,Vector{Int64}}
: Degree of freedomcalculation_type::String
: Calculation type.block::Int64
: Block number.
Returns
value::Float64
: Global value.nnodes::Int64
: Number of nodes.
PeriLab.IO.global_value_sum
— Functionglobal_value_sum(field::SubArray, dof::Union{Int64,Vector{Int64}}, nodes::Union{SubArray,Vector{Int64}})
Calculate the global sum of a field for given nodes.
Arguments
field::SubArray
: Field.dof::Union{Int64,Vector{Int64}
: Degree of freedomnodes::Union{SubArray,Vector{Int64}}
: Nodes.
Returns
returnValue::Vector
: Global value.
PeriLab.IO.global_value_max
— Functionglobal_value_max(field::SubArray, dof::Union{Int64,Vector{Int64}}, nodes::Union{SubArray,Vector{Int64}})
Calculate the global maximum of a field for given nodes.
Arguments
field::SubArray
: Field.dof::Union{Int64,Vector{Int64}}
: Degree of freedomnodes::Union{SubArray,Vector{Int64}}
: Nodes.
Returns
returnValue::Vector
: Global value.
PeriLab.IO.global_value_min
— Functionglobal_value_min(field::SubArray, dof::Union{Int64,Vector{Int64}}, nodes::Union{SubArray,Vector{Int64}})
Calculate the global minimum of a field for given nodes.
Arguments
field::SubArray
: Field.dof::Union{Int64,Vector{Int64}}
: Degree of freedomnodes::Union{SubArray,Vector{Int64}}
: Nodes.
Returns
returnValue::Vector
: Global value.
PeriLab.IO.global_value_avg
— Functionglobal_value_avg(field::SubArray, dof::Union{Int64,Vector{Int64}}, nodes::Union{SubArray,Vector{Int64}})
Calculate the global average of a field for given nodes.
Arguments
field::SubArray
: Field.dof::Union{Int64,Vector{Int64}}
: Degree of freedomnodes::Union{SubArray,Vector{Int64}}
: Nodes.
Returns
returnValue::Vector
: Global value.
Read_Mesh
PeriLab.IO.init_data
— Functioninit_data(params::Dict, path::String, datamanager::Module, comm::MPI.Comm, to::TimerOutput)
Initializes the data for the mesh.
Arguments
params::Dict
: The parameters for the simulation.path::String
: The path to the mesh file.datamanager::Data_manager
: The data manager.comm::MPI.Comm
: The MPI communicator.to::TimerOutput
: The timer output.
Returns
datamanager::Data_manager
: The data manager.params::Dict
: The parameters for the simulation.
PeriLab.IO.create_and_distribute_bond_norm
— Functioncreate_and_distribute_bond_norm(comm::MPI.Comm, datamanager::Module, nlist_filtered_ids::Vector{Vector{Int64}}, distribution::Vector{Int64}, bond_norm::Vector{Float64}, dof::Int64)
Create and distribute the bond norm
Arguments
comm::MPI.Comm
: MPI communicatordatamanager::Module
: Data managernlist_filtered_ids::Vector{Vector{Int64}}
: The filtered neighborhood listdistribution::Vector{Int64}
: The distributionbond_norm::Vector{Float64}
: The bond normdof::Int64
: The degree of freedom
PeriLab.IO.get_local_element_topology
— Functionget_local_element_topology(datamanager::Module, topology::Vector{Vector{Int64}}, distribution::Vector{Int64})
Get the local element topology
Arguments
datamanager::Module
: The datamanagertopology::Vector{Vector{Int64}}
: The topologydistribution::Vector{Int64}
: The distribution
Returns
datamanager::Module
: The datamanager
PeriLab.IO.get_local_overlap_map
— Functionget_local_overlap_map()
Changes entries in the overlap map from the global numbering to the local computer core one.
Arguments
overlap_map::Dict{Int64, Dict{Int64, String}}
: overlap map with global nodes.distribution::Vector{Vector{Int64}}
: global nodes distribution at cores, needed for the gobal to local mappingranks Array{Int64}
: number of used computer cores
Returns
overlap_map::Dict{Int64, Dict{Int64, String}}
: returns overlap map with local nodes.
Example:
get_local_overlap_map(overlap_map, distribution, ranks) # returns local nodes
PeriLab.IO.local_nodes_from_dict
— Functionlocal_nodes_from_dict(glob_to_loc::Dict{Int,Int}, global_nodes::Vector{Int64})
Changes entries in the overlap map from the global numbering to the local computer core one.
Arguments
glob_to_loc::Dict{Int,Int}
: global to local mappingglobal_nodes::Vector{Int64}
: global nodes
Returns
overlap_map::Dict{Int64, Dict{Int64, String}}
: returns overlap map with local nodes.
PeriLab.IO.distribute_neighborhoodlist_to_cores
— Functiondistribute_neighborhoodlist_to_cores(comm::MPI.Comm, datamanager::Module, nlist, distribution)
Distributes the neighborhood list to the cores.
Arguments
comm::MPI.Comm
: MPI communicatordatamanager::Module
: Data managernlist
: neighborhood listdistribution Array{Int64}
: global nodes distribution at cores
Returns
datamanager::Module
: data manager
PeriLab.IO.get_local_neighbors
— Functionget_local_neighbors(mapping, nlist_core)
Gets the local neighborhood list from the global neighborhood list
Arguments
mapping
: mapping functionnlist_core
: global neighborhood list
Returns
nlist_core
: local neighborhood list
PeriLab.IO.get_bond_geometry
— Functionget_bond_geometry(datamanager::Module)
Gets the bond geometry
Arguments
datamanager::Module
: Data manager
Returns
datamanager::Module
: data manager
PeriLab.IO.define_nsets
— Functiondefine_nsets(nsets::Dict{String,Vector{Any,Int64}}, datamanager::Module)
Defines the node sets
Arguments
nsets::Dict{String,Vector{Any,Int64}}
: Node sets read from filesdatamanager::Module
: Data manager
PeriLab.IO.distribution_to_cores
— Functiondistribution_to_cores(comm::MPI.Comm, datamanager::Module, mesh, distribution, dof::Int64)
Distributes the mesh data to the cores
Arguments
comm::MPI.Comm
: MPI communicatordatamanager::Module
: Data managermesh
: Meshdistribution Array{Int64}
: global nodes distribution at coresdof::Int64
: Degree of freedom
Returns
datamanager::Module
: data manager
PeriLab.IO.check_mesh_elements
— Functioncheck_mesh_elements(mesh, dof)
Process and analyze mesh data to create an dictionary containing information about mesh elements for further processing.
Arguments
mesh::DataFrame
: The input mesh data represented as a DataFrame.dof::Int64
: The degrees of freedom (DOF) for the mesh elements.
Returns
A dictionary containing information about mesh elements, which can be used for further processing or uploading.
Example
```julia meshdata = DataFrame(x1 = [1.0, 2.0, 3.0], x2 = [4.0, 5.0, 6.0], volume = [10.0, 20.0, 30.0]) dof = 3 result = checkmeshelements(meshdata, dof)
PeriLab.IO.read_mesh
— Functionread_mesh(filename::String, params::Dict)
Read mesh data from a file and return it as a DataFrame.
Arguments
filename::String
: The path to the mesh file.params::Dict
: The input parameters.
Returns
mesh::DataFrame
: The mesh data as a DataFrame.
PeriLab.IO.area_of_polygon
— Functionarea_of_polygon(vertices)
Calculate the area of a polygon.
Arguments
vertices
: The vertices of the polygon.
Returns
area
: The area of the polygon.
PeriLab.IO.set_dof
— Functionset_dof(mesh::DataFrame)
Set the degrees of freedom (DOF) for the mesh elements.
Arguments
mesh::DataFrame
: The input mesh data represented as a DataFrame.
Returns
dof::Int64
: The degrees of freedom (DOF) for the mesh elements.
PeriLab.IO.load_and_evaluate_mesh
— Functionload_and_evaluate_mesh(params::Dict, path::String, ranksize::Int64, to::TimerOutput)
Load and evaluate the mesh data.
Arguments
params::Dict
: The input parameters.path::String
: The path to the mesh file.ranksize::Int64
: The number of ranks.to::TimerOutput
: The timer output
Returns
distribution::Array{Int64,1}
: The distribution of the mesh elements.mesh::DataFrame
: The mesh data as a DataFrame.ntype::Dict
: The type of the mesh elements.overlap_map::Array{Array{Int64,1},1}
: The overlap map of the mesh elements.nlist::Array{Array{Int64,1},1}
: The neighborhood list of the mesh elements.dof::Int64
: The degrees of freedom (DOF) for the mesh elements.nsets::Dict
: The node setstopology::Int64
::Array{Int64,nelement:nodes}`: The topology of elements.el_distribution::Array{Int64,1}
: The distribution of the finite elements.
PeriLab.IO.create_neighborhoodlist
— Functioncreate_neighborhoodlist(mesh::DataFrame, params::Dict, dof::Int64)
Create the neighborhood list of the mesh elements.
Arguments
mesh::DataFrame
: The input mesh data represented as a DataFrame.params::Dict
: The input parameters.dof::Int64
: The degrees of freedom (DOF) for the mesh elements.
Returns
nlist::Array{Array{Int64,1},1}
: The neighborhood list of the mesh elements.
PeriLab.IO.get_number_of_neighbornodes
— Functionget_number_of_neighbornodes(nlist::Vector{Vector{Int64}})
Get the number of neighbors for each node.
Arguments
nlist::Vector{Vector{Int64}}
: The neighborhood list of the mesh elements.
Returns
length_nlist::Vector{Int64}
: The number of neighbors for each node.
PeriLab.IO.node_distribution
— Functionnode_distribution(nlist::Vector{Vector{Int64}}, size::Int64)
Create the distribution of the nodes.
Arguments
nlist::Vector{Vector{Int64}}
: The neighborhood list of the mesh elements.size::Int64
: The number of ranks.distribution_type::String
: The distribution type.
Returns
distribution::Vector{Vector{Int64}}
: The distribution of the nodes.ptc::Vector{Int64}
: Defines at which core / rank each node lies.ntype::Dict
: The type of the nodes.
PeriLab.IO._init_overlap_map_
— Function_init_overlap_map_(size)
Initialize the overlap map.
Arguments
size::Int64
: The number of ranks.
Returns
overlap_map::Dict{Int64,Dict{Int64,Dict{String,Vector{Int64}}}}
: The overlap map.
PeriLab.IO.create_overlap_map
— Functioncreate_overlap_map(distribution, ptc, size)
Create the overlap map.
Arguments
distribution::Array{Int64,1}
: The distribution of the nodes.ptc::Array{Int64,1}
: The number of nodes in each rank.size::Int64
: The number of ranks.
Returns
overlap_map::Dict{Int64,Dict{Int64,Dict{String,Vector{Int64}}}}
: The overlap map.
PeriLab.IO.create_distribution
— Functioncreate_distribution(nnodes::Int64, size::Int64)
Calculate the initial size of each chunk for a nearly equal number of nodes vs. cores this algorithm might lead to the problem, that the last core is not equally loaded
Arguments
nnodes::Int64
: The number of nodes.size::Int64
: The number of cores.
Returns
distribution::Array{Int64,1}
: The distribution of the nodes.point_to_core::Array{Int64,1}
: The number of nodes in each rank.
PeriLab.IO.create_distribution_node_based
— Functioncreate_distribution_node_based(nnodes::Int64,nlist::Vector{Vector{Int64}}, size::Int64)
Calculate the initial size of each chunk for a nearly equal number of nodes vs. cores this algorithm might lead to the problem, that the last core is not equally loaded
Arguments
nnodes::Int64
: The number of nodes.nlist::Vector{Vector{Int64}}
: The neighborhood list.size::Int64
: The number of cores.
Returns
distribution::Array{Int64,1}
: The distribution of the nodes.point_to_core::Array{Int64,1}
: The number of nodes in each rank.
PeriLab.IO.create_distribution_neighbor_based
— Functioncreate_distribution_neighbor_based(nnodes::Int64,nlist::Vector{Vector{Int64}}, size::Int64)
Calculate the initial size of each chunk for a nearly equal number of nodes vs. cores this algorithm might lead to the problem, that the last core is not equally loaded
Arguments
nnodes::Int64
: The number of nodes.nlist::Vector{Vector{Int64}}
: The neighborhood list.size::Int64
: The number of cores.
Returns
distribution::Array{Int64,1}
: The distribution of the nodes.point_to_core::Array{Int64,1}
: The number of nodes in each rank.
PeriLab.IO.neighbors
— Functionneighbors(mesh, params::Dict, coor)
Compute the neighbor list for each node in a mesh based on their proximity using a BallTree data structure.
Arguments
mesh
: A mesh data structure containing the coordinates and other information.params
: paramss needed for computing the neighbor list.coor
: A vector of coordinate names along which to compute the neighbor list.
Returns
An array of neighbor lists, where each element represents the neighbors of a node in the mesh.
PeriLab.IO.bond_intersects_disc
— Functionbond_intersects_disc(p0::Vector{Float64}, p1::Vector{Float64}, center::Vector{Float64}, normal::Vector{Float64}, radius::Float64)
Check if a line segment intersects a disk.
Arguments
p0::Vector{Float64}
: The start point of the line segment.p1::Vector{Float64}
: The end point of the line segment.center::Vector{Float64}
: The center of the disk.normal::Vector{Float64}
: The normal of the plane.radius::Float64
: The radius of the disk.
Returns
Bool
: True if the line segment intersects the disk, False otherwise.
PeriLab.IO.bond_intersect_infinite_plane
— Functionbond_intersect_infinite_plane(p0::Vector{Float64}, p1::Vector{Float64}, lower_left_corner::Vector{Float64}, normal::Vector{Float64})
Check if a line segment intersects an infinite plane.
Arguments
p0::Vector{Float64}
: The start point of the line segment.p1::Vector{Float64}
: The end point of the line segment.lower_left_corner::Vector{Float64}
: The lower left corner of the plane.normal::Vector{Float64}
: The normal of the plane.
Returns
Bool
: True if the line segment intersects the plane, False otherwise.
PeriLab.IO.bond_intersect_rectangle_plane
— Functionbond_intersect_rectangle_plane(x::Vector{Float64}, lower_left_corner::Vector{Float64}, bottom_unit_vector::Vector{Float64}, normal::Vector{Float64}, side_length::Float64, bottom_length::Float64)
Check if a bond intersects a rectangle plane.
Arguments
x::Vector{Float64}
: The point.lower_left_corner::Vector{Float64}
: The lower left corner of the rectangle.bottom_unit_vector::Vector{Float64}
: The unit vector along the bottom of the rectangle.normal::Vector{Float64}
: The normal of the plane.side_length::Float64
: The side length of the rectangle.bottom_length::Float64
: The bottom length of the rectangle.
Returns
Bool
: True if the point is inside the rectangle, False otherwise.
PeriLab.IO.apply_bond_filters
— Functionapply_bond_filters(nlist::Vector{Vector{Int64}}, mesh::DataFrame, params::Dict, dof::Int64)
Apply the bond filters to the neighborhood list.
Arguments
nlist::Vector{Vector{Int64}}
: The neighborhood list.mesh::DataFrame
: The mesh.params::Dict
: The parameters.dof::Int64
: The degrees of freedom.
Returns
nlist::Vector{Vector{Int64}}
: The filtered neighborhood list.nlist_filtered_ids::Vector{Vector{Int64}}
: The filtered neighborhood list.
PeriLab.IO.disk_filter
— Functiondisk_filter(nnodes::Int64, data::Matrix{Float64}, filter::Dict, nlist::Vector{Vector{Int64}}, dof::Int64)
Apply the disk filter to the neighborhood list.
Arguments
nnodes::Int64
: The number of nodes.data::Matrix{Float64}
: The data.filter::Dict
: The filter.nlist::Vector{Vector{Int64}}
: The neighborhood list.dof::Int64
: The degrees of freedom.
Returns
filter_flag::Vector{Bool}
: The filter flag.normal::Vector{Float64}
: The normal vector of the disk.
PeriLab.IO.rectangular_plane_filter
— Functionrectangular_plane_filter(nnodes::Int64, data::Matrix{Float64}, filter::Dict, nlist::Vector{Vector{Int64}}, dof::Int64)
Apply the rectangular plane filter to the neighborhood list.
Arguments
nnodes::Int64
: The number of nodes.data::Matrix{Float64}
: The data.filter::Dict
: The filter.nlist::Vector{Vector{Int64}}
: The neighborhood list.dof::Int64
: The degrees of freedom.
Returns
filter_flag::Vector{Bool}
: The filter flag.normal::Vector{Float64}
: The normal vector of the disk.
PeriLab.IO.glob_to_loc
— Functionglob_to_loc(distribution)
Get the global to local mapping
Arguments
distribution
: The distribution
Returns
glob_to_loc
: The global to local mapping
PeriLab.IO.check_for_duplicate_in_dataframe
— Functioncheck_for_duplicate_in_dataframe(mesh::DataFrame)
check duplicated entries and throws an error if one is there. If not everything is ok.
Arguments
mesh::DataFrame
: The input mesh data represented as a DataFrame.
PeriLab.IO.check_types_in_dataframe
— Functioncheck_types_in_dataframe(mesh::DataFrame)
check if block_id in mesh contains only int.
Arguments
mesh::DataFrame
: The input mesh data represented as a DataFrame.
Geometry
PeriLab.IO.Geometry.bond_geometry
— Function bond_geometry(nodes::Union{SubArray,Vector{Int64}}, nlist, coor, undeformed_bond, undeformed_bond_length)
Calculate bond geometries between nodes based on their coordinates.
Arguments
nodes::Union{SubArray,Vector{Int64}}
: A vector of integers representing node IDs.nlist
: A data structure (e.g., a list or array) representing neighboring node IDs for each node.coor
: A matrix representing the coordinates of each node.undeformed_bond
: A preallocated array or data structure to store bond geometries.undeformed_bond_length
: A preallocated array or data structure to store bond distances.
Output
undeformed_bond
: An updatedundeformed_bond
array with calculated bond geometries.
Description
This function calculates bond geometries between nodes. For each node in nodes
, it computes the bond vector between the node and its neighboring nodes based on their coordinates. It also calculates the distance (magnitude) of each bond vector.
If the distance of any bond vector is found to be zero, indicating identical point coordinates, an error is raised.
Example
```julia nodes = [1, 2, 3] dof = 2 nlist = [[2, 3], [1, 3], [1, 2]] coor = [0.0 0.0; 1.0 0.0; 0.0 1.0] undeformed_bond = zeros(Float64, length(nodes), length(nlist[1]), dof + 1)
undeformedbond(nodes, dof, nlist, coor, undeformedbond)
PeriLab.IO.Geometry.shape_tensor
— Functionshape_tensor(nodes::Union{SubArray, Vector{Int64}}, dof::Int64, nlist, volume, omega, bond_damage, undeformed_bond, shape_tensor, inverse_shape_tensor)
Calculate the shape tensor and its inverse for a set of nodes in a computational mechanics context.
Arguments
nodes::Union{SubArray, Vector{Int64}}
: A vector of integers representing node IDs.dof::Int64
: An integer representing the degrees of freedom.nlist
: A data structure (e.g., a list or array) representing neighboring node IDs for each node.volume
: A vector or array containing volume information for each node.omega
: A vector or array containing omega information for each node.bond_damage
: A data structure representing bond damage for each node.undeformed_bond
: A data structure representing bond geometries for each node.shape_tensor
: A preallocated 3D array to store the shape tensors for each node.inverse_shape_tensor
: A preallocated 3D array to store the inverse shape tensors for each node.
Output
shape_tensor
: An updatedshape_tensor
array with calculated shape tensors.inverse_shape_tensor
: An updatedinverse_shape_tensor
array with calculated inverse shape tensors.
Description
This function calculates the shape tensor and its inverse for a set of nodes in a computational mechanics context. The shape tensor is a key quantity used in continuum mechanics to describe material deformation. It is calculated based on bond damage, bond geometries, volume, and omega information for each node.
For each node in nodes
, the function iterates through degrees of freedom (dof
) and computes elements of the shape tensor. The inverse of the shape tensor is also calculated and stored in inverse_shape_tensor
.
Example
```julia nodes = [1, 2, 3] dof = 3 nlist = [[2, 3], [1, 3], [1, 2]] volume = [0.1, 0.2, 0.3] omega = [0.5, 0.4, 0.6] bonddamage = zeros(Float64, length(nodes), length(nlist[1])) undeformedbond = rand(Float64, length(nodes), length(nlist[1]), dof) shapetensor = zeros(Float64, length(nodes), dof, dof) inverseshape_tensor = zeros(Float64, length(nodes), dof, dof)
shapetensor(nodes, dof, nlist, volume, omega, bonddamage, undeformedbond, shapetensor, inverseshapetensor)
PeriLab.IO.Geometry.compute_deformation_gradient
— Functioncompute_deformation_gradient(nodes::Union{SubArray, Vector{Int64}}, dof::Int64, nlist, volume, omega, bond_damage, undeformed_bond, deformed_bond, inverse_shape_tensor, deformation_gradient)
Calculate the deformation gradient tensor for a set of nodes in a computational mechanics context.
Arguments
nodes::Union{SubArray, Vector{Int64}}
: A vector of integers representing node IDs.dof::Int64
: An integer representing the degrees of freedom.nlist
: A data structure (e.g., a list or array) representing neighboring node IDs for each node.volume
: A vector or array containing volume information for each node.omega
: A vector or array containing omega information for each node.bond_damage
: A data structure representing bond damage for each node.undeformed_bond
: A data structure representing bond geometries for each node.deformed_bond
: A data structure representing deformed bond properties for each node.inverse_shape_tensor
: A data structure representing the inverse shape tensors for each node.deformation_gradient
: A preallocated 3D array to store the deformation gradient tensors for each node.
Output
deformation_gradient
: An updateddeformation_gradient
array with calculated deformation gradient tensors.
Description
This function calculates the deformation gradient tensor for a set of nodes in a computational mechanics context. The deformation gradient tensor characterizes the deformation of a material.
For each node in nodes
, the function iterates through degrees of freedom (dof
) and computes elements of the deformation gradient tensor based on bond damage, deformed bond properties, bond geometries, volume, and omega information. The calculated deformation gradient tensor is stored in deformation_gradient
.
Example
```julia nodes = [1, 2, 3] dof = 3 nlist = [[2, 3], [1, 3], [1, 2]] volume = [0.1, 0.2, 0.3] omega = [0.5, 0.4, 0.6] bonddamage = zeros(Float64, length(nodes), length(nlist[1])) undeformedbond = rand(Float64, length(nodes), length(nlist[1]), dof) deformedbond = rand(Float64, length(nodes), length(nlist[1]), dof) inverseshapetensor = rand(Float64, length(nodes), dof, dof) deformationgradient = zeros(Float64, length(nodes), dof, dof)
computedeformationgradient(nodes, dof, nlist, volume, omega, bonddamage, undeformedbond, deformedbond, inverseshapetensor, deformationgradient)
PeriLab.IO.Geometry.compute_strain
— Functionfunction compute_strain(nodes::Union{Base.OneTo{Int64},Vector{Int64}, SubArray}, deformation_gradient, strain)
Calculate strains for specified nodes based on deformation gradients.
Arguments
nodes::Union{SubArray, Vector{Int64}}
: List of nodesdeformation_gradient
: Deformation gradient at current time step (2D or 3D array).
Returns
- Updated
strain
array containing strains.
This function iterates over the specified nodes and computes strain at each node using the given deformation gradients.
PeriLab.IO.Geometry.rotation_tensor
— Functionfunction rotation_tensor(angles::Vector{Float64})
Creates the rotation tensor for 2D or 3D applications. Uses Rotations.jl package.
Arguments
angles::Vector{Float64}
: Vector of angles definede in degrees of length one or three
Returns
- Rotation tensor
ReadInputDeck
PeriLab.IO.read_input
— Functionread_input(filename::String)
Reads the input deck from a yaml file
Arguments
filename::String
: The name of the yaml file
Returns
params::Dict{String,Any}
: The parameters read from the yaml file
PeriLab.IO.read_input_file
— Functionread_input_file(filename::String)
Reads the input deck from a yaml file
Arguments
filename::String
: The name of the yaml file
Returns
Dict{String,Any}
: The validated parameters read from the yaml file.
WriteExodusResults
PeriLab.IO.create_result_file
— Functioncreate_result_file(filename::Union{AbstractString,String}, num_nodes::Int64, num_dim::Int64, num_elem_blks::Int64, num_node_sets::Int64)
Creates a exodus file for the results
Arguments
filename::Union{AbstractString,String}
: The name of the file to createnum_nodes::Int64
: The number of nodesnum_dim::Int64
: The number of dimensionsnum_elem_blks::Int64
: The number of element blocksnum_node_sets::Int64
: The number of node sets
Returns
result_file::Dict{String,Any}
: A dictionary containing the filename and the exodus file
create_result_file(filename::String, outputs::Dict)
Creates a csv file for the results
Arguments
filename::String
: The name of the file to createoutputs::Dict
: The outputs dictionary
Returns
Dict
: The result file
PeriLab.IO.paraview_specifics
— Functionparaview_specifics(dof::Int64)
Returns the paraview specific dof
Arguments
dof::Int64
: The degrees of freedom
Returns
paraview_specifics::String
: The paraview specific dof
PeriLab.IO.get_paraview_coordinates
— Functionget_paraview_coordinates(dof::Int64, refDof::Int64)
Returns the paraview specific dof
Arguments
dof::Int64
: The degrees of freedomrefDof::Int64
: The reference degrees of freedom
Returns
paraview_specifics::String
: The paraview specific dof
PeriLab.IO.get_block_nodes
— Functionget_block_nodes(block_Id::Union{SubArray,Vector{Int64}}, block::Int64)
Returns the nodes of a block
Arguments
block_Id::Union{SubArray,Vector{Int64}}
: The block Idblock::Int64
: The block
Returns
nodes::Vector{Int64}
: The nodes of the block
PeriLab.IO.init_results_in_exodus
— Functioninit_results_in_exodus(exo::ExodusDatabase, output::Dict{}, coords::Union{Matrix{Int64},Matrix{Float64}}, block_Id::Vector{Int64}, uniqueBlocks::Vector{Int64}, nsets::Dict{String,Vector{Int64}}, global_ids::Vector{Int64}, PERILAB_VERSION::String)
Initializes the results in exodus
Arguments
exo::ExodusDatabase
: The exodus databaseoutput::Dict{String,Any}
: The outputcoords::Union{Matrix{Int64},Matrix{Float64}}
: The coordinatesblock_Id::Vector{Int64}
: The block IduniqueBlocks::Vector{Int64}
: The unique blocksnsets::Dict{String,Vector{Int64}}
: The node setsglobal_ids::Vector{Int64}
: The global ids
Returns
result_file::Dict{String,Any}
: The result file
PeriLab.IO.write_step_and_time
— Functionwrite_step_and_time(exo::ExodusDatabase, step::Int64, time::Float64)
Writes the step and time in the exodus file
Arguments
exo::ExodusDatabase
: The exodus filestep::Int64
: The steptime::Float64
: The time
Returns
exo::ExodusDatabase
: The exodus file
PeriLab.IO.write_nodal_results_in_exodus
— Functionwrite_nodal_results_in_exodus(exo::ExodusDatabase, step::Int64, output::Dict, datamanager::Module)
Writes the nodal results in the exodus file
Arguments
exo::ExodusDatabase
: The exodus filestep::Int64
: The stepoutput::Dict
: The outputdatamanager::Module
: The datamanager
Returns
exo::ExodusDatabase
: The exodus file
PeriLab.IO.write_global_results_in_exodus
— Functionwrite_global_results_in_exodus(exo::ExodusDatabase, step::Int64, global_values)
Writes the global results in the exodus file
Arguments
exo::ExodusDatabase
: The exodus filestep::Int64
: The stepglobal_values
: The global values
Returns
exo::ExodusDatabase
: The exodus file
PeriLab.IO.merge_exodus_file
— Functionmerge_exodus_file(file_name::Union{AbstractString,String})
Merges the exodus file
Arguments
file_name::Union{AbstractString,String}
: The name of the file to merge
Returns
exo::ExodusDatabase
: The exodus file
WriteCSVResults
PeriLab.IO.write_global_results_in_csv
— Functionwrite_global_results_in_csv(csv_file::IOStream, time::Float64, global_values)
Writes the global results to the csv file
Arguments
csv_file::IOStream
: The csv fileglobal_values
: The global values
Helpers
PeriLab.Solver.Helpers.find_indices
— Functionfind_indices(vector, what)
Returns the indices of vector
that are equal to what
.
Arguments
vector::Vector
: The vector to search in.what
: The value to search for.
Returns
indices::Vector
: The indices ofvector
that are equal towhat
.
PeriLab.Solver.Helpers.find_active
— Functionfind_active(active::Vector{Bool})
Returns the indices of active
that are true.
Arguments
active::Vector{Bool}
: The vector to search in.
Returns
indices::Vector
: The indices ofactive
that are true.
PeriLab.Solver.Helpers.get_active_update_nodes
— Functionget_active_update_nodes(active::SubArray, update_list::SubArray, block_nodes::Dict{Int64,Vector{Int64}}, block::Int64)
Returns the active nodes and the update nodes.
Arguments
active::SubArray
: The active vector.update_list::SubArray
: The update vector.block_nodes::Dict{Int64,Vector{Int64}}
: The vector to search in.block::Int64
: The block_id.
Returns
active_nodes::Vector{Int64}
: The nodes ofactive
that are true.update_nodes::Vector{Int64}
: The nodes ofupdate
that are true.
PeriLab.Solver.Helpers.find_files_with_ending
— Functionfind_files_with_ending(folder_path::AbstractString, file_ending::AbstractString)
Returns a list of files in folder_path
that end with file_ending
.
Arguments
folder_path::AbstractString
: The path to the folder.file_ending::AbstractString
: The ending of the files.
Returns
file_list::Vector{String}
: The list of files that end withfile_ending
.
PeriLab.Solver.Helpers.check_inf_or_nan
— Functioncheck_inf_or_nan(array, msg)
Checks if the sum of the array is finite. If not, an error is raised.
Arguments
array
: The array to check.msg
: The error message to raise.
Returns
Bool
:true
if the sum of the array is finite,false
otherwise.
PeriLab.Solver.Helpers.matrix_style
— Functionmatrix_style(A)
Include a scalar or an array and reshape it to style needed for LinearAlgebra package
Arguments
A
: The array or scalar to reshape
Returns
Array
: The reshaped array
PeriLab.Solver.Helpers.progress_bar
— Functionprogress_bar(rank::Int64, nsteps::Int64, silent::Bool)
Create a progress bar if the rank is 0. The progress bar ranges from 1 to nsteps + 1.
Arguments
- rank::Int64: An integer to determine if the progress bar should be created.
- nsteps::Int64: The total number of steps in the progress bar.
- silent::Bool: de/activates the progress bar
Returns
- ProgressBar or UnitRange: If rank is 0, a ProgressBar object is returned. Otherwise, a range from 1 to nsteps + 1 is returned.
PeriLab.Solver.Helpers.get_fourth_order
— Functionget_fourth_order(CVoigt, dof)
Constructs a symmetric fourth-order tensor from a Voigt notation vector. It uses Tensors.jl package.
This function takes a Voigt notation vector CVoigt
and the degree of freedom dof
to create a symmetric fourth-order tensor. The CVoigt
vector contains components that represent the tensor in Voigt notation, and dof
specifies the dimension of the tensor.
Arguments
CVoigt::Matrix{Float64}
: A vector containing components of the tensor in Voigt notation.dof::Int64
: The dimension of the resulting symmetric fourth-order tensor.
Returns
SymmetricFourthOrderTensor{dof}
: A symmetric fourth-order tensor of dimensiondof
.
Example
```julia CVoigt = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] dof = 3 result = getfourthorder(CVoigt, dof)
PeriLab.Solver.Helpers.find_inverse_bond_id
— Functionfind_inverse_bond_id(nlist::SubArray)
Finds the inverse of the bond id in the nlist.
Arguments
nlist::SubArray
: The nlist to find the inverse of.
Returns
inverse_nlist::Vector{Dict{Int64,Int64}}
: The inverse nlist.
PeriLab.Solver.Helpers.rotate
— Functionrotate(nodes::Union{SubArray,Vector{Int64}}, dof::Int64, matrix::Union{SubArray,Array{Float64,3}}, angles::SubArray, back::Bool)
Rotates the matrix.
Arguments
nodes::Union{SubArray,Vector{Int64}}
: List of block nodes.matrix::Union{SubArray,Array{Float64,3}}
: Matrix.rot::SubArray
: Rotation tensor.back::Bool
: Back.
Returns
matrix::SubArray
: Matrix.
PeriLab.Solver.Helpers.rotate_second_order_tensor
— Functionrotate_second_order_tensor(angles::Union{Vector{Float64},Vector{Int64}}, tensor::Matrix{Float64}, dof::Int64, back::Bool)
Rotates the second order tensor.
Arguments
angles::Union{Vector{Float64},Vector{Int64}}
: Angles.tensor::Matrix{Float64}
: Second order tensor.dof::Int64
: Degree of freedom.back::Bool
: Back.
Returns
tensor::Matrix{Float64}
: Second order tensor.
Pre_Calculation
PeriLab.Solver.Model_Factory.Pre_Calculation.init_fields
— Functioninit_fields(datamanager::Module)
Initializes the fields.
Arguments
datamanager::Data_manager
: Datamanager
Returns
datamanager::Data_manager
: Datamanager.
PeriLab.Solver.Model_Factory.Pre_Calculation.init_model
— Functioninit_model(datamanager::Module, nodes::Union{SubArray,Vector{Int64}, block::Int64)
Initializes the model.
Arguments
datamanager::Data_manager
: Datamanagernodes::Union{SubArray,Vector{Int64}}
: The nodes.block::Int64
: Block.
Returns
datamanager::Data_manager
: Datamanager.
PeriLab.Solver.Model_Factory.Pre_Calculation.fields_for_local_synchronization
— Functionfields_for_local_synchronization(model_param::Dict)
Finds all synchronization fields from the model class
Arguments
model_param::Dict
: model parameter.
Returns
synch_dict::Dict
: Synchronization Dictionary.
PeriLab.Solver.Model_Factory.Pre_Calculation.compute_model
— Functioncompute_model(datamanager::Module, nodes::Union{SubArray,Vector{Int64}}, model_param::Dict, block::Int64, time::Float64, dt::Float64,to::TimerOutput,)
Computes the pre calculation models
Arguments
datamanager::Module
: The datamanagernodes::Union{SubArray,Vector{Int64}}
: The nodesmodel_param::Dict
: The model parametersblock::Int64
: The blocktime::Float64
: The current timedt::Float64
: The time step
Returns
datamanager::Module
: The datamanager
PeriLab.Solver.Model_Factory.Pre_Calculation.check_dependencies
— Functioncheck_dependencies(datamanager::Module, block_nodes::Dict{Int64,Vector{Int64}}
Check if materials are used which needs a form of pre calculation. If so, the option will be set.
Arguments
datamanager::Module
: Datamanager.block_nodes::Dict{Int64,Vector{Int64}}
: block nodes.
Returns
datamanager::Data_manager
: Datamanager.
parameter_handling
PeriLab.IO.Parameter_Handling.validate_yaml
— Functionvalidate_yaml(params::Dict)
Validates the parameters against the expected structure
Arguments
params::Dict
: The parameters dictionary.
Returns
params::Dict
: The parameters dictionary.
PeriLab.IO.Parameter_Handling.validate_structure_recursive
— Functionvalidate_structure_recursive(expected::Dict, actual::Dict, validate::Bool, checked_keys::Array, path::String="")
Validates the parameters against the expected structure
Arguments
expected::Dict
: The expected structureactual::Dict
: The actual structurevalidate::Bool
: The validation resultschecked_keys::Array
: The keys that have been checkedpath::String
: The current path
Returns
validate::Bool
: The validation resultchecked_keys::Array
: The keys that have been checked
PeriLab.IO.Parameter_Handling.get_all_keys
— Functionget_all_keys(params::Dict)
Get all the keys in the parameters
Arguments
params::Dict
: The parameters dictionary.
Returns
keys_list::Array
: The keys list
PeriLab.IO.Parameter_Handling.get_density
— Functionget_density(params::Dict, block_id::Int64)
Get the density of a block.
Arguments
params::Dict
: The parametersblock_id::Int64
: The ID of the block
Returns
density::Float64
: The density of the block
PeriLab.IO.Parameter_Handling.get_heat_capacity
— Functionget_heat_capacity(params::Dict, block_id::Int64)
Get the heat capacity of a block.
Arguments
params::Dict
: The parametersblock_id::Int64
: The ID of the block
Returns
heat_capacity::Float64
: The heat capacity of the block
PeriLab.IO.Parameter_Handling.get_horizon
— Functionget_horizon(params::Dict, block_id::Int64)
Get the horizon of a block.
Arguments
params::Dict
: The parametersblock_id::Int64
: The ID of the block
Returns
horizon::Float64
: The horizon of the block
PeriLab.IO.Parameter_Handling.get_values
— Functionget_values(params::Dict, block_id::Int64, valueName::String, defaultValue::Union{Float64,Bool,Nothing})
Get the value of a block.
Arguments
params::Dict
: The parametersblock_id::Int64
: The ID of the blockvalueName::String
: The name of the valuedefaultValue::Union{Float64,Bool,Nothing
: The default value
Returns
value::Float64
: The value of the block
PeriLab.IO.Parameter_Handling.get_number_of_blocks
— Functionget_number_of_blocks(params::Dict)
Get the number of blocks.
Arguments
params::Dict
: The parameters
Returns
number_of_blocks::Int64
: The number of blocks
PeriLab.IO.Parameter_Handling.get_block_models
— Functionget_block_models(params::Dict, block_id::Int64)
Get the models of a block.
Arguments
params::Dict
: The parametersblock_id::Int64
: The ID of the block
Returns
modelDict::Dict{String,String}
: The models of the block
PeriLab.IO.Parameter_Handling.get_computes_names
— Functionget_computes_names(params::Dict)
Get the names of the computes.
Arguments
params::Dict
: The parameters dictionary.
Returns
computes_names::Vector{String}
: The names of the computes.
PeriLab.IO.Parameter_Handling.get_output_variables
— Functionget_output_variables(output::String, variables::Vector)
Get the output variable.
Arguments
output::String
: The output variable.variables::Vector
: The variables.
Returns
output::String
: The output variable.
PeriLab.IO.Parameter_Handling.get_computes
— Functionget_computes(params::Dict, variables::Vector{String})
Get the computes.
Arguments
params::Dict
: The parameters dictionary.variables::Vector{String}
: The variables.
Returns
computes::Dict{String,Dict{Any,Any}}
: The computes.
PeriLab.IO.Parameter_Handling.get_mesh_name
— Functionget_mesh_name(params::Dict)
Returns the name of the mesh file from the parameters
Arguments
params::Dict
: The parameters
Returns
String
: The name of the mesh file
PeriLab.IO.Parameter_Handling.get_bond_filters
— Functionget_bond_filters(params::Dict)
Returns the bond filters from the parameters
Arguments
params::Dict
: The parameters
Returns
check::Bool
: Whether the bond filters are definedbfList::Dict{String,Dict{String,Any}}
: The bond filters
PeriLab.IO.Parameter_Handling.get_node_sets
— Functionget_node_sets(params::Dict, path::String)
Returns the node sets from the parameters
Arguments
params::Dict
: The parameterspath::String
: The path to the mesh file
Returns
nsets::Dict{String,Any}
: The node sets
PeriLab.IO.Parameter_Handling.check_for_duplicates
— Functioncheck_for_duplicates(filenames)
Check for duplicate filenames.
Arguments
filenames::Vector{String}
: The filenames
PeriLab.IO.Parameter_Handling.get_output_filenames
— Functionget_output_filenames(params::Dict, output_dir::String)
Gets the output filenames.
Arguments
params::Dict
: The parametersoutput_dir::String
: The file directory
Returns
filenames::Vector{String}
: The filenames
PeriLab.IO.Parameter_Handling.get_output_type
— Functionget_output_type(outputs::Dict, output::String)
Gets the output type.
Arguments
outputs::Dict
: The outputsoutput::String
: The output
Returns
output_type::String
: The output type
PeriLab.IO.Parameter_Handling.get_flush_file
— Functionget_flush_file(outputs::Dict, output::String)
Gets the flush file.
Arguments
outputs::Dict
: The outputsoutput::String
: The output
Returns
flush_file::Bool
: The flush file
PeriLab.IO.Parameter_Handling.get_write_after_damage
— Functionget_write_after_damage(outputs::Dict, output::String)
Get the write after damage.
Arguments
outputs::Dict
: The outputsoutput::String
: The output
Returns
write_after_damage::Bool
: The value
PeriLab.IO.Parameter_Handling.get_output_fieldnames
— Functionget_output_fieldnames(outputs::Dict, variables::Vector{String}, computes::Vector{String}, output_type::String)
Gets the output fieldnames.
Arguments
outputs::Dict
: The outputsvariables::Vector{String}
: The variablescomputes::Vector{String}
: The computesoutput_type::String
: The output type
Returns
output_fieldnames::Vector{String}
: The output fieldnames
PeriLab.IO.Parameter_Handling.get_outputs
— Functionget_outputs(params::Dict, variables::Vector{String}, compute_names::Vector{String})
Gets the outputs.
Arguments
params::Dict
: The parametersvariables::Vector{String}
: The variablescompute_names::Vector{String}
: The compute names
Returns
outputs::Dict
: The outputs
PeriLab.IO.Parameter_Handling.get_output_frequency
— Functionget_output_frequency(params::Dict, nsteps::Int64)
Gets the output frequency.
Arguments
params::Dict
: The parametersnsteps::Int64
: The number of steps
Returns
freq::Vector{Int64}
: The output frequency
PeriLab.IO.Parameter_Handling.get_model_parameter
— Functionget_model_parameter(params, model, id)
Retrieve a model parameter from a dictionary of parameters.
This function retrieves a specific model parameter from a dictionary of parameters based on the provided model and identifier (id).
Arguments
params::Dict
: A dictionary containing various parameters.model::String
: The model type for which the parameter is sought.id::String
: The identifier (name) of the specific model parameter.
Returns
parameter::Any
: The retrieved model parameter, ornothing
if the parameter is not found.
Errors
If the specified model is defined in blocks but no model definition block exists, an error message is logged, and the function returns
nothing
.If the model with the given identifier is defined in blocks but missing in the model's definition, an error message is logged, and the function returns
nothing
.
Example
```julia params = Dict( "Models" => Dict( "Models" => Dict( "ModelA" => 42, "ModelB" => 24 ) ) )
model = "Models" id = "ModelA"
result = getmodelparameter(params, model, id) if result !== nothing println("Parameter id: result") else println("Parameter not found.") end
PeriLab.IO.Parameter_Handling.get_models_option
— Functionget_models_option(params, options)
Process models-related options based on the provided parameters.
This function processes models-related options based on the parameters dictionary and updates the options dictionary accordingly.
Arguments
params::Dict
: A dictionary containing various parameters, including models-related information.options::Dict
: A dictionary containing options to be updated based on the models parameters.
Returns
updated_options::Dict
: A dictionary containing updated options based on the models parameters.
Errors
If the 'Pre Calculation' section exists in the 'Models' block but does not contain required options, an error message is logged.
If a material model is missing the 'Material Model' specification, an error message is logged.
Example
```julia params = Dict( "Models" => Dict( "Pre Calculation" => Dict( "Option1" => true, "Option2" => false ), "Material Models" => Dict( 1 => Dict( "Material Model" => "Correspondence" ), 2 => Dict( "Material Model" => "Bond Associated" ) ) ) )
options = Dict( "Option1" => false, "Option2" => true )
updatedoptions = getmodelsoption(params, options) println("Updated Options: ", updatedoptions)
PeriLab.IO.Parameter_Handling.get_solver_name
— Functionget_solver_name(params::Dict)
Get the name of the solver
Arguments
params::Dict
: The parameters dictionary.
Returns
solver_name::String
: The name of the solver
PeriLab.IO.Parameter_Handling.get_initial_time
— Functionget_initial_time(params::Dict)
Get the initial time
Arguments
params::Dict
: The parameters dictionary.
Returns
initial_time::Float64
: The initial time
PeriLab.IO.Parameter_Handling.get_final_time
— Functionget_final_time(params::Dict)
Get the final time
Arguments
params::Dict
: The parameters dictionary.
Returns
final_time::Float64
: The final time
PeriLab.IO.Parameter_Handling.get_safety_factor
— Functionget_safety_factor(params::Dict)
Get the safety factor
Arguments
params::Dict
: The parameters dictionary.
Returns
safety_factor::Float64
: The safety factor
PeriLab.IO.Parameter_Handling.get_fixed_dt
— Functionget_fixed_dt(params::Dict)
Get the fixed time step
Arguments
params::Dict
: The parameters dictionary.
Returns
fixed_dt::Float64
: The fixed time step
PeriLab.IO.Parameter_Handling.get_numerical_damping
— Functionget_numerical_damping(params::Dict)
Get the numerical damping
Arguments
params::Dict
: The parameters dictionary.
Returns
numerical_damping::Float64
: The numerical damping
PeriLab.IO.Parameter_Handling.get_max_damage
— Functiongetmaxdamage(params::Dict)
Get the maximum damage.
Arguments
params::Dict
: The parameters dictionary.
Returns
write_after_damage::Bool
: The value
PeriLab.IO.Parameter_Handling.get_model_options
— Functionget_model_options(params::Dict)
Get the solver options
Arguments
params::Dict
: The parameters dictionary.
Returns
solver_options::Dict
: The solver options
PeriLab.IO.Parameter_Handling.get_header
— Functionget_header(filename::Union{String,AbstractString})
Returns the header line and the header.
Arguments
filename::Union{String,AbstractString}
: The filename of the file.
Returns
header_line::Int
: The header line.header::Vector{String}
: The header.
Set_modules
PeriLab.Solver.Model_Factory.Material.Set_modules.find_jl_files
— Functionfind_jl_files(directory::AbstractString)
Recursively find Julia files (.jl) in a directory.
This function recursively searches for Julia source files with the ".jl" extension in the specified directory and its subdirectories. It returns a vector of file paths for all the found .jl files.
Arguments
directory::AbstractString
: The directory in which to search for .jl files.
Returns
A vector of strings, where each string is a file path to a .jl file found in the specified directory and its subdirectories.
Example
```julia jlfiles = findjlfiles("/path/to/modules") for jlfile in jlfiles println("Found Julia file: ", jlfile) end
PeriLab.Solver.Model_Factory.Material.Set_modules.find_module_files
— Functionfind_module_files(directory::AbstractString, specific::String)
Search for Julia modules containing a specific function in a given directory.
This function searches for Julia modules (files with .jl
extension) in the specified directory and checks if they contain a specific function. It returns a list of dictionaries where each dictionary contains the file path and the name of the module where the specific function is found.
Arguments
directory::AbstractString
: The directory to search for Julia modules.specific::String
: The name of the specific function to search for.
Returns
An array of dictionaries, where each dictionary has the following keys:
"File"
: The file path to the module where the specific function is found."Module Name"
: The name of the module where the specific function is found.
Example
```julia result = findmodulefiles("/path/to/modules", "myfunction") for moduleinfo in result println("Function found in module: ", moduleinfo["Module Name"]) println("Module file path: ", moduleinfo["File"]) end
PeriLab.Solver.Model_Factory.Material.Set_modules.include_files
— Functioninclude_files(module_list::Vector{Any})
Include files specified in a list of modules.
This function iterates over a list of modules and includes the files specified in each module's "File" key.
Arguments
module_list::Vector{Any}
: A list of modules where each module is expected to be a dictionary-like object with a "File" key specifying the file path.
Examples
```julia include_files([Dict("File" => "module1.jl"), Dict("File" => "module2.jl")])
PeriLab.Solver.Model_Factory.Material.Set_modules.create_module_specifics
— Functioncreate_module_specifics(name::String, module_list::Dict{String,AbstractString}(),specifics::Dict{String,String}(), values::Tuple)
Searches for a specific function within a list of modules and calls that function if found.
This function iterates over a list of modules specified in module_list
and looks for a module-specific function specified in the specifics
dictionary. If the module and function are found, it calls that function with the provided values
tuple.
Arguments
name::String
: The name to match against the module names.module_list::Dict{String, AbstractString}
: A dictionary of module names mapped to abstract strings.specifics::Dict{String, String}
: A dictionary specifying the module-specific function to call for each module.values::Tuple
: A tuple of values to be passed as arguments to the module-specific function.
Example
```julia modulelist = Dict("Module1" => "Module1Name", "Module2" => "Module2Name") specifics = Dict("Module1Name" => "module1function", "Module2Name" => "module2function") values = (arg1, arg2) createmodulespecifics("Module1Name", modulelist, specifics, values)
create_module_specifics(name::String, module_list::Dict{String,AbstractString}(),specifics::Dict{String,String}())
# Returns: the function itself
Logging_module
PeriLab.Logging_module.set_result_files
— Functionset_result_files(result_files_temp::Vector{Dict})
Set the result files.
Arguments
result_files_temp::Vector{Dict}
: The result files.
PeriLab.Logging_module.print_table
— Functionprint_table(data::Matrix, datamanager::Module)
Print the table.
Arguments
data::Matrix
: The data.datamanager::Module
: The data manager.
PeriLab.Logging_module.progress_filter
— Functionprogress_filter(log_args)
Filter progress messages.
Arguments
log_args
: The log arguments.
Returns
true
: If the message is not a progress message.false
: If the message is a progress message.
PeriLab.Logging_module.init_logging
— Functioninit_logging(filename::String, debug::Bool, silent::Bool, rank::Int64, size::Int64)
Initialize the logging.
Arguments
filename::String
: The filename.debug::Bool
: If debug is true.silent::Bool
: If silent is true.rank::Int64
: The rank.size::Int64
: The size.