Skip to content

Commit 570e53c

Browse files
authored
Merge pull request #24 from hyeoksu-lee/merge
Case checking moved to Python! (MFlowCode#1066)
2 parents 4b7ab1c + 262e980 commit 570e53c

File tree

9 files changed

+1712
-1073
lines changed

9 files changed

+1712
-1073
lines changed

.github/workflows/lint-toolchain.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ jobs:
1111
- uses: actions/checkout@v4
1212

1313
- name: MFC Python setup
14+
uses: actions/setup-python@v5
15+
with:
16+
python-version: '3.14'
17+
18+
- name: Initialize MFC
1419
run: ./mfc.sh init
1520

1621
- name: Lint the toolchain

src/common/m_checker_common.fpp

Lines changed: 0 additions & 362 deletions
Large diffs are not rendered by default.

src/post_process/m_checker.fpp

Lines changed: 0 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -26,150 +26,24 @@ contains
2626
impure subroutine s_check_inputs
2727

2828
call s_check_inputs_output_format
29-
call s_check_inputs_partial_domain
30-
call s_check_inputs_partial_density
31-
call s_check_inputs_velocity
32-
call s_check_inputs_flux_limiter
33-
call s_check_inputs_volume_fraction
34-
call s_check_inputs_vorticity
35-
call s_check_inputs_qm
36-
call s_check_inputs_liutex
37-
call s_check_inputs_schlieren
38-
call s_check_inputs_surface_tension
39-
call s_check_inputs_no_flow_variables
4029

4130
end subroutine s_check_inputs
4231

4332
!> Checks constraints on output format parameters
4433
impure subroutine s_check_inputs_output_format
45-
@:PROHIBIT(format /= 1 .and. format /= 2)
46-
@:PROHIBIT(precision /= 1 .and. precision /= 2)
4734
@:PROHIBIT(precision == 2 .and. wp == sp)
4835
end subroutine s_check_inputs_output_format
4936

50-
!> Checks constraints on partial domain parameters
51-
impure subroutine s_check_inputs_partial_domain
52-
@:PROHIBIT(output_partial_domain .and. format == 1)
53-
@:PROHIBIT(output_partial_domain .and. precision == 1)
54-
@:PROHIBIT(output_partial_domain .and. any([flux_wrt, heat_ratio_wrt, pres_inf_wrt, c_wrt, schlieren_wrt, qm_wrt, liutex_wrt, ib, any(omega_wrt)]))
55-
@:PROHIBIT(output_partial_domain .and. (f_is_default(x_output%beg) .or. f_is_default(x_output%end)))
56-
@:PROHIBIT(output_partial_domain .and. n /= 0 .and. (f_is_default(y_output%beg) .or. f_is_default(y_output%end)))
57-
@:PROHIBIT(output_partial_domain .and. p /= 0 .and. (f_is_default(z_output%beg) .or. f_is_default(z_output%end)))
58-
59-
#:for X in ['x', 'y', 'z']
60-
@:PROHIBIT(${X}$_output%beg > ${X}$_output%end)
61-
#:endfor
62-
end subroutine s_check_inputs_partial_domain
63-
64-
!> Checks constraints on partial density parameters
65-
impure subroutine s_check_inputs_partial_density
66-
character(len=5) :: iStr
67-
integer :: i
68-
69-
do i = 1, num_fluids
70-
call s_int_to_str(i, iStr)
71-
@:PROHIBIT(alpha_rho_wrt(i) .and. model_eqns == 1, "alpha_rho_wrt("//trim(iStr)//") is not supported for model_eqns = 1")
72-
@:PROHIBIT(alpha_rho_wrt(i) .and. i > num_fluids, "Index of alpha_rho_wrt("//trim(iStr)//") exceeds the total number of fluids")
73-
end do
74-
end subroutine s_check_inputs_partial_density
75-
76-
!> Checks constraints on momentum parameters
77-
impure subroutine s_check_inputs_momentum
78-
@:PROHIBIT(n == 0 .and. mom_wrt(2))
79-
@:PROHIBIT(p == 0 .and. mom_wrt(3))
80-
end subroutine s_check_inputs_momentum
81-
82-
!> Checks constraints on velocity parameters
83-
impure subroutine s_check_inputs_velocity
84-
@:PROHIBIT(n == 0 .and. vel_wrt(2))
85-
@:PROHIBIT(p == 0 .and. vel_wrt(3))
86-
end subroutine s_check_inputs_velocity
87-
88-
!> Checks constraints on flux limiter parameters
89-
impure subroutine s_check_inputs_flux_limiter
90-
@:PROHIBIT(n == 0 .and. flux_wrt(2))
91-
@:PROHIBIT(p == 0 .and. flux_wrt(3))
92-
@:PROHIBIT(all(flux_lim /= (/dflt_int, 1, 2, 3, 4, 5, 6, 7/)), "flux_lim must be between 1 and 7")
93-
end subroutine s_check_inputs_flux_limiter
94-
95-
!> Checks constraints on volume fraction parameters
96-
impure subroutine s_check_inputs_volume_fraction
97-
character(len=5) :: iStr
98-
integer :: i
99-
100-
do i = 1, num_fluids
101-
call s_int_to_str(i, iStr)
102-
@:PROHIBIT(alpha_wrt(i) .and. model_eqns == 1, "alpha_wrt("//trim(iStr)//") is not supported for model_eqns = 1")
103-
@:PROHIBIT(alpha_wrt(i) .and. i > num_fluids, "Index of alpha_wrt("//trim(iStr)//") exceeds the total number of fluids")
104-
end do
105-
end subroutine s_check_inputs_volume_fraction
106-
107-
!> Checks constraints on vorticity parameters
108-
impure subroutine s_check_inputs_vorticity
109-
@:PROHIBIT(n == 0 .and. any(omega_wrt))
110-
@:PROHIBIT(p == 0 .and. (omega_wrt(1) .or. omega_wrt(2)))
111-
@:PROHIBIT(any(omega_wrt) .and. fd_order == dflt_int, "fd_order must be set for omega_wrt")
112-
end subroutine s_check_inputs_vorticity
113-
11437
!> Checks constraints on fft_wrt
11538
impure subroutine s_check_inputs_fft
11639
integer :: num_procs_y, num_procs_z
11740

118-
@:PROHIBIT(fft_wrt .and. (n == 0 .or. p == 0), "FFT WRT only in 3D")
119-
@:PROHIBIT(fft_wrt .and. cyl_coord, "FFT WRT incompatible with cylindrical coordinates")
120-
@:PROHIBIT(fft_wrt .and. (MOD(m_glb+1,2) == 1 .or. MOD(n_glb+1,2) == 1 .or. MOD(p_glb+1,2) == 1), "FFT WRT requires global dimensions divisible by 2")
12141
@:PROHIBIT(fft_wrt .and. MOD(n_glb+1,n+1) /= 0, "FFT WRT requires n_glb to be divisible by num_procs_y")
12242
@:PROHIBIT(fft_wrt .and. MOD(p_glb+1,p+1) /= 0, "FFT WRT requires p_glb to be divisible by num_procs_z")
12343
num_procs_y = (n_glb + 1)/(n + 1)
12444
num_procs_z = (p_glb + 1)/(p + 1)
12545
@:PROHIBIT(fft_wrt .and. MOD(m_glb+1,num_procs_y) /= 0, "FFT WRT requires m_glb to be divisible by num_procs_y")
12646
@:PROHIBIT(fft_wrt .and. MOD(n_glb+1,num_procs_z) /= 0, "FFT WRT requires n_glb to be divisible by num_procs_z")
127-
@:PROHIBIT(fft_wrt .and. (bc_x%beg < -1 .or. bc_y%beg < -1 .or. bc_z%beg < -1 .or. bc_x%end < -1 .or. bc_y%end < -1 .or. bc_z%end < -1), "FFT WRT requires periodic BCs")
12847
end subroutine s_check_inputs_fft
12948

130-
!> Checks constraints on Q-criterion parameters
131-
impure subroutine s_check_inputs_qm
132-
@:PROHIBIT(n == 0 .and. qm_wrt)
133-
end subroutine s_check_inputs_qm
134-
135-
!> Checks constraints on liutex parameters
136-
impure subroutine s_check_inputs_liutex
137-
@:PROHIBIT(n == 0 .and. liutex_wrt)
138-
end subroutine s_check_inputs_liutex
139-
140-
!> Checks constraints on numerical Schlieren parameters
141-
!! (schlieren_wrt and schlieren_alpha)
142-
impure subroutine s_check_inputs_schlieren
143-
character(len=5) :: iStr
144-
integer :: i
145-
146-
@:PROHIBIT(n == 0 .and. schlieren_wrt)
147-
@:PROHIBIT(schlieren_wrt .and. fd_order == dflt_int, "fd_order must be set for schlieren_wrt")
148-
149-
do i = 1, num_fluids
150-
call s_int_to_str(i, iStr)
151-
@:PROHIBIT(.not. f_is_default(schlieren_alpha(i)) .and. schlieren_alpha(i) <= 0._wp, &
152-
"schlieren_alpha("//trim(iStr)//") must be greater than zero")
153-
@:PROHIBIT(.not. f_is_default(schlieren_alpha(i)) .and. i > num_fluids, &
154-
"Index of schlieren_alpha("//trim(iStr)//") exceeds the total number of fluids")
155-
@:PROHIBIT(.not. f_is_default(schlieren_alpha(i)) .and. (.not. schlieren_wrt), &
156-
"schlieren_alpha("//trim(iStr)//") should be set only with schlieren_wrt enabled")
157-
end do
158-
end subroutine s_check_inputs_schlieren
159-
160-
!> Checks constraints on surface tension parameters (cf_wrt and sigma)
161-
impure subroutine s_check_inputs_surface_tension
162-
@:PROHIBIT(cf_wrt .and. .not. surface_tension, &
163-
"cf_wrt can only be enabled if the surface coefficient is set")
164-
end subroutine s_check_inputs_surface_tension
165-
166-
!> Checks constraints on the absence of flow variables
167-
impure subroutine s_check_inputs_no_flow_variables
168-
@:PROHIBIT(.not. any([ &
169-
(/rho_wrt, E_wrt, pres_wrt, gamma_wrt, heat_ratio_wrt, pi_inf_wrt, &
170-
pres_inf_wrt, cons_vars_wrt, prim_vars_wrt, c_wrt, schlieren_wrt/), &
171-
alpha_rho_wrt, mom_wrt, vel_wrt, flux_wrt, alpha_wrt, omega_wrt]), &
172-
"None of the flow variables have been selected for post-process. Exiting.")
173-
end subroutine s_check_inputs_no_flow_variables
174-
17549
end module m_checker

0 commit comments

Comments
 (0)