@@ -132,7 +132,6 @@ function dydt_explicit_v1 (t, y) result(dydt)
132
132
end do
133
133
! $OMP END DO
134
134
! $OMP END PARALLEL
135
- ! if (any(particles_hexit(1:Nactive) .ne. 0)) particles_hexit(0) = 1
136
135
end function dydt_explicit_v1
137
136
138
137
function dydt_implicit_v1 (t , y ) result(dydt) ! Tienen un error sistemático que no detecto aún
@@ -148,7 +147,7 @@ function dydt_implicit_v1 (t, y) result(dydt) ! Tienen un error sistemático que
148
147
real (kind= 8 ) :: rcm(2 ), vcm(2 ), raux(0 :Nboulders,2 ), vaux(0 :Nboulders,2 )
149
148
real (kind= 8 ) :: omega, omega2, omegadot, inertia, angmom
150
149
integer (kind= 4 ) :: i, ineqs, particle_i
151
- real (kind= 8 ) :: dummy_real2(2 )
150
+ real (kind= 8 ) :: dummy_real2(2 ), aux_real
152
151
153
152
dydt = cero
154
153
@@ -166,14 +165,19 @@ function dydt_implicit_v1 (t, y) result(dydt) ! Tienen un error sistemático que
166
165
end do
167
166
rcm = rcm / asteroid_mass ! rcm = sum_i m_i * r_i / M
168
167
vcm = vcm / asteroid_mass ! vcm = sum_i m_i * v_i / M
168
+ if (sqrt (sum (rcm * rcm)) < error_tolerance) rcm = cero ! Avoid numerical errors
169
+ if (sqrt (sum (vcm * vcm)) < error_tolerance) vcm = cero ! Avoid numerical errors
169
170
! Calculate angmom and inertia
171
+ aux_real = cero
170
172
angmom = cero
171
173
inertia = cero
172
174
do i = 0 , Nboulders
173
175
raux(i,:) = rib(i,:) - rcm
174
176
vaux(i,:) = vib(i,:) - vcm
177
+ ! aux_real = 0.4d0 * mass_ast_arr(i) * radius_ast_arr(i)**2 ! Inertia Sphere
175
178
angmom = angmom + mass_ast_arr(i) * cross2D(raux(i,:), vaux(i,:)) ! Traslacional
176
- inertia = inertia + mass_ast_arr(i) * sum (raux(i,:) * raux(i,:)) ! Inercia
179
+ ! angmom = angmom + aux_real * cross2D(raux(i,:), vaux(i,:))/sum(raux(i,:) * raux(i,:)) ! Rotacional (Sphere)
180
+ inertia = inertia + aux_real + mass_ast_arr(i) * sum (raux(i,:) * raux(i,:)) ! Sphere + Steiner
177
181
end do
178
182
! ! Get Omega from L/I
179
183
omega = angmom / inertia
@@ -218,7 +222,7 @@ function dydt_implicit_v1 (t, y) result(dydt) ! Tienen un error sistemático que
218
222
dydt(ineqs+3 ) = - omega2 * raux(i,1 ) - omegadot * raux(i,2 ) ! a_i = -w^2 * r_i + dw/dt * (-ry,rx)
219
223
dydt(ineqs+4 ) = - omega2 * raux(i,2 ) + omegadot * raux(i,1 ) ! a_i = -w^2 * r_i + dw/dt * (-ry,rx)
220
224
end do
221
- ! if (any(particles_hexit(1:Nactive) .ne. 0)) particles_hexit(0) = 1
225
+ ! print*, t, angmom/asteroid_angmom, inertia/asteroid_inertia, omega/asteroid_omega
222
226
end function dydt_implicit_v1
223
227
224
228
function dydt_explicit_v2 (t , y ) result(dydt)
@@ -288,7 +292,6 @@ function dydt_explicit_v2 (t, y) result(dydt)
288
292
end do
289
293
! $OMP END DO
290
294
! $OMP END PARALLEL
291
- ! if (any(particles_hexit(1:Nactive) .ne. 0)) particles_hexit(0) = 1
292
295
end function dydt_explicit_v2
293
296
294
297
function dydt_implicit_v2 (t , y ) result(dydt)
@@ -359,7 +362,6 @@ function dydt_implicit_v2 (t, y) result(dydt)
359
362
! $OMP END DO
360
363
! $OMP END PARALLEL
361
364
dydt(2 ) = domegadt(t, omega) + omegadot
362
- ! if (any(particles_hexit(1:Nactive) .ne. 0)) particles_hexit(0) = 1
363
365
end function dydt_implicit_v2
364
366
365
367
function dydt_no_boulders (t , y ) result(dydt)
0 commit comments