Skip to content

Commit 66fd315

Browse files
committed
Added support for dynamic relaxation solver and multibody simulations
1 parent 84d2617 commit 66fd315

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

src/time_solvers/dynamic_relaxation.jl

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,17 @@ function init_density_matrix!(dh::AbstractThreadsBodyDataHandler, dr::DynamicRel
113113
return nothing
114114
end
115115

116+
function init_density_matrix!(dh::AbstractThreadsMultibodyDataHandler,
117+
dr::DynamicRelaxation)
118+
for body_idx in each_body_idx(dh)
119+
body_dh = get_body_dh(dh, body_idx)
120+
@threads :static for chunk in body_dh.chunks
121+
_init_density_matrix!(chunk, dr, chunk.paramsetup)
122+
end
123+
end
124+
return nothing
125+
end
126+
116127
function init_density_matrix!(dh::AbstractMPIBodyDataHandler, dr::DynamicRelaxation)
117128
_init_density_matrix!(dh.chunk, dr, dh.chunk.paramsetup)
118129
return nothing
@@ -216,6 +227,36 @@ function relaxation_timestep!(dh::AbstractMPIBodyDataHandler,
216227
return nothing
217228
end
218229

230+
function relaxation_timestep!(dh::AbstractThreadsMultibodyDataHandler,
231+
options::AbstractJobOptions, Δt, n)
232+
t = n * Δt
233+
for body_idx in each_body_idx(dh)
234+
body_dh = get_body_dh(dh, body_idx)
235+
@threads :static for chunk_id in eachindex(body_dh.chunks)
236+
chunk = body_dh.chunks[chunk_id]
237+
apply_boundary_conditions!(chunk, t)
238+
update_disp_and_pos!(chunk, Δt)
239+
end
240+
end
241+
calc_force_density!(dh, t, Δt)
242+
update_caches!(dh)
243+
calc_contact_force_densities!(dh)
244+
for body_idx in each_body_idx(dh)
245+
body_dh = get_body_dh(dh, body_idx)
246+
@threads :static for chunk_id in eachindex(body_dh.chunks)
247+
chunk = body_dh.chunks[chunk_id]
248+
cn = calc_damping(chunk, Δt)
249+
if n == 1
250+
relaxation_first_step!(chunk, Δt)
251+
else
252+
relaxation_step!(chunk, Δt, cn)
253+
end
254+
export_results(body_dh, options, chunk_id, n, t)
255+
end
256+
end
257+
return nothing
258+
end
259+
219260
function calc_damping(chunk::AbstractBodyChunk, Δt::Float64)
220261
s = chunk.storage
221262
cn1 = 0.0

0 commit comments

Comments
 (0)