From 2a965e4a5c6c1e5d1cfd41e0a24422d138145a3c Mon Sep 17 00:00:00 2001 From: Jan-Timo Hesse Date: Fri, 11 Oct 2024 15:40:13 +0200 Subject: [PATCH 1/2] remove depreacted function --- docs/src/lib/io_functions.md | 24 ++++- src/Models/Model_Factory.jl | 2 +- .../Parameters/parameter_handling_models.jl | 89 ------------------- 3 files changed, 24 insertions(+), 91 deletions(-) diff --git a/docs/src/lib/io_functions.md b/docs/src/lib/io_functions.md index c4cc8994..686958b3 100644 --- a/docs/src/lib/io_functions.md +++ b/docs/src/lib/io_functions.md @@ -1,6 +1,7 @@ # IO - Functions ## Index + ```@index Pages = ["io_functions.md"] ``` @@ -8,7 +9,9 @@ Pages = ["io_functions.md"] ```@meta CurrentModule = PeriLab.IO ``` + ## IO + ```@docs merge_exodus_files open_result_file @@ -36,7 +39,9 @@ global_value_avg ```@meta CurrentModule = PeriLab.IO ``` + ## Read_Mesh + ```@docs init_data create_and_distribute_bond_norm @@ -76,7 +81,9 @@ check_types_in_dataframe ```@meta CurrentModule = PeriLab.IO.Geometry ``` + ## Geometry + ```@docs bond_geometry shape_tensor @@ -88,7 +95,9 @@ rotation_tensor ```@meta CurrentModule = PeriLab.IO ``` + ## Read_Input_Deck + ```@docs read_input read_input_file @@ -97,7 +106,9 @@ read_input_file ```@meta CurrentModule = PeriLab.IO ``` + ## Write_Exodus_Results + ```@docs create_result_file paraview_specifics @@ -113,7 +124,9 @@ merge_exodus_file ```@meta CurrentModule = PeriLab.IO ``` + ## Write_CSV_Results + ```@docs write_global_results_in_csv ``` @@ -121,7 +134,9 @@ write_global_results_in_csv ```@meta CurrentModule = PeriLab.Solver.Helpers ``` + ## Helpers + ```@docs find_indices find_active @@ -139,7 +154,9 @@ rotate_second_order_tensor ```@meta CurrentModule = PeriLab.Solver.Model_Factory.Pre_Calculation ``` + ## Pre_Calculation + ```@docs init_fields init_model @@ -151,7 +168,9 @@ check_dependencies ```@meta CurrentModule = PeriLab.IO.Parameter_Handling ``` + ## parameter_handling + ```@docs validate_yaml validate_structure_recursive @@ -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 @@ -192,7 +210,9 @@ get_header ```@meta CurrentModule = PeriLab.Solver.Model_Factory.Material.Set_modules ``` + ## Set_modules + ```@docs find_jl_files find_module_files @@ -203,7 +223,9 @@ create_module_specifics ```@meta CurrentModule = PeriLab.Logging_module ``` + ## Logging_module + ```@docs set_result_files print_table diff --git a/src/Models/Model_Factory.jl b/src/Models/Model_Factory.jl index 167357e2..04d4c66c 100644 --- a/src/Models/Model_Factory.jl +++ b/src/Models/Model_Factory.jl @@ -13,7 +13,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") diff --git a/src/Support/Parameters/parameter_handling_models.jl b/src/Support/Parameters/parameter_handling_models.jl index b441221f..98f0b9cf 100644 --- a/src/Support/Parameters/parameter_handling_models.jl +++ b/src/Support/Parameters/parameter_handling_models.jl @@ -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 From ca92ba46ecf40e7a849b1696dea05b60ec143fab Mon Sep 17 00:00:00 2001 From: Jan-Timo Hesse Date: Fri, 11 Oct 2024 15:45:18 +0200 Subject: [PATCH 2/2] refac --- src/Models/Thermal/heat_transfer.jl | 13 +++++++------ src/Support/Parameters/parameter_handling.jl | 9 +++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/Models/Thermal/heat_transfer.jl b/src/Models/Thermal/heat_transfer.jl index 63b6bcbd..d8ee5d7f 100644 --- a/src/Models/Thermal/heat_transfer.jl +++ b/src/Models/Thermal/heat_transfer.jl @@ -100,13 +100,14 @@ function compute_model( ) for iID in nodes - if dof == 2 - dx = sqrt(volume[iID]) - elseif dof == 3 - dx = volume[iID]^(1 / 3) - end - if surface_nodes[iID] && specific_volume[iID] > req_specific_volume + + if dof == 2 + dx = sqrt(volume[iID]) + elseif dof == 3 + dx = volume[iID]^(1 / 3) + end + heat_flow[iID] += (kappa * (temperature[iID] - Tenv)) / dx * floor(specific_volume[iID]) end diff --git a/src/Support/Parameters/parameter_handling.jl b/src/Support/Parameters/parameter_handling.jl index 31c820c0..857a8b0b 100644 --- a/src/Support/Parameters/parameter_handling.jl +++ b/src/Support/Parameters/parameter_handling.jl @@ -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" => [