Skip to content

Commit 4a9140f

Browse files
committed
2 parents 451504a + bb5ce64 commit 4a9140f

File tree

14 files changed

+101
-41
lines changed

14 files changed

+101
-41
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "PeriLab"
22
uuid = "2ecefcea-59f0-46dd-9cfd-1d2b8cc5f112"
33
authors = ["Christian Willberg <christian.willberg@dlr.de>", "Jan-Timo Hesse <jan-timo.hesse@dlr.de>"]
4-
version = "1.3.0"
4+
version = "1.3.1"
55

66
[deps]
77
AbaqusReader = "bc6b9049-e460-56d6-94b4-a597b2c0390d"

docs/make.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ makedocs(
6262
"Data Manager"=>"lib/data_manager_functions.md",
6363
"Solver"=>"lib/solver_functions.md",
6464
"IO"=>"lib/io_functions.md",
65+
"Geometry"=>"lib/geometry_functions.md",
6566
"MPI"=>"lib/mpi_functions.md",
6667
"Helper"=>"lib/helper_functions.md",
6768
"Logging"=>"lib/logging_functions.md",

docs/src/lib/geometry_functions.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# IO - Functions
2+
3+
## Index
4+
5+
```@index
6+
Pages = ["geometry_functions.md"]
7+
```
8+
9+
```@meta
10+
CurrentModule = PeriLab
11+
```
12+
13+
## Geometry
14+
15+
```@autodocs
16+
Modules = [IO.Geometry]
17+
Order = [:function, :type]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: 2023 Christian Willberg <christian.willberg@dlr.de>, Jan-Timo Hesse <jan-timo.hesse@dlr.de>
2+
3+
SPDX-License-Identifier: BSD-3-Clause

docs/src/lib/io_functions.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@ Modules = [IO]
1717
Order = [:function, :type]
1818
```
1919

20-
## Geometry
21-
22-
```@autodocs
23-
Modules = [IO.Geometry]
24-
Order = [:function, :type]
25-
```
26-
2720
## parameter_handling
2821

2922
```@autodocs

src/Core/Data_manager.jl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export initialize_data
2020
export get_active_models
2121
export get_all_field_keys
2222
export has_key
23+
export get_step
2324
export get_accuracy_order
2425
export get_aniso_crit_values
2526
export get_block_list
@@ -50,6 +51,7 @@ export get_rotation
5051
export get_element_rotation
5152
export init_properties
5253
export remove_active_model
54+
export set_step
5355
export set_accuracy_order
5456
export set_block_list
5557
export set_crit_values_matrix
@@ -89,6 +91,7 @@ const data = Dict()
8991
Initialize all parameter in the datamanager and sets them to the default values.
9092
"""
9193
function initialize_data()
94+
data["step"] = 0
9295
data["nnodes"] = 0
9396
data["num_controller"] = 0
9497
data["num_responder"] = 0
@@ -145,6 +148,31 @@ function initialize_data()
145148
end
146149
###################################
147150

151+
"""
152+
set_step(step::Int64)
153+
154+
Set the step of the simulation.
155+
156+
# Arguments
157+
- `step::Int64`: The step of the simulation.
158+
159+
"""
160+
function set_step(step::Int64)
161+
data["step"] = step
162+
end
163+
164+
"""
165+
get_step()
166+
167+
Get the step of the simulation.
168+
169+
# Returns
170+
- `Int64`: The step of the simulation.
171+
172+
"""
173+
function get_step()
174+
return data["step"]
175+
end
148176

149177
"""
150178
add_active_model(key::String, module_name::Module)

src/Core/Solver/Verlet.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ function run_solver(
477477
iter = progress_bar(rank, nsteps, silent)
478478
#nodes::Vector{Int64} = Vector{Int64}(1:datamanager.get_nnodes())
479479
@inbounds @fastmath for idt in iter
480+
datamanager.set_step(idt)
480481
@timeit to "Verlet" begin
481482
if "Material" in solver_options["Models"]
482483
uNP1 = datamanager.get_field("Displacements", "NP1")

src/IO/IO.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ function get_results_mapping(params::Dict, path::String, datamanager::Module)
211211
fieldnames = outputs[output]["fieldnames"]
212212
output_mapping[id]["flush_file"] = get_flush_file(outputs, output)
213213
output_mapping[id]["write_after_damage"] = get_write_after_damage(outputs, output)
214+
output_mapping[id]["start_time"] = get_start_time(outputs, output)
215+
output_mapping[id]["end_time"] = get_end_time(outputs, output)
214216
for fieldname in fieldnames
215217
compute_name = ""
216218
compute_params = Dict{}
@@ -577,6 +579,9 @@ function write_results(
577579
if outputs[id]["write_after_damage"] && max_damage == 0.0
578580
continue
579581
end
582+
if outputs[id]["start_time"] > time || outputs[id]["end_time"] < time
583+
continue
584+
end
580585
output_frequency = datamanager.get_output_frequency()
581586
output_frequency[id]["Counter"] += 1
582587
if output_frequency[id]["Counter"] == output_frequency[id]["Output Frequency"]

src/Models/Material/Material_Models/Correspondence/Correspondence_UMAT.jl

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,11 @@ function init_model(
8383

8484
for iID = 1:num_props
8585
if !haskey(material_parameter, "Property_$iID")
86-
@error "Property_$iID is missing. Number of properties is $num_props and properties have to be in order without a missing number."
87-
return nothing
86+
@warn "Property_$iID is missing. Make sure that all properties are defined."
87+
properties[iID] = 0.0
88+
else
89+
properties[iID] = material_parameter["Property_$iID"]
8890
end
89-
properties[iID] = material_parameter["Property_$iID"]
9091
end
9192

9293
if !haskey(material_parameter, "UMAT Material Name")
@@ -275,6 +276,8 @@ function compute_stresses(
275276

276277
DFGRD0 = datamanager.get_field("DFGRD0")
277278
DFGRD1 = datamanager.get_field("Deformation Gradient")
279+
JSTEP = datamanager.get_step()
280+
KINC::Int64 = 1
278281
not_supported_int::Int64 = 0
279282
for iID in nodes
280283
STATEV_temp = statev[iID, :]
@@ -318,12 +321,12 @@ function compute_stresses(
318321
not_supported_float,
319322
DFGRD0[iID, :, :],
320323
DFGRD1[iID, :, :],
324+
iID,
321325
not_supported_int,
322326
not_supported_int,
323327
not_supported_int,
324-
not_supported_int,
325-
not_supported_int,
326-
not_supported_int,
328+
JSTEP,
329+
KINC,
327330
)
328331

329332
statev[iID, :] = STATEV_temp

src/PeriLab.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ import .Logging_module
5555
import .IO
5656
import .Solver_control
5757

58-
PERILAB_VERSION = "1.3.0"
58+
PERILAB_VERSION = "1.3.1"
5959

6060
export main
6161

src/Support/Parameters/parameter_handling.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ global expected_structure = Dict(
150150
"Output File Type" => [String, false],
151151
"Output Filename" => [String, true],
152152
"Write After Damage" => [Bool, false],
153+
"Start Time" => [Float64, false],
154+
"End Time" => [Float64, false],
153155
"Output Variables" => [
154156
Dict{Any,Any}("Any" => [Bool, true]),
155157
true,

src/Support/Parameters/parameter_handling_output.jl

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
export get_flush_file
66
export get_write_after_damage
7+
export get_start_time
8+
export get_end_time
79
export get_outputs
810
export get_output_frequency
911
export get_output_filenames
@@ -118,6 +120,36 @@ function get_write_after_damage(outputs::Dict, output::String)
118120
get(outputs[output], "Write After Damage", false)
119121
end
120122

123+
"""
124+
get_start_time(outputs::Dict, output::String)
125+
126+
Get the start_time.
127+
128+
# Arguments
129+
- `outputs::Dict`: The outputs
130+
- `output::String`: The output
131+
# Returns
132+
- `start_time::Float64`: The value
133+
"""
134+
function get_start_time(outputs::Dict, output::String)
135+
get(outputs[output], "Start Time", 0.0)
136+
end
137+
138+
"""
139+
get_end_time(outputs::Dict, output::String)
140+
141+
Get the end_time.
142+
143+
# Arguments
144+
- `outputs::Dict`: The outputs
145+
- `output::String`: The output
146+
# Returns
147+
- `end_time::Float64`: The value
148+
"""
149+
function get_end_time(outputs::Dict, output::String)
150+
get(outputs[output], "End Time", Inf64)
151+
end
152+
121153
"""
122154
get_output_fieldnames(outputs::Dict, variables::Vector{String}, computes::Vector{String}, output_type::String)
123155

src/Support/Parameters/parameter_handling_solver.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ Get the maximum damage.
134134
# Arguments
135135
- `params::Dict`: The parameters dictionary.
136136
# Returns
137-
- `write_after_damage::Bool`: The value
137+
- `max_damage::Float64`: The value
138138
"""
139139
function get_max_damage(params::Dict)
140140
return Float64(get(params["Solver"], "Maximum Damage", Inf64))

test/unit_tests/Models/Material/Material_Models/Correspondence/ut_Correspondence_UMAT.jl

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -60,31 +60,6 @@ end
6060
Dict{String,Any}(),
6161
),
6262
)
63-
@test isnothing(
64-
Correspondence_UMAT.init_model(
65-
test_data_manager,
66-
Vector{Int64}(1:nodes),
67-
Dict{String,Any}(
68-
"File" => file,
69-
"Number of Properties" => 3,
70-
"Property_1" => 2,
71-
"Property_3" => 2.4,
72-
),
73-
),
74-
)
75-
@test isnothing(
76-
Correspondence_UMAT.init_model(
77-
test_data_manager,
78-
Vector{Int64}(1:nodes),
79-
Dict{String,Any}(
80-
"File" => file,
81-
"Number of Properties" => 3,
82-
"Property_1" => 2,
83-
"Property_2" => 2.4,
84-
"Property_4" => 2,
85-
),
86-
),
87-
)
8863

8964
@test isnothing(
9065
Correspondence_UMAT.init_model(

0 commit comments

Comments
 (0)