Help with Idealized Forcing via ana_pair – Pressure Gradient Appears Periodic in Parallel Run

General scientific issues regarding ROMS

Moderators: arango, robertson

Post Reply
Message
Author
hyc006
Posts: 37
Joined: Thu Nov 30, 2023 2:12 am
Location: UCSD

Help with Idealized Forcing via ana_pair – Pressure Gradient Appears Periodic in Parallel Run

#1 Unread post by hyc006 »

Hi everyone,

I'm working on an idealized ROMS setup where I drive the flow using a pressure gradient imposed by air pressure. To implement this, I modified ana_pair.h to set a latitudinally varying air pressure, disabling periodic exchange to ensure the gradient is preserved across the entire domain. Here's the relevant portion of my ana_pair.h:

Code: Select all

#elif defined SHALLOW
  Cor_freq = -1.182E-05_r8
  Tilt_pressure = -0.8_r8 * Cor_freq * rho0 * 111.2_r8 * 1000_r8
  Mid_lat = -4.6741
  Mid_pressure = 1013.25_r8

  DO j=JstrR-2, JendR+2
    DO i=IstrR-2, IendR+2
      Lat_move = latr(i,j) - Mid_lat
      Pair(i,j) = Mid_pressure + 0.01_r8 * Tilt_pressure * Lat_move
    END DO
  END DO
To avoid applying periodicity, I commented out the exchange routine:

Code: Select all

!  Exchange boundary data.
!
!      IF (EWperiodic(ng).or.NSperiodic(ng)) THEN
!        CALL exchange_r2d_tile (ng, tile,                               &
!     &                          LBi, UBi, LBj, UBj,                     &
!     &                          Pair)
!      END IF
This setup works perfectly on my old server and also when running the model serially on my new server. However, when I run the model in parallel on the new server, the air pressure field still appears to behave as if it's periodic—despite the exchange call being commented out.

Some differences between the servers:

Old server: OpenMPI + gfortran
New server: MPICH + ifort
So, I’m wondering:

Is there something wrong or incomplete in my code that might be causing this?
Is it possible the parallel communication is still doing something I’m not catching?
Is there a more robust or recommended way to implement a latitudinal pressure gradient that is non-periodic?
I’ve attached my full ana_pair.h file below in case it’s helpful.
ana_pair.h
(4.89 KiB) Downloaded 10 times
Thanks in advance for any help or suggestions!

Best,
Hsin-Yi Chen

hyc006
Posts: 37
Joined: Thu Nov 30, 2023 2:12 am
Location: UCSD

Re: Help with Idealized Forcing via ana_pair – Pressure Gradient Appears Periodic in Parallel Run

#2 Unread post by hyc006 »

Hi everyone,

This is Hsin-Yi again. Just wanted to follow up on my earlier post about trying to impose a latitudinal pressure gradient in `ana_pair.h` without applying periodic boundaries. I'm still struggling with the issue where, when I run the model in parallel on a new server, the air pressure field seems to behave as if it's periodic—even though I’ve commented out the periodic exchange in `ana_pair`.

Here’s what I’ve tried since then:

1. Switched compilers: I tried switching from `ifort` to `gfortran` on the new server, but unfortunately, the problem still persists.

2. Modified `ana_pair.h` and `exchange_2d.F`:
- I created a new subroutine `exchange_pair_tile` based on `exchange_r2d_tile`, but explicitly forced all periodic flags to be off, like this:

Code: Select all

     IF (EWperiodic(ng)) THEN
  #ifdef DISTRIBUTE
       EW_exchange = .FALSE.
  #else
       EW_exchange = .FALSE.
  #endif
     ELSE
       EW_exchange = .FALSE.
     END IF

     IF (NSperiodic(ng)) THEN
  #ifdef DISTRIBUTE
       NS_exchange = .FALSE.
  #else
       NS_exchange = .FALSE.
  #endif
     ELSE
       NS_exchange = .FALSE.
     END IF

- In `ana_pair.h`, I then called this new subroutine instead of the default `exchange_r2d_tile`.
- I also updated the distributed communication part at the end of `ana_pair.h`:

Code: Select all

  #ifdef DISTRIBUTE
       CALL mp_exchange2d (ng, tile, model, 1,                          &
      &                    LBi, UBi, LBj, UBj,                          &
      &                    NghostPoints,                               &
      &                    .FALSE., .FALSE.,                            &
      &                    Pair)
  #endif

Despite these efforts, the problem remains when I run in parallel: the air pressure field still looks like it's being treated as periodic. It's as if the model is not picking up my modified subroutine or somehow falling back to a default behavior.

Does anyone know what might be going wrong? Is there something else I need to do to ensure the model uses my custom `exchange_pair_tile` routine?

I’ve attached the modified `ana_pair.h` and `exchange_2d.F` files to this post. Any guidance would be much appreciated!
ana_pair.h
(5.15 KiB) Downloaded 5 times
exchange_2d.F
(29.85 KiB) Downloaded 6 times
Thanks again,
Hsin-Yi Chen

Post Reply