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_aux.f90
Go to the documentation of this file.
1
3 use logger, only : neko_log, log_size
4 use num_types, only : rp
5 use krylov, only : ksp_monitor_t
6 use, intrinsic :: ieee_arithmetic, only: ieee_is_nan
7 use utils, only : neko_error, neko_warning
8 use comm, only : pe_rank
9 implicit none
10 private
11
12 public :: fluid_step_info
13
14contains
15
18 subroutine fluid_step_info(step, t, dt, ksp_results, strict_convergence)
19 type(ksp_monitor_t), intent(in) :: ksp_results(4)
20 integer, intent(in) :: step
21 real(kind=rp), intent(in) :: t, dt
22 logical, intent(in) :: strict_convergence
23 character(len=LOG_SIZE) :: log_buf
24 integer :: i
25
26 call neko_log%message('Pressure')
27
28 write(log_buf, '(A,A,A)') 'Iterations: ',&
29 'Start residual: ', 'Final residual:'
30 call neko_log%message(log_buf)
31 write(log_buf, '(I11,3x, E15.7,5x, E15.7)') ksp_results(1)%iter, &
32 ksp_results(1)%res_start, ksp_results(1)%res_final
33 call neko_log%message(log_buf)
34
35 call neko_log%message('X-Velocity')
36 write(log_buf, '(A,A,A)') 'Iterations: ',&
37 'Start residual: ', 'Final residual:'
38 call neko_log%message(log_buf)
39 write(log_buf, '(I11,3x, E15.7,5x, E15.7)') ksp_results(2)%iter, &
40 ksp_results(2)%res_start, ksp_results(2)%res_final
41 call neko_log%message(log_buf)
42
43 call neko_log%message('Y-Velocity')
44 write(log_buf, '(A,A,A)') 'Iterations: ',&
45 'Start residual: ', 'Final residual:'
46 call neko_log%message(log_buf)
47 write(log_buf, '(I11,3x, E15.7,5x, E15.7)') ksp_results(3)%iter, &
48 ksp_results(3)%res_start, ksp_results(3)%res_final
49 call neko_log%message(log_buf)
50
51 call neko_log%message('Z-Velocity')
52 write(log_buf, '(A,A,A)') 'Iterations: ', &
53 'Start residual: ', 'Final residual:'
54 call neko_log%message(log_buf)
55 write(log_buf, '(I11,3x, E15.7,5x, E15.7)') ksp_results(4)%iter, &
56 ksp_results(4)%res_start, ksp_results(4)%res_final
57 call neko_log%message(log_buf)
58
59 ! Check for convergence
60 do i = 1, 4
61 if (ieee_is_nan(ksp_results(i)%res_final)) then
62 call neko_error("Fluid solver diverged")
63 end if
64
65 if ((.not. ksp_results(i)%converged) .and. (pe_rank .eq. 0)) then
66 log_buf = 'Fluid solver did not converge for'
67 select case(i)
68 case(1)
69 log_buf = trim(log_buf) // ' pressure'
70 case(2)
71 log_buf = trim(log_buf) // ' x-velocity'
72 case(3)
73 log_buf = trim(log_buf) // ' y-velocity'
74 case(4)
75 log_buf = trim(log_buf) // ' z-velocity'
76 end select
77
78 if (strict_convergence) then
79 call neko_error(log_buf)
80 else
81 call neko_warning(log_buf)
82 end if
83 end if
84 end do
85
86 end subroutine fluid_step_info
87
88end module fluid_aux
Definition comm.F90:1
integer pe_rank
MPI rank.
Definition comm.F90:51
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
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
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:12
Utilities.
Definition utils.f90:35
subroutine, public neko_warning(warning_msg)
Reports a warning to standard output.
Definition utils.f90:266
Type for storing initial and final residuals in a Krylov solver.
Definition krylov.f90:56