244 subroutine fluid_pnpn_init(this, msh, lx, params, user, chkp)
245 class(fluid_pnpn_t),
target,
intent(inout) :: this
246 type(
mesh_t),
target,
intent(inout) :: msh
247 integer,
intent(in) :: lx
248 type(json_file),
target,
intent(inout) :: params
249 type(
user_t),
target,
intent(in) :: user
250 type(
chkp_t),
target,
intent(inout) :: chkp
251 character(len=15),
parameter :: scheme =
'Modular (Pn/Pn)'
253 class(
bc_t),
pointer :: bc_i, vel_bc
254 real(kind=
rp) :: abs_tol
255 character(len=LOG_SIZE) :: log_buf
256 integer :: ierr, integer_val, solver_maxiter
257 character(len=:),
allocatable :: solver_type, precon_type
258 logical :: monitor, found
260 type(json_file) :: numerics_params, precon_params
265 call this%init_base(msh, lx, params, scheme,
user, .true.)
276 call json_get(params,
'case.numerics.time_order', integer_val)
277 allocate(this%ext_bdf)
278 call this%ext_bdf%init(integer_val)
281 this%full_stress_formulation, .false.)
283 if (this%full_stress_formulation .eqv. .true.)
then
285 call ax_helm_factory(this%Ax_vel, full_formulation = .true.)
288 call pnpn_prs_res_stress_factory(this%prs_res)
291 call pnpn_vel_res_stress_factory(this%vel_res)
294 call ax_helm_factory(this%Ax_vel, full_formulation = .false.)
297 call pnpn_prs_res_factory(this%prs_res)
300 call pnpn_vel_res_factory(this%vel_res)
305 if (params%valid_path(
'case.fluid.nut_field'))
then
306 if (this%full_stress_formulation .eqv. .false.)
then
307 call neko_error(
"You need to set full_stress_formulation to " // &
308 "true for the fluid to have a spatially varying " // &
311 call json_get(params,
'case.fluid.nut_field', this%nut_field_name)
313 this%nut_field_name =
""
317 call ax_helm_factory(this%Ax_prs, full_formulation = .false.)
321 call rhs_maker_sumab_fctry(this%sumab)
324 call rhs_maker_ext_fctry(this%makeabf)
327 call rhs_maker_bdf_fctry(this%makebdf)
330 call rhs_maker_oifs_fctry(this%makeoifs)
333 associate(xh_lx => this%Xh%lx, xh_ly => this%Xh%ly, xh_lz => this%Xh%lz, &
334 dm_xh => this%dm_Xh, nelv => this%msh%nelv)
336 call this%p_res%init(dm_xh,
"p_res")
337 call this%u_res%init(dm_xh,
"u_res")
338 call this%v_res%init(dm_xh,
"v_res")
339 call this%w_res%init(dm_xh,
"w_res")
340 call this%abx1%init(dm_xh,
"abx1")
341 call this%aby1%init(dm_xh,
"aby1")
342 call this%abz1%init(dm_xh,
"abz1")
343 call this%abx2%init(dm_xh,
"abx2")
344 call this%aby2%init(dm_xh,
"aby2")
345 call this%abz2%init(dm_xh,
"abz2")
346 call this%advx%init(dm_xh,
"advx")
347 call this%advy%init(dm_xh,
"advy")
348 call this%advz%init(dm_xh,
"advz")
351 call this%du%init(this%dm_Xh,
'du')
352 call this%dv%init(this%dm_Xh,
'dv')
353 call this%dw%init(this%dm_Xh,
'dw')
354 call this%dp%init(this%dm_Xh,
'dp')
357 call this%setup_bcs(
user, params)
361 if (found)
call this%write_boundary_conditions()
363 call this%proj_prs%init(this%dm_Xh%size(), this%pr_projection_dim, &
364 this%pr_projection_activ_step)
366 call this%proj_vel%init(this%dm_Xh%size(), this%vel_projection_dim, &
367 this%vel_projection_activ_step)
373 if (params%valid_path(
'case.fluid.flow_rate_force'))
then
374 call this%vol_flow%init(this%dm_Xh, params)
378 call neko_log%section(
"Pressure solver")
381 'case.fluid.pressure_solver.max_iterations', &
383 call json_get(params,
'case.fluid.pressure_solver.type', solver_type)
384 call json_get(params,
'case.fluid.pressure_solver.preconditioner.type', &
387 'case.fluid.pressure_solver.preconditioner', precon_params)
388 call json_get(params,
'case.fluid.pressure_solver.absolute_tolerance', &
392 call neko_log%message(
'Type : ('// trim(solver_type) // &
393 ', ' // trim(precon_type) //
')')
394 write(log_buf,
'(A,ES13.6)')
'Abs tol :', abs_tol
397 call this%solver_factory(this%ksp_prs, this%dm_Xh%size(), &
398 solver_type, solver_maxiter, abs_tol, monitor)
399 call this%precon_factory_(this%pc_prs, this%ksp_prs, &
400 this%c_Xh, this%dm_Xh, this%gs_Xh, this%bcs_prs, &
401 precon_type, precon_params)
406 call json_get(params,
'case.numerics', numerics_params)
407 call advection_factory(this%adv, numerics_params, this%c_Xh, &
408 this%ulag, this%vlag, this%wlag, &
409 chkp%dtlag, chkp%tlag, this%ext_bdf, &
415 call this%chkp%init(this%u, this%v, this%w, this%p)
417 this%chkp%abx1 => this%abx1
418 this%chkp%abx2 => this%abx2
419 this%chkp%aby1 => this%aby1
420 this%chkp%aby2 => this%aby2
421 this%chkp%abz1 => this%abz1
422 this%chkp%abz2 => this%abz2
423 call this%chkp%add_lag(this%ulag, this%vlag, this%wlag)
431 subroutine fluid_pnpn_restart(this, chkp)
432 class(fluid_pnpn_t),
target,
intent(inout) :: this
433 type(chkp_t),
intent(inout) :: chkp
434 real(kind=rp) :: dtlag(10), tlag(10)
435 type(field_t) :: u_temp, v_temp, w_temp
441 n = this%u%dof%size()
442 if (
allocated(chkp%previous_mesh%elements) .or. &
443 chkp%previous_Xh%lx .ne. this%Xh%lx)
then
444 associate(u => this%u, v => this%v, w => this%w, p => this%p, &
445 c_xh => this%c_Xh, ulag => this%ulag, vlag => this%vlag, &
447 do concurrent(j = 1:n)
448 u%x(j,1,1,1) = u%x(j,1,1,1) * c_xh%mult(j,1,1,1)
449 v%x(j,1,1,1) = v%x(j,1,1,1) * c_xh%mult(j,1,1,1)
450 w%x(j,1,1,1) = w%x(j,1,1,1) * c_xh%mult(j,1,1,1)
451 p%x(j,1,1,1) = p%x(j,1,1,1) * c_xh%mult(j,1,1,1)
453 do i = 1, this%ulag%size()
454 do concurrent(j = 1:n)
455 ulag%lf(i)%x(j,1,1,1) = ulag%lf(i)%x(j,1,1,1) &
457 vlag%lf(i)%x(j,1,1,1) = vlag%lf(i)%x(j,1,1,1) &
459 wlag%lf(i)%x(j,1,1,1) = wlag%lf(i)%x(j,1,1,1) &
466 if (neko_bcknd_device .eq. 1)
then
467 associate(u => this%u, v => this%v, w => this%w, &
468 ulag => this%ulag, vlag => this%vlag, wlag => this%wlag,&
470 call device_memcpy(u%x, u%x_d, u%dof%size(), &
471 host_to_device, sync = .false.)
472 call device_memcpy(v%x, v%x_d, v%dof%size(), &
473 host_to_device, sync = .false.)
474 call device_memcpy(w%x, w%x_d, w%dof%size(), &
475 host_to_device, sync = .false.)
476 call device_memcpy(p%x, p%x_d, p%dof%size(), &
477 host_to_device, sync = .false.)
478 call device_memcpy(ulag%lf(1)%x, ulag%lf(1)%x_d, &
479 u%dof%size(), host_to_device, sync = .false.)
480 call device_memcpy(ulag%lf(2)%x, ulag%lf(2)%x_d, &
481 u%dof%size(), host_to_device, sync = .false.)
483 call device_memcpy(vlag%lf(1)%x, vlag%lf(1)%x_d, &
484 v%dof%size(), host_to_device, sync = .false.)
485 call device_memcpy(vlag%lf(2)%x, vlag%lf(2)%x_d, &
486 v%dof%size(), host_to_device, sync = .false.)
488 call device_memcpy(wlag%lf(1)%x, wlag%lf(1)%x_d, &
489 w%dof%size(), host_to_device, sync = .false.)
490 call device_memcpy(wlag%lf(2)%x, wlag%lf(2)%x_d, &
491 w%dof%size(), host_to_device, sync = .false.)
492 call device_memcpy(this%abx1%x, this%abx1%x_d, &
493 w%dof%size(), host_to_device, sync = .false.)
494 call device_memcpy(this%abx2%x, this%abx2%x_d, &
495 w%dof%size(), host_to_device, sync = .false.)
496 call device_memcpy(this%aby1%x, this%aby1%x_d, &
497 w%dof%size(), host_to_device, sync = .false.)
498 call device_memcpy(this%aby2%x, this%aby2%x_d, &
499 w%dof%size(), host_to_device, sync = .false.)
500 call device_memcpy(this%abz1%x, this%abz1%x_d, &
501 w%dof%size(), host_to_device, sync = .false.)
502 call device_memcpy(this%abz2%x, this%abz2%x_d, &
503 w%dof%size(), host_to_device, sync = .false.)
504 call device_memcpy(this%advx%x, this%advx%x_d, &
505 w%dof%size(), host_to_device, sync = .false.)
506 call device_memcpy(this%advy%x, this%advy%x_d, &
507 w%dof%size(), host_to_device, sync = .false.)
508 call device_memcpy(this%advz%x, this%advz%x_d, &
509 w%dof%size(), host_to_device, sync = .false.)
516 if (
allocated(chkp%previous_mesh%elements) &
517 .or. chkp%previous_Xh%lx .ne. this%Xh%lx)
then
518 call this%gs_Xh%op(this%u, gs_op_add)
519 call this%gs_Xh%op(this%v, gs_op_add)
520 call this%gs_Xh%op(this%w, gs_op_add)
521 call this%gs_Xh%op(this%p, gs_op_add)
523 do i = 1, this%ulag%size()
524 call this%gs_Xh%op(this%ulag%lf(i), gs_op_add)
525 call this%gs_Xh%op(this%vlag%lf(i), gs_op_add)
526 call this%gs_Xh%op(this%wlag%lf(i), gs_op_add)
613 subroutine fluid_pnpn_step(this, time, dt_controller)
614 class(fluid_pnpn_t),
target,
intent(inout) :: this
615 type(time_state_t),
intent(in) :: time
616 type(time_step_controller_t),
intent(in) :: dt_controller
620 type(ksp_monitor_t) :: ksp_results(4)
622 type(file_t) :: dump_file
623 class(bc_t),
pointer :: bc_i
624 type(non_normal_t),
pointer :: bc_j
626 if (this%freeze)
return
628 n = this%dm_Xh%size()
630 call profiler_start_region(
'Fluid', 1)
631 associate(u => this%u, v => this%v, w => this%w, p => this%p, &
632 u_e => this%u_e, v_e => this%v_e, w_e => this%w_e, &
633 du => this%du, dv => this%dv, dw => this%dw, dp => this%dp, &
634 u_res => this%u_res, v_res => this%v_res, w_res => this%w_res, &
635 p_res => this%p_res, ax_vel => this%Ax_vel, ax_prs => this%Ax_prs, &
637 c_xh => this%c_Xh, dm_xh => this%dm_Xh, gs_xh => this%gs_Xh, &
638 ulag => this%ulag, vlag => this%vlag, wlag => this%wlag, &
639 msh => this%msh, prs_res => this%prs_res, &
640 source_term => this%source_term, vel_res => this%vel_res, &
641 sumab => this%sumab, makeoifs => this%makeoifs, &
642 makeabf => this%makeabf, makebdf => this%makebdf, &
643 vel_projection_dim => this%vel_projection_dim, &
644 pr_projection_dim => this%pr_projection_dim, &
646 rho => this%rho, mu_tot => this%mu_tot, &
647 f_x => this%f_x, f_y => this%f_y, f_z => this%f_z, &
648 t => time%t, tstep => time%tstep, dt => time%dt, &
649 ext_bdf => this%ext_bdf, event => glb_cmd_event)
652 call sumab%compute_fluid(u_e, v_e, w_e, u, v, w, &
653 ulag, vlag, wlag, ext_bdf%advection_coeffs, ext_bdf%nadv)
656 call this%source_term%compute(time)
659 call this%bcs_vel%apply_vector(f_x%x, f_y%x, f_z%x, &
660 this%dm_Xh%size(), time, strong = .false.)
664 call this%adv%compute(u, v, w, &
665 this%advx, this%advy, this%advz, &
666 xh, this%c_Xh, dm_xh%size(), dt)
673 call makeabf%compute_fluid(this%abx1, this%aby1, this%abz1,&
674 this%abx2, this%aby2, this%abz2, &
675 f_x%x, f_y%x, f_z%x, &
676 rho%x(1,1,1,1), ext_bdf%advection_coeffs, n)
679 call makeoifs%compute_fluid(this%advx%x, this%advy%x, this%advz%x, &
680 f_x%x, f_y%x, f_z%x, &
681 rho%x(1,1,1,1), dt, n)
684 call this%adv%compute(u, v, w, &
686 xh, this%c_Xh, dm_xh%size())
692 call makeabf%compute_fluid(this%abx1, this%aby1, this%abz1,&
693 this%abx2, this%aby2, this%abz2, &
694 f_x%x, f_y%x, f_z%x, &
695 rho%x(1,1,1,1), ext_bdf%advection_coeffs, n)
698 call makebdf%compute_fluid(ulag, vlag, wlag, f_x%x, f_y%x, f_z%x, &
699 u, v, w, c_xh%B, rho%x(1,1,1,1), dt, &
700 ext_bdf%diffusion_coeffs, ext_bdf%ndiff, n)
707 call this%bc_apply_vel(time, strong = .true.)
708 call this%bc_apply_prs(time)
711 call this%update_material_properties(time)
714 call profiler_start_region(
'Pressure_residual', 18)
716 call prs_res%compute(p, p_res,&
721 this%bc_prs_surface, this%bc_sym_surface,&
722 ax_prs, ext_bdf%diffusion_coeffs(1), dt, &
726 if (.not. this%prs_dirichlet)
call ortho(p_res%x, this%glb_n_points, n)
728 call gs_xh%op(p_res, gs_op_add, event)
729 call device_event_sync(event)
732 call this%bclst_dp%apply_scalar(p_res%x, p%dof%size(), time)
735 call profiler_end_region(
'Pressure_residual', 18)
738 call this%proj_prs%pre_solving(p_res%x, tstep, c_xh, n, dt_controller, &
741 call this%pc_prs%update()
743 call profiler_start_region(
'Pressure_solve', 3)
747 this%ksp_prs%solve(ax_prs, dp, p_res%x, n, c_xh, &
748 this%bclst_dp, gs_xh)
749 ksp_results(1)%name =
'Pressure'
752 call profiler_end_region(
'Pressure_solve', 3)
754 call this%proj_prs%post_solving(dp%x, ax_prs, c_xh, &
755 this%bclst_dp, gs_xh, n, tstep, dt_controller)
758 call field_add2(p, dp, n)
759 if (.not. this%prs_dirichlet)
call ortho(p%x, this%glb_n_points, n)
762 call profiler_start_region(
'Velocity_residual', 19)
763 call vel_res%compute(ax_vel, u, v, w, &
764 u_res, v_res, w_res, &
768 mu_tot, rho, ext_bdf%diffusion_coeffs(1), &
771 call gs_xh%op(u_res, gs_op_add, event)
772 call device_event_sync(event)
773 call gs_xh%op(v_res, gs_op_add, event)
774 call device_event_sync(event)
775 call gs_xh%op(w_res, gs_op_add, event)
776 call device_event_sync(event)
779 call this%bclst_vel_res%apply(u_res, v_res, w_res, time)
782 call profiler_end_region(
'Velocity_residual', 19)
784 call this%proj_vel%pre_solving(u_res%x, v_res%x, w_res%x, &
785 tstep, c_xh, n, dt_controller,
'Velocity')
787 call this%pc_vel%update()
789 call profiler_start_region(
"Velocity_solve", 4)
790 ksp_results(2:4) = this%ksp_vel%solve_coupled(ax_vel, du, dv, dw, &
791 u_res%x, v_res%x, w_res%x, n, c_xh, &
792 this%bclst_du, this%bclst_dv, this%bclst_dw, gs_xh, &
793 this%ksp_vel%max_iter)
794 call profiler_end_region(
"Velocity_solve", 4)
795 if (this%full_stress_formulation)
then
796 ksp_results(2)%name =
'Momentum'
798 ksp_results(2)%name =
'X-Velocity'
799 ksp_results(3)%name =
'Y-Velocity'
800 ksp_results(4)%name =
'Z-Velocity'
803 call this%proj_vel%post_solving(du%x, dv%x, dw%x, ax_vel, c_xh, &
804 this%bclst_du, this%bclst_dv, this%bclst_dw, gs_xh, n, tstep, &
807 if (neko_bcknd_device .eq. 1)
then
808 call device_opadd2cm(u%x_d, v%x_d, w%x_d, &
809 du%x_d, dv%x_d, dw%x_d, 1.0_rp, n, msh%gdim)
811 call opadd2cm(u%x, v%x, w%x, du%x, dv%x, dw%x, 1.0_rp, n, msh%gdim)
814 if (this%forced_flow_rate)
then
816 call this%vol_flow%adjust( u, v, w, p, u_res, v_res, w_res, p_res, &
817 c_xh, gs_xh, ext_bdf, rho%x(1,1,1,1), mu_tot, &
818 dt, this%bclst_dp, this%bclst_du, this%bclst_dv, &
819 this%bclst_dw, this%bclst_vel_res, ax_vel, ax_prs, this%ksp_prs, &
820 this%ksp_vel, this%pc_prs, this%pc_vel, this%ksp_prs%max_iter, &
821 this%ksp_vel%max_iter)
824 call fluid_step_info(time, ksp_results, &
825 this%full_stress_formulation, this%strict_convergence)
828 call profiler_end_region(
'Fluid', 1)
833 subroutine fluid_pnpn_setup_bcs(this, user, params)
834 class(fluid_pnpn_t),
target,
intent(inout) :: this
835 type(user_t),
target,
intent(in) :: user
836 type(json_file),
intent(inout) :: params
837 integer :: i, n_bcs, zone_index, j, zone_size, global_zone_size, ierr
838 class(bc_t),
pointer :: bc_i
839 type(json_core) :: core
840 type(json_value),
pointer :: bc_object
841 type(json_file) :: bc_subdict
844 logical,
allocatable :: marked_zones(:)
845 integer,
allocatable :: zone_indices(:)
848 call this%bclst_vel_res%init()
849 call this%bclst_du%init()
850 call this%bclst_dv%init()
851 call this%bclst_dw%init()
852 call this%bclst_dp%init()
854 call this%bc_vel_res%init_from_components(this%c_Xh)
855 call this%bc_du%init_from_components(this%c_Xh)
856 call this%bc_dv%init_from_components(this%c_Xh)
857 call this%bc_dw%init_from_components(this%c_Xh)
858 call this%bc_dp%init_from_components(this%c_Xh)
861 call this%bc_prs_surface%init_from_components(this%c_Xh)
862 call this%bc_sym_surface%init_from_components(this%c_Xh)
865 if (params%valid_path(
'case.fluid.boundary_conditions'))
then
866 call params%info(
'case.fluid.boundary_conditions', n_children = n_bcs)
867 call params%get_core(core)
868 call params%get(
'case.fluid.boundary_conditions', bc_object, found)
873 call this%bcs_vel%init(n_bcs)
875 allocate(marked_zones(
size(this%msh%labeled_zones)))
876 marked_zones = .false.
880 call json_extract_item(core, bc_object, i, bc_subdict)
882 call json_get(bc_subdict,
"zone_indices", zone_indices)
887 do j = 1,
size(zone_indices)
888 zone_size = this%msh%labeled_zones(zone_indices(j))%size
889 call mpi_allreduce(zone_size, global_zone_size, 1, &
890 mpi_integer, mpi_max, neko_comm, ierr)
892 if (global_zone_size .eq. 0)
then
893 write(error_unit,
'(A, A, I0, A, A, I0, A)')
"*** ERROR ***: ",&
894 "Zone index ", zone_indices(j), &
895 " is invalid as this zone has 0 size, meaning it ", &
896 "is not in the mesh. Check fluid boundary condition ", &
901 if (marked_zones(zone_indices(j)) .eqv. .true.)
then
902 write(error_unit,
'(A, A, I0, A, A, A, A)')
"*** ERROR ***: ", &
903 "Zone with index ", zone_indices(j), &
904 " has already been assigned a boundary condition. ", &
905 "Please check your boundary_conditions entry for the ", &
906 "fluid and make sure that each zone index appears only ", &
907 "in a single boundary condition."
910 marked_zones(zone_indices(j)) = .true.
915 call velocity_bc_factory(bc_i, this, bc_subdict, this%c_Xh,
user)
919 if (
associated(bc_i))
then
933 call this%bclst_vel_res%append(bc_i)
934 call this%bc_du%mark_facets(bc_i%bc_x%marked_facet)
935 call this%bc_dv%mark_facets(bc_i%bc_y%marked_facet)
936 call this%bc_dw%mark_facets(bc_i%bc_z%marked_facet)
938 call this%bcs_vel%append(bc_i)
940 call this%bc_sym_surface%mark_facets(bc_i%marked_facet)
941 type is (non_normal_t)
944 call this%bclst_vel_res%append(bc_i)
945 call this%bc_du%mark_facets(bc_i%bc_x%marked_facet)
946 call this%bc_dv%mark_facets(bc_i%bc_y%marked_facet)
947 call this%bc_dw%mark_facets(bc_i%bc_z%marked_facet)
948 type is (shear_stress_t)
950 call this%bclst_vel_res%append(bc_i%symmetry)
951 call this%bclst_du%append(bc_i%symmetry%bc_x)
952 call this%bclst_dv%append(bc_i%symmetry%bc_y)
953 call this%bclst_dw%append(bc_i%symmetry%bc_z)
955 call this%bcs_vel%append(bc_i)
956 type is (wall_model_bc_t)
958 call this%bclst_vel_res%append(bc_i%symmetry)
959 call this%bclst_du%append(bc_i%symmetry%bc_x)
960 call this%bclst_dv%append(bc_i%symmetry%bc_y)
961 call this%bclst_dw%append(bc_i%symmetry%bc_z)
963 call this%bcs_vel%append(bc_i)
970 if (bc_i%strong .eqv. .true.)
then
971 call this%bc_vel_res%mark_facets(bc_i%marked_facet)
972 call this%bc_du%mark_facets(bc_i%marked_facet)
973 call this%bc_dv%mark_facets(bc_i%marked_facet)
974 call this%bc_dw%mark_facets(bc_i%marked_facet)
976 call this%bc_prs_surface%mark_facets(bc_i%marked_facet)
979 call this%bcs_vel%append(bc_i)
985 do i = 1,
size(this%msh%labeled_zones)
986 if ((this%msh%labeled_zones(i)%size .gt. 0) .and. &
987 (marked_zones(i) .eqv. .false.))
then
988 write(error_unit,
'(A, A, I0)')
"*** ERROR ***: ", &
989 "No fluid boundary condition assigned to zone ", i
997 call this%bcs_prs%init(n_bcs)
1001 call json_extract_item(core, bc_object, i, bc_subdict)
1003 call pressure_bc_factory(bc_i, this, bc_subdict, this%c_Xh,
user)
1007 if (
associated(bc_i))
then
1008 call this%bcs_prs%append(bc_i)
1011 if (bc_i%strong .eqv. .true.)
then
1012 call this%bc_dp%mark_facets(bc_i%marked_facet)
1020 do i = 1,
size(this%msh%labeled_zones)
1021 if (this%msh%labeled_zones(i)%size .gt. 0)
then
1022 call neko_error(
"No boundary_conditions entry in the case file!")
1028 call this%bcs_vel%init()
1029 call this%bcs_prs%init()
1033 call this%bc_prs_surface%finalize()
1034 call this%bc_sym_surface%finalize()
1036 call this%bc_vel_res%finalize()
1037 call this%bc_du%finalize()
1038 call this%bc_dv%finalize()
1039 call this%bc_dw%finalize()
1040 call this%bc_dp%finalize()
1042 call this%bclst_vel_res%append(this%bc_vel_res)
1043 call this%bclst_du%append(this%bc_du)
1044 call this%bclst_dv%append(this%bc_dv)
1045 call this%bclst_dw%append(this%bc_dw)
1046 call this%bclst_dp%append(this%bc_dp)
1049 this%prs_dirichlet = .not. this%bclst_dp%is_empty()
1050 call mpi_allreduce(mpi_in_place, this%prs_dirichlet, 1, &
1051 mpi_logical, mpi_lor, neko_comm)
1056 subroutine fluid_pnpn_write_boundary_conditions(this)
1062 class(fluid_pnpn_t),
target,
intent(inout) :: this
1063 type(dirichlet_t) :: bdry_mask
1064 type(field_t),
pointer :: bdry_field
1065 type(file_t) :: bdry_file
1066 integer :: temp_index, i
1067 class(bc_t),
pointer :: bci
1068 character(len=LOG_SIZE) :: log_buf
1070 call neko_log%section(
"Fluid boundary conditions")
1071 write(log_buf,
'(A)')
'Marking using integer keys in bdry0.f00000'
1072 call neko_log%message(log_buf)
1073 write(log_buf,
'(A)')
'Condition-value pairs: '
1074 call neko_log%message(log_buf)
1075 write(log_buf,
'(A)')
' no_slip = 1'
1076 call neko_log%message(log_buf)
1077 write(log_buf,
'(A)')
' velocity_value = 2'
1078 call neko_log%message(log_buf)
1079 write(log_buf,
'(A)')
' outflow, normal_outflow (+dong) = 3'
1080 call neko_log%message(log_buf)
1081 write(log_buf,
'(A)')
' symmetry = 4'
1082 call neko_log%message(log_buf)
1083 write(log_buf,
'(A)')
' periodic = 6'
1084 call neko_log%message(log_buf)
1085 write(log_buf,
'(A)')
' user_velocity = 7'
1086 call neko_log%message(log_buf)
1087 write(log_buf,
'(A)')
' user_pressure = 8'
1088 call neko_log%message(log_buf)
1089 write(log_buf,
'(A)')
' shear_stress = 9'
1090 call neko_log%message(log_buf)
1091 write(log_buf,
'(A)')
' wall_modelling = 10'
1092 call neko_log%message(log_buf)
1093 write(log_buf,
'(A)')
' blasius_profile = 11'
1094 call neko_log%message(log_buf)
1095 call neko_log%end_section()
1097 call this%scratch%request_field(bdry_field, temp_index)
1102 call bdry_mask%init_from_components(this%c_Xh, 6.0_rp)
1103 call bdry_mask%mark_zone(this%msh%periodic)
1104 call bdry_mask%finalize()
1105 call bdry_mask%apply_scalar(bdry_field%x, this%dm_Xh%size())
1106 call bdry_mask%free()
1108 do i = 1, this%bcs_prs%size()
1109 bci => this%bcs_prs%get(i)
1110 select type (
bc => bci)
1111 type is (zero_dirichlet_t)
1112 call bdry_mask%init_from_components(this%c_Xh, 3.0_rp)
1113 call bdry_mask%mark_facets(bci%marked_facet)
1114 call bdry_mask%finalize()
1115 call bdry_mask%apply_scalar(bdry_field%x, this%dm_Xh%size())
1116 call bdry_mask%free()
1118 call bdry_mask%init_from_components(this%c_Xh, 3.0_rp)
1119 call bdry_mask%mark_facets(bci%marked_facet)
1120 call bdry_mask%finalize()
1121 call bdry_mask%apply_scalar(bdry_field%x, this%dm_Xh%size())
1122 call bdry_mask%free()
1124 call bdry_mask%init_from_components(this%c_Xh, 8.0_rp)
1125 call bdry_mask%mark_facets(bci%marked_facet)
1126 call bdry_mask%finalize()
1127 call bdry_mask%apply_scalar(bdry_field%x, this%dm_Xh%size())
1128 call bdry_mask%free()
1132 do i = 1, this%bcs_vel%size()
1133 bci => this%bcs_vel%get(i)
1134 select type (
bc => bci)
1135 type is (zero_dirichlet_t)
1136 call bdry_mask%init_from_components(this%c_Xh, 1.0_rp)
1137 call bdry_mask%mark_facets(bci%marked_facet)
1138 call bdry_mask%finalize()
1139 call bdry_mask%apply_scalar(bdry_field%x, this%dm_Xh%size())
1140 call bdry_mask%free()
1142 call bdry_mask%init_from_components(this%c_Xh, 2.0_rp)
1143 call bdry_mask%mark_facets(bci%marked_facet)
1144 call bdry_mask%finalize()
1145 call bdry_mask%apply_scalar(bdry_field%x, this%dm_Xh%size())
1146 call bdry_mask%free()
1147 type is (symmetry_t)
1148 call bdry_mask%init_from_components(this%c_Xh, 4.0_rp)
1149 call bdry_mask%mark_facets(bci%marked_facet)
1150 call bdry_mask%finalize()
1151 call bdry_mask%apply_scalar(bdry_field%x, this%dm_Xh%size())
1152 call bdry_mask%free()
1154 call bdry_mask%init_from_components(this%c_Xh, 7.0_rp)
1155 call bdry_mask%mark_facets(bci%marked_facet)
1156 call bdry_mask%finalize()
1157 call bdry_mask%apply_scalar(bdry_field%x, this%dm_Xh%size())
1158 call bdry_mask%free()
1159 type is (shear_stress_t)
1160 call bdry_mask%init_from_components(this%c_Xh, 9.0_rp)
1161 call bdry_mask%mark_facets(bci%marked_facet)
1162 call bdry_mask%finalize()
1163 call bdry_mask%apply_scalar(bdry_field%x, this%dm_Xh%size())
1164 call bdry_mask%free()
1165 type is (wall_model_bc_t)
1166 call bdry_mask%init_from_components(this%c_Xh, 10.0_rp)
1167 call bdry_mask%mark_facets(bci%marked_facet)
1168 call bdry_mask%finalize()
1169 call bdry_mask%apply_scalar(bdry_field%x, this%dm_Xh%size())
1170 call bdry_mask%free()
1172 call bdry_mask%init_from_components(this%c_Xh, 11.0_rp)
1173 call bdry_mask%mark_facets(bci%marked_facet)
1174 call bdry_mask%finalize()
1175 call bdry_mask%apply_scalar(bdry_field%x, this%dm_Xh%size())
1176 call bdry_mask%free()
1181 call bdry_file%init(
'bdry.fld')
1182 call bdry_file%write(bdry_field)
1184 call this%scratch%relinquish_field(temp_index)