Skip to content

Commit

Permalink
remove synch_field and move to init
Browse files Browse the repository at this point in the history
  • Loading branch information
JTHesse committed Aug 21, 2024
1 parent b477e97 commit f6f26b2
Show file tree
Hide file tree
Showing 17 changed files with 10 additions and 233 deletions.
11 changes: 8 additions & 3 deletions src/Core/data_manager.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1544,18 +1544,23 @@ Sets the synchronization dictionary globally.
- `download_from_cores`::Bool: Whether to download the field from the cores.
- `upload_to_cores`::Bool: Whether to upload the field to the cores.
"""
function set_synch(name, download_from_cores, upload_to_cores)
function set_synch(name, download_from_cores, upload_to_cores, dof = 0)
global fields_to_synch

if name in get_all_field_keys()
field = get_field(name)
if dof == 0
dof = length(field[1, :])
end
fields_to_synch[name] = Dict{String,Any}(
"upload_to_cores" => upload_to_cores,
"download_from_cores" => download_from_cores,
"dof" => length(field[1, :]),
"dof" => dof,
)
elseif name * "NP1" in get_all_field_keys()
field = get_field(name * "NP1")
if dof == 0
dof = length(field[1, :])
end
fields_to_synch[name*"NP1"] = Dict{String,Any}(
"upload_to_cores" => upload_to_cores,
"download_from_cores" => download_from_cores,
Expand Down
14 changes: 0 additions & 14 deletions src/Models/Damage/Critical_Stretch.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export compute_damage
export compute_damage_pre_calculation
export damage_name
export init_damage_model
export synch_field
"""
damage_name()
Expand Down Expand Up @@ -131,19 +130,6 @@ function compute_damage_pre_calculation(
return datamanager
end

"""
synch_field(datamanager::Module, synchronise_field)
Field for synchronisation.
# Arguments
- `datamanager::Data_manager`: Datamanager.
- `synchronise_field`: Synchronise function to distribute parameter through cores.
"""
function synch_field(datamanager::Module, synchronise_field)
return datamanager
end

function init_damage_model(
datamanager::Module,
nodes::Union{SubArray,Vector{Int64}},
Expand Down
16 changes: 0 additions & 16 deletions src/Models/Damage/Damage_Factory.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export compute_damage_pre_calculation
export init_interface_crit_values
export init_damage_model
export init_damage_model_fields
export synch_field

"""
init_damage_model_fields(datamanager::Module)
Expand Down Expand Up @@ -113,21 +112,6 @@ function compute_damage_pre_calculation(
return mod.compute_damage_pre_calculation(datamanager, nodes, block, time, dt)
end

"""
synch_field(datamanager::Module, damage_model::String, synchronise_field)
Field for synchronisation.
# Arguments
- `datamanager::Data_manager`: Datamanager.
- `damage_model::String`: The damage model
- `synchronise_field`: Synchronise function to distribute parameter through cores.
"""
function synch_field(datamanager::Module, damage_model::String, synchronise_field)
mod = datamanager.get_model_module(damage_model)
return mod.synch_field(datamanager, synchronise_field)
end

"""
damage_index(datamanager,::Union{SubArray, Vector{Int64})
Expand Down
15 changes: 0 additions & 15 deletions src/Models/Damage/Damage_template/damage_template.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ module Damage_template
export compute_damage
export compute_damage_pre_calculation
export damage_name
export synch_field
"""
damage_name()
Expand Down Expand Up @@ -95,20 +94,6 @@ function compute_damage_pre_calculation(
return datamanager
end

"""
synch_field(datamanager::Module, synchronise_field)
Field for synchronisation.
# Arguments
- `datamanager::Data_manager`: Datamanager.
- `synchronise_field`: Synchronise function to distribute parameter through cores.
"""
function synch_field(datamanager::Module, synchronise_field)
@info "Here you can add fields for synchronisation."
return datamanager
end

"""
init_damage_model(datamanager::Module, nodes::Union{SubArray,Vector{Int64}}, damage_parameter::Dict, block::Int64)
Expand Down
28 changes: 2 additions & 26 deletions src/Models/Damage/Energy_release.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export compute_damage
export compute_damage_pre_calculation
export damage_name
export init_damage_model
export synch_field
"""
damage_name()
Expand Down Expand Up @@ -241,31 +240,6 @@ function compute_damage_pre_calculation(
return datamanager
end

"""
synch_field(datamanager::Module, synchronise_field)
Field for synchronisation.
# Arguments
- `datamanager::Data_manager`: Datamanager.
- `synchronise_field`: Synchronise function to distribute parameter through cores.
"""
function synch_field(datamanager::Module, synchronise_field)
synchfield = Dict(
"Bond Forces" =>
Dict("upload_to_cores" => true, "dof" => datamanager.get_dof()),
)
synchronise_field(
datamanager.get_comm(),
synchfield,
datamanager.get_overlap_map(),
datamanager.get_field,
"Bond Forces",
"upload_to_cores",
)
return datamanager
end

"""
get_quad_horizon(horizon::Float64, dof::Int64)
Expand Down Expand Up @@ -308,6 +282,8 @@ function init_damage_model(
end
end

datamanager.set_synch("Bond Forces", false, true, datamanager.get_dof())

return datamanager
end
end
15 changes: 0 additions & 15 deletions src/Models/Material/Material_Factory.jl
Original file line number Diff line number Diff line change
Expand Up @@ -117,21 +117,6 @@ function init_material_model(
return datamanager
end

"""
synch_field(datamanager::Module, material_model::String, synchronise_field)
Field for synchronisation.
# Arguments
- `datamanager::Data_manager`: Datamanager.
- `material_model::String`: The material model
- `synchronise_field`: Synchronise function to distribute parameter through cores.
"""
function synch_field(datamanager::Module, material_model::String, synchronise_field)
mod = datamanager.get_model_module(material_model)
return mod.synch_field(datamanager, synchronise_field)
end

"""
compute_forces(datamanager::Module, nodes::Union{SubArray,Vector{Int64}}, model_param::Dict, time::Float64, dt::Float64, to::TimerOutput)
Expand Down
13 changes: 0 additions & 13 deletions src/Models/Material/Material_Models/BondBased/Bondbased_Elastic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,6 @@ function material_name()
return "Bond-based Elastic"
end

"""
synch_field(datamanager::Module, synchronise_field)
Field for synchronisation.
# Arguments
- `datamanager::Data_manager`: Datamanager.
- `synchronise_field`: Synchronise function to distribute parameter through cores.
"""
function synch_field(datamanager::Module, synchronise_field)
return datamanager
end

"""
compute_forces(datamanager::Module, nodes::Union{SubArray,Vector{Int64}}, material_parameter::Dict, time::Float64, dt::Float64)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,6 @@ function init_material_model(
return datamanager
end

"""
synch_field(datamanager::Module, synchronise_field)
Field for synchronisation.
# Arguments
- `datamanager::Data_manager`: Datamanager.
- `synchronise_field`: Synchronise function to distribute parameter through cores.
"""
function synch_field(datamanager::Module, synchronise_field)
return datamanager
end

"""
https://link.springer.com/article/10.1007/s10409-021-01055-5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,6 @@ function material_name()
return "Correspondence"
end

"""
synch_field(datamanager::Module, synchronise_field)
Field for synchronisation.
# Arguments
- `datamanager::Data_manager`: Datamanager.
- `synchronise_field`: Synchronise function to distribute parameter through cores.
"""
function synch_field(datamanager::Module, synchronise_field)
return datamanager
end

"""
compute_forces(datamanager, nodes, material_parameter, time, dt, to::TimerOutput)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,6 @@ function correspondence_name()
return "Correspondence Elastic"
end

"""
synch_field(datamanager::Module, synchronise_field)
Field for synchronisation.
# Arguments
- `datamanager::Data_manager`: Datamanager.
- `synchronise_field`: Synchronise function to distribute parameter through cores.
"""
function synch_field(datamanager::Module, synchronise_field)
return datamanager
end

"""
compute_stresses(datamanager::Module, iID:Int64, dof::Int64, material_parameter::Dict, time::Float64, dt::Float64, strain_increment::SubArray, stress_N::SubArray, stress_NP1::SubArray)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,6 @@ function correspondence_name()
return "Correspondence Plastic"
end

"""
synch_field(datamanager::Module, synchronise_field)
Field for synchronisation.
# Arguments
- `datamanager::Data_manager`: Datamanager.
- `synchronise_field`: Synchronise function to distribute parameter through cores.
"""
function synch_field(datamanager::Module, synchronise_field)
return datamanager
end

"""
compute_stresses(datamanager::Module, nodes::Union{SubArray,Vector{Int64}}, dof::Int64, material_parameter::Dict, time::Float64, dt::Float64, strain_increment::SubArray, stress_N::SubArray, stress_NP1::SubArray, iID_jID_nID::Tuple=())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,19 +188,6 @@ function correspondence_name()
return "Correspondence UMAT"
end

"""
synch_field(datamanager::Module, synchronise_field)
Field for synchronisation.
# Arguments
- `datamanager::Data_manager`: Datamanager.
- `synchronise_field`: Synchronise function to distribute parameter through cores.
"""
function synch_field(datamanager::Module, synchronise_field)
return datamanager
end

"""
compute_stresses(datamanager::Module, nodes::Union{SubArray,Vector{Int64}}, dof::Int64, material_parameter::Dict, time::Float64, dt::Float64, strain_increment::SubArray, stress_N::SubArray, stress_NP1::SubArray, iID_jID_nID::Tuple=())
Expand Down
13 changes: 0 additions & 13 deletions src/Models/Material/Material_Models/Ordinary/PD_Solid_Elastic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,6 @@ function material_name()
return "PD Solid Elastic"
end

"""
synch_field(datamanager::Module, synchronise_field)
Field for synchronisation.
# Arguments
- `datamanager::Data_manager`: Datamanager.
- `synchronise_field`: Synchronise function to distribute parameter through cores.
"""
function synch_field(datamanager::Module, synchronise_field)
return datamanager
end

"""
compute_forces(datamanager::Module, nodes::Union{SubArray,Vector{Int64}}, material_parameter::Dict, time::Float64, dt::Float64, to::TimerOutput)
Expand Down
13 changes: 0 additions & 13 deletions src/Models/Material/Material_Models/Ordinary/PD_Solid_Plastic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,6 @@ function material_name()
return "PD Solid Plastic"
end

"""
synch_field(datamanager::Module, synchronise_field)
Field for synchronisation.
# Arguments
- `datamanager::Data_manager`: Datamanager.
- `synchronise_field`: Synchronise function to distribute parameter through cores.
"""
function synch_field(datamanager::Module, synchronise_field)
return datamanager
end

"""
compute_forces(datamanager, nodes, material_parameter, time, dt, to::TimerOutput)
Expand Down
15 changes: 0 additions & 15 deletions src/Models/Material/Material_template/correspondence_template.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export fe_support
export init_material_model
export correspondence_name
export compute_forces
export synch_field

"""
fe_support()
Expand Down Expand Up @@ -70,20 +69,6 @@ function correspondence_name()
return "Correspondence Template"
end

"""
synch_field(datamanager::Module, synchronise_field)
Field for synchronisation.
# Arguments
- `datamanager::Data_manager`: Datamanager.
- `synchronise_field`: Synchronise function to distribute parameter through cores.
"""
function synch_field(datamanager::Module, synchronise_field)
@info "Here you can add fields for synchronisation."
return datamanager
end

"""
compute_stresses(datamanager::Module, nodes::Union{SubArray,Vector{Int64}}, dof::Int64, material_parameter::Dict, time::Float64, dt::Float64, strain_increment::SubArray, stress_N::SubArray, stress_NP1::SubArray, iID_jID_nID::Tuple=())
Expand Down
Loading

0 comments on commit f6f26b2

Please sign in to comment.