SURFEX v8.1
General documentation of Surfex
arpege_stretch_a.F90
Go to the documentation of this file.
1 !SFX_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier
2 !SFX_LIC This is part of the SURFEX software governed by the CeCILL-C licence
3 !SFX_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
4 !SFX_LIC for details. version 1.
5 ! ##########################################################################
6 SUBROUTINE arpege_stretch_a(KN,PLAP,PLOP,PCOEF,PLAR,PLOR,PLAC,PLOC)
7 ! ##########################################################################
8 !!**** *ARPEGE_STRETCH_A* - Projection to Arpege stretched grid
9 !!
10 !! PURPOSE
11 !! -------
12 !!
13 !! Projection from standard Lat,Lon grid to Arpege stretched grid
14 !!
15 !! METHOD
16 !! ------
17 !!
18 !! The projection is defined in two steps :
19 !! 1. A rotation to place the stretching pole at the north pole
20 !! 2. The stretching
21 !! This routine is a basic implementation of the informations founded in
22 !! 'Note de travail Arpege n#3'
23 !! 'Transformation de coordonnees'
24 !! J.F.Geleyn 1988
25 !! This document describes a slightly different transformation in 3 steps. Only the
26 !! two first steps are to be taken in account (at the time of writing this paper has
27 !! not been updated).
28 !!
29 !! EXTERNAL
30 !! --------
31 !!
32 !!
33 !! IMPLICIT ARGUMENTS
34 !! ------------------
35 !!
36 !! REFERENCE
37 !! ---------
38 !!
39 !! This routine is based on :
40 !! 'Note de travail ARPEGE' number 3
41 !! by J.F. GELEYN (may 1988)
42 !!
43 !! AUTHOR
44 !! ------
45 !!
46 !! V.Bousquet
47 !!
48 !! MODIFICATIONS
49 !! -------------
50 !!
51 !! Original 07/01/1999
52 !! V. Masson 01/2004 Externalization of surface
53 !!
54 !
55 ! 0. DECLARATIONS
56 ! ---------------
57 !
58  USE modd_csts,ONLY : xpi
59 !
60 USE yomhook ,ONLY : lhook, dr_hook
61 USE parkind1 ,ONLY : jprb
62 !
63  IMPLICIT NONE
64 !
65 ! 0.1. Declaration of arguments
66 ! -----------------------------
67 
68  INTEGER, INTENT(IN) :: KN ! Number of points to convert
69  REAL, INTENT(IN) :: PLAP ! Latitude of stretching pole
70  REAL, INTENT(IN) :: PLOP ! Longitude of stretching pole
71  REAL, INTENT(IN) :: PCOEF ! Stretching coefficient
72  REAL, DIMENSION(KN), INTENT(IN) :: PLAR ! Lat. of points
73  REAL, DIMENSION(KN), INTENT(IN) :: PLOR ! Lon. of points
74  REAL, DIMENSION(KN), INTENT(OUT) :: PLAC ! Computed pseudo-lat. of points
75  REAL, DIMENSION(KN), INTENT(OUT) :: PLOC ! Computed pseudo-lon. of points
76 !
77  REAL :: ZSINSTRETCHLA ! Sine of stretching point lat.
78  REAL :: ZSINSTRETCHLO ! Sine of stretching point lon.
79  REAL :: ZCOSSTRETCHLA ! Cosine of stretching point lat.
80  REAL :: ZCOSSTRETCHLO ! Cosine of stretching point lon.
81  REAL :: ZSINLA ! Sine of computed point latitude
82  REAL :: ZSINLO ! Sine of computed point longitude
83  REAL :: ZCOSLA ! Cosine of computed point latitude
84  REAL :: ZCOSLO ! Cosine of computed point longitude
85  REAL :: ZSINLAS ! Sine of point's pseudo-latitude
86  REAL :: ZSINLOS ! Sine of point's pseudo-longitude
87  REAL :: ZCOSLOS ! Cosine of point's pseudo-lon.
88  REAL :: ZA,ZB,ZD ! Dummy variables used for
89  REAL :: ZX,ZY ! computations
90 !
91  INTEGER :: JLOOP1 ! Dummy loop counter
92  REAL(KIND=JPRB) :: ZHOOK_HANDLE
93 !
94  IF (lhook) CALL dr_hook('ARPEGE_STRETCH_A',0,zhook_handle)
95  zsinstretchla = sin(plap*xpi/180.)
96  zcosstretchla = cos(plap*xpi/180.)
97  zsinstretchlo = sin(plop*xpi/180.)
98  zcosstretchlo = cos(plop*xpi/180.)
99  ! L = longitude (0 = Greenwich, + toward east)
100  ! l = latitude (90 = N.P., -90 = S.P.)
101  ! p stands for stretching pole
102  plac(:) = plar(:) * xpi / 180.
103  ploc(:) = plor(:) * xpi / 180.
104  ! A = 1 + c.c
105  za = 1. + pcoef*pcoef
106  ! B = 1 - c.c
107  zb = 1. - pcoef*pcoef
108  DO jloop1=1, kn
109  zsinla = sin(plac(jloop1))
110  zcosla = cos(plac(jloop1))
111  zsinlo = sin(ploc(jloop1))
112  zcoslo = cos(ploc(jloop1))
113  ! X = cos(Lp-L)
114  zx = zcoslo*zcosstretchlo + zsinlo*zsinstretchlo
115  ! Y = sin(Lp-L)
116  zy = zsinstretchlo*zcoslo - zsinlo*zcosstretchlo
117  ! D = (1+c.c) + (1-c.c)(sin lp.sin l + cos lp.cos l.cos(Lp-L))
118  zd = za + zb*(zsinstretchla*zsinla+zcosstretchla*zcosla*zx)
119  ! (1-c.c)+(1+c.c)((sin lp.sin l + cos lp.cos l.cos(Lp-L))
120  ! sin lr = -------------------------------------------------------
121  ! D
122  zsinlas = (zb + za*(zsinstretchla*zsinla+zcosstretchla*zcosla*zx)) / zd
123  ! D' = D * cos lr
124  zd = zd * (amax1(1e-6,sqrt(1.-zsinlas*zsinlas)))
125  ! 2.c.(cos lp.sin l - sin lp.cos l.cos(Lp-L))
126  ! cos Lr = -------------------------------------------
127  ! D'
128  zcoslos = 2.*pcoef*(zcosstretchla*zsinla-zsinstretchla*zcosla*zx) / zd
129  ! 2.c.cos l.cos(Lp-L)
130  ! sin Lr = -------------------
131  ! D'
132  zsinlos = 2.*pcoef*(zcosla*zy) / zd
133  ! saturations (corrects calculation errors)
134  zsinlas = max(zsinlas,-1.)
135  zsinlas = min(zsinlas, 1.)
136  zcoslos = max(zcoslos,-1.)
137  zcoslos = min(zcoslos, 1.)
138  ! back from sine & cosine
139  plac(jloop1) = asin(zsinlas)
140  IF (zsinlos>0) THEN
141  ploc(jloop1) = acos(zcoslos)
142  ELSE
143  ploc(jloop1) = -acos(zcoslos)
144  ENDIF
145  ENDDO
146  ploc(:) = ploc(:) * 180. / xpi
147  plac(:) = plac(:) * 180. / xpi
148 IF (lhook) CALL dr_hook('ARPEGE_STRETCH_A',1,zhook_handle)
149 END SUBROUTINE arpege_stretch_a
150 !-------------------------------------------------------------------------------
real, save xpi
Definition: modd_csts.F90:43
integer, parameter jprb
Definition: parkind1.F90:32
logical lhook
Definition: yomhook.F90:15
subroutine arpege_stretch_a(KN, PLAP, PLOP, PCOEF, PLAR, PLOR, PLAC, PLOC)