Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/PeriHub/PeriLab.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
CWillberg committed Oct 10, 2024
2 parents a22ee98 + ca92ba4 commit 4ba790a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 91 deletions.
24 changes: 23 additions & 1 deletion docs/src/lib/io_functions.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# IO - Functions

## Index

```@index
Pages = ["io_functions.md"]
```

```@meta
CurrentModule = PeriLab.IO
```

## IO

```@docs
merge_exodus_files
open_result_file
Expand Down Expand Up @@ -36,7 +39,9 @@ global_value_avg
```@meta
CurrentModule = PeriLab.IO
```

## Read_Mesh

```@docs
init_data
create_and_distribute_bond_norm
Expand Down Expand Up @@ -76,7 +81,9 @@ check_types_in_dataframe
```@meta
CurrentModule = PeriLab.IO.Geometry
```

## Geometry

```@docs
bond_geometry
shape_tensor
Expand All @@ -88,7 +95,9 @@ rotation_tensor
```@meta
CurrentModule = PeriLab.IO
```

## Read_Input_Deck

```@docs
read_input
read_input_file
Expand All @@ -97,7 +106,9 @@ read_input_file
```@meta
CurrentModule = PeriLab.IO
```

## Write_Exodus_Results

```@docs
create_result_file
paraview_specifics
Expand All @@ -113,15 +124,19 @@ merge_exodus_file
```@meta
CurrentModule = PeriLab.IO
```

## Write_CSV_Results

```@docs
write_global_results_in_csv
```

```@meta
CurrentModule = PeriLab.Solver.Helpers
```

## Helpers

```@docs
find_indices
find_active
Expand All @@ -139,7 +154,9 @@ rotate_second_order_tensor
```@meta
CurrentModule = PeriLab.Solver.Model_Factory.Pre_Calculation
```

## Pre_Calculation

```@docs
init_fields
init_model
Expand All @@ -151,7 +168,9 @@ check_dependencies
```@meta
CurrentModule = PeriLab.IO.Parameter_Handling
```

## parameter_handling

```@docs
validate_yaml
validate_structure_recursive
Expand All @@ -177,7 +196,6 @@ get_output_fieldnames
get_outputs
get_output_frequency
get_model_parameter
get_models_option
get_solver_name
get_initial_time
get_final_time
Expand All @@ -192,7 +210,9 @@ get_header
```@meta
CurrentModule = PeriLab.Solver.Model_Factory.Material.Set_modules
```

## Set_modules

```@docs
find_jl_files
find_module_files
Expand All @@ -203,7 +223,9 @@ create_module_specifics
```@meta
CurrentModule = PeriLab.Logging_module
```

## Logging_module

```@docs
set_result_files
print_table
Expand Down
2 changes: 1 addition & 1 deletion src/Models/Model_Factory.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ include("./Material/Material_Factory.jl")
include("./Thermal/Thermal_Factory.jl")
include("./Pre_calculation/Pre_Calculation_Factory.jl")
include("../Support/Parameters/parameter_handling.jl")
using .Parameter_Handling: get_models_option, get_model_parameter, get_heat_capacity
using .Parameter_Handling: get_model_parameter, get_heat_capacity
# in future FEM will be outside of the Model_Factory
include("../FEM/FEM_Factory.jl")

Expand Down
9 changes: 9 additions & 0 deletions src/Support/Parameters/parameter_handling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,15 @@ global expected_structure = Dict(
),
false,
],
"Pre Calculation Global" => [
Dict{Any,Any}(
"Bond Associated Correspondence" => [Bool, false],
"Deformation Gradient" => [Bool, false],
"Deformed Bond Geometry" => [Bool, false],
"Shape Tensor" => [Bool, false],
),
false,
],
"Pre Calculation Models" => [
Dict{Any,Any}(
"Any" => [
Expand Down
89 changes: 0 additions & 89 deletions src/Support/Parameters/parameter_handling_models.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,92 +102,3 @@ function find_data_files(params::Dict)
end
return file_keys
end


"""
get_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
)
updated_options = get_models_option(params, options)
println("Updated Options: ", updated_options)
"""
function get_models_option(params::Dict, options::Dict)
if haskey(params["Models"], "Pre Calculation")
for option in keys(options)
if haskey(params["Models"]["Pre Calculation"], option)
options[option] = params["Models"]["Pre Calculation"][option]
end
end
end
if !haskey(params["Models"], "Material Models")
@warn "Material Models are missing!"
return options
end
materials = params["Models"]["Material Models"]
for material in eachindex(materials)
if haskey(materials[material], "Material Model")
options["Deformed Bond Geometry"] = true
if occursin("Correspondence", materials[material]["Material Model"])
if haskey(materials[material], "Bond Associated") &&
!(options["Bond Associated Correspondence"])
# if its activated it stays that way
options["Bond Associated Correspondence"] =
materials[material]["Bond Associated"]
end
if !(options["Bond Associated Correspondence"])
options["Shape Tensor"] = true
options["Deformation Gradient"] = true
end
end
else
@error "No Material Model: '$material' has been defined"
return nothing
end

end
return options
end

0 comments on commit 4ba790a

Please sign in to comment.