Changeset 4208 for dynamico_lmdz
- Timestamp:
- Dec 30, 2019, 3:46:20 PM (5 years ago)
- Location:
- dynamico_lmdz/simple_physics
- Files:
-
- 2 deleted
- 3 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
dynamico_lmdz/simple_physics/config/LMDZ/USEFUL
r4202 r4208 1 1 ./build_lmdz_phyparam.sh patch_lmdz 2 2 ./build_lmdz_phyparam.sh full 3 (cd TEST_PARAM/; time ./gcm.e | tee gcm.log && ./check.sh IRENE)3 (cd TEST_PARAM/; time ./gcm.e | tee gcm.log | grep '* pas ' && ./check.sh IRENE) -
dynamico_lmdz/simple_physics/phyparam/param/iniphyparam.F
r4202 r4208 15 15 USE astronomy 16 16 USE turbulence, ONLY : lmixmin, emin_turb 17 USE surface 17 18 IMPLICIT NONE 18 19 … … 52 53 53 54 #include "callkeys.h" 54 #include "surface.h"55 55 #include "iniprint.h" 56 56 -
dynamico_lmdz/simple_physics/phyparam/param/phyparam.F
r4205 r4208 18 18 USE radiative_sw, ONLY : sw 19 19 USE radiative_lw, ONLY : lw 20 20 USE surface 21 21 c 22 22 IMPLICIT NONE … … 83 83 #include "dimensions.h" 84 84 #include "callkeys.h" 85 #include "surface.h"85 c#include "surface.h" 86 86 87 87 c Arguments : -
dynamico_lmdz/simple_physics/phyparam/physics/surface.F90
r4207 r4208 1 SUBROUTINE soil(ngrid,nsoil,firstcall,ptherm_i, & 2 & ptimestep,ptsrf,ptsoil, & 3 & pcapcal,pfluxgrd) 4 IMPLICIT NONE 5 6 !======================================================================= 7 ! 8 ! Auteur: Frederic Hourdin 30/01/92 9 ! ------- 10 ! 11 ! objet: computation of : the soil temperature evolution 12 ! ------ the surfacic heat capacity "Capcal" 13 ! the surface conduction flux pcapcal 14 ! 15 ! 16 ! Method: implicit time integration 17 ! ------- 18 ! Consecutive ground temperatures are related by: 19 ! T(k+1) = C(k) + D(k)*T(k) (1) 20 ! the coefficients C and D are computed at the t-dt time-step. 21 ! Routine structure: 22 ! 1)new temperatures are computed using (1) 23 ! 2)C and D coefficients are computed from the new temperature 24 ! profile for the t+dt time-step 25 ! 3)the coefficients A and B are computed where the diffusive 26 ! fluxes at the t+dt time-step is given by 27 ! Fdiff = A + B Ts(t+dt) 28 ! or Fdiff = F0 + Capcal (Ts(t+dt)-Ts(t))/dt 29 ! with F0 = A + B (Ts(t)) 30 ! Capcal = B*dt 31 ! 32 ! Interface: 33 ! ---------- 34 ! 35 ! Arguments: 36 ! ---------- 37 ! ngird number of grid-points 38 ! ptimestep physical timestep (s) 39 ! pto(ngrid,nsoil) temperature at time-step t (K) 40 ! ptn(ngrid,nsoil) temperature at time step t+dt (K) 41 ! pcapcal(ngrid) specific heat (W*m-2*s*K-1) 42 ! pfluxgrd(ngrid) surface diffusive flux from ground (Wm-2) 43 ! 44 !======================================================================= 45 ! declarations: 46 ! ------------- 47 48 49 !----------------------------------------------------------------------- 50 ! arguments 51 ! --------- 52 53 INTEGER ngrid,nsoil 54 REAL ptimestep 55 REAL ptsrf(ngrid),ptsoil(ngrid,nsoil),ptherm_i(ngrid) 56 REAL pcapcal(ngrid),pfluxgrd(ngrid) 57 LOGICAL firstcall 58 59 60 !----------------------------------------------------------------------- 61 ! local arrays 62 ! ------------ 63 64 INTEGER ig,jk 65 REAL za(ngrid),zb(ngrid) 66 REAL zdz2(nsoil),z1(ngrid) 67 REAL min_period,dalph_soil 68 69 ! local saved variables: 70 ! ---------------------- 71 REAL,SAVE :: lambda 72 REAL,ALLOCATABLE,SAVE :: dz1(:),dz2(:),zc(:,:),zd(:,:) 73 !$OMP THREADPRIVATE(dz1,dz2,zc,zd,lambda) 74 75 !----------------------------------------------------------------------- 76 ! Depthts: 77 ! -------- 78 79 REAL fz,rk,fz1,rk1,rk2 80 fz(rk)=fz1*(dalph_soil**rk-1.)/(dalph_soil-1.) 81 82 print*,'firstcall soil ',firstcall 83 IF (firstcall) THEN 84 85 !----------------------------------------------------------------------- 86 ! ground levels 87 ! grnd=z/l where l is the skin depth of the diurnal cycle: 88 ! -------------------------------------------------------- 89 90 print*,'nsoil,ngrid,firstcall=',nsoil,ngrid,firstcall 91 ALLOCATE(dz1(nsoil),dz2(nsoil)) 92 ALLOCATE(zc(ngrid,nsoil),zd(ngrid,nsoil)) 93 94 min_period=20000. 95 dalph_soil=2. 96 97 OPEN(99,file='soil.def',status='old',form='formatted',err=9999) 98 READ(99,*) min_period 99 READ(99,*) dalph_soil 100 PRINT*,'Discretization for the soil model' 101 PRINT*,'First level e-folding depth',min_period, & 102 & ' dalph',dalph_soil 103 CLOSE(99) 104 9999 CONTINUE 105 106 ! la premiere couche represente un dixieme de cycle diurne 107 fz1=sqrt(min_period/3.14) 108 109 DO jk=1,nsoil 110 rk1=jk 111 rk2=jk-1 112 dz2(jk)=fz(rk1)-fz(rk2) 113 ENDDO 114 DO jk=1,nsoil-1 115 rk1=jk+.5 116 rk2=jk-.5 117 dz1(jk)=1./(fz(rk1)-fz(rk2)) 118 ENDDO 119 lambda=fz(.5)*dz1(1) 120 PRINT*,'full layers, intermediate layers (secoonds)' 121 DO jk=1,nsoil 122 rk=jk 123 rk1=jk+.5 124 rk2=jk-.5 125 PRINT*,fz(rk1)*fz(rk2)*3.14, & 126 & fz(rk)*fz(rk)*3.14 127 ENDDO 128 129 ! Initialisations: 130 ! ---------------- 131 132 ELSE 133 !----------------------------------------------------------------------- 134 ! Computation of the soil temperatures using the Cgrd and Dgrd 135 ! coefficient computed at the previous time-step: 136 ! ----------------------------------------------- 137 138 ! surface temperature 139 DO ig=1,ngrid 140 ptsoil(ig,1)=(lambda*zc(ig,1)+ptsrf(ig))/ & 141 & (lambda*(1.-zd(ig,1))+1.) 142 ENDDO 143 144 ! other temperatures 145 DO jk=1,nsoil-1 146 DO ig=1,ngrid 147 ptsoil(ig,jk+1)=zc(ig,jk)+zd(ig,jk)*ptsoil(ig,jk) 148 ENDDO 149 ENDDO 150 151 ENDIF 152 !----------------------------------------------------------------------- 153 ! Computation of the Cgrd and Dgrd coefficient for the next step: 154 ! --------------------------------------------------------------- 155 156 DO jk=1,nsoil 157 zdz2(jk)=dz2(jk)/ptimestep 158 ENDDO 159 160 DO ig=1,ngrid 161 z1(ig)=zdz2(nsoil)+dz1(nsoil-1) 162 zc(ig,nsoil-1)=zdz2(nsoil)*ptsoil(ig,nsoil)/z1(ig) 163 zd(ig,nsoil-1)=dz1(nsoil-1)/z1(ig) 164 ENDDO 165 166 DO jk=nsoil-1,2,-1 167 DO ig=1,ngrid 168 z1(ig)=1./(zdz2(jk)+dz1(jk-1)+dz1(jk)*(1.-zd(ig,jk))) 169 zc(ig,jk-1)= & 170 & (ptsoil(ig,jk)*zdz2(jk)+dz1(jk)*zc(ig,jk))*z1(ig) 171 zd(ig,jk-1)=dz1(jk-1)*z1(ig) 172 ENDDO 173 ENDDO 174 175 !----------------------------------------------------------------------- 176 ! computation of the surface diffusive flux from ground and 177 ! calorific capacity of the ground: 178 ! --------------------------------- 179 180 DO ig=1,ngrid 181 pfluxgrd(ig)=ptherm_i(ig)*dz1(1)* & 182 & (zc(ig,1)+(zd(ig,1)-1.)*ptsoil(ig,1)) 183 pcapcal(ig)=ptherm_i(ig)* & 184 & (dz2(1)+ptimestep*(1.-zd(ig,1))*dz1(1)) 185 z1(ig)=lambda*(1.-zd(ig,1))+1. 186 pcapcal(ig)=pcapcal(ig)/z1(ig) 187 pfluxgrd(ig)=pfluxgrd(ig) & 188 & +pcapcal(ig)*(ptsoil(ig,1)*z1(ig)-lambda*zc(ig,1)-ptsrf(ig)) & 189 & /ptimestep 190 ENDDO 191 192 RETURN 193 END 1 MODULE surface 2 IMPLICIT NONE 3 PRIVATE 4 SAVE 5 6 REAL, PARAMETER :: pi=2.*ASIN(1.) 7 8 ! common variables 9 REAL, PUBLIC :: I_mer,I_ter,Cd_mer,Cd_ter, & 10 & alb_mer,alb_ter,emi_mer,emi_ter 11 12 ! local saved variables: 13 ! ---------------------- 14 REAL :: lambda 15 REAL,ALLOCATABLE :: dz1(:),dz2(:),zc(:,:),zd(:,:) 16 !$OMP THREADPRIVATE(dz1,dz2,zc,zd,lambda) 17 18 PUBLIC :: soil 19 20 CONTAINS 21 22 SUBROUTINE init_soil(ngrid,nsoil) 23 INTEGER, INTENT(IN) :: ngrid, nsoil 24 REAL min_period,dalph_soil 25 REAL fz,rk,fz1,rk1,rk2 26 INTEGER :: jk 27 28 ! this is a function definition 29 fz(rk)=fz1*(dalph_soil**rk-1.)/(dalph_soil-1.) 30 31 !----------------------------------------------------------------------- 32 ! ground levels 33 ! grnd=z/l where l is the skin depth of the diurnal cycle: 34 ! -------------------------------------------------------- 35 36 print*,'nsoil,ngrid,firstcall=',nsoil,ngrid, .TRUE. 37 ALLOCATE(dz1(nsoil),dz2(nsoil)) 38 ALLOCATE(zc(ngrid,nsoil),zd(ngrid,nsoil)) 39 40 min_period=20000. 41 dalph_soil=2. 42 43 ! la premiere couche represente un dixieme de cycle diurne 44 fz1=sqrt(min_period/pi) 45 46 DO jk=1,nsoil 47 rk1=jk 48 rk2=jk-1 49 dz2(jk)=fz(rk1)-fz(rk2) 50 ENDDO 51 DO jk=1,nsoil-1 52 rk1=jk+.5 53 rk2=jk-.5 54 dz1(jk)=1./(fz(rk1)-fz(rk2)) 55 ENDDO 56 lambda=fz(.5)*dz1(1) 57 PRINT*,'full layers, intermediate layers (secoonds)' 58 DO jk=1,nsoil 59 rk=jk 60 rk1=jk+.5 61 rk2=jk-.5 62 PRINT*,fz(rk1)*fz(rk2)*pi, & 63 & fz(rk)*fz(rk)*pi 64 ENDDO 65 66 END SUBROUTINE init_soil 67 68 SUBROUTINE soil(ngrid,nsoil,firstcall,ptherm_i, & 69 & ptimestep,ptsrf,ptsoil, & 70 & pcapcal,pfluxgrd) 71 72 !======================================================================= 73 ! 74 ! Auteur: Frederic Hourdin 30/01/92 75 ! ------- 76 ! 77 ! objet: computation of : the soil temperature evolution 78 ! ------ the surfacic heat capacity "Capcal" 79 ! the surface conduction flux pcapcal 80 ! 81 ! 82 ! Method: implicit time integration 83 ! ------- 84 ! Consecutive ground temperatures are related by: 85 ! T(k+1) = C(k) + D(k)*T(k) (1) 86 ! the coefficients C and D are computed at the t-dt time-step. 87 ! Routine structure: 88 ! 1)new temperatures are computed using (1) 89 ! 2)C and D coefficients are computed from the new temperature 90 ! profile for the t+dt time-step 91 ! 3)the coefficients A and B are computed where the diffusive 92 ! fluxes at the t+dt time-step is given by 93 ! Fdiff = A + B Ts(t+dt) 94 ! or Fdiff = F0 + Capcal (Ts(t+dt)-Ts(t))/dt 95 ! with F0 = A + B (Ts(t)) 96 ! Capcal = B*dt 97 ! 98 ! Interface: 99 ! ---------- 100 ! 101 ! Arguments: 102 ! ---------- 103 ! ngrid number of grid-points 104 ! ptimestep physical timestep (s) 105 ! pto(ngrid,nsoil) temperature at time-step t (K) 106 ! ptn(ngrid,nsoil) temperature at time step t+dt (K) 107 ! pcapcal(ngrid) specific heat (W*m-2*s*K-1) 108 ! pfluxgrd(ngrid) surface diffusive flux from ground (Wm-2) 109 ! 110 !======================================================================= 111 ! declarations: 112 ! ------------- 113 114 115 !----------------------------------------------------------------------- 116 ! arguments 117 ! --------- 118 119 INTEGER ngrid,nsoil 120 REAL ptimestep 121 REAL ptsrf(ngrid),ptsoil(ngrid,nsoil),ptherm_i(ngrid) 122 REAL pcapcal(ngrid),pfluxgrd(ngrid) 123 LOGICAL firstcall 124 125 126 !----------------------------------------------------------------------- 127 ! local arrays 128 ! ------------ 129 130 INTEGER ig,jk 131 REAL za(ngrid),zb(ngrid) 132 REAL zdz2(nsoil),z1(ngrid) 133 134 print*,'firstcall soil ',firstcall 135 IF (firstcall) THEN 136 CALL init_soil(ngrid, nsoil) 137 ELSE 138 !----------------------------------------------------------------------- 139 ! Computation of the soil temperatures using the Cgrd and Dgrd 140 ! coefficient computed at the previous time-step: 141 ! ----------------------------------------------- 142 143 ! surface temperature 144 DO ig=1,ngrid 145 ptsoil(ig,1)=(lambda*zc(ig,1)+ptsrf(ig))/ & 146 & (lambda*(1.-zd(ig,1))+1.) 147 ENDDO 148 149 ! other temperatures 150 DO jk=1,nsoil-1 151 DO ig=1,ngrid 152 ptsoil(ig,jk+1)=zc(ig,jk)+zd(ig,jk)*ptsoil(ig,jk) 153 ENDDO 154 ENDDO 155 156 ENDIF 157 158 !----------------------------------------------------------------------- 159 ! Computation of the Cgrd and Dgrd coefficient for the next step: 160 ! --------------------------------------------------------------- 161 162 DO jk=1,nsoil 163 zdz2(jk)=dz2(jk)/ptimestep 164 ENDDO 165 166 DO ig=1,ngrid 167 z1(ig)=zdz2(nsoil)+dz1(nsoil-1) 168 zc(ig,nsoil-1)=zdz2(nsoil)*ptsoil(ig,nsoil)/z1(ig) 169 zd(ig,nsoil-1)=dz1(nsoil-1)/z1(ig) 170 ENDDO 171 172 DO jk=nsoil-1,2,-1 173 DO ig=1,ngrid 174 z1(ig)=1./(zdz2(jk)+dz1(jk-1)+dz1(jk)*(1.-zd(ig,jk))) 175 zc(ig,jk-1)= & 176 & (ptsoil(ig,jk)*zdz2(jk)+dz1(jk)*zc(ig,jk))*z1(ig) 177 zd(ig,jk-1)=dz1(jk-1)*z1(ig) 178 ENDDO 179 ENDDO 180 181 !----------------------------------------------------------------------- 182 ! computation of the surface diffusive flux from ground and 183 ! calorific capacity of the ground: 184 ! --------------------------------- 185 186 DO ig=1,ngrid 187 pfluxgrd(ig)=ptherm_i(ig)*dz1(1)* & 188 & (zc(ig,1)+(zd(ig,1)-1.)*ptsoil(ig,1)) 189 z1(ig)=lambda*(1.-zd(ig,1))+1. 190 pcapcal(ig)=ptherm_i(ig)* & 191 & ptimestep*(zdz2(1)+(1.-zd(ig,1))*dz1(1))/z1(ig) 192 pfluxgrd(ig)=pfluxgrd(ig) & 193 & +pcapcal(ig)*(ptsoil(ig,1)*z1(ig)-lambda*zc(ig,1)-ptsrf(ig)) & 194 & /ptimestep 195 ENDDO 196 197 END SUBROUTINE soil 198 199 END MODULE surface
Note: See TracChangeset
for help on using the changeset viewer.