Neko  0.9.0
A portable framework for high-order spectral element flow simulations
fluid_aux.f90
Go to the documentation of this file.
1 
2 module fluid_aux
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  implicit none
8  private
9 
10  public :: fluid_step_info
11 
12 contains
13 
16  subroutine fluid_step_info(step, t, dt, ksp_results)
17  type(ksp_monitor_t), intent(in) :: ksp_results(4)
18  integer, intent(in) :: step
19  real(kind=rp), intent(in) :: t, dt
20  character(len=LOG_SIZE) :: log_buf
21  integer :: i
22 
23 
24  call neko_log%message('Pressure')
25 
26  write(log_buf, '(A,A,A)') 'Iterations: ',&
27  'Start residual: ', 'Final residual:'
28  call neko_log%message(log_buf)
29  write(log_buf, '(I11,3x, E15.7,5x, E15.7)') ksp_results(1)%iter, &
30  ksp_results(1)%res_start, ksp_results(1)%res_final
31  call neko_log%message(log_buf)
32 
33  call neko_log%message('X-Velocity')
34  write(log_buf, '(A,A,A)') 'Iterations: ',&
35  'Start residual: ', 'Final residual:'
36  call neko_log%message(log_buf)
37  write(log_buf, '(I11,3x, E15.7,5x, E15.7)') ksp_results(2)%iter, &
38  ksp_results(2)%res_start, ksp_results(2)%res_final
39  call neko_log%message(log_buf)
40 
41  call neko_log%message('Y-Velocity')
42  write(log_buf, '(A,A,A)') 'Iterations: ',&
43  'Start residual: ', 'Final residual:'
44  call neko_log%message(log_buf)
45  write(log_buf, '(I11,3x, E15.7,5x, E15.7)') ksp_results(3)%iter, &
46  ksp_results(3)%res_start, ksp_results(3)%res_final
47  call neko_log%message(log_buf)
48 
49  call neko_log%message('Z-Velocity')
50  write(log_buf, '(A,A,A)') 'Iterations: ', &
51  'Start residual: ', 'Final residual:'
52  call neko_log%message(log_buf)
53  write(log_buf, '(I11,3x, E15.7,5x, E15.7)') ksp_results(4)%iter, &
54  ksp_results(4)%res_start, ksp_results(4)%res_final
55  call neko_log%message(log_buf)
56 
57  ! Check for divergence
58  do i = 1, 4
59  if (ieee_is_nan(ksp_results(i)%res_final)) then
60  call neko_log%error("Fluid solver diverged")
61  stop
62  end if
63  end do
64 
65  end subroutine fluid_step_info
66 
67 end module fluid_aux
Auxiliary routines for fluid solvers.
Definition: fluid_aux.f90:2
subroutine, public fluid_step_info(step, t, dt, ksp_results)
Prints for prs, velx, vely, velz the following: Number of iterations, start residual,...
Definition: fluid_aux.f90:17
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
Type for storing initial and final residuals in a Krylov solver.
Definition: krylov.f90:56