@@ -42,12 +42,11 @@ function WallBoundarySystem(initial_condition, model; prescribed_motion=nothing,
4242 coordinates = copy (initial_condition. coordinates)
4343
4444 ismoving = Ref (! isnothing (prescribed_motion))
45- initialize ! (prescribed_motion, initial_condition)
45+ initialize_prescribed_motion ! (prescribed_motion, initial_condition)
4646
4747 cache = create_cache_boundary (prescribed_motion, initial_condition)
4848 cache = (cache... , color= Int (color_value))
4949
50- # Because of dispatches boundary model needs to be first!
5150 return WallBoundarySystem (initial_condition, coordinates, model, prescribed_motion,
5251 ismoving, adhesion_coefficient, cache)
5352end
105104 return current_velocity (v, system, system. prescribed_motion, particle)
106105end
107106
108- @inline function current_velocity (v, system, movement , particle)
107+ @inline function current_velocity (v, system, prescribed_motion , particle)
109108 (; cache, ismoving) = system
110109
111110 if ismoving[]
115114 return zero (SVector{ndims (system), eltype (system)})
116115end
117116
118- @inline function current_velocity (v, system, movement :: Nothing , particle)
117+ @inline function current_velocity (v, system, prescribed_motion :: Nothing , particle)
119118 return zero (SVector{ndims (system), eltype (system)})
120119end
121120
127126 return current_acceleration (system, system. prescribed_motion, particle)
128127end
129128
130- @inline function current_acceleration (system, :: PrescribedMotion , particle)
129+ @inline function current_acceleration (system:: WallBoundarySystem , :: PrescribedMotion ,
130+ particle)
131131 (; cache, ismoving) = system
132132
133133 if ismoving[]
137137 return zero (SVector{ndims (system), eltype (system)})
138138end
139139
140- @inline function current_acceleration (system, :: Nothing , particle)
140+ @inline function current_acceleration (system:: WallBoundarySystem , :: Nothing , particle)
141141 return zero (SVector{ndims (system), eltype (system)})
142142end
143143
177177function update_positions! (system:: WallBoundarySystem , v, u, v_ode, u_ode, semi, t)
178178 (; prescribed_motion) = system
179179
180- prescribed_motion (system, t, semi)
180+ apply_prescribed_motion! (system, prescribed_motion, semi, t)
181+ end
182+
183+ function apply_prescribed_motion! (system:: WallBoundarySystem ,
184+ prescribed_motion:: PrescribedMotion , semi, t)
185+ (; ismoving, coordinates, cache) = system
186+ (; acceleration, velocity) = cache
187+
188+ prescribed_motion (coordinates, velocity, acceleration, ismoving, system, semi, t)
189+
190+ return system
191+ end
192+
193+ function apply_prescribed_motion! (system:: WallBoundarySystem , :: Nothing , semi, t)
194+ return system
181195end
182196
183197function update_quantities! (system:: WallBoundarySystem , v, u, v_ode, u_ode, semi, t)
0 commit comments