|
| 1 | +!> |
| 2 | +!!@file m_checker.f90 |
| 3 | +!!@brief Contains module m_checker |
| 4 | + |
| 5 | +#:include 'macros.fpp' |
| 6 | + |
| 7 | +!> @brief The purpose of the module is to check for compatible input files |
| 8 | +module m_checker |
| 9 | + |
| 10 | + use m_global_parameters !< Definitions of the global parameters |
| 11 | + |
| 12 | + use m_mpi_proxy !< Message passing interface (MPI) module proxy |
| 13 | + |
| 14 | + use m_helper_basic !< Functions to compare floating point numbers |
| 15 | + |
| 16 | + use m_helper |
| 17 | + |
| 18 | + implicit none |
| 19 | + |
| 20 | + private; public :: s_check_inputs |
| 21 | + |
| 22 | +contains |
| 23 | + |
| 24 | + !> Checks compatibility of parameters in the input file. |
| 25 | + !! Used by the post_process stage |
| 26 | + subroutine s_check_inputs |
| 27 | + |
| 28 | + call s_check_inputs_output_format |
| 29 | + call s_check_inputs_partial_density |
| 30 | + call s_check_inputs_velocity |
| 31 | + call s_check_inputs_flux_limiter |
| 32 | + call s_check_inputs_volume_fraction |
| 33 | + call s_check_inputs_vorticity |
| 34 | + call s_check_inputs_schlieren |
| 35 | + call s_check_inputs_surface_tension |
| 36 | + call s_check_inputs_no_flow_variables |
| 37 | + |
| 38 | + end subroutine s_check_inputs |
| 39 | + |
| 40 | + !> Checks constraints on output format parameters |
| 41 | + subroutine s_check_inputs_output_format |
| 42 | + @:PROHIBIT(format /= 1 .and. format /= 2) |
| 43 | + @:PROHIBIT(precision /= 1 .and. precision /= 2) |
| 44 | + end subroutine s_check_inputs_output_format |
| 45 | + |
| 46 | + !> Checks constraints on partial density parameters |
| 47 | + subroutine s_check_inputs_partial_density |
| 48 | + character(len=5) :: iStr |
| 49 | + integer :: i |
| 50 | + |
| 51 | + do i = 1, num_fluids |
| 52 | + call s_int_to_str(i, iStr) |
| 53 | + @:PROHIBIT(alpha_rho_wrt(i) .and. model_eqns == 1, "alpha_rho_wrt("//trim(iStr)//") is not supported for model_eqns = 1") |
| 54 | + @:PROHIBIT(alpha_rho_wrt(i) .and. i > num_fluids, "Index of alpha_rho_wrt("//trim(iStr)//") exceeds the total number of fluids") |
| 55 | + end do |
| 56 | + end subroutine s_check_inputs_partial_density |
| 57 | + |
| 58 | + !> Checks constraints on momentum parameters |
| 59 | + subroutine s_check_inputs_momentum |
| 60 | + @:PROHIBIT(n == 0 .and. mom_wrt(2)) |
| 61 | + @:PROHIBIT(p == 0 .and. mom_wrt(3)) |
| 62 | + end subroutine s_check_inputs_momentum |
| 63 | + |
| 64 | + !> Checks constraints on velocity parameters |
| 65 | + subroutine s_check_inputs_velocity |
| 66 | + @:PROHIBIT(n == 0 .and. vel_wrt(2)) |
| 67 | + @:PROHIBIT(p == 0 .and. vel_wrt(3)) |
| 68 | + end subroutine s_check_inputs_velocity |
| 69 | + |
| 70 | + !> Checks constraints on flux limiter parameters |
| 71 | + subroutine s_check_inputs_flux_limiter |
| 72 | + @:PROHIBIT(n == 0 .and. flux_wrt(2)) |
| 73 | + @:PROHIBIT(p == 0 .and. flux_wrt(3)) |
| 74 | + @:PROHIBIT(all(flux_lim /= (/dflt_int, 1, 2, 3, 4, 5, 6, 7/)), "flux_lim must be between 1 and 7") |
| 75 | + end subroutine s_check_inputs_flux_limiter |
| 76 | + |
| 77 | + !> Checks constraints on volume fraction parameters |
| 78 | + subroutine s_check_inputs_volume_fraction |
| 79 | + character(len=5) :: iStr |
| 80 | + integer :: i |
| 81 | + |
| 82 | + do i = 1, num_fluids |
| 83 | + call s_int_to_str(i, iStr) |
| 84 | + @:PROHIBIT(alpha_wrt(i) .and. model_eqns == 1, "alpha_wrt("//trim(iStr)//") is not supported for model_eqns = 1") |
| 85 | + @:PROHIBIT(alpha_wrt(i) .and. i > num_fluids, "Index of alpha_wrt("//trim(iStr)//") exceeds the total number of fluids") |
| 86 | + end do |
| 87 | + end subroutine s_check_inputs_volume_fraction |
| 88 | + |
| 89 | + !> Checks constraints on vorticity parameters |
| 90 | + subroutine s_check_inputs_vorticity |
| 91 | + @:PROHIBIT(n == 0 .and. any(omega_wrt)) |
| 92 | + @:PROHIBIT(p == 0 .and. (omega_wrt(1) .or. omega_wrt(2))) |
| 93 | + @:PROHIBIT(any(omega_wrt) .and. fd_order == dflt_int, "fd_order must be set for omega_wrt") |
| 94 | + end subroutine s_check_inputs_vorticity |
| 95 | + |
| 96 | + !> Checks constraints on numerical Schlieren parameters |
| 97 | + !! (schlieren_wrt and schlieren_alpha) |
| 98 | + subroutine s_check_inputs_schlieren |
| 99 | + character(len=5) :: iStr |
| 100 | + integer :: i |
| 101 | + |
| 102 | + @:PROHIBIT(n == 0 .and. schlieren_wrt) |
| 103 | + @:PROHIBIT(schlieren_wrt .and. fd_order == dflt_int, "fd_order must be set for schlieren_wrt") |
| 104 | + |
| 105 | + do i = 1, num_fluids |
| 106 | + call s_int_to_str(i, iStr) |
| 107 | + @:PROHIBIT(.not. f_is_default(schlieren_alpha(i)) .and. schlieren_alpha(i) <= 0d0, & |
| 108 | + "schlieren_alpha("//trim(iStr)//") must be greater than zero") |
| 109 | + @:PROHIBIT(.not. f_is_default(schlieren_alpha(i)) .and. i > num_fluids, & |
| 110 | + "Index of schlieren_alpha("//trim(iStr)//") exceeds the total number of fluids") |
| 111 | + @:PROHIBIT(.not. f_is_default(schlieren_alpha(i)) .and. (.not. schlieren_wrt), & |
| 112 | + "schlieren_alpha("//trim(iStr)//") should be set only with schlieren_wrt enabled") |
| 113 | + end do |
| 114 | + end subroutine s_check_inputs_schlieren |
| 115 | + |
| 116 | + !> Checks constraints on surface tension parameters (cf_wrt and sigma) |
| 117 | + subroutine s_check_inputs_surface_tension |
| 118 | + @:PROHIBIT(cf_wrt .and. f_is_default(sigma), & |
| 119 | + "cf_wrt can only be enabled if the surface coefficient is set") |
| 120 | + end subroutine s_check_inputs_surface_tension |
| 121 | + |
| 122 | + !> Checks constraints on the absence of flow variables |
| 123 | + subroutine s_check_inputs_no_flow_variables |
| 124 | + @:PROHIBIT(.not. any([ & |
| 125 | + (/rho_wrt, E_wrt, pres_wrt, gamma_wrt, heat_ratio_wrt, pi_inf_wrt, & |
| 126 | + pres_inf_wrt, cons_vars_wrt, prim_vars_wrt, c_wrt, schlieren_wrt/), & |
| 127 | + alpha_rho_wrt, mom_wrt, vel_wrt, flux_wrt, alpha_wrt, omega_wrt]), & |
| 128 | + "None of the flow variables have been selected for post-process. Exiting ...") |
| 129 | + end subroutine s_check_inputs_no_flow_variables |
| 130 | + |
| 131 | +end module m_checker |
0 commit comments