Ignore:
Timestamp:
Mar 19, 2026, 2:35:46 PM (11 days ago)
Author:
gmilcareck
Message:

Thermodynamics update on LMDZ.GENERIC

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.GENERIC/libf/phygeneric/inifis_mod.F90

    r4130 r4146  
    1919  use time_phylmdz_mod, only: diagfi_output_rate, slow_diagfi, &
    2020                              init_time, daysec, dtphys
    21   use comcstfi_mod, only: rad, cpp, g, r, rcp, &
    22                           mugaz, pi, avocado
     21  use comcstfi_mod, only: rad, cppd_ref, cppv_ref, cppc_ref, g, rd_ref, rcp_ref, &
     22                          mugaz_ref, pi, avocado
    2323  use planete_mod, only: nres
    2424  use planetwide_mod, only: planetwide_sumval
     
    9090  ! initialize constants in comcstfi_mod
    9191  rad=prad
    92   cpp=pcpp
     92  cppd_ref=pcpp
    9393  g=pg
    94   r=pr
    95   rcp=r/cpp
    96   mugaz=8.314463*1000./pr ! dummy init
     94  rd_ref=pr
     95  rcp_ref=rd_ref/cppd_ref
     96  mugaz_ref=8.314463*1000./pr ! dummy init
    9797  pi=2.*asin(1.)
    9898  avocado = 6.022141e23   ! added by RW
     
    11031103     if (is_master) write(*,*)trim(rname)//": generic_condensation = ",generic_condensation
    11041104     
     1105     if (generic_condensation) then
     1106                if (is_master) write(*,*)trim(rname)//": value for metallicity? "
     1107                metallicity=0.0 ! default value
     1108                call getin_p("metallicity",metallicity)
     1109                if (is_master) write(*,*)trim(rname)//": metallicity = ",metallicity
     1110
     1111                if (is_master) write(*,*)trim(rname)//": Deep generic tracer vapor mixing ratio ? (no effect if negative) "
     1112                qvap_deep=-1. ! default value
     1113                call getin_p("qvap_deep",qvap_deep)
     1114                if (is_master) write(*,*)trim(rname)//": qvap_deep = ",qvap_deep   
     1115
     1116                if (is_master) write(*,*)trim(rname)//":top generic tracer vapor mixing ratio ? (no effect if negative) "
     1117                qvap_top=-1. ! default value
     1118                call getin_p("qvap_top",qvap_top)
     1119                if (is_master) write(*,*)trim(rname)//": qvap_top = ",qvap_top
     1120
     1121                if (is_master) write(*,*)trim(rname)//": align_strato_cold_trap ? "
     1122                align_strato_cold_trap=.false. ! default value
     1123                call getin_p("align_strato_cold_trap",align_strato_cold_trap)
     1124                if (is_master) write(*,*)trim(rname)//": align_strato_cold_trap = ",align_strato_cold_trap
     1125     endif
     1126     
    11051127     if (is_master) write(*,*)trim(rname)//": Generic rain of tracers ?"
    11061128     generic_rain=.false. !default value
    11071129     call getin_p("generic_rain",generic_rain)
    11081130     if (is_master) write(*,*)trim(rname)//": generic_rain = ",generic_rain
     1131     
     1132     if (generic_rain) then
     1133            if (is_master) write(*,*)trim(rname)//": re-evaporate precipitations?"
     1134            evap_prec_generic=.true. ! default value
     1135            call getin_p("evap_prec_generic",evap_prec_generic)
     1136            if (is_master) write(*,*)trim(rname)//": evap_prec_generic = ",evap_prec_generic
     1137
     1138            if (evap_prec_generic) then
     1139               if (is_master) write(*,*)trim(rname)//": multiplicative constant in reevaporation"
     1140               evap_coeff_generic=1.   ! default value
     1141               call getin_p("evap_coeff_generic",evap_coeff_generic)
     1142               if (is_master) write(*,*)trim(rname)//": evap_coeff_generic = ",evap_coeff_generic       
     1143            end if
     1144
     1145            if (is_master) write(*,*)trim(rname)//": Precipitation scheme to use?"
     1146            precip_scheme_generic=1 ! default value
     1147            call getin_p("precip_scheme_generic",precip_scheme_generic)
     1148            if (is_master) write(*,*)trim(rname)//": precip_scheme_generic = ",precip_scheme_generic
     1149
     1150            if (precip_scheme_generic.eq.1) then
     1151               if (is_master) write(*,*)trim(rname)//": rainthreshold_generic in simple scheme?"
     1152               rainthreshold_generic=0. ! default value
     1153               call getin_p("rainthreshold_generic",rainthreshold_generic)
     1154               if (is_master) write(*,*)trim(rname)//": rainthreshold_generic = ",rainthreshold_generic
     1155               
     1156            else if (precip_scheme_generic.eq.2.or.precip_scheme_generic.eq.3) then
     1157               
     1158               if (is_master) write(*,*)trim(rname)//": cloud GCS saturation level in non simple scheme?"
     1159               cloud_sat_generic=2.6e-4   ! default value
     1160               call getin_p("cloud_sat_generic",cloud_sat_generic)
     1161               if (is_master) write(*,*)trim(rname)//": cloud_sat_generic = ",cloud_sat_generic
     1162           
     1163               if (is_master) write(*,*)trim(rname)//": precipitation timescale in non simple scheme?"
     1164               precip_timescale_generic=3600.  ! default value
     1165               call getin_p("precip_timescale_generic",precip_timescale_generic)
     1166               if (is_master) write(*,*)trim(rname)//": precip_timescale_generic = ",precip_timescale_generic
     1167
     1168            else if (precip_scheme_generic.eq.4) then
     1169               
     1170               if (is_master) write(*,*)trim(rname)//": multiplicative constant in Boucher 95 precip scheme"
     1171               Cboucher_generic=1.   ! default value
     1172               call getin_p("Cboucher_generic",Cboucher_generic)
     1173               if (is_master) write(*,*)trim(rname)//": Cboucher_generic = ",Cboucher_generic   
     1174
     1175            endif
     1176     endif
    11091177
    11101178     if (is_master) write(*,*)trim(rname)//": Include moist adjustement for GCS ?"
     
    12071275       call getin_p("nvarlayer",nvarlayer)
    12081276     endif
    1209 
    1210      if (is_master) write(*,*)'Predefined Cp from dynamics is ',cpp,'J kg^-1 K^-1'
    1211      if (is_master) write(*,*)'Predefined Mg from dynamics is ',mugaz,'amu'
    1212 
    1213      force_cpp=.false. ! default value
    1214      call getin_p("force_cpp",force_cpp)
    1215      if (force_cpp) then
    1216       if (is_master) write(*,*)trim(rname)//": force_cpp = ",force_cpp
    1217       if (is_master) write(*,*)trim(rname)//": force_cpp is deprecated.",&
    1218       "Set cpp_mugaz_mode=1 in callfis to emulate force_cpp=.true."
    1219       call abort_physic(rname,"Anyway, you need to set force_cpp=.false. to continue.",1)
    1220      endif
    1221 
    1222      if (is_master) write(*,*)trim(rname)//&
    1223      ": where do you want your cpp/mugaz value to come from?",&
    1224      "=> 0: dynamics (3d), 1: forced in callfis (1d), 2: computed from gases.def (1d)?"
     1277     
     1278     if (is_master) write(*,*)trim(rname)//&
     1279     ": where do you want your cppd_ref/mugaz_ref value to come from?",&
     1280     "=> 0: dynamics (3d), 1: forced in callphys.def (1d), 2: computed from gases.def (1d)?"
    12251281     cpp_mugaz_mode = 0 ! default value
    12261282     call getin_p("cpp_mugaz_mode",cpp_mugaz_mode)
     
    12351291        call abort_physic(rname,"cpp_mugaz_mode must be >= 1 in 1d",1)
    12361292     endif
    1237 
    1238      if (cpp_mugaz_mode == 1) then
    1239        mugaz = -99999.
     1293     
     1294     if (is_master) write(*,*)trim(rname)//&
     1295     ": CHOOSE THERMODYNAMICS MOD"
     1296     thermo_phy='thermo_uni_ideal' !default value
     1297     call getin_p("thermo_phy",thermo_phy)
     1298     if (is_master) write(*,*)trim(rname)//": thermo_phy = ",trim(thermo_phy)
     1299     if(thermo_phy.eq.'thermo_uni_ideal') then
     1300       if (cpp_mugaz_mode == 0) write(*,*) "cppd_ref and mugaz_ref fixed by the dynamics"
     1301       if (cpp_mugaz_mode == 1) then
     1302         write(*,*) "cppd_ref and mugaz_ref fixed by the physics (callphys.def)"
     1303         cppd_ref = -99999.
     1304         if (is_master) write(*,*)trim(rname)//&
     1305           ": DRY SPECIFIC HEAT CAPACITY in J K-1 kg-1 ?"
     1306         call getin_p("cppd_ref",cppd_ref)
     1307         IF (cppd_ref.eq.-99999.) THEN
     1308             PRINT *, "cppd_ref must be set if thermo_phy = thermo_uni_ideal and cpp_mugaz_mode == 1"
     1309             STOP
     1310         ENDIF
     1311         mugaz_ref = -99999.
     1312         if (is_master) write(*,*)trim(rname)//&
     1313           ": MEAN MOLECULAR MASS in g mol-1 ?"
     1314         call getin_p("mugaz_ref",mugaz_ref)
     1315         IF (mugaz_ref.eq.-99999.) THEN
     1316           call abort_physic(rname,"mugaz_ref must be set if cpp_mugaz_mode = 1",1)
     1317         ENDIF
     1318       endif
     1319       if (cpp_mugaz_mode == 2) write(*,*) "cppd_ref and mugaz_ref calculated by calc_cpp_mugaz in physics"
     1320       call su_gases
     1321       call calc_cpp_mugaz
     1322       if (generic_condensation) then
     1323         cppv_ref = -99999.
     1324         if (is_master) write(*,*)trim(rname)//&
     1325           ": VAPOUR TRACER SPECIFIC HEAT CAPACITY in J K-1 kg-1 ?"
     1326         call getin_p("cppv_ref",cppv_ref)
     1327         IF (cppv_ref.eq.-99999.) THEN
     1328             PRINT *, "cppv_ref must be set if generic_condensation = true"
     1329             STOP
     1330         ENDIF
     1331       endif
     1332     elseif(thermo_phy.eq.'thermo_binary_ideal') then
     1333       write(*,*) "WARNING: thermo_binary_ideal can be used only wit the DYNAMICO CORE or in 1D"
     1334       if (.not.tracer) then
     1335          call abort_physic(rname,"Error: We need a tracer for the thermo_binary_ideal mod!",1)
     1336       endif
     1337       if (cpp_mugaz_mode == 0) write(*,*) "cppd_ref and mugaz_ref fixed by the dynamics"
     1338       if (cpp_mugaz_mode == 1) then
     1339         write(*,*) "cppd_ref and mugaz_ref fixed by the physics (callphys.def)"
     1340         cppd_ref = -99999.
     1341         if (is_master) write(*,*)trim(rname)//&
     1342           ": DRY SPECIFIC HEAT CAPACITY in J K-1 kg-1 ?"
     1343         call getin_p("cppd_ref",cppd_ref)
     1344         IF (cppd_ref.eq.-99999.) THEN
     1345             PRINT *, "cppd_ref must be set if thermo_phy = thermo_binary_ideal"
     1346             STOP
     1347         ENDIF
     1348         mugaz_ref = -99999.
     1349         if (is_master) write(*,*)trim(rname)//&
     1350           ": MEAN MOLECULAR MASS in g mol-1 ?"
     1351         call getin_p("mugaz_ref",mugaz_ref)
     1352         IF (mugaz_ref.eq.-99999.) THEN
     1353           call abort_physic(rname,"mugaz_ref must be set if cpp_mugaz_mode = 1",1)
     1354         ENDIF
     1355       endif
     1356       if (cpp_mugaz_mode == 2) write(*,*) "cppd_ref and mugaz_ref calculated by calc_cpp_mugaz in physics"
     1357       call su_gases
     1358       call calc_cpp_mugaz
     1359       cppv_ref = -99999.
    12401360       if (is_master) write(*,*)trim(rname)//&
    1241          ": MEAN MOLECULAR MASS in g mol-1 ?"
    1242        call getin_p("mugaz",mugaz)
    1243        IF (mugaz.eq.-99999.) THEN
    1244          call abort_physic(rname,"mugaz must be set if cpp_mugaz_mode = 1",1)
     1361         ": VAPOUR TRACER SPECIFIC HEAT CAPACITY in J K-1 kg-1 ?"
     1362       call getin_p("cppv_ref",cppv_ref)
     1363       IF (cppv_ref.eq.-99999.) THEN
     1364           PRINT *, "cppv_ref must be set if thermo_phy = thermo_binary_ideal"
     1365           STOP
    12451366       ENDIF
    1246        cpp = -99999.
     1367       cppc_ref = -99999.
    12471368       if (is_master) write(*,*)trim(rname)//&
    1248          ": SPECIFIC HEAT CAPACITY in J K-1 kg-1 ?"
    1249        call getin_p("cpp",cpp)
    1250        IF (cpp.eq.-99999.) THEN
    1251            call abort_physic(rname, "cpp must be set if cpp_mugaz_mode = 1", 1)
     1369         ": CONDENSED TRACER SPECIFIC HEAT CAPACITY in J K-1 kg-1 ?"
     1370       call getin_p("cppc_ref",cppc_ref)
     1371       IF (cppc_ref.eq.-99999.) THEN
     1372           PRINT *, "cppc_ref must be set if thermo_phy = thermo_binary_ideal"
     1373           STOP
    12521374       ENDIF
    1253        if (is_master) write(*,*)'New Cp from callfis is ',cpp,'J kg^-1 K^-1'
    1254        if (is_master) write(*,*)'New Mg from callfis is ',mugaz,'amu'
    1255  
    1256      endif ! of if (cpp_mugaz_mode == 1)
    1257      call su_gases
    1258      call calc_cpp_mugaz
     1375     else
     1376       call abort_physic(rname,"thermodynamics mod not recognized",1)
     1377     endif
    12591378
    12601379     if (is_master) then
Note: See TracChangeset for help on using the changeset viewer.