Changeset 2117 for LMDZ5/trunk/libf
- Timestamp:
- Sep 11, 2014, 8:47:39 PM (10 years ago)
- Location:
- LMDZ5/trunk/libf/phylmd
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ5/trunk/libf/phylmd/1DUTILS.h
r2096 r2117 2909 2909 return 2910 2910 end 2911 !=====================================================================2912 subroutine read_amma(fich_amma,nlevel,ntime &2913 & ,zz,pp,temp,qv,u,v,dw &2914 & ,dt,dq,sens,flat)2915 2916 !program reading forcings of the AMMA case study2917 2918 2919 implicit none2920 2921 #include "netcdf.inc"2922 2923 integer ntime,nlevel2924 character*80 :: fich_amma2925 real*8 zz(nlevel)2926 2927 real*8 temp(nlevel),pp(nlevel)2928 real*8 qv(nlevel),u(nlevel)2929 real*8 v(nlevel)2930 real*8 dw(nlevel,ntime)2931 real*8 dt(nlevel,ntime)2932 real*8 dq(nlevel,ntime)2933 real*8 flat(ntime),sens(ntime)2934 2935 integer nid, ierr2936 integer nbvar3d2937 parameter(nbvar3d=30)2938 integer var3didin(nbvar3d)2939 2940 ierr = NF_OPEN(fich_amma,NF_NOWRITE,nid)2941 if (ierr.NE.NF_NOERR) then2942 write(*,*) 'ERROR: Pb opening forcings nc file '2943 write(*,*) NF_STRERROR(ierr)2944 stop ""2945 endif2946 2947 2948 ierr=NF_INQ_VARID(nid,"zz",var3didin(1))2949 if(ierr/=NF_NOERR) then2950 write(*,*) NF_STRERROR(ierr)2951 stop 'lev'2952 endif2953 2954 2955 ierr=NF_INQ_VARID(nid,"temp",var3didin(2))2956 if(ierr/=NF_NOERR) then2957 write(*,*) NF_STRERROR(ierr)2958 stop 'temp'2959 endif2960 2961 ierr=NF_INQ_VARID(nid,"qv",var3didin(3))2962 if(ierr/=NF_NOERR) then2963 write(*,*) NF_STRERROR(ierr)2964 stop 'qv'2965 endif2966 2967 ierr=NF_INQ_VARID(nid,"u",var3didin(4))2968 if(ierr/=NF_NOERR) then2969 write(*,*) NF_STRERROR(ierr)2970 stop 'u'2971 endif2972 2973 ierr=NF_INQ_VARID(nid,"v",var3didin(5))2974 if(ierr/=NF_NOERR) then2975 write(*,*) NF_STRERROR(ierr)2976 stop 'v'2977 endif2978 2979 ierr=NF_INQ_VARID(nid,"dw",var3didin(6))2980 if(ierr/=NF_NOERR) then2981 write(*,*) NF_STRERROR(ierr)2982 stop 'dw'2983 endif2984 2985 ierr=NF_INQ_VARID(nid,"dt",var3didin(7))2986 if(ierr/=NF_NOERR) then2987 write(*,*) NF_STRERROR(ierr)2988 stop 'dt'2989 endif2990 2991 ierr=NF_INQ_VARID(nid,"dq",var3didin(8))2992 if(ierr/=NF_NOERR) then2993 write(*,*) NF_STRERROR(ierr)2994 stop 'dq'2995 endif2996 2997 ierr=NF_INQ_VARID(nid,"sens",var3didin(9))2998 if(ierr/=NF_NOERR) then2999 write(*,*) NF_STRERROR(ierr)3000 stop 'sens'3001 endif3002 3003 ierr=NF_INQ_VARID(nid,"flat",var3didin(10))3004 if(ierr/=NF_NOERR) then3005 write(*,*) NF_STRERROR(ierr)3006 stop 'flat'3007 endif3008 3009 ierr=NF_INQ_VARID(nid,"pp",var3didin(11))3010 if(ierr/=NF_NOERR) then3011 write(*,*) NF_STRERROR(ierr)3012 stop 'pp'3013 endif3014 3015 !dimensions lecture3016 ! call catchaxis(nid,ntime,nlevel,time,z,ierr)3017 3018 #ifdef NC_DOUBLE3019 ierr = NF_GET_VAR_DOUBLE(nid,var3didin(1),zz)3020 #else3021 ierr = NF_GET_VAR_REAL(nid,var3didin(1),zz)3022 #endif3023 if(ierr/=NF_NOERR) then3024 write(*,*) NF_STRERROR(ierr)3025 stop "getvarup"3026 endif3027 ! write(*,*)'lecture z ok',zz3028 3029 #ifdef NC_DOUBLE3030 ierr = NF_GET_VAR_DOUBLE(nid,var3didin(2),temp)3031 #else3032 ierr = NF_GET_VAR_REAL(nid,var3didin(2),temp)3033 #endif3034 if(ierr/=NF_NOERR) then3035 write(*,*) NF_STRERROR(ierr)3036 stop "getvarup"3037 endif3038 ! write(*,*)'lecture th ok',temp3039 3040 #ifdef NC_DOUBLE3041 ierr = NF_GET_VAR_DOUBLE(nid,var3didin(3),qv)3042 #else3043 ierr = NF_GET_VAR_REAL(nid,var3didin(3),qv)3044 #endif3045 if(ierr/=NF_NOERR) then3046 write(*,*) NF_STRERROR(ierr)3047 stop "getvarup"3048 endif3049 ! write(*,*)'lecture qv ok',qv3050 3051 #ifdef NC_DOUBLE3052 ierr = NF_GET_VAR_DOUBLE(nid,var3didin(4),u)3053 #else3054 ierr = NF_GET_VAR_REAL(nid,var3didin(4),u)3055 #endif3056 if(ierr/=NF_NOERR) then3057 write(*,*) NF_STRERROR(ierr)3058 stop "getvarup"3059 endif3060 ! write(*,*)'lecture u ok',u3061 3062 #ifdef NC_DOUBLE3063 ierr = NF_GET_VAR_DOUBLE(nid,var3didin(5),v)3064 #else3065 ierr = NF_GET_VAR_REAL(nid,var3didin(5),v)3066 #endif3067 if(ierr/=NF_NOERR) then3068 write(*,*) NF_STRERROR(ierr)3069 stop "getvarup"3070 endif3071 ! write(*,*)'lecture v ok',v3072 3073 #ifdef NC_DOUBLE3074 ierr = NF_GET_VAR_DOUBLE(nid,var3didin(6),dw)3075 #else3076 ierr = NF_GET_VAR_REAL(nid,var3didin(6),dw)3077 #endif3078 if(ierr/=NF_NOERR) then3079 write(*,*) NF_STRERROR(ierr)3080 stop "getvarup"3081 endif3082 ! write(*,*)'lecture w ok',dw3083 3084 #ifdef NC_DOUBLE3085 ierr = NF_GET_VAR_DOUBLE(nid,var3didin(7),dt)3086 #else3087 ierr = NF_GET_VAR_REAL(nid,var3didin(7),dt)3088 #endif3089 if(ierr/=NF_NOERR) then3090 write(*,*) NF_STRERROR(ierr)3091 stop "getvarup"3092 endif3093 ! write(*,*)'lecture dt ok',dt3094 3095 #ifdef NC_DOUBLE3096 ierr = NF_GET_VAR_DOUBLE(nid,var3didin(8),dq)3097 #else3098 ierr = NF_GET_VAR_REAL(nid,var3didin(8),dq)3099 #endif3100 if(ierr/=NF_NOERR) then3101 write(*,*) NF_STRERROR(ierr)3102 stop "getvarup"3103 endif3104 ! write(*,*)'lecture dq ok',dq3105 3106 #ifdef NC_DOUBLE3107 ierr = NF_GET_VAR_DOUBLE(nid,var3didin(9),sens)3108 #else3109 ierr = NF_GET_VAR_REAL(nid,var3didin(9),sens)3110 #endif3111 if(ierr/=NF_NOERR) then3112 write(*,*) NF_STRERROR(ierr)3113 stop "getvarup"3114 endif3115 ! write(*,*)'lecture sens ok',sens3116 3117 #ifdef NC_DOUBLE3118 ierr = NF_GET_VAR_DOUBLE(nid,var3didin(10),flat)3119 #else3120 ierr = NF_GET_VAR_REAL(nid,var3didin(10),flat)3121 #endif3122 if(ierr/=NF_NOERR) then3123 write(*,*) NF_STRERROR(ierr)3124 stop "getvarup"3125 endif3126 ! write(*,*)'lecture flat ok',flat3127 3128 #ifdef NC_DOUBLE3129 ierr = NF_GET_VAR_DOUBLE(nid,var3didin(11),pp)3130 #else3131 ierr = NF_GET_VAR_REAL(nid,var3didin(11),pp)3132 #endif3133 if(ierr/=NF_NOERR) then3134 write(*,*) NF_STRERROR(ierr)3135 stop "getvarup"3136 endif3137 ! write(*,*)'lecture pp ok',pp3138 3139 return3140 end subroutine read_amma3141 !======================================================================3142 SUBROUTINE interp_amma_time(day,day1,annee_ref &3143 & ,year_ini_amma,day_ini_amma,nt_amma,dt_amma,nlev_amma &3144 & ,vitw_amma,ht_amma,hq_amma,lat_amma,sens_amma &3145 & ,vitw_prof,ht_prof,hq_prof,lat_prof,sens_prof)3146 implicit none3147 3148 !---------------------------------------------------------------------------------------3149 ! Time interpolation of a 2D field to the timestep corresponding to day3150 !3151 ! day: current julian day (e.g. 717538.2)3152 ! day1: first day of the simulation3153 ! nt_amma: total nb of data in the forcing (e.g. 48 for AMMA)3154 ! dt_amma: total time interval (in sec) between 2 forcing data (e.g. 30min for AMMA)3155 !---------------------------------------------------------------------------------------3156 3157 #include "compar1d.h"3158 3159 ! inputs:3160 integer annee_ref3161 integer nt_amma,nlev_amma3162 integer year_ini_amma3163 real day, day1,day_ini_amma,dt_amma3164 real vitw_amma(nlev_amma,nt_amma)3165 real ht_amma(nlev_amma,nt_amma)3166 real hq_amma(nlev_amma,nt_amma)3167 real lat_amma(nt_amma)3168 real sens_amma(nt_amma)3169 ! outputs:3170 real vitw_prof(nlev_amma)3171 real ht_prof(nlev_amma)3172 real hq_prof(nlev_amma)3173 real lat_prof,sens_prof3174 ! local:3175 integer it_amma1, it_amma2,k3176 real timeit,time_amma1,time_amma2,frac3177 3178 3179 if (forcing_type.eq.6) then3180 ! Check that initial day of the simulation consistent with AMMA case:3181 if (annee_ref.ne.2006) then3182 print*,'Pour AMMA, annee_ref doit etre 2006'3183 print*,'Changer annee_ref dans run.def'3184 stop3185 endif3186 if (annee_ref.eq.2006 .and. day1.lt.day_ini_amma) then3187 print*,'AMMA a débuté le 10 juillet 2006',day1,day_ini_amma3188 print*,'Changer dayref dans run.def'3189 stop3190 endif3191 if (annee_ref.eq.2006 .and. day1.gt.day_ini_amma+1) then3192 print*,'AMMA a fini le 11 juillet'3193 print*,'Changer dayref ou nday dans run.def'3194 stop3195 endif3196 endif3197 3198 ! Determine timestep relative to the 1st day of AMMA:3199 ! timeit=(day-day1)*86400.3200 ! if (annee_ref.eq.1992) then3201 ! timeit=(day-day_ini_toga)*86400.3202 ! else3203 ! timeit=(day+61.-1.)*86400. ! 61 days between Nov01 and Dec31 19923204 ! endif3205 timeit=(day-day_ini_amma)*864003206 3207 ! Determine the closest observation times:3208 ! it_amma1=INT(timeit/dt_amma)+13209 ! it_amma2=it_amma1 + 13210 ! time_amma1=(it_amma1-1)*dt_amma3211 ! time_amma2=(it_amma2-1)*dt_amma3212 3213 it_amma1=INT(timeit/dt_amma)+13214 IF (it_amma1 .EQ. nt_amma) THEN3215 it_amma2=it_amma13216 ELSE3217 it_amma2=it_amma1 + 13218 ENDIF3219 time_amma1=(it_amma1-1)*dt_amma3220 time_amma2=(it_amma2-1)*dt_amma3221 3222 if (it_amma1 .gt. nt_amma) then3223 write(*,*) 'PB-stop: day, it_amma1, it_amma2, timeit: ' &3224 & ,day,day_ini_amma,it_amma1,it_amma2,timeit/86400.3225 stop3226 endif3227 3228 ! time interpolation:3229 frac=(time_amma2-timeit)/(time_amma2-time_amma1)3230 frac=max(frac,0.0)3231 3232 lat_prof = lat_amma(it_amma2) &3233 & -frac*(lat_amma(it_amma2)-lat_amma(it_amma1))3234 sens_prof = sens_amma(it_amma2) &3235 & -frac*(sens_amma(it_amma2)-sens_amma(it_amma1))3236 3237 do k=1,nlev_amma3238 vitw_prof(k) = vitw_amma(k,it_amma2) &3239 & -frac*(vitw_amma(k,it_amma2)-vitw_amma(k,it_amma1))3240 ht_prof(k) = ht_amma(k,it_amma2) &3241 & -frac*(ht_amma(k,it_amma2)-ht_amma(k,it_amma1))3242 hq_prof(k) = hq_amma(k,it_amma2) &3243 & -frac*(hq_amma(k,it_amma2)-hq_amma(k,it_amma1))3244 enddo3245 3246 return3247 END3248 2911 3249 2912 !===================================================================== -
LMDZ5/trunk/libf/phylmd/1D_decl_cases.h
r2019 r2117 1 #include "netcdf.inc" 2 1 3 ! Declarations specifiques au cas Toga 2 4 character*80 :: fich_toga … … 79 81 80 82 81 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!82 !Declarations specifiques au cas AMMA83 character*80 :: fich_amma84 ! Option du cas AMMA ou on impose la discretisation verticale (Ap,Bp)85 integer nlev_amma, nt_amma86 ! parameter (nlev_amma=29, nt_amma=48) ! Fleur, juillet 201287 parameter (nlev_amma=36, nt_amma=48) ! Romain, octobre 201288 ! parameter (nlev_amma=26, nt_amma=48) ! Test MPL feverier 201389 integer year_ini_amma, day_ini_amma, mth_ini_amma90 real heure_ini_amma91 real day_ju_ini_amma ! Julian day of amma first day92 parameter (year_ini_amma=2006)93 parameter (mth_ini_amma=7)94 parameter (day_ini_amma=10) ! 10 = 10Juil200695 parameter (heure_ini_amma=0.) !0h en secondes96 real dt_amma97 parameter (dt_amma=1800.)98 83 99 !profils initiaux:100 real plev_amma(nlev_amma)101 102 real z_amma(nlev_amma)103 real th_amma(nlev_amma),q_amma(nlev_amma)104 real u_amma(nlev_amma)105 real v_amma(nlev_amma)106 107 real th_ammai(nlev_amma),q_ammai(nlev_amma)108 real u_ammai(nlev_amma)109 real v_ammai(nlev_amma)110 real vitw_ammai(nlev_amma)111 real ht_ammai(nlev_amma)112 real hq_ammai(nlev_amma)113 real vt_ammai(nlev_amma)114 real vq_ammai(nlev_amma)115 116 !forcings117 real ht_amma(nlev_amma,nt_amma)118 real hq_amma(nlev_amma,nt_amma)119 real vitw_amma(nlev_amma,nt_amma)120 real lat_amma(nt_amma),sens_amma(nt_amma)121 122 !champs interpoles123 real vitw_profamma(nlev_amma)124 real ht_profamma(nlev_amma)125 real hq_profamma(nlev_amma)126 real lat_profamma,sens_profamma127 real vt_profamma(nlev_amma)128 real vq_profamma(nlev_amma)129 real th_profamma(nlev_amma)130 real q_profamma(nlev_amma)131 real u_profamma(nlev_amma)132 real v_profamma(nlev_amma)133 134 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!135 84 !Declarations specifiques au cas FIRE 136 85 character*80 :: fich_fire -
LMDZ5/trunk/libf/phylmd/1D_read_forc_cases.h
r2019 r2117 290 290 291 291 if (forcing_amma) then 292 !read AMMA forcings 293 fich_amma='amma.nc' 294 call read_amma(fich_amma,nlev_amma,nt_amma & 295 & ,z_amma,plev_amma,th_amma,q_amma,u_amma,v_amma,vitw_amma & 296 & ,ht_amma,hq_amma,sens_amma,lat_amma) 292 293 call read_1D_cases 297 294 298 295 write(*,*) 'Forcing AMMA lu' -
LMDZ5/trunk/libf/phylmd/lmdz1d.F90
r2040 r2117 21 21 USE indice_sol_mod 22 22 USE phyaqua_mod 23 USE mod_1D_cases_read 23 24 24 25 implicit none
Note: See TracChangeset
for help on using the changeset viewer.