@@ -40,7 +40,7 @@ function init_solver(solver_options::Dict{Any,Any},
4040 bcs:: Dict{Any,Any} ,
4141 block_nodes:: Dict{Int64,Vector{Int64}} )
4242 horizon = Data_Manager. get_field (" Horizon" )
43- if Data_Manager. get_rank ()> 1
43+ if Data_Manager. get_rank () > 1
4444 @warn " Implementation might not work for MPI. Especially for coupling. It has to be tested."
4545 end
4646 find_bc_free_dof (bcs)
@@ -63,7 +63,7 @@ function init_solver(solver_options::Dict{Any,Any},
6363
6464 for (block, nodes) in pairs (block_nodes)
6565 model_param = Data_Manager. get_properties (block, " Material Model" )
66- Correspondence_matrix_based. init_model (nodes, model_param)
66+ Correspondence_matrix_based. init_model (nodes, model_param, block )
6767 end
6868 @timeit " init_matrix" Correspondence_matrix_based. init_matrix ()
6969 dof = Data_Manager. get_dof ()
@@ -80,12 +80,12 @@ function init_solver(solver_options::Dict{Any,Any},
8080 @info " dt: $(solver_options[" dt" ]) "
8181 @info " Numerical Damping: $(solver_options[" Numerical Damping" ]) "
8282
83- reduction_blocks= []
84- if model_reduction!= false
83+ reduction_blocks = []
84+ if model_reduction != false
8585 reduction_blocks = get (solver_options[" Model Reduction" ], " Reduction Blocks" , [])
8686
87- if reduction_blocks== []
88- model_reduction== false
87+ if reduction_blocks == []
88+ model_reduction == false
8989 @error " No reduction blocks defined for model reduction. If you want to use a reduced model please define 'Reduction Blocks' in the yaml input deck."
9090 else
9191 if reduction_blocks isa Float64
@@ -108,13 +108,13 @@ function init_solver(solver_options::Dict{Any,Any},
108108 @warn " No other models work with full matrix Verlet right now."
109109 end
110110
111- if reduction_blocks!= []
111+ if reduction_blocks != []
112112 coor = Data_Manager. get_field (" Coordinates" )
113113 master_nodes = Int64[]
114114 slave_nodes = Int64[]
115115 pd_nodes = Int64[]
116116 nlist = Data_Manager. get_nlist ()
117- cn= Data_Manager. create_constant_node_scalar_field (" Coupling Nodes" , Int64)
117+ cn = Data_Manager. create_constant_node_scalar_field (" Coupling Nodes" , Int64)
118118 full_blocks = setdiff (collect (keys (block_nodes)), reduction_blocks)
119119 for block in full_blocks
120120 append! (pd_nodes, block_nodes[block])
@@ -132,29 +132,29 @@ function init_solver(solver_options::Dict{Any,Any},
132132 master_nodes = sort (unique (master_nodes))
133133 slave_nodes = setdiff (collect (1 : Data_Manager. get_nnodes ()), master_nodes)
134134
135- cn[slave_nodes]. = 6
136- cn[master_nodes]. = 2
137- cn[pd_nodes]. = 1
135+ cn[slave_nodes] . = 6
136+ cn[master_nodes] . = 2
137+ cn[pd_nodes] . = 1
138138
139139 for block in eachindex (block_nodes)
140140 intersect! (block_nodes[block], pd_nodes)
141141 end
142142
143- if ! (master_nodes== [])
143+ if ! (master_nodes == [])
144144 perm = collect (1 : (length (master_nodes) * Data_Manager. get_dof ()))
145145 perm_master = create_permutation (master_nodes, Data_Manager. get_dof ())
146146 perm_slave = create_permutation (slave_nodes, Data_Manager. get_dof ())
147147 perm_pd_nodes = create_permutation (pd_nodes, Data_Manager. get_dof ())
148148 # create reduced M^-1*K for linear run
149149 # TODO adapt for mass matrix
150- density_mass = zeros (length (density)* Data_Manager. get_dof ())
150+ density_mass = zeros (length (density) * Data_Manager. get_dof ())
151151 density_mass .= density[1 ]
152152
153153 perm_pd_reduced = findall (in (perm_pd_nodes), perm_master)
154154
155155 K_reduced,
156156 mass_reduced = guyan_reduction (K, density_mass, perm_master, perm_slave, dof)
157- K_reduced[perm_pd_reduced, :]. = 0
157+ K_reduced[perm_pd_reduced, :] . = 0
158158 # K_reduced[:, perm_pd_reduced].=0
159159 Data_Manager. set_stiffness_matrix (sparse (K_reduced[perm, perm]))
160160 Data_Manager. set_mass_matrix (lu (sparse (mass_reduced[perm, perm])))
@@ -220,12 +220,12 @@ function run_solver(solver_options::Dict{Any,Any},
220220 rank = Data_Manager. get_rank ()
221221 iter = progress_bar (rank, nsteps, silent)
222222
223- if solver_options[" Model Reduction" ]!= false
224- master_nodes= Data_Manager. get_reduced_model_master ()
223+ if solver_options[" Model Reduction" ] != false
224+ master_nodes = Data_Manager. get_reduced_model_master ()
225225 M_fact = Data_Manager. get_mass_matrix ()
226- temp = zeros (length (master_nodes)* Data_Manager. get_dof ())
226+ temp = zeros (length (master_nodes) * Data_Manager. get_dof ())
227227 else
228- temp= zeros (Data_Manager. get_dof ()* Data_Manager. get_nnodes ())
228+ temp = zeros (Data_Manager. get_dof () * Data_Manager. get_nnodes ())
229229 end
230230 K:: AbstractMatrix{Float64} = Data_Manager. get_stiffness_matrix ()
231231
@@ -249,10 +249,10 @@ function run_solver(solver_options::Dict{Any,Any},
249249 bcs, time,
250250 step_time)
251251
252- if solver_options[" Model Reduction" ]!= false
252+ if solver_options[" Model Reduction" ] != false
253253 active_nodes = master_nodes
254- active_list. = false
255- active_list[Data_Manager. get_reduced_model_pd ()]. = true
254+ active_list . = false
255+ active_list[Data_Manager. get_reduced_model_pd ()] . = true
256256 end
257257
258258 vNP1[active_nodes, :] = (1 - numerical_damping) .*
@@ -305,7 +305,7 @@ function run_solver(solver_options::Dict{Any,Any},
305305 forces[active_nodes, :] .= force_densities_NP1[active_nodes, :] .*
306306 volume[active_nodes]
307307 @timeit " Accelaration computation" begin
308- if solver_options[" Model Reduction" ]!= false
308+ if solver_options[" Model Reduction" ] != false
309309 a[active_nodes, :] = reshape (M_fact \
310310 vec (force_densities_NP1[active_nodes, :] .*
311311 volume[active_nodes]),
345345
346346function f_int (K:: AbstractMatrix{Float64} , u:: AbstractVector{Float64} ,
347347 sa:: Tuple{Int64,Int64} )
348- return reshape (K* u, sa... )
348+ return reshape (K * u, sa... )
349349end
350350
351351function f_int_inplace! (F:: AbstractMatrix{Float64} ,
0 commit comments