Loading [MathJax]/extensions/tex2jax.js
Neko 0.9.99
A portable framework for high-order spectral element flow simulations
All Classes Namespaces Files Functions Variables Typedefs Enumerator Macros Pages
fluid_pnpn.f90
Go to the documentation of this file.
1! Copyright (c) 2022-2025, The Neko Authors
2! All rights reserved.
3!
4! Redistribution and use in source and binary forms, with or without
5! modification, are permitted provided that the following conditions
6! are met:
7!
8! * Redistributions of source code must retain the above copyright
9! notice, this list of conditions and the following disclaimer.
10!
11! * Redistributions in binary form must reproduce the above
12! copyright notice, this list of conditions and the following
13! disclaimer in the documentation and/or other materials provided
14! with the distribution.
15!
16! * Neither the name of the authors nor the names of its
17! contributors may be used to endorse or promote products derived
18! from this software without specific prior written permission.
19!
20! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23! FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24! COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25! INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26! BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27! LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28! CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29! LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30! ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31! POSSIBILITY OF SUCH DAMAGE.
32!
35 use comm
36 use, intrinsic :: iso_fortran_env, only: error_unit
37 use coefs, only : coef_t
38 use symmetry, only : symmetry_t
40 use logger, only: neko_log, log_size
41 use num_types, only : rp
42 use krylov, only : ksp_monitor_t
44 pnpn_prs_res_factory, pnpn_vel_res_factory, &
45 pnpn_prs_res_stress_factory, pnpn_vel_res_stress_factory
47 rhs_maker_oifs_t, rhs_maker_sumab_fctry, rhs_maker_bdf_fctry, &
48 rhs_maker_ext_fctry, rhs_maker_oifs_fctry
52 use fluid_aux, only : fluid_step_info
54 use projection, only : projection_t
58 use advection, only : advection_t, advection_factory
60 use json_module, only : json_file, json_core, json_value
63 use json_module, only : json_file
64 use ax_product, only : ax_t, ax_helm_factory
65 use field, only : field_t
66 use dirichlet, only : dirichlet_t
70 use non_normal, only : non_normal_t
71 use checkpoint, only : chkp_t
72 use mesh, only : mesh_t
73 use user_intf, only : user_t
75 use gs_ops, only : gs_op_add
77 use mathops, only : opadd2cm, opcolv
78 use bc_list, only: bc_list_t
82 use bc, only : bc_t
83 use file, only : file_t
84 use operators, only : ortho
85 implicit none
86 private
87
88
89
91
93 type(field_t) :: p_res, u_res, v_res, w_res
94
97 type(field_t) :: dp, du, dv, dw
98
99 !
100 ! Implicit operators, i.e. the left-hand-side of the Helmholz problem.
101 !
102
103 ! Coupled Helmholz operator for velocity
104 class(ax_t), allocatable :: ax_vel
105 ! Helmholz operator for pressure
106 class(ax_t), allocatable :: ax_prs
107
108 !
109 ! Projections for solver speed-up
110 !
111
113 type(projection_t) :: proj_prs
114 type(projection_vel_t) :: proj_vel
115
116 !
117 ! Special Karniadakis scheme boundary conditions in the pressure equation
118 !
119
121 type(facet_normal_t) :: bc_prs_surface
122
124 type(facet_normal_t) :: bc_sym_surface
125
126 !
127 ! Boundary conditions and lists for residuals and solution increments
128 !
129
131 type(zero_dirichlet_t) :: bc_vel_res
133 type(zero_dirichlet_t) :: bc_du
135 type(zero_dirichlet_t) :: bc_dv
137 type(zero_dirichlet_t) :: bc_dw
139 type(zero_dirichlet_t) :: bc_dp
140
142 type(bc_list_t) :: bclst_vel_res
143 type(bc_list_t) :: bclst_du
144 type(bc_list_t) :: bclst_dv
145 type(bc_list_t) :: bclst_dw
146 type(bc_list_t) :: bclst_dp
147
148
149 ! Checker for wether we have a strong pressure bc. If not, the pressure
150 ! is demeaned at every time step.
151 logical :: prs_dirichlet = .false.
152
153
154 ! The advection operator.
155 class(advection_t), allocatable :: adv
156
157 ! Time OIFS interpolation scheme for advection.
158 logical :: oifs
159
160 ! Time variables
161 type(field_t) :: abx1, aby1, abz1
162 type(field_t) :: abx2, aby2, abz2
163
164 ! Advection terms for the oifs method
165 type(field_t) :: advx, advy, advz
166
168 class(pnpn_prs_res_t), allocatable :: prs_res
169
171 class(pnpn_vel_res_t), allocatable :: vel_res
172
174 class(rhs_maker_sumab_t), allocatable :: sumab
175
177 class(rhs_maker_ext_t), allocatable :: makeabf
178
180 class(rhs_maker_bdf_t), allocatable :: makebdf
181
183 class(rhs_maker_oifs_t), allocatable :: makeoifs
184
186 type(fluid_volflow_t) :: vol_flow
187
188 contains
190 procedure, pass(this) :: init => fluid_pnpn_init
192 procedure, pass(this) :: free => fluid_pnpn_free
194 procedure, pass(this) :: step => fluid_pnpn_step
196 procedure, pass(this) :: restart => fluid_pnpn_restart
198 procedure, pass(this) :: setup_bcs => fluid_pnpn_setup_bcs
200 procedure, pass(this) :: write_boundary_conditions => &
202 end type fluid_pnpn_t
203
204 interface
205
212 module subroutine pressure_bc_factory(object, scheme, json, coef, user)
213 class(bc_t), pointer, intent(inout) :: object
214 type(fluid_pnpn_t), intent(in) :: scheme
215 type(json_file), intent(inout) :: json
216 type(coef_t), intent(in) :: coef
217 type(user_t), intent(in) :: user
218 end subroutine pressure_bc_factory
219 end interface
220
221 interface
222
229 module subroutine velocity_bc_factory(object, scheme, json, coef, user)
230 class(bc_t), pointer, intent(inout) :: object
231 type(fluid_pnpn_t), intent(in) :: scheme
232 type(json_file), intent(inout) :: json
233 type(coef_t), intent(in) :: coef
234 type(user_t), intent(in) :: user
235 end subroutine velocity_bc_factory
236 end interface
237
238contains
239
240 subroutine fluid_pnpn_init(this, msh, lx, params, user, chkp)
241 class(fluid_pnpn_t), target, intent(inout) :: this
242 type(mesh_t), target, intent(inout) :: msh
243 integer, intent(in) :: lx
244 type(json_file), target, intent(inout) :: params
245 type(user_t), target, intent(in) :: user
246 type(chkp_t), target, intent(inout) :: chkp
247 character(len=15), parameter :: scheme = 'Modular (Pn/Pn)'
248 integer :: i
249 class(bc_t), pointer :: bc_i, vel_bc
250 real(kind=rp) :: abs_tol
251 character(len=LOG_SIZE) :: log_buf
252 integer :: ierr, integer_val, solver_maxiter
253 character(len=:), allocatable :: solver_type, precon_type
254 logical :: monitor, found
255 logical :: advection
256 type(json_file) :: numerics_params
257
258 call this%free()
259
260 ! Initialize base class
261 call this%init_base(msh, lx, params, scheme, user, .true.)
262
263 ! Add pressure field to the registry. For this scheme it is in the same
264 ! Xh as the velocity
265 call neko_field_registry%add_field(this%dm_Xh, 'p')
266 this%p => neko_field_registry%get_field('p')
267
268 !
269 ! Select governing equations via associated residual and Ax types
270 !
271
272 call json_get(params, 'case.numerics.time_order', integer_val)
273 allocate(this%ext_bdf)
274 call this%ext_bdf%init(integer_val)
275
276 if (this%variable_material_properties .eqv. .true.) then
277 ! Setup backend dependent Ax routines
278 call ax_helm_factory(this%Ax_vel, full_formulation = .true.)
279
280 ! Setup backend dependent prs residual routines
281 call pnpn_prs_res_stress_factory(this%prs_res)
282
283 ! Setup backend dependent vel residual routines
284 call pnpn_vel_res_stress_factory(this%vel_res)
285 else
286 ! Setup backend dependent Ax routines
287 call ax_helm_factory(this%Ax_vel, full_formulation = .false.)
288
289 ! Setup backend dependent prs residual routines
290 call pnpn_prs_res_factory(this%prs_res)
291
292 ! Setup backend dependent vel residual routines
293 call pnpn_vel_res_factory(this%vel_res)
294 end if
295
296 ! Setup Ax for the pressure
297 call ax_helm_factory(this%Ax_prs, full_formulation = .false.)
298
299
300 ! Setup backend dependent summation of AB/BDF
301 call rhs_maker_sumab_fctry(this%sumab)
302
303 ! Setup backend dependent summation of extrapolation scheme
304 call rhs_maker_ext_fctry(this%makeabf)
305
306 ! Setup backend depenent contributions to F from lagged BD terms
307 call rhs_maker_bdf_fctry(this%makebdf)
308
309 ! Setup backend dependent summations of the OIFS method
310 call rhs_maker_oifs_fctry(this%makeoifs)
311
312 ! Initialize variables specific to this plan
313 associate(xh_lx => this%Xh%lx, xh_ly => this%Xh%ly, xh_lz => this%Xh%lz, &
314 dm_xh => this%dm_Xh, nelv => this%msh%nelv)
315
316 call this%p_res%init(dm_xh, "p_res")
317 call this%u_res%init(dm_xh, "u_res")
318 call this%v_res%init(dm_xh, "v_res")
319 call this%w_res%init(dm_xh, "w_res")
320 call this%abx1%init(dm_xh, "abx1")
321 call this%aby1%init(dm_xh, "aby1")
322 call this%abz1%init(dm_xh, "abz1")
323 call this%abx2%init(dm_xh, "abx2")
324 call this%aby2%init(dm_xh, "aby2")
325 call this%abz2%init(dm_xh, "abz2")
326 call this%advx%init(dm_xh, "advx")
327 call this%advy%init(dm_xh, "advy")
328 call this%advz%init(dm_xh, "advz")
329 end associate
330
331 call this%du%init(this%dm_Xh, 'du')
332 call this%dv%init(this%dm_Xh, 'dv')
333 call this%dw%init(this%dm_Xh, 'dw')
334 call this%dp%init(this%dm_Xh, 'dp')
335
336 ! Set up boundary conditions
337 call this%setup_bcs(user, params)
338
339 ! Check if we need to output boundaries
340 call json_get_or_default(params, 'case.output_boundary', found, .false.)
341 if (found) call this%write_boundary_conditions()
342
343 call this%proj_prs%init(this%dm_Xh%size(), this%pr_projection_dim, &
344 this%pr_projection_activ_step)
345
346 call this%proj_vel%init(this%dm_Xh%size(), this%vel_projection_dim, &
347 this%vel_projection_activ_step)
348
349
350
351 ! Determine the time-interpolation scheme
352 call json_get_or_default(params, 'case.numerics.oifs', this%oifs, .false.)
353 if (params%valid_path('case.fluid.flow_rate_force')) then
354 call this%vol_flow%init(this%dm_Xh, params)
355 end if
356
357 ! Setup pressure solver
358 call neko_log%section("Pressure solver")
359
360 call json_get_or_default(params, &
361 'case.fluid.pressure_solver.max_iterations', &
362 solver_maxiter, 800)
363 call json_get(params, 'case.fluid.pressure_solver.type', solver_type)
364 call json_get(params, 'case.fluid.pressure_solver.preconditioner', &
365 precon_type)
366 call json_get(params, 'case.fluid.pressure_solver.absolute_tolerance', &
367 abs_tol)
368 call json_get_or_default(params, 'case.fluid.pressure_solver.monitor', &
369 monitor, .false.)
370 call neko_log%message('Type : ('// trim(solver_type) // &
371 ', ' // trim(precon_type) // ')')
372 write(log_buf, '(A,ES13.6)') 'Abs tol :', abs_tol
373 call neko_log%message(log_buf)
374
375 call this%solver_factory(this%ksp_prs, this%dm_Xh%size(), &
376 solver_type, solver_maxiter, abs_tol, monitor)
377 call this%precon_factory_(this%pc_prs, this%ksp_prs, &
378 this%c_Xh, this%dm_Xh, this%gs_Xh, this%bcs_prs, precon_type)
379 ! Initialize the advection factory
380 call json_get_or_default(params, 'case.fluid.advection', advection, .true.)
381 call json_extract_object(params, 'case.numerics', numerics_params)
382 call advection_factory(this%adv, numerics_params, this%c_Xh, &
383 this%ulag, this%vlag, this%wlag, &
384 chkp%dtlag, chkp%tlag, this%ext_bdf, &
385 .not. advection)
386 ! Should be in init_base maybe?
387 this%chkp => chkp
388 ! This is probably scheme specific
389 ! Should not be init really, but more like, add fluid or something...
390 call this%chkp%init(this%u, this%v, this%w, this%p)
391
392 this%chkp%abx1 => this%abx1
393 this%chkp%abx2 => this%abx2
394 this%chkp%aby1 => this%aby1
395 this%chkp%aby2 => this%aby2
396 this%chkp%abz1 => this%abz1
397 this%chkp%abz2 => this%abz2
398 call this%chkp%add_lag(this%ulag, this%vlag, this%wlag)
399
400 call neko_log%end_section()
401
402 end subroutine fluid_pnpn_init
403
404 subroutine fluid_pnpn_restart(this, chkp)
405 class(fluid_pnpn_t), target, intent(inout) :: this
406 type(chkp_t), intent(inout) :: chkp
407 real(kind=rp) :: dtlag(10), tlag(10)
408 type(field_t) :: u_temp, v_temp, w_temp
409 integer :: i, j, n
410
411 dtlag = chkp%dtlag
412 tlag = chkp%tlag
413
414 n = this%u%dof%size()
415 if (allocated(chkp%previous_mesh%elements) .or. &
416 chkp%previous_Xh%lx .ne. this%Xh%lx) then
417 associate(u => this%u, v => this%v, w => this%w, p => this%p, &
418 c_xh => this%c_Xh, ulag => this%ulag, vlag => this%vlag, &
419 wlag => this%wlag)
420 do concurrent(j = 1:n)
421 u%x(j,1,1,1) = u%x(j,1,1,1) * c_xh%mult(j,1,1,1)
422 v%x(j,1,1,1) = v%x(j,1,1,1) * c_xh%mult(j,1,1,1)
423 w%x(j,1,1,1) = w%x(j,1,1,1) * c_xh%mult(j,1,1,1)
424 p%x(j,1,1,1) = p%x(j,1,1,1) * c_xh%mult(j,1,1,1)
425 end do
426 do i = 1, this%ulag%size()
427 do concurrent(j = 1:n)
428 ulag%lf(i)%x(j,1,1,1) = ulag%lf(i)%x(j,1,1,1) &
429 * c_xh%mult(j,1,1,1)
430 vlag%lf(i)%x(j,1,1,1) = vlag%lf(i)%x(j,1,1,1) &
431 * c_xh%mult(j,1,1,1)
432 wlag%lf(i)%x(j,1,1,1) = wlag%lf(i)%x(j,1,1,1) &
433 * c_xh%mult(j,1,1,1)
434 end do
435 end do
436 end associate
437 end if
438
439 if (neko_bcknd_device .eq. 1) then
440 associate(u => this%u, v => this%v, w => this%w, &
441 ulag => this%ulag, vlag => this%vlag, wlag => this%wlag,&
442 p => this%p)
443 call device_memcpy(u%x, u%x_d, u%dof%size(), &
444 host_to_device, sync = .false.)
445 call device_memcpy(v%x, v%x_d, v%dof%size(), &
446 host_to_device, sync = .false.)
447 call device_memcpy(w%x, w%x_d, w%dof%size(), &
448 host_to_device, sync = .false.)
449 call device_memcpy(p%x, p%x_d, p%dof%size(), &
450 host_to_device, sync = .false.)
451 call device_memcpy(ulag%lf(1)%x, ulag%lf(1)%x_d, &
452 u%dof%size(), host_to_device, sync = .false.)
453 call device_memcpy(ulag%lf(2)%x, ulag%lf(2)%x_d, &
454 u%dof%size(), host_to_device, sync = .false.)
455
456 call device_memcpy(vlag%lf(1)%x, vlag%lf(1)%x_d, &
457 v%dof%size(), host_to_device, sync = .false.)
458 call device_memcpy(vlag%lf(2)%x, vlag%lf(2)%x_d, &
459 v%dof%size(), host_to_device, sync = .false.)
460
461 call device_memcpy(wlag%lf(1)%x, wlag%lf(1)%x_d, &
462 w%dof%size(), host_to_device, sync = .false.)
463 call device_memcpy(wlag%lf(2)%x, wlag%lf(2)%x_d, &
464 w%dof%size(), host_to_device, sync = .false.)
465 call device_memcpy(this%abx1%x, this%abx1%x_d, &
466 w%dof%size(), host_to_device, sync = .false.)
467 call device_memcpy(this%abx2%x, this%abx2%x_d, &
468 w%dof%size(), host_to_device, sync = .false.)
469 call device_memcpy(this%aby1%x, this%aby1%x_d, &
470 w%dof%size(), host_to_device, sync = .false.)
471 call device_memcpy(this%aby2%x, this%aby2%x_d, &
472 w%dof%size(), host_to_device, sync = .false.)
473 call device_memcpy(this%abz1%x, this%abz1%x_d, &
474 w%dof%size(), host_to_device, sync = .false.)
475 call device_memcpy(this%abz2%x, this%abz2%x_d, &
476 w%dof%size(), host_to_device, sync = .false.)
477 call device_memcpy(this%advx%x, this%advx%x_d, &
478 w%dof%size(), host_to_device, sync = .false.)
479 call device_memcpy(this%advy%x, this%advy%x_d, &
480 w%dof%size(), host_to_device, sync = .false.)
481 call device_memcpy(this%advz%x, this%advz%x_d, &
482 w%dof%size(), host_to_device, sync = .false.)
483 end associate
484 end if
485 ! Make sure that continuity is maintained (important for interpolation)
486 ! Do not do this for lagged rhs
487 ! (derivatives are not necessairly coninous across elements)
488
489 if (allocated(chkp%previous_mesh%elements) &
490 .or. chkp%previous_Xh%lx .ne. this%Xh%lx) then
491 call this%gs_Xh%op(this%u, gs_op_add)
492 call this%gs_Xh%op(this%v, gs_op_add)
493 call this%gs_Xh%op(this%w, gs_op_add)
494 call this%gs_Xh%op(this%p, gs_op_add)
495
496 do i = 1, this%ulag%size()
497 call this%gs_Xh%op(this%ulag%lf(i), gs_op_add)
498 call this%gs_Xh%op(this%vlag%lf(i), gs_op_add)
499 call this%gs_Xh%op(this%wlag%lf(i), gs_op_add)
500 end do
501 end if
502
503 end subroutine fluid_pnpn_restart
504
505 subroutine fluid_pnpn_free(this)
506 class(fluid_pnpn_t), intent(inout) :: this
507
508 !Deallocate velocity and pressure fields
509 call this%scheme_free()
510
511 call this%bc_prs_surface%free()
512 call this%bc_sym_surface%free()
513 call this%bclst_vel_res%free()
514 call this%bclst_dp%free()
515 call this%proj_prs%free()
516 call this%proj_vel%free()
517
518 call this%p_res%free()
519 call this%u_res%free()
520 call this%v_res%free()
521 call this%w_res%free()
522
523 call this%du%free()
524 call this%dv%free()
525 call this%dw%free()
526 call this%dp%free()
527
528 call this%abx1%free()
529 call this%aby1%free()
530 call this%abz1%free()
531
532 call this%abx2%free()
533 call this%aby2%free()
534 call this%abz2%free()
535
536 call this%advx%free()
537 call this%advy%free()
538 call this%advz%free()
539
540 if (allocated(this%Ax_vel)) then
541 deallocate(this%Ax_vel)
542 end if
543
544 if (allocated(this%Ax_prs)) then
545 deallocate(this%Ax_prs)
546 end if
547
548 if (allocated(this%prs_res)) then
549 deallocate(this%prs_res)
550 end if
551
552 if (allocated(this%vel_res)) then
553 deallocate(this%vel_res)
554 end if
555
556 if (allocated(this%sumab)) then
557 deallocate(this%sumab)
558 end if
559
560 if (allocated(this%makeabf)) then
561 deallocate(this%makeabf)
562 end if
563
564 if (allocated(this%makebdf)) then
565 deallocate(this%makebdf)
566 end if
567
568 if (allocated(this%makeoifs)) then
569 deallocate(this%makeoifs)
570 end if
571
572 if (allocated(this%ext_bdf)) then
573 deallocate(this%ext_bdf)
574 end if
575
576 call this%vol_flow%free()
577
578 end subroutine fluid_pnpn_free
579
586 subroutine fluid_pnpn_step(this, t, tstep, dt, ext_bdf, dt_controller)
587 class(fluid_pnpn_t), target, intent(inout) :: this
588 real(kind=rp), intent(in) :: t
589 integer, intent(in) :: tstep
590 real(kind=rp), intent(in) :: dt
591 type(time_scheme_controller_t), intent(in) :: ext_bdf
592 type(time_step_controller_t), intent(in) :: dt_controller
593 ! number of degrees of freedom
594 integer :: n
595 ! Solver results monitors (pressure + 3 velocity)
596 type(ksp_monitor_t) :: ksp_results(4)
597
598 type(file_t) :: dump_file
599 class(bc_t), pointer :: bc_i
600 type(non_normal_t), pointer :: bc_j
601
602 if (this%freeze) return
603
604 n = this%dm_Xh%size()
605
606 call profiler_start_region('Fluid', 1)
607 associate(u => this%u, v => this%v, w => this%w, p => this%p, &
608 u_e => this%u_e, v_e => this%v_e, w_e => this%w_e, &
609 du => this%du, dv => this%dv, dw => this%dw, dp => this%dp, &
610 u_res => this%u_res, v_res => this%v_res, w_res => this%w_res, &
611 p_res => this%p_res, ax_vel => this%Ax_vel, ax_prs => this%Ax_prs, &
612 xh => this%Xh, &
613 c_xh => this%c_Xh, dm_xh => this%dm_Xh, gs_xh => this%gs_Xh, &
614 ulag => this%ulag, vlag => this%vlag, wlag => this%wlag, &
615 msh => this%msh, prs_res => this%prs_res, &
616 source_term => this%source_term, vel_res => this%vel_res, &
617 sumab => this%sumab, makeoifs => this%makeoifs, &
618 makeabf => this%makeabf, makebdf => this%makebdf, &
619 vel_projection_dim => this%vel_projection_dim, &
620 pr_projection_dim => this%pr_projection_dim, &
621 rho => this%rho, mu => this%mu, oifs => this%oifs, &
622 rho_field => this%rho_field, mu_field => this%mu_field, &
623 f_x => this%f_x, f_y => this%f_y, f_z => this%f_z, &
624 if_variable_dt => dt_controller%if_variable_dt, &
625 dt_last_change => dt_controller%dt_last_change, &
626 event => glb_cmd_event)
627
628 ! Extrapolate the velocity if it's not done in nut_field estimation
629 call sumab%compute_fluid(u_e, v_e, w_e, u, v, w, &
630 ulag, vlag, wlag, ext_bdf%advection_coeffs, ext_bdf%nadv)
631
632 ! Compute the source terms
633 call this%source_term%compute(t, tstep)
634
635 ! Add Neumann bc contributions to the RHS
636 call this%bcs_vel%apply_vector(f_x%x, f_y%x, f_z%x, &
637 this%dm_Xh%size(), t, tstep, strong = .false.)
638
639 ! Compute the gradient jump penalty term
640 if (this%if_gradient_jump_penalty .eqv. .true.) then
641 call this%gradient_jump_penalty_u%compute(u, v, w, u)
642 call this%gradient_jump_penalty_v%compute(u, v, w, v)
643 call this%gradient_jump_penalty_w%compute(u, v, w, w)
644 call this%gradient_jump_penalty_u%perform(f_x)
645 call this%gradient_jump_penalty_v%perform(f_y)
646 call this%gradient_jump_penalty_w%perform(f_z)
647 end if
648
649 if (oifs) then
650 ! Add the advection operators to the right-hand-side.
651 call this%adv%compute(u, v, w, &
652 this%advx, this%advy, this%advz, &
653 xh, this%c_Xh, dm_xh%size(), dt)
654
655 ! At this point the RHS contains the sum of the advection operator and
656 ! additional source terms, evaluated using the velocity field from the
657 ! previous time-step. Now, this value is used in the explicit time
658 ! scheme to advance both terms in time.
659 call makeabf%compute_fluid(this%abx1, this%aby1, this%abz1,&
660 this%abx2, this%aby2, this%abz2, &
661 f_x%x, f_y%x, f_z%x, &
662 rho, ext_bdf%advection_coeffs, n)
663
664 ! Now, the source terms from the previous time step are added to the RHS.
665 call makeoifs%compute_fluid(this%advx%x, this%advy%x, this%advz%x, &
666 f_x%x, f_y%x, f_z%x, &
667 rho, dt, n)
668 else
669 ! Add the advection operators to the right-hand-side.
670 call this%adv%compute(u, v, w, &
671 f_x, f_y, f_z, &
672 xh, this%c_Xh, dm_xh%size())
673
674 ! At this point the RHS contains the sum of the advection operator and
675 ! additional source terms, evaluated using the velocity field from the
676 ! previous time-step. Now, this value is used in the explicit time
677 ! scheme to advance both terms in time.
678 call makeabf%compute_fluid(this%abx1, this%aby1, this%abz1,&
679 this%abx2, this%aby2, this%abz2, &
680 f_x%x, f_y%x, f_z%x, &
681 rho, ext_bdf%advection_coeffs, n)
682
683 ! Add the RHS contributions coming from the BDF scheme.
684 call makebdf%compute_fluid(ulag, vlag, wlag, f_x%x, f_y%x, f_z%x, &
685 u, v, w, c_xh%B, rho, dt, &
686 ext_bdf%diffusion_coeffs, ext_bdf%ndiff, n)
687 end if
688
689 call ulag%update()
690 call vlag%update()
691 call wlag%update()
692
693 call this%bc_apply_vel(t, tstep, strong = .true.)
694 call this%bc_apply_prs(t, tstep)
695
696 ! Update material properties if necessary
697 call this%update_material_properties()
698
699 ! Compute pressure residual.
700 call profiler_start_region('Pressure_residual', 18)
701
702 call prs_res%compute(p, p_res,&
703 u, v, w, &
704 u_e, v_e, w_e, &
705 f_x, f_y, f_z, &
706 c_xh, gs_xh, &
707 this%bc_prs_surface, this%bc_sym_surface,&
708 ax_prs, ext_bdf%diffusion_coeffs(1), dt, &
709 mu_field, rho_field, event)
710
711 ! De-mean the pressure residual when no strong pressure boundaries present
712 if (.not. this%prs_dirichlet) call ortho(p_res%x, this%glb_n_points, n)
713
714 call gs_xh%op(p_res, gs_op_add, event)
715 call device_event_sync(event)
716
717 ! Set the residual to zero at strong pressure boundaries.
718 call this%bclst_dp%apply_scalar(p_res%x, p%dof%size(), t, tstep)
719
720
721 call profiler_end_region('Pressure_residual', 18)
722
723
724 call this%proj_prs%pre_solving(p_res%x, tstep, c_xh, n, dt_controller, &
725 'Pressure')
726
727 call this%pc_prs%update()
728
729 call profiler_start_region('Pressure_solve', 3)
730
731 ! Solve for the pressure increment.
732 ksp_results(1) = &
733 this%ksp_prs%solve(ax_prs, dp, p_res%x, n, c_xh, this%bclst_dp, gs_xh)
734
735
736 call profiler_end_region('Pressure_solve', 3)
737
738 call this%proj_prs%post_solving(dp%x, ax_prs, c_xh, &
739 this%bclst_dp, gs_xh, n, tstep, dt_controller)
740
741 ! Update the pressure with the increment. Demean if necessary.
742 call field_add2(p, dp, n)
743 if (.not. this%prs_dirichlet) call ortho(p%x, this%glb_n_points, n)
744
745 ! Compute velocity residual.
746 call profiler_start_region('Velocity_residual', 19)
747 call vel_res%compute(ax_vel, u, v, w, &
748 u_res, v_res, w_res, &
749 p, &
750 f_x, f_y, f_z, &
751 c_xh, msh, xh, &
752 mu_field, rho_field, ext_bdf%diffusion_coeffs(1), &
753 dt, dm_xh%size())
754
755 call gs_xh%op(u_res, gs_op_add, event)
756 call device_event_sync(event)
757 call gs_xh%op(v_res, gs_op_add, event)
758 call device_event_sync(event)
759 call gs_xh%op(w_res, gs_op_add, event)
760 call device_event_sync(event)
761
762 ! Set residual to zero at strong velocity boundaries.
763 call this%bclst_vel_res%apply(u_res, v_res, w_res, t, tstep)
764
765
766 call profiler_end_region('Velocity_residual', 19)
767
768 call this%proj_vel%pre_solving(u_res%x, v_res%x, w_res%x, &
769 tstep, c_xh, n, dt_controller, 'Velocity')
770
771 call this%pc_vel%update()
772
773 call profiler_start_region("Velocity_solve", 4)
774 ksp_results(2:4) = this%ksp_vel%solve_coupled(ax_vel, du, dv, dw, &
775 u_res%x, v_res%x, w_res%x, n, c_xh, &
776 this%bclst_du, this%bclst_dv, this%bclst_dw, gs_xh, &
777 this%ksp_vel%max_iter)
778 call profiler_end_region("Velocity_solve", 4)
779
780 call this%proj_vel%post_solving(du%x, dv%x, dw%x, ax_vel, c_xh, &
781 this%bclst_du, this%bclst_dv, this%bclst_dw, gs_xh, n, tstep, &
782 dt_controller)
783
784 if (neko_bcknd_device .eq. 1) then
785 call device_opadd2cm(u%x_d, v%x_d, w%x_d, &
786 du%x_d, dv%x_d, dw%x_d, 1.0_rp, n, msh%gdim)
787 else
788 call opadd2cm(u%x, v%x, w%x, du%x, dv%x, dw%x, 1.0_rp, n, msh%gdim)
789 end if
790
791 if (this%forced_flow_rate) then
792 call this%vol_flow%adjust( u, v, w, p, u_res, v_res, w_res, p_res, &
793 c_xh, gs_xh, ext_bdf, rho, mu, dt, &
794 this%bclst_dp, this%bclst_du, this%bclst_dv, &
795 this%bclst_dw, this%bclst_vel_res, ax_vel, ax_prs, this%ksp_prs, &
796 this%ksp_vel, this%pc_prs, this%pc_vel, this%ksp_prs%max_iter, &
797 this%ksp_vel%max_iter)
798 end if
799
800 call fluid_step_info(tstep, t, dt, ksp_results, this%strict_convergence)
801
802 end associate
803 call profiler_end_region('Fluid', 1)
804 end subroutine fluid_pnpn_step
805
808 subroutine fluid_pnpn_setup_bcs(this, user, params)
809 class(fluid_pnpn_t), intent(inout) :: this
810 type(user_t), target, intent(in) :: user
811 type(json_file), intent(inout) :: params
812 integer :: i, n_bcs, zone_index, j, zone_size, global_zone_size, ierr
813 class(bc_t), pointer :: bc_i
814 type(json_core) :: core
815 type(json_value), pointer :: bc_object
816 type(json_file) :: bc_subdict
817 logical :: found
818 ! Monitor which boundary zones have been marked
819 logical, allocatable :: marked_zones(:)
820 integer, allocatable :: zone_indices(:)
821
822 ! Lists for the residuals and solution increments
823 call this%bclst_vel_res%init()
824 call this%bclst_du%init()
825 call this%bclst_dv%init()
826 call this%bclst_dw%init()
827 call this%bclst_dp%init()
828
829 call this%bc_vel_res%init_from_components(this%c_Xh)
830 call this%bc_du%init_from_components(this%c_Xh)
831 call this%bc_dv%init_from_components(this%c_Xh)
832 call this%bc_dw%init_from_components(this%c_Xh)
833 call this%bc_dp%init_from_components(this%c_Xh)
834
835 ! Special PnPn boundary conditions for pressure
836 call this%bc_prs_surface%init_from_components(this%c_Xh)
837 call this%bc_sym_surface%init_from_components(this%c_Xh)
838
839 ! Populate bcs_vel and bcs_prs based on the case file
840 if (params%valid_path('case.fluid.boundary_conditions')) then
841 call params%info('case.fluid.boundary_conditions', n_children = n_bcs)
842 call params%get_core(core)
843 call params%get('case.fluid.boundary_conditions', bc_object, found)
844
845 !
846 ! Velocity bcs
847 !
848 call this%bcs_vel%init(n_bcs)
849
850 allocate(marked_zones(size(this%msh%labeled_zones)))
851 marked_zones = .false.
852
853 do i = 1, n_bcs
854 ! Create a new json containing just the subdict for this bc
855 call json_extract_item(core, bc_object, i, bc_subdict)
856
857 call json_get(bc_subdict, "zone_indices", zone_indices)
858
859 ! Check that we are not trying to assing a bc to zone, for which one
860 ! has already been assigned and that the zone has more than 0 size
861 ! in the mesh.
862 do j = 1, size(zone_indices)
863 zone_size = this%msh%labeled_zones(zone_indices(j))%size
864 call mpi_allreduce(zone_size, global_zone_size, 1, &
865 mpi_integer, mpi_max, neko_comm, ierr)
866
867 if (global_zone_size .eq. 0) then
868 write(error_unit, '(A, A, I0, A, A, I0, A)') "*** ERROR ***: ",&
869 "Zone index ", zone_indices(j), &
870 " is invalid as this zone has 0 size, meaning it ", &
871 "is not in the mesh. Check fluid boundary condition ", &
872 i, "."
873 error stop
874 end if
875
876 if (marked_zones(zone_indices(j)) .eqv. .true.) then
877 write(error_unit, '(A, A, I0, A, A, A, A)') "*** ERROR ***: ", &
878 "Zone with index ", zone_indices(j), &
879 " has already been assigned a boundary condition. ", &
880 "Please check your boundary_conditions entry for the ", &
881 "fluid and make sure that each zone index appears only ", &
882 "in a single boundary condition."
883 error stop
884 else
885 marked_zones(zone_indices(j)) = .true.
886 end if
887 end do
888
889 bc_i => null()
890 call velocity_bc_factory(bc_i, this, bc_subdict, this%c_Xh, user)
891
892 ! Not all bcs require an allocation for velocity in particular,
893 ! so we check.
894 if (associated(bc_i)) then
895
896 ! We need to treat mixed bcs separately because they are by
897 ! convention marked weak and currently contain nested
898 ! bcs, some of which are strong.
899 select type (bc_i)
900 type is (symmetry_t)
901 ! Symmetry has 3 internal bcs, but only one actually contains
902 ! markings.
903 ! Symmetry's apply_scalar doesn't do anything, so we need to mark
904 ! individual nested bcs to the du,dv,dw, whereas the vel_res can
905 ! just get symmetry as a whole, because on this list we call
906 ! apply_vector.
907 ! Additionally we have to mark the special surface bc for p.
908 call this%bclst_vel_res%append(bc_i)
909 call this%bc_du%mark_facets(bc_i%bc_x%marked_facet)
910 call this%bc_dv%mark_facets(bc_i%bc_y%marked_facet)
911 call this%bc_dw%mark_facets(bc_i%bc_z%marked_facet)
912
913 call this%bcs_vel%append(bc_i)
914
915 call this%bc_sym_surface%mark_facets(bc_i%marked_facet)
916 type is (non_normal_t)
917 ! This is a bc for the residuals and increments, not the
918 ! velocity itself. So, don't append to bcs_vel
919 call this%bclst_vel_res%append(bc_i)
920 call this%bc_du%mark_facets(bc_i%bc_x%marked_facet)
921 call this%bc_dv%mark_facets(bc_i%bc_y%marked_facet)
922 call this%bc_dw%mark_facets(bc_i%bc_z%marked_facet)
923 type is (shear_stress_t)
924 ! Same as symmetry
925 call this%bclst_vel_res%append(bc_i%symmetry)
926 call this%bclst_du%append(bc_i%symmetry%bc_x)
927 call this%bclst_dv%append(bc_i%symmetry%bc_y)
928 call this%bclst_dw%append(bc_i%symmetry%bc_z)
929
930 call this%bcs_vel%append(bc_i)
931 type is (wall_model_bc_t)
932 ! Same as symmetry
933 call this%bclst_vel_res%append(bc_i%symmetry)
934 call this%bclst_du%append(bc_i%symmetry%bc_x)
935 call this%bclst_dv%append(bc_i%symmetry%bc_y)
936 call this%bclst_dw%append(bc_i%symmetry%bc_z)
937
938 call this%bcs_vel%append(bc_i)
939 class default
940
941 ! For the default case we use our dummy zero_dirichlet bcs to
942 ! mark the same faces as in ordinary velocity dirichlet
943 ! conditions.
944 ! Additionally we mark the special PnPn pressure bc.
945 if (bc_i%strong .eqv. .true.) then
946 call this%bc_vel_res%mark_facets(bc_i%marked_facet)
947 call this%bc_du%mark_facets(bc_i%marked_facet)
948 call this%bc_dv%mark_facets(bc_i%marked_facet)
949 call this%bc_dw%mark_facets(bc_i%marked_facet)
950
951 call this%bc_prs_surface%mark_facets(bc_i%marked_facet)
952 end if
953
954 call this%bcs_vel%append(bc_i)
955 end select
956 end if
957 end do
958
959 ! Make sure all labeled zones with non-zero size have been marked
960 do i = 1, size(this%msh%labeled_zones)
961 if ((this%msh%labeled_zones(i)%size .gt. 0) .and. &
962 (marked_zones(i) .eqv. .false.)) then
963 write(error_unit, '(A, A, I0)') "*** ERROR ***: ", &
964 "No fluid boundary condition assigned to zone ", i
965 error stop
966 end if
967 end do
968
969 !
970 ! Pressure bcs
971 !
972 call this%bcs_prs%init(n_bcs)
973
974 do i = 1, n_bcs
975 ! Create a new json containing just the subdict for this bc
976 call json_extract_item(core, bc_object, i, bc_subdict)
977 bc_i => null()
978 call pressure_bc_factory(bc_i, this, bc_subdict, this%c_Xh, user)
979
980 ! Not all bcs require an allocation for pressure in particular,
981 ! so we check.
982 if (associated(bc_i)) then
983 call this%bcs_prs%append(bc_i)
984
985 ! Mark strong bcs in the dummy dp bc to force zero change.
986 if (bc_i%strong .eqv. .true.) then
987 call this%bc_dp%mark_facets(bc_i%marked_facet)
988 end if
989
990 end if
991
992 end do
993 else
994 ! Check that there are no labeled zones, i.e. all are periodic.
995 do i = 1, size(this%msh%labeled_zones)
996 if (this%msh%labeled_zones(i)%size .gt. 0) then
997 call neko_error("No boundary_conditions entry in the case file!")
998 end if
999 end do
1000
1001 end if
1002
1003 call this%bc_prs_surface%finalize()
1004 call this%bc_sym_surface%finalize()
1005
1006 call this%bc_vel_res%finalize()
1007 call this%bc_du%finalize()
1008 call this%bc_dv%finalize()
1009 call this%bc_dw%finalize()
1010 call this%bc_dp%finalize()
1011
1012 call this%bclst_vel_res%append(this%bc_vel_res)
1013 call this%bclst_du%append(this%bc_du)
1014 call this%bclst_dv%append(this%bc_dv)
1015 call this%bclst_dw%append(this%bc_dw)
1016 call this%bclst_dp%append(this%bc_dp)
1017
1018 ! If we have no strong pressure bcs, we will demean the pressure
1019 this%prs_dirichlet = .not. this%bclst_dp%is_empty()
1020 call mpi_allreduce(mpi_in_place, this%prs_dirichlet, 1, &
1021 mpi_logical, mpi_lor, neko_comm)
1022
1023 end subroutine fluid_pnpn_setup_bcs
1024
1026 subroutine fluid_pnpn_write_boundary_conditions(this)
1027 use inflow, only : inflow_t
1029 use blasius, only : blasius_t
1031 use usr_inflow, only : usr_inflow_t
1032 use dong_outflow, only : dong_outflow_t
1033 class(fluid_pnpn_t), target, intent(inout) :: this
1034 type(dirichlet_t) :: bdry_mask
1035 type(field_t), pointer :: bdry_field
1036 type(file_t) :: bdry_file
1037 integer :: temp_index, i
1038 class(bc_t), pointer :: bci
1039 character(len=LOG_SIZE) :: log_buf
1040
1041 call neko_log%section("Fluid boundary conditions")
1042 write(log_buf, '(A)') 'Marking using integer keys in bdry0.f00000'
1043 call neko_log%message(log_buf)
1044 write(log_buf, '(A)') 'Condition-value pairs: '
1045 call neko_log%message(log_buf)
1046 write(log_buf, '(A)') ' no_slip = 1'
1047 call neko_log%message(log_buf)
1048 write(log_buf, '(A)') ' velocity_value = 2'
1049 call neko_log%message(log_buf)
1050 write(log_buf, '(A)') ' outflow, normal_outflow (+dong) = 3'
1051 call neko_log%message(log_buf)
1052 write(log_buf, '(A)') ' symmetry = 4'
1053 call neko_log%message(log_buf)
1054 write(log_buf, '(A)') ' user_velocity_pointwise = 5'
1055 call neko_log%message(log_buf)
1056 write(log_buf, '(A)') ' periodic = 6'
1057 call neko_log%message(log_buf)
1058 write(log_buf, '(A)') ' user_velocity = 7'
1059 call neko_log%message(log_buf)
1060 write(log_buf, '(A)') ' user_pressure = 8'
1061 call neko_log%message(log_buf)
1062 write(log_buf, '(A)') ' shear_stress = 9'
1063 call neko_log%message(log_buf)
1064 write(log_buf, '(A)') ' wall_modelling = 10'
1065 call neko_log%message(log_buf)
1066 write(log_buf, '(A)') ' blasius_profile = 11'
1067 call neko_log%message(log_buf)
1068 call neko_log%end_section()
1069
1070 call this%scratch%request_field(bdry_field, temp_index)
1071 bdry_field = 0.0_rp
1072
1073
1074
1075 call bdry_mask%init_from_components(this%c_Xh, 6.0_rp)
1076 call bdry_mask%mark_zone(this%msh%periodic)
1077 call bdry_mask%finalize()
1078 call bdry_mask%apply_scalar(bdry_field%x, this%dm_Xh%size())
1079 call bdry_mask%free()
1080
1081 do i = 1, this%bcs_prs%size()
1082 bci => this%bcs_prs%get(i)
1083 select type (bc => bci)
1084 type is (zero_dirichlet_t)
1085 call bdry_mask%init_from_components(this%c_Xh, 3.0_rp)
1086 call bdry_mask%mark_facets(bci%marked_facet)
1087 call bdry_mask%finalize()
1088 call bdry_mask%apply_scalar(bdry_field%x, this%dm_Xh%size())
1089 call bdry_mask%free()
1090 type is (dong_outflow_t)
1091 call bdry_mask%init_from_components(this%c_Xh, 3.0_rp)
1092 call bdry_mask%mark_facets(bci%marked_facet)
1093 call bdry_mask%finalize()
1094 call bdry_mask%apply_scalar(bdry_field%x, this%dm_Xh%size())
1095 call bdry_mask%free()
1096 type is (field_dirichlet_t)
1097 call bdry_mask%init_from_components(this%c_Xh, 8.0_rp)
1098 call bdry_mask%mark_facets(bci%marked_facet)
1099 call bdry_mask%finalize()
1100 call bdry_mask%apply_scalar(bdry_field%x, this%dm_Xh%size())
1101 call bdry_mask%free()
1102 end select
1103 end do
1104
1105 do i = 1, this%bcs_vel%size()
1106 bci => this%bcs_vel%get(i)
1107 select type (bc => bci)
1108 type is (zero_dirichlet_t)
1109 call bdry_mask%init_from_components(this%c_Xh, 1.0_rp)
1110 call bdry_mask%mark_facets(bci%marked_facet)
1111 call bdry_mask%finalize()
1112 call bdry_mask%apply_scalar(bdry_field%x, this%dm_Xh%size())
1113 call bdry_mask%free()
1114 type is (inflow_t)
1115 call bdry_mask%init_from_components(this%c_Xh, 2.0_rp)
1116 call bdry_mask%mark_facets(bci%marked_facet)
1117 call bdry_mask%finalize()
1118 call bdry_mask%apply_scalar(bdry_field%x, this%dm_Xh%size())
1119 call bdry_mask%free()
1120 type is (symmetry_t)
1121 call bdry_mask%init_from_components(this%c_Xh, 4.0_rp)
1122 call bdry_mask%mark_facets(bci%marked_facet)
1123 call bdry_mask%finalize()
1124 call bdry_mask%apply_scalar(bdry_field%x, this%dm_Xh%size())
1125 call bdry_mask%free()
1126 type is (usr_inflow_t)
1127 call bdry_mask%init_from_components(this%c_Xh, 5.0_rp)
1128 call bdry_mask%mark_facets(bci%marked_facet)
1129 call bdry_mask%finalize()
1130 call bdry_mask%apply_scalar(bdry_field%x, this%dm_Xh%size())
1131 call bdry_mask%free()
1132 type is (field_dirichlet_vector_t)
1133 call bdry_mask%init_from_components(this%c_Xh, 7.0_rp)
1134 call bdry_mask%mark_facets(bci%marked_facet)
1135 call bdry_mask%finalize()
1136 call bdry_mask%apply_scalar(bdry_field%x, this%dm_Xh%size())
1137 call bdry_mask%free()
1138 type is (shear_stress_t)
1139 call bdry_mask%init_from_components(this%c_Xh, 9.0_rp)
1140 call bdry_mask%mark_facets(bci%marked_facet)
1141 call bdry_mask%finalize()
1142 call bdry_mask%apply_scalar(bdry_field%x, this%dm_Xh%size())
1143 call bdry_mask%free()
1144 type is (wall_model_bc_t)
1145 call bdry_mask%init_from_components(this%c_Xh, 10.0_rp)
1146 call bdry_mask%mark_facets(bci%marked_facet)
1147 call bdry_mask%finalize()
1148 call bdry_mask%apply_scalar(bdry_field%x, this%dm_Xh%size())
1149 call bdry_mask%free()
1150 type is (blasius_t)
1151 call bdry_mask%init_from_components(this%c_Xh, 11.0_rp)
1152 call bdry_mask%mark_facets(bci%marked_facet)
1153 call bdry_mask%finalize()
1154 call bdry_mask%apply_scalar(bdry_field%x, this%dm_Xh%size())
1155 call bdry_mask%free()
1156 end select
1157 end do
1158
1159
1160 bdry_file = file_t('bdry.fld')
1161 call bdry_file%write(bdry_field)
1162
1163 call this%scratch%relinquish_field(temp_index)
1164 end subroutine fluid_pnpn_write_boundary_conditions
1165
1166end module fluid_pnpn
Copy data between host and device (or device and device)
Definition device.F90:65
Retrieves a parameter by name or assigns a provided default value. In the latter case also adds the m...
Retrieves a parameter by name or throws an error.
Subroutines to add advection terms to the RHS of a transport equation.
Definition advection.f90:34
Defines a Matrix-vector product.
Definition ax.f90:34
Defines a list of bc_t.
Definition bc_list.f90:34
Defines a boundary condition.
Definition bc.f90:34
Defines a Blasius profile dirichlet condition.
Definition blasius.f90:34
Defines a checkpoint.
Coefficients.
Definition coef.f90:34
Definition comm.F90:1
subroutine, public device_opadd2cm(a1_d, a2_d, a3_d, b1_d, b2_d, b3_d, c, n, gdim)
subroutine, public device_opcolv(a1_d, a2_d, a3_d, c_d, gdim, n)
Device abstraction, common interface for various accelerators.
Definition device.F90:34
subroutine, public device_event_sync(event)
Synchronize an event.
Definition device.F90:1244
integer, parameter, public host_to_device
Definition device.F90:46
type(c_ptr), bind(C), public glb_cmd_event
Event for the global command queue.
Definition device.F90:56
Defines a dirichlet boundary condition.
Definition dirichlet.f90:34
Defines a dong outflow condition.
Dirichlet condition applied in the facet normal direction.
Defines inflow dirichlet conditions.
Defines user dirichlet condition for a scalar field.
subroutine, public field_add2(a, b, n)
Vector addition .
subroutine, public field_copy(a, b, n)
Copy a vector .
Defines a registry for storing solution fields.
type(field_registry_t), target, public neko_field_registry
Global field registry.
Defines a field.
Definition field.f90:34
Module for file I/O operations.
Definition file.f90:34
Auxiliary routines for fluid solvers.
Definition fluid_aux.f90:2
subroutine, public fluid_step_info(step, t, dt, ksp_results, strict_convergence)
Prints for prs, velx, vely, velz the following: Number of iterations, start residual,...
Definition fluid_aux.f90:19
Modular version of the Classic Nek5000 Pn/Pn formulation for fluids.
subroutine fluid_pnpn_setup_bcs(this, user, params)
Sets up the boundary condition for the scheme.
subroutine fluid_pnpn_restart(this, chkp)
subroutine fluid_pnpn_step(this, t, tstep, dt, ext_bdf, dt_controller)
Advance fluid simulation in time.
subroutine fluid_pnpn_write_boundary_conditions(this)
Write a field with boundary condition specifications.
subroutine fluid_pnpn_free(this)
subroutine fluid_pnpn_init(this, msh, lx, params, user, chkp)
Boundary condition factory for pressure.
Defines Gather-scatter operations.
Definition gs_ops.f90:34
integer, parameter, public gs_op_add
Definition gs_ops.f90:36
Defines inflow dirichlet conditions.
Definition inflow.f90:34
Utilities for retrieving parameters from the case files.
subroutine, public json_extract_object(json, name, object)
Extract object as a separate JSON dictionary.
Implements the base abstract type for Krylov solvers plus helper types.
Definition krylov.f90:34
Logging routines.
Definition log.f90:34
type(log_t), public neko_log
Global log stream.
Definition log.f90:65
integer, parameter, public log_size
Definition log.f90:42
Collection of vector field operations operating on and . Note that in general the indices and ....
Definition mathops.f90:65
subroutine, public opcolv(a1, a2, a3, c, gdim, n)
Definition mathops.f90:97
subroutine, public opadd2cm(a1, a2, a3, b1, b2, b3, c, n, gdim)
Definition mathops.f90:142
Defines a mesh.
Definition mesh.f90:34
Build configurations.
integer, parameter neko_bcknd_device
Dirichlet condition on axis aligned plane in the non normal direction.
integer, parameter, public dp
Definition num_types.f90:9
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:12
Operators.
Definition operators.f90:34
subroutine, public ortho(x, glb_n_points, n)
Othogonalize with regard to vector (1,1,1,1,1,1...,1)^T.
Defines Pressure and velocity residuals in the Pn-Pn formulation.
Definition pnpn_res.f90:34
Profiling interface.
Definition profiler.F90:34
subroutine, public profiler_start_region(name, region_id)
Started a named (name) profiler region.
Definition profiler.F90:78
subroutine, public profiler_end_region(name, region_id)
End the most recently started profiler region.
Definition profiler.F90:109
Project x onto X , the space of old solutions and back again Couple projections for velocity.
Project x onto X, the space of old solutions and back again.
Routines to generate the right-hand sides for the convection-diffusion equation. Employs the EXT/BDF ...
Definition rhs_maker.f90:38
Defines a shear stress boundary condition for a vector field. Maintainer: Timofey Mukha.
Implements the source_term_t type and a wrapper source_term_wrapper_t.
Mixed Dirichlet-Neumann axis aligned symmetry plane.
Definition symmetry.f90:34
Compound scheme for the advection and diffusion operators in a transport equation.
Implements type time_step_controller.
Interfaces for user interaction with NEKO.
Definition user_intf.f90:34
Defines inflow dirichlet conditions.
Utilities.
Definition utils.f90:35
subroutine, public neko_type_error(base_type, wrong_type, known_types)
Reports an error allocating a type for a particular base pointer class.
Definition utils.f90:250
Defines the wall_model_bc_t type. Maintainer: Timofey Mukha.
Defines a zero-valued Dirichlet boundary condition.
Base abstract type for computing the advection operator.
Definition advection.f90:46
Base type for a matrix-vector product providing .
Definition ax.f90:43
Base type for a boundary condition.
Definition bc.f90:57
A list of allocatable `bc_t`. Follows the standard interface of lists.
Definition bc_list.f90:47
Blasius profile for inlet (vector valued).
Definition blasius.f90:52
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
Definition coef.f90:55
Generic Dirichlet boundary condition on .
Definition dirichlet.f90:47
Dong outflow condition Follows "A Convective-like Energy-Stable Open Boundary Condition for Simulati...
Dirichlet condition in facet normal direction.
User defined dirichlet condition, for which the user can work with an entire field....
Extension of the user defined dirichlet condition field_dirichlet
A wrapper around a polymorphic generic_file_t that handles its init. This is essentially a factory fo...
Definition file.f90:54
Dirichlet condition for inlet (vector valued)
Definition inflow.f90:46
Type for storing initial and final residuals in a Krylov solver.
Definition krylov.f90:56
Dirichlet condition in non normal direction of a plane.
Abstract type to compute pressure residual.
Definition pnpn_res.f90:48
Abstract type to compute velocity residual.
Definition pnpn_res.f90:54
Abstract type to add contributions to F from lagged BD terms.
Definition rhs_maker.f90:59
Abstract type to sum up contributions to kth order extrapolation scheme.
Definition rhs_maker.f90:52
Abstract type to add contributions of kth order OIFS scheme.
Definition rhs_maker.f90:66
Abstract type to compute extrapolated velocity field for the pressure equation.
Definition rhs_maker.f90:46
A shear stress boundary condition.
Mixed Dirichlet-Neumann symmetry plane condition.
Definition symmetry.f90:49
Implements the logic to compute the time coefficients for the advection and diffusion operators in a ...
A type collecting all the overridable user routines.
User defined dirichlet condition for velocity.
A shear stress boundary condition, computing the stress values using a wall model.
Zero-valued Dirichlet boundary condition. Used for no-slip walls, but also for various auxillary cond...