@@ -2413,19 +2413,12 @@ subroutine PPM_reconstruction_x(h_in, h_W, h_E, G, LB, h_min, monotonic, simple_
2413
2413
if (segment% direction == OBC_DIRECTION_E) then
2414
2414
I= segment% HI% IsdB
2415
2415
if (associated (segment% h_Reg)) then
2416
- if (allocated (segment% h_Reg% h_res)) then
2417
- do j= segment% HI% jsd,segment% HI% jed
2418
- h_W(i+1 ,j) = segment% h_Reg% h_res(i,j,k)
2419
- h_E(i+1 ,j) = segment% h_Reg% h_res(i,j,k)
2420
- h_W(i,j) = segment% h_Reg% h_res(i,j,k)
2421
- h_E(i,j) = segment% h_Reg% h_res(i,j,k)
2422
- enddo
2423
- else
2424
- write (mesg,' ("In MOM_continuity_PPM, PPM_reconstruction_y called with ", &
2425
- & "badly configured h_res.")' ) &
2426
- stencil + max (G% jsd- jsl,jel- G% jed)
2427
- call MOM_error(FATAL,mesg)
2428
- endif
2416
+ do j= segment% HI% jsd,segment% HI% jed
2417
+ h_W(i+1 ,j) = segment% h_Reg% h_res(i,j,k)
2418
+ h_E(i+1 ,j) = segment% h_Reg% h_res(i,j,k)
2419
+ h_W(i,j) = segment% h_Reg% h_res(i,j,k)
2420
+ h_E(i,j) = segment% h_Reg% h_res(i,j,k)
2421
+ enddo
2429
2422
else
2430
2423
do j= segment% HI% jsd,segment% HI% jed
2431
2424
h_W(i+1 ,j) = h_in(i,j)
@@ -2437,19 +2430,12 @@ subroutine PPM_reconstruction_x(h_in, h_W, h_E, G, LB, h_min, monotonic, simple_
2437
2430
elseif (segment% direction == OBC_DIRECTION_W) then
2438
2431
I= segment% HI% IsdB
2439
2432
if (associated (segment% h_Reg)) then
2440
- if (allocated (segment% h_Reg% h_res)) then
2441
- do j= segment% HI% jsd,segment% HI% jed
2442
- h_W(i,j) = segment% h_Reg% h_res(i,j,k)
2443
- h_E(i,j) = segment% h_Reg% h_res(i,j,k)
2444
- h_W(i+1 ,j) = segment% h_Reg% h_res(i,j,k)
2445
- h_E(i+1 ,j) = segment% h_Reg% h_res(i,j,k)
2446
- enddo
2447
- else
2448
- write (mesg,' ("In MOM_continuity_PPM, PPM_reconstruction_y called with ", &
2449
- & "badly configured h_res.")' ) &
2450
- stencil + max (G% jsd- jsl,jel- G% jed)
2451
- call MOM_error(FATAL,mesg)
2452
- endif
2433
+ do j= segment% HI% jsd,segment% HI% jed
2434
+ h_W(i,j) = segment% h_Reg% h_res(i,j,k)
2435
+ h_E(i,j) = segment% h_Reg% h_res(i,j,k)
2436
+ h_W(i+1 ,j) = segment% h_Reg% h_res(i,j,k)
2437
+ h_E(i+1 ,j) = segment% h_Reg% h_res(i,j,k)
2438
+ enddo
2453
2439
else
2454
2440
do j= segment% HI% jsd,segment% HI% jed
2455
2441
h_W(i,j) = h_in(i+1 ,j)
@@ -2579,19 +2565,12 @@ subroutine PPM_reconstruction_y(h_in, h_S, h_N, G, LB, h_min, monotonic, simple_
2579
2565
if (segment% direction == OBC_DIRECTION_N) then
2580
2566
J= segment% HI% JsdB
2581
2567
if (associated (segment% h_Reg)) then
2582
- if (allocated (segment% h_Reg% h_res)) then
2583
- do i= segment% HI% isd,segment% HI% ied
2584
- h_S(i,j+1 ) = segment% h_Reg% h_res(i,j,k)
2585
- h_N(i,j+1 ) = segment% h_Reg% h_res(i,j,k)
2586
- h_S(i,j) = segment% h_Reg% h_res(i,j,k)
2587
- h_N(i,j) = segment% h_Reg% h_res(i,j,k)
2588
- enddo
2589
- else
2590
- write (mesg,' ("In MOM_continuity_PPM, PPM_reconstruction_y called with ", &
2591
- & "badly configured h_res.")' ) &
2592
- stencil + max (G% jsd- jsl,jel- G% jed)
2593
- call MOM_error(FATAL,mesg)
2594
- endif
2568
+ do i= segment% HI% isd,segment% HI% ied
2569
+ h_S(i,j+1 ) = segment% h_Reg% h_res(i,j,k)
2570
+ h_N(i,j+1 ) = segment% h_Reg% h_res(i,j,k)
2571
+ h_S(i,j) = segment% h_Reg% h_res(i,j,k)
2572
+ h_N(i,j) = segment% h_Reg% h_res(i,j,k)
2573
+ enddo
2595
2574
else
2596
2575
do i= segment% HI% isd,segment% HI% ied
2597
2576
h_S(i,j+1 ) = h_in(i,j)
@@ -2603,19 +2582,12 @@ subroutine PPM_reconstruction_y(h_in, h_S, h_N, G, LB, h_min, monotonic, simple_
2603
2582
elseif (segment% direction == OBC_DIRECTION_S) then
2604
2583
J= segment% HI% JsdB
2605
2584
if (associated (segment% h_Reg)) then
2606
- if (allocated (segment% h_Reg% h_res)) then
2607
- do i= segment% HI% isd,segment% HI% ied
2608
- h_S(i,j) = segment% h_Reg% h_res(i,j,k)
2609
- h_N(i,j) = segment% h_Reg% h_res(i,j,k)
2610
- h_S(i,j+1 ) = segment% h_Reg% h_res(i,j,k)
2611
- h_N(i,j+1 ) = segment% h_Reg% h_res(i,j,k)
2612
- enddo
2613
- else
2614
- write (mesg,' ("In MOM_continuity_PPM, PPM_reconstruction_y called with ", &
2615
- & "badly configured h_res.")' ) &
2616
- stencil + max (G% jsd- jsl,jel- G% jed)
2617
- call MOM_error(FATAL,mesg)
2618
- endif
2585
+ do i= segment% HI% isd,segment% HI% ied
2586
+ h_S(i,j) = segment% h_Reg% h_res(i,j,k)
2587
+ h_N(i,j) = segment% h_Reg% h_res(i,j,k)
2588
+ h_S(i,j+1 ) = segment% h_Reg% h_res(i,j,k)
2589
+ h_N(i,j+1 ) = segment% h_Reg% h_res(i,j,k)
2590
+ enddo
2619
2591
else
2620
2592
do i= segment% HI% isd,segment% HI% ied
2621
2593
h_S(i,j) = h_in(i,j+1 )
@@ -2737,23 +2709,33 @@ function ratio_max(a, b, maxrat) result(ratio)
2737
2709
end function ratio_max
2738
2710
2739
2711
! > Initializes continuity_ppm_cs
2740
- subroutine continuity_PPM_init (Time , G , GV , US , param_file , diag , CS )
2712
+ subroutine continuity_PPM_init (Time , G , GV , US , param_file , diag , CS , OBC )
2741
2713
type (time_type), target , intent (in ) :: Time ! < The current model time.
2742
2714
type (ocean_grid_type), intent (in ) :: G ! < The ocean's grid structure.
2743
2715
type (verticalGrid_type), intent (in ) :: GV ! < Vertical grid structure.
2744
- type (unit_scale_type), intent (in ) :: US ! < A dimensional unit scaling type
2716
+ type (unit_scale_type), intent (in ) :: US ! < A dimensional unit scaling type
2745
2717
type (param_file_type), intent (in ) :: param_file ! < A structure indicating
2746
2718
! ! the open file to parse for model parameter values.
2747
2719
type (diag_ctrl), target , intent (inout ) :: diag ! < A structure that is used to
2748
2720
! ! regulate diagnostic output.
2749
2721
type (continuity_PPM_CS), intent (inout ) :: CS ! < Module's control structure.
2722
+ type (ocean_OBC_type), pointer :: OBC ! < Open boundaries control structure.
2723
+ logical :: local_open_BC
2724
+ type (OBC_segment_type), pointer :: segment = > NULL ()
2725
+ integer :: n
2750
2726
2751
2727
! > This include declares and sets the variable "version".
2752
2728
# include " version_variable.h"
2753
2729
character (len= 40 ) :: mdl = " MOM_continuity_PPM" ! This module's name.
2730
+ character (len= 256 ) :: mesg
2754
2731
2755
2732
CS% initialized = .true.
2756
2733
2734
+ local_open_BC = .false.
2735
+ if (associated (OBC)) then
2736
+ local_open_BC = OBC% open_u_BCs_exist_globally
2737
+ endif
2738
+
2757
2739
! Read all relevant parameters and write them to the model log.
2758
2740
call log_version(param_file, mdl, version, " " )
2759
2741
call get_param(param_file, mdl, " MONOTONIC_CONTINUITY" , CS% monotonic, &
@@ -2817,6 +2799,19 @@ subroutine continuity_PPM_init(Time, G, GV, US, param_file, diag, CS)
2817
2799
id_clock_update = cpu_clock_id(' (Ocean continuity update)' , grain= CLOCK_ROUTINE)
2818
2800
id_clock_correct = cpu_clock_id(' (Ocean continuity correction)' , grain= CLOCK_ROUTINE)
2819
2801
2802
+ if (local_open_BC) then
2803
+ do n= 1 , OBC% number_of_segments
2804
+ segment = > OBC% segment(n)
2805
+ if (associated (segment% h_Reg)) then
2806
+ if (.not. allocated (segment% h_Reg% h_res)) then
2807
+ write (mesg,' ("In MOM_continuity_PPM, continuity_PPM_init called with ", &
2808
+ & "badly configured h_res.")' )
2809
+ call MOM_error(FATAL, mesg)
2810
+ endif
2811
+ endif
2812
+ enddo
2813
+ endif
2814
+
2820
2815
end subroutine continuity_PPM_init
2821
2816
2822
2817
! > continuity_PPM_stencil returns the continuity solver stencil size
0 commit comments