269 zone_name, center, scale, coef, long_print, center_type)
271 character(len=*),
intent(in) :: name
272 real(kind=
rp),
intent(in) :: center(3)
273 real(kind=
rp),
intent(in) :: scale
274 character(len=*),
intent(in) :: fluid_name
275 character(len=*),
intent(in) :: zone_name
276 integer,
intent(in) :: zone_id
277 type(
coef_t),
target,
intent(in) :: coef
278 logical,
intent(in) :: long_print
279 character(len=*),
intent(in),
optional :: center_type
280 character(len=:),
allocatable :: ctype_str
281 integer :: n_pts, glb_n_pts, ierr
282 real(kind=
rp) :: avg_r(3)
283 character(len=1000) :: log_buf
286 this%zone_id = zone_id
288 this%zone_name = zone_name
290 if (
present(center_type))
then
291 ctype_str = center_type
296 call this%ale_link(zone_id, ctype_str, center)
298 if (ctype_str /=
'fixed' .and. .not. this%moving_center)
then
299 ctype_str =
'fixed (reverted from ' // ctype_str //
')'
303 if (.not. this%moving_center)
then
309 this%print_format =
'(I7,E20.10,E20.10,E20.10,E20.10,A)'
311 this%print_format =
'(I7,E13.5,E13.5,E13.5,E13.5,A)'
318 this%mu =>
neko_registry%get_field_by_name(fluid_name //
'_mu_tot')
321 call this%bc%init_base(this%coef)
322 call this%bc%mark_zone(this%case%msh%labeled_zones(this%zone_id))
323 call this%bc%finalize()
324 n_pts = this%bc%msk(0)
325 if (n_pts .gt. 0)
then
326 call this%n1%init(n_pts)
327 call this%n2%init(n_pts)
328 call this%n3%init(n_pts)
329 call this%r1%init(n_pts)
330 call this%r2%init(n_pts)
331 call this%r3%init(n_pts)
332 call this%force1%init(n_pts)
333 call this%force2%init(n_pts)
334 call this%force3%init(n_pts)
335 call this%force4%init(n_pts)
336 call this%force5%init(n_pts)
337 call this%force6%init(n_pts)
338 call this%s11msk%init(n_pts)
339 call this%s22msk%init(n_pts)
340 call this%s33msk%init(n_pts)
341 call this%s12msk%init(n_pts)
342 call this%s13msk%init(n_pts)
343 call this%s23msk%init(n_pts)
344 call this%pmsk%init(n_pts)
345 call this%mu_msk%init(n_pts)
349 this%n1, this%n2, this%n3, n_pts)
351 this%u%size(), n_pts)
353 this%u%size(), n_pts)
355 this%u%size(), n_pts)
357 call mpi_allreduce(n_pts, glb_n_pts, 1, &
360 avg_r(1) =
glsum(this%r1%x, n_pts)/glb_n_pts
361 avg_r(2) =
glsum(this%r2%x, n_pts)/glb_n_pts
362 avg_r(3) =
glsum(this%r3%x, n_pts)/glb_n_pts
364 call neko_log%section(
'Force/torque calculation')
365 write(log_buf,
'(A,I4,A,A)')
'Zone ', zone_id,
' ', trim(zone_name)
368 write(log_buf,
'(A,I6, I6)')
'Global number of GLL points in zone: ', &
372 write(log_buf,
'(A,A)')
'Center Type: ', trim(ctype_str)
375 if (trim(ctype_str) ==
'pivot' .or. &
376 trim(ctype_str) ==
'body_attached')
then
377 write(log_buf,
'(A,A)')
'Linked to ALE Body movement: ', &
378 trim(this%linked_body_name)
380 write(log_buf,
'(A,E15.7,E15.7,E15.7)') &
381 'Initial center for torque calculation: ', this%center
384 write(log_buf,
'(A,E15.7,E15.7,E15.7)') &
385 'Fixed center for torque calculation: ', this%center
389 write(log_buf,
'(A,E15.7,E15.7,E15.7)') &
390 'Average of zone''s coordinates: ', avg_r
393 write(log_buf,
'(A,E15.7)')
'Scale: ', scale
398 call cadd(this%r1%x, -this%center(1), n_pts)
399 call cadd(this%r2%x, -this%center(2), n_pts)
400 call cadd(this%r3%x, -this%center(3), n_pts)
457 real(kind=
rp) :: dgtq(12) = 0.0_rp
458 integer :: n_pts, temp_indices(6)
459 type(
field_t),
pointer :: s11, s22, s33, s12, s13, s23
460 character(len=1000) :: log_buf
461 real(kind=
rp) :: rot_offset(3)
462 n_pts = this%bc%msk(0)
466 if (this%moving_center .and.
associated(this%body_P))
then
467 if (
associated(this%body_R))
then
469 rot_offset(1) = this%body_R(1,1)*this%local_offset(1) + &
470 this%body_R(1,2)*this%local_offset(2) + &
471 this%body_R(1,3)*this%local_offset(3)
472 rot_offset(2) = this%body_R(2,1)*this%local_offset(1) + &
473 this%body_R(2,2)*this%local_offset(2) + &
474 this%body_R(2,3)*this%local_offset(3)
475 rot_offset(3) = this%body_R(3,1)*this%local_offset(1) + &
476 this%body_R(3,2)*this%local_offset(2) + &
477 this%body_R(3,3)*this%local_offset(3)
479 this%center = this%body_P + rot_offset
483 if (this%update_normals)
then
486 this%n1, this%n2, this%n3, n_pts)
489 this%u%size(), n_pts)
491 this%u%size(), n_pts)
493 this%u%size(), n_pts)
495 call cadd(this%r1%x, -this%center(1), n_pts)
496 call cadd(this%r2%x, -this%center(2), n_pts)
497 call cadd(this%r3%x, -this%center(3), n_pts)
517 this%u, this%v, this%w, this%coef)
522 this%u%size(), n_pts)
524 this%u%size(), n_pts)
526 this%u%size(), n_pts)
528 this%u%size(), n_pts)
530 this%u%size(), n_pts)
532 this%u%size(), n_pts)
534 this%u%size(), n_pts)
536 this%u%size(), n_pts)
538 this%force4%x, this%force5%x, this%force6%x, &
551 dgtq(1) =
glsum(this%force1%x, n_pts)
552 dgtq(2) =
glsum(this%force2%x, n_pts)
553 dgtq(3) =
glsum(this%force3%x, n_pts)
554 dgtq(4) =
glsum(this%force4%x, n_pts)
555 dgtq(5) =
glsum(this%force5%x, n_pts)
556 dgtq(6) =
glsum(this%force6%x, n_pts)
557 call vcross(this%s11msk%x, this%s22msk%x, this%s33msk%x, &
558 this%r1%x, this%r2%x, this%r3%x, &
559 this%force1%x, this%force2%x, this%force3%x, n_pts)
561 dgtq(7) =
glsum(this%s11msk%x, n_pts)
562 dgtq(8) =
glsum(this%s22msk%x, n_pts)
563 dgtq(9) =
glsum(this%s33msk%x, n_pts)
564 call vcross(this%s11msk%x, this%s22msk%x, this%s33msk%x, &
565 this%r1%x, this%r2%x, this%r3%x, &
566 this%force4%x, this%force5%x, this%force6%x, n_pts)
567 dgtq(10) =
glsum(this%s11msk%x, n_pts)
568 dgtq(11) =
glsum(this%s22msk%x, n_pts)
569 dgtq(12) =
glsum(this%s33msk%x, n_pts)
571 if (n_pts .gt. 0)
then
573 this%bc%msk_d, this%u%size(), n_pts)
575 this%bc%msk_d, this%u%size(), n_pts)
577 this%bc%msk_d, this%u%size(), n_pts)
579 this%bc%msk_d, this%u%size(), n_pts)
581 this%bc%msk_d, this%u%size(), n_pts)
583 this%bc%msk_d, this%u%size(), n_pts)
585 this%bc%msk_d, this%u%size(), n_pts)
587 this%bc%msk_d, this%u%size(), n_pts)
609 this%r1%x_d, this%r2%x_d, this%r3%x_d, &
610 this%force1%x_d, this%force2%x_d, &
611 this%force3%x_d, n_pts)
612 call device_vcross(this%s12msk%x_d, this%s13msk%x_d, this%s23msk%x_d,&
613 this%r1%x_d, this%r2%x_d, this%r3%x_d, &
614 this%force4%x_d, this%force5%x_d, this%force6%x_d, n_pts)
629 dgtq = this%scale*dgtq
630 write(log_buf,
'(A, I4, A, A)')
'Force and torque on zone ', &
631 this%zone_id,
' ', this%zone_name
633 write(log_buf,
'(A)') &
634 'Time step, time, total force/torque, pressure, viscous, direction'
636 write(log_buf, this%print_format) &
637 time%tstep, time%t, dgtq(1) + dgtq(4), dgtq(1), dgtq(4),
', forcex'
639 write(log_buf, this%print_format) &
640 time%tstep, time%t, dgtq(2) + dgtq(5), dgtq(2), dgtq(5),
', forcey'
642 write(log_buf, this%print_format) &
643 time%tstep, time%t, dgtq(3) + dgtq(6), dgtq(3), dgtq(6),
', forcez'
645 write(log_buf, this%print_format) &
646 time%tstep, time%t, dgtq(7) + dgtq(10), dgtq(7), dgtq(10),
', torquex'
648 write(log_buf, this%print_format) &
649 time%tstep, time%t, dgtq(8) + dgtq(11), dgtq(8), dgtq(11),
', torquey'
651 write(log_buf, this%print_format) &
652 time%tstep, time%t, dgtq(9) + dgtq(12), dgtq(9), dgtq(12),
', torquez'