Changeset 3862 for trunk/LMDZ.PLUTO


Ignore:
Timestamp:
Jul 23, 2025, 9:32:26 AM (12 days ago)
Author:
tbertrand
Message:

PLUTO PCM:
Newstart.F : new option (bugn2_new) to correct for warm N2 patches that form when interpolating on the grid
TB

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.PLUTO/libf/dynphy_lonlat/phypluto/newstart.F

    r3763 r3862  
    158158      integer :: iref,jref,iref1,jref1,iref2,jref2
    159159      integer :: igref,igref1,igref2,igref3
     160      integer :: edge(4) ! index of the adjecent points, N,S,E,W
     161      integer :: ignew,compt
    160162
    161163      INTEGER :: itau
     
    672674        write(*,*) 'digsp: specific to dig SP'
    673675        write(*,*) 'bugn2: correct bug of warm n2 due to HighRes'
     676        write(*,*) 'bugn2_new: correct bug of warm n2 due to HighRes'
    674677        write(*,*) 'bugch4: correct bug of warm ch4 due to HighRes'
    675678        write(*,*) 'flatnosp : topo flat except SP (topo controled)'
     
    27532756!        END DO
    27542757
     2758c       bugn2_new correct bug warm n2 due to change of resolution
     2759c       -----------------------------------------------------
     2760        else if (modif(1:len_trim(modif)) .eq. 'bugn2_new') then
     2761               
     2762          write(*,*) 'Where do you want to apply the change?'
     2763          write(*,*) 'Choice band : lat1 and lat2 ?'
     2764 564      read(*,*,iostat=ierr) val,val2
     2765          if(ierr.ne.0) goto 564
     2766          write(*,*) 'Choice band : lon1 and lon2 ?'
     2767 565      read(*,*,iostat=ierr) val3,val4
     2768          if(ierr.ne.0) goto 565
     2769          write(*,*) 'Choice of topography range ?'
     2770 566      read(*,*,iostat=ierr) val5,val6
     2771          if(ierr.ne.0) goto 566
     2772
     2773          ! let's find where we need to apply the correction
     2774          ierr=1
     2775          do while (ierr.ne.0)
     2776           ierr=0
     2777           do ig=1,ngridmx
     2778            IF (qsurf(ig,igcm_n2).gt.0.) then
     2779
     2780             IF (   (latfi(ig)*180./pi.ge.val)  .and.
     2781     &              (latfi(ig)*180./pi.le.val2)  .and.
     2782     &              (lonfi(ig)*180./pi.ge.val3)  .and.
     2783     &              (lonfi(ig)*180./pi.le.val4)  ) then
     2784
     2785              IF (   (phisfi(ig).ge.val5)  .and.
     2786     &               (phisfi(ig).le.val6)  ) then
     2787                 ! Get the index of the adjecent points, N,S,E,W
     2788                 call get_next_point(ig,edge)
     2789                 ignew=0
     2790                 DO compt=1,4
     2791                    if (qsurf(edge(compt),igcm_n2).le.1.e-6) then
     2792                       ignew=edge(compt)
     2793                    endif
     2794                 ENDDO
     2795                 if (ignew.gt.0) then  ! Applying correction
     2796                   ierr=1
     2797                   write(*,*) 'ig=',ig,' replaced with ',ignew
     2798                   qsurf(ig,igcm_n2)=0.
     2799                   tsurf(ig)=tsurf(ignew)
     2800                   DO l=1,nsoilmx
     2801                       tsoil(ig,l)=tsoil(ignew,l)
     2802                   ENDDO
     2803                 else
     2804                   write(*,*) 'No solution for ig=',ig
     2805                   write(*,*) '  edge=',edge
     2806                 endif
     2807
     2808              ENDIF
     2809             ENDIF
     2810            ENDIF
     2811           end do
     2812          end do
     2813
    27552814c       flatnosp : flat topo outside a specific terrain (SP)
    27562815c       -----------------------------------------------------
     
    41244183      end
    41254184
     4185
     4186      SUBROUTINE get_next_point(ig,edge)
     4187
     4188      IMPLICIT NONE
     4189
     4190      include "dimensions.h"
     4191c=======================================================================
     4192c  Auteur :  T. Bertrand
     4193c   Objet:
     4194c   Get next point where arr=0
     4195c=======================================================================
     4196c   Arguments:
     4197c   ----------
     4198      INTEGER ig
     4199      INTEGER :: edge(4) ! index of the adjecent points, N,S,E,W
     4200
     4201c   Local:
     4202c   ------
     4203      integer, parameter :: ngridmx = (2+(jjm-1)*iim - 1/jjm)
     4204
     4205      ! Selection of the adjacent index depending on the grid point
     4206      !! poles (now well implemented yet)
     4207      IF (ig.eq.1) then
     4208         edge = (/2, 2+int(iim/4),2+2*int(iim/4),iim+1 /)
     4209      ELSEIF (ig.eq.ngridmx) then
     4210         edge =(/ngridmx-iim,ngridmx-int(iim/4),
     4211     &                        ngridmx-2*int(iim/4),ngridmx-1 /)
     4212      !! 9 other cases:  edges East, west, or in the center , at edges north south or in the center
     4213      ELSEIF (mod(ig,iim).eq.2) then ! Edge east :  N,S,W,E
     4214          IF (ig.eq.2) then
     4215             edge = (/1, ig+iim,ig-1+iim,ig+1 /)
     4216          ELSEIF (ig.eq.ngridmx-iim) then
     4217             edge = (/ig-iim, ngridmx,ig-1+iim,ig+1 /)
     4218          ELSE
     4219             edge = (/ig-iim, ig+iim,ig-1+iim,ig+1 /)
     4220          ENDIF
     4221      ELSEIF (mod(ig,iim).eq.1) then ! Edge west
     4222          IF (ig.eq.iim+1) then
     4223             edge = (/1,ig+iim,ig-1,ig+1-iim /)
     4224          ELSEIF (ig.eq.ngridmx-1) then
     4225             edge = (/ig-iim,ngridmx,ig-1,ig+1-iim /)
     4226          ELSE
     4227             edge = (/ig-iim,ig+iim,ig-1,ig+1-iim /)
     4228          ENDIF
     4229      ELSE
     4230          IF ((ig.gt.2).and.(ig.lt.iim+1)) then
     4231             edge = (/1,ig+iim,ig-1,ig+1 /)
     4232          ELSEIF ((ig.gt.ngridmx-iim).and.(ig.lt.ngridmx-1)) then
     4233             edge = (/ig-iim,ngridmx,ig-1,ig+1 /)
     4234          ELSE
     4235             edge = (/ig-iim,ig+iim,ig-1,ig+1 /)
     4236          ENDIF
     4237      ENDIF
     4238
     4239      end subroutine get_next_point
Note: See TracChangeset for help on using the changeset viewer.