Skip to content

Commit ad56252

Browse files
committed
modularize src/oce_adv_tra_driver.F90 src/oce_adv_tra_hor.F90, remove needless module-interfaces, and update references
1 parent 7846a0d commit ad56252

3 files changed

Lines changed: 88 additions & 740 deletions

File tree

src/oce_adv_tra_driver.F90

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ module oce_adv_tra_driver_module
66
USE MOD_DYN
77
use g_comm_auto
88
use diagnostics
9-
use oce_adv_tra_hor_interfaces
10-
use oce_adv_tra_ver_interfaces
9+
use oce_adv_tra_hor_module
10+
use oce_adv_tra_ver_module
1111
use oce_adv_tra_fct_module, only: oce_tra_adv_fct
1212

1313
implicit none
@@ -28,8 +28,8 @@ subroutine do_oce_adv_tra(dt, vel, w, wi, we, tr_num, dynamics, tracers, partit,
2828
USE MOD_DYN
2929
use g_comm_auto
3030
use diagnostics, only: ldiag_DVD
31-
use oce_adv_tra_hor_interfaces
32-
use oce_adv_tra_ver_interfaces
31+
use oce_adv_tra_hor_module
32+
use oce_adv_tra_ver_module
3333
use oce_adv_tra_fct_module, only: oce_tra_adv_fct
3434
! oce_tra_adv_flux2dtracer is now in the same module
3535
implicit none

src/oce_adv_tra_hor.F90

Lines changed: 25 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,23 @@
11
!===============================================================================================================================
22
!**************** routines for horizontal tracer advection ***********************
3-
module oce_adv_tra_hor_interfaces
4-
interface
3+
module oce_adv_tra_hor_module
4+
use MOD_MESH
5+
use MOD_TRACER
6+
USE MOD_PARTIT
7+
USE MOD_PARSUP
8+
use g_comm_auto
9+
use O_PARAM, only: r_earth
10+
implicit none
11+
private
12+
public :: adv_tra_hor_upw1, adv_tra_hor_muscl, adv_tra_hor_mfct
13+
contains
514
! (low order upwind)
615
! returns flux given at edges which contributes with
716
! plus sign into 1st. node and with the minus sign into the 2nd node
817
! IF init_zero=.TRUE. : flux will be set to zero before computation
918
! IF init_zero=.FALSE. : flux=flux-input flux
1019
! flux is not multiplied with dt
11-
subroutine adv_tra_hor_upw1(vel, ttf, partit, mesh, flux, o_init_zero)
12-
use MOD_MESH
13-
use MOD_TRACER
14-
USE MOD_PARTIT
15-
USE MOD_PARSUP
16-
type(t_partit),intent(in), target :: partit
17-
type(t_mesh), intent(in), target :: mesh
18-
real(kind=WP), intent(in) :: ttf( mesh%nl-1, partit%myDim_nod2D+partit%eDim_nod2D)
19-
real(kind=WP), intent(in) :: vel(2, mesh%nl-1, partit%myDim_elem2D+partit%eDim_elem2D)
20-
real(kind=WP), intent(inout) :: flux( mesh%nl-1, partit%myDim_edge2D)
21-
logical, optional :: o_init_zero
22-
end subroutine adv_tra_hor_upw1
23-
!===============================================================================
24-
! MUSCL
25-
! returns flux given at edges which contributes with
26-
! plus sign into 1st. node and with the minus sign into the 2nd node
27-
! IF init_zero=.TRUE. : flux will be set to zero before computation
28-
! IF init_zero=.FALSE. : flux=flux-input flux
29-
! flux is not multiplied with dt
30-
subroutine adv_tra_hor_muscl(vel, ttf, partit, mesh, num_ord, flux, edge_up_dn_grad, nboundary_lay, o_init_zero)
31-
use MOD_MESH
32-
USE MOD_PARTIT
33-
USE MOD_PARSUP
34-
type(t_partit),intent(in), target :: partit
35-
type(t_mesh), intent(in), target :: mesh
36-
real(kind=WP), intent(in) :: num_ord ! num_ord is the fraction of fourth-order contribution in the solution
37-
real(kind=WP), intent(in) :: ttf( mesh%nl-1, partit%myDim_nod2D+partit%eDim_nod2D)
38-
real(kind=WP), intent(in) :: vel(2, mesh%nl-1, partit%myDim_elem2D+partit%eDim_elem2D)
39-
real(kind=WP), intent(inout) :: flux( mesh%nl-1, partit%myDim_edge2D)
40-
integer, intent(in) :: nboundary_lay(partit%myDim_nod2D+partit%eDim_nod2D)
41-
real(kind=WP), intent(in) :: edge_up_dn_grad(4, mesh%nl-1, partit%myDim_edge2D)
42-
logical, optional :: o_init_zero
43-
end subroutine adv_tra_hor_muscl
44-
! a not stable version of MUSCL (reconstruction in the vicinity of bottom topography is not upwind)
45-
! it runs with FCT option only
46-
subroutine adv_tra_hor_mfct(vel, ttf, partit, mesh, num_ord, flux, edge_up_dn_grad, o_init_zero)
47-
use MOD_MESH
48-
USE MOD_PARTIT
49-
USE MOD_PARSUP
50-
type(t_partit),intent(inout), target :: partit
51-
type(t_mesh), intent(in), target :: mesh
52-
real(kind=WP), intent(in) :: num_ord ! num_ord is the fraction of fourth-order contribution in the solution
53-
real(kind=WP), intent(in) :: ttf( mesh%nl-1, partit%myDim_nod2D+partit%eDim_nod2D)
54-
real(kind=WP), intent(in) :: vel(2, mesh%nl-1, partit%myDim_elem2D+partit%eDim_elem2D)
55-
real(kind=WP), intent(inout) :: flux( mesh%nl-1, partit%myDim_edge2D)
56-
real(kind=WP), intent(in) :: edge_up_dn_grad(4, mesh%nl-1, partit%myDim_edge2D)
57-
logical, optional :: o_init_zero
58-
end subroutine adv_tra_hor_mfct
59-
end interface
60-
end module oce_adv_tra_hor_interfaces
61-
!
62-
!
63-
!===============================================================================
64-
subroutine adv_tra_hor_upw1(vel, ttf, partit, mesh, flux, o_init_zero)
65-
use MOD_MESH
66-
use O_PARAM, only: r_earth
67-
USE MOD_PARTIT
68-
USE MOD_PARSUP
69-
use g_comm_auto
70-
implicit none
20+
subroutine adv_tra_hor_upw1(vel, ttf, partit, mesh, flux, o_init_zero)
7121
type(t_partit),intent(in), target :: partit
7222
type(t_mesh), intent(in), target :: mesh
7323
real(kind=WP), intent(in) :: ttf( mesh%nl-1, partit%myDim_nod2D+partit%eDim_nod2D)
@@ -255,17 +205,15 @@ subroutine adv_tra_hor_upw1(vel, ttf, partit, mesh, flux, o_init_zero)
255205
#else
256206
!$ACC END PARALLEL LOOP
257207
#endif
258-
end subroutine adv_tra_hor_upw1
259-
!
260-
!
208+
end subroutine adv_tra_hor_upw1
261209
!===============================================================================
262-
subroutine adv_tra_hor_muscl(vel, ttf, partit, mesh, num_ord, flux, edge_up_dn_grad, nboundary_lay, o_init_zero)
263-
use MOD_MESH
264-
use MOD_TRACER
265-
USE MOD_PARTIT
266-
USE MOD_PARSUP
267-
use g_comm_auto
268-
implicit none
210+
! MUSCL
211+
! returns flux given at edges which contributes with
212+
! plus sign into 1st. node and with the minus sign into the 2nd node
213+
! IF init_zero=.TRUE. : flux will be set to zero before computation
214+
! IF init_zero=.FALSE. : flux=flux-input flux
215+
! flux is not multiplied with dt
216+
subroutine adv_tra_hor_muscl(vel, ttf, partit, mesh, num_ord, flux, edge_up_dn_grad, nboundary_lay, o_init_zero)
269217
type(t_partit),intent(in), target :: partit
270218
type(t_mesh), intent(in), target :: mesh
271219
real(kind=WP), intent(in) :: num_ord ! num_ord is the fraction of fourth-order contribution in the solution
@@ -540,17 +488,11 @@ subroutine adv_tra_hor_muscl(vel, ttf, partit, mesh, num_ord, flux, edge_up_dn_g
540488
end do
541489
!$OMP END DO
542490
!$OMP END PARALLEL
543-
end subroutine adv_tra_hor_muscl
491+
end subroutine adv_tra_hor_muscl
544492
!
545493
!
546494
!===============================================================================
547-
subroutine adv_tra_hor_mfct(vel, ttf, partit, mesh, num_ord, flux, edge_up_dn_grad, o_init_zero)
548-
use MOD_MESH
549-
use MOD_TRACER
550-
USE MOD_PARTIT
551-
USE MOD_PARSUP
552-
use g_comm_auto
553-
implicit none
495+
subroutine adv_tra_hor_mfct(vel, ttf, partit, mesh, num_ord, flux, edge_up_dn_grad, o_init_zero)
554496
type(t_partit),intent(inout), target :: partit
555497
type(t_mesh), intent(in), target :: mesh
556498
real(kind=WP), intent(in) :: num_ord ! num_ord is the fraction of fourth-order contribution in the solution
@@ -832,4 +774,6 @@ subroutine adv_tra_hor_mfct(vel, ttf, partit, mesh, num_ord, flux, edge_up_dn_gr
832774
#else
833775
!$ACC END PARALLEL LOOP
834776
#endif
835-
end subroutine adv_tra_hor_mfct
777+
end subroutine adv_tra_hor_mfct
778+
779+
end module oce_adv_tra_hor_module

0 commit comments

Comments
 (0)