Incorporating Latitude Dependency in Analytical Air Pressure Changes in ROMS

Report or discuss software problems and other woes

Moderators: arango, robertson

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

Incorporating Latitude Dependency in Analytical Air Pressure Changes in ROMS

#1 Unread post by hyc006 »

Hello everyone,

I'm new to the ROMS community and currently attempting to implement analytical air pressure changes in space, specifically across latitudes. To achieve this, I attempted to incorporate the latitude variable into my pair functions. Here's what I've tried so far:

Code: Select all

CALL ana_pair_tile (ng, tile, model,                            &
     &                      LBi, UBi, LBj, UBj,                         &
     &                      IminS, ImaxS, JminS, JmaxS,                 &
#ifdef SPHERICAL
     &                      GRID(ng) % latr,                            &
#else
     &                      GRID(ng) % yr,                              &
#endif
     &                      FORCES(ng) % Pair)
In comparison, the original code is:

Code: Select all

CALL ana_pair_tile (ng, tile, model,                              &
     &                    LBi, UBi, LBj, UBj,                           &
     &                    IminS, ImaxS, JminS, JmaxS,                   &
     &                    FORCES(ng) % Pair)
However, upon attempting to build romsM, I encountered the following error:

Code: Select all

analytical.f90:405.38:
     &                      GRID(ng) % latr,                            &
                                      1
Error: Symbol 'grid' at (1) has no IMPLICIT type
make: *** [/home/hyc006/ROMS_OLD/runs/shallow_no_island/shallow_0416_ana/Build_romsM/analytical.o] Error 1
Could anyone provide insight into what might be wrong with my code? Any help would be greatly appreciated. The full edited ana_pair.h code I make is in the following:

Code: Select all

      SUBROUTINE ana_pair (ng, tile, model)
!
!! svn $Id: ana_pair.h 1054 2021-03-06 19:47:12Z arango $
!!======================================================================
!! Copyright (c) 2002-2021 The ROMS/TOMS Group                         !
!!   Licensed under a MIT/X style license                              !
!!   See License_ROMS.txt                                              !
!=======================================================================
!                                                                      !
!  This routine sets surface air pressure (mb) using an analytical     !
!  expression.                                                         !
!                                                                      !
!=======================================================================
!
      USE mod_param
      USE mod_forces
      USE mod_ncparam
!
! Imported variable declarations.
!
      integer, intent(in) :: ng, tile, model
!
! Local variable declarations.
!
      character (len=*), parameter :: MyFile =                          &
     &  __FILE__
!
#include "tile.h"
!
      CALL ana_pair_tile (ng, tile, model,                            &
     &                      LBi, UBi, LBj, UBj,                         &
     &                      IminS, ImaxS, JminS, JmaxS,                 &
#ifdef SPHERICAL
     &                      GRID(ng) % latr,                            &
#else
     &                      GRID(ng) % yr,                              &
#endif
     &                      FORCES(ng) % Pair)
!
!
!      CALL ana_pair_tile (ng, tile, model,                              &
!     &                    LBi, UBi, LBj, UBj,                           &
!     &                    IminS, ImaxS, JminS, JmaxS                    &
!#ifdef SPHERICAL
!     &                      GRID(ng) % latr,                            &
!#else
!     &                      GRID(ng) % yr,                              &
!#endif
!     &                    FORCES(ng) % Pair)
!
! Set analytical header file name used.
!
#ifdef DISTRIBUTE
      IF (Lanafile) THEN
#else
      IF (Lanafile.and.(tile.eq.0)) THEN
#endif

        ANANAME(17)=MyFile
      END IF
!
      RETURN
      END SUBROUTINE ana_pair
!
!***********************************************************************
      SUBROUTINE ana_pair_tile (ng, tile, model,                        &
     &                          LBi, UBi, LBj, UBj,                     &
     &                          IminS, ImaxS, JminS, JmaxS,             &
#ifdef SPHERICAL
     &                             latr,                                &
#else
     &                             yr,                                  &
#endif
     &                          Pair)                       
!***********************************************************************
!
      USE mod_param
      USE mod_scalars
!
      USE exchange_2d_mod, ONLY : exchange_r2d_tile
#ifdef DISTRIBUTE
      USE mp_exchange_mod, ONLY : mp_exchange2d
#endif
!
!  Imported variable declarations.
!
      integer, intent(in) :: ng, tile, model
      integer, intent(in) :: LBi, UBi, LBj, UBj
      integer, intent(in) :: IminS, ImaxS, JminS, JmaxS
!
#ifdef ASSUMED_SHAPE
      real(r8), intent(out) :: Pair(LBi:,LBj:)
#else
      real(r8), intent(out) :: Pair(LBi:UBi,LBj:UBj)
#endif
# ifdef SPHERICAL
      real(r8), intent(in) :: latr(LBi:,LBj:)
# else
      real(r8), intent(in) :: yr(LBi:,LBj:)
# endif

!
!  Local variable declarations.
!
      integer :: i, j
      real(r8) :: Lat_all, Lat_move, Tilt

#include "set_bounds.h"
!
!-----------------------------------------------------------------------
!  Set analytical surface air pressure (mb).
!  (1 mb = 100 Pa = 1 hPa,  1 bar = 1.0e+5 N/m2 = 1.0e+5 dynes/cm2).
!-----------------------------------------------------------------------
!
#if defined BENCHMARK
      DO j=JstrT,JendT
        DO i=IstrT,IendT
          Pair(i,j)=1025.0_r8
        END DO
      END DO
#elif defined BL_TEST
      DO j=JstrT,JendT
        DO i=IstrT,IendT
          Pair(i,j)=1013.48_r8
        END DO
      END DO
#elif defined SHALLOW || SHALLOWNI
      Lat_all = latr(IendT,JendT) - latr(1,1)
      DO j=JstrT,JendT
        DO i=IstrT,IendT
	  Lat_move = latr(i,j)-latr(1,1)
	  Tilt = (Lat_move - (Lat_all/2))*0.0066 
          Pair(i,j)=1013.25_r8 + 9.81_r8 * rho0 *Tilt
        END DO
      END DO
#else
      ana_pair.h: no values provided for Pair.
#endif
!
!  Exchange boundary data.
!
      IF (EWperiodic(ng).or.NSperiodic(ng)) THEN
        CALL exchange_r2d_tile (ng, tile,                               &
     &                          LBi, UBi, LBj, UBj,                     &
     &                          Pair)
      END IF

#ifdef DISTRIBUTE
      CALL mp_exchange2d (ng, tile, model, 1,                           &
     &                    LBi, UBi, LBj, UBj,                           &
     &                    NghostPoints,                                 &
     &                    EWperiodic(ng), NSperiodic(ng),               &
     &                    Pair)
#endif
!
      RETURN
      END SUBROUTINE ana_pair_tile

jcwarner
Posts: 1183
Joined: Wed Dec 31, 2003 6:16 pm
Location: USGS, USA

Re: Incorporating Latitude Dependency in Analytical Air Pressure Changes in ROMS

#2 Unread post by jcwarner »

1) in ana_pair, near the top you have
USE mod_param
USE mod_forces
USE mod_ncparam

you need to add mod_grid, so make it look like:
USE mod_param
USE mod_forces
USE mod_grid
USE mod_ncparam

User avatar
arango
Site Admin
Posts: 1351
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University
Contact:

Re: Incorporating Latitude Dependency in Analytical Air Pressure Changes in ROMS

#3 Unread post by arango »

Well, the compiler is telling what is wrong. To use the GRID(ng) structure, you need to include its module association in ana_pair.h:

Code: Select all

          USE mod_grid
Your application also needs to have spherical coordinates (lat, lat). Most idealized applications in ROMS use Cartesian coordinates.

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

Re: Incorporating Latitude Dependency in Analytical Air Pressure Changes in ROMS

#4 Unread post by hyc006 »

This works! Thanks a lot for your help.

Post Reply