Changeset 4150 for trunk/LMDZ.MARS/libf/phymars
- Timestamp:
- Mar 24, 2026, 5:27:57 PM (7 weeks ago)
- Location:
- trunk/LMDZ.MARS/libf/phymars
- Files:
-
- 1 added
- 6 edited
-
conf_phys.F (modified) (2 diffs)
-
iostart.F90 (modified) (3 diffs)
-
phyetat0_mod.F90 (modified) (2 diffs)
-
phyredem.F90 (modified) (3 diffs)
-
phys_state_var_init_mod.F90 (modified) (2 diffs)
-
physiq_mod.F (modified) (7 diffs)
-
tracer_mass_fixer_dyn_mod.F90 (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/libf/phymars/conf_phys.F
r4102 r4150 50 50 & coal_coeff_mode,full_coag_equations 51 51 use lwxn_mod, only: lwxn_linear, lwxn_alphan, lwxn_ncouche 52 use tracer_mass_fixer_dyn_mod, only: call_mass_fixer_dyn 52 53 use callkeys_mod, only: startphy_file, activice, activeco2ice, 53 54 & calladj, callatke, callcond, … … 1258 1259 endif 1259 1260 1261 c ---------------------------------------------------------- 1262 1263 ! Tracer mass fixer for dynamics 1264 1265 write(*,*) "call tracer mass fixer for dynamics?" 1266 call getin_p("call_mass_fixer_dyn", call_mass_fixer_dyn) 1267 write(*,*) "call_mass_fixer_dyn = ", call_mass_fixer_dyn 1268 1260 1269 ! Test of incompatibility: 1261 1270 ! if photochem is used, then water should be used too -
trunk/LMDZ.MARS/libf/phymars/iostart.F90
r3702 r4150 8 8 9 9 ! restartfi.nc file dimension identifiers: (see open_restartphy()) 10 INTEGER,SAVE :: idim0 ! "scalar" dimension 10 11 INTEGER,SAVE :: idim1 ! "index" dimension 11 12 INTEGER,SAVE :: idim2 ! "physical_points" dimension … … 510 511 write(*,*)'open_restartphy: problem writing title ' 511 512 write(*,*)trim(nf90_strerror(ierr)) 513 ENDIF 514 515 ierr=NF90_DEF_DIM(nid_restart,"scalar",1,idim0) 516 IF (ierr/=NF90_NOERR) THEN 517 write(*,*)'open_restartphy: problem defining scalar dimension ' 518 write(*,*)trim(nf90_strerror(ierr)) 519 CALL abort_physic("open_restartphy","Failed defining scalar",1) 512 520 ENDIF 513 521 … … 1061 1069 ENDIF 1062 1070 return ! nothing left to do 1071 ELSEIF (var_size==1) THEN 1072 ! We know it is a scalar 1073 idim1d=idim0 1063 1074 ELSEIF (var_size==length) THEN 1064 1075 ! We know it is a "controle" kind of 1D array -
trunk/LMDZ.MARS/libf/phymars/phyetat0_mod.F90
r3974 r4150 26 26 use nonoro_gwd_mix_mod, only: du_eddymix_gwd, dv_eddymix_gwd, de_eddymix_rto, & 27 27 df_eddymix_flx, dh_eddymix_gwd, dq_eddymix_gwd 28 use tracer_mass_fixer_dyn_mod, only: mass_predyn_co, mass_predyn_o2, mass_predyn_h2, mass_predyn_ho2, & 29 mass_predyn_h2o2, mass_predyn_n2, mass_predyn_ar, mass_predyn_he, & 30 found_startfi_co, found_startfi_o2, found_startfi_h2, found_startfi_ho2, & 31 found_startfi_h2o2, found_startfi_n2, found_startfi_ar, found_startfi_he, & 32 call_mass_fixer_dyn 28 33 use compute_dtau_mod, only: dtau 29 34 use dust_rad_adjust_mod, only: dust_rad_adjust_prev,dust_rad_adjust_next … … 718 723 minval(df_eddymix_flx ), maxval(df_eddymix_flx ) 719 724 725 ! Correction to tracer mass non-conservation in dynamics 726 if (startphy_file .and. call_mass_fixer_dyn) then 727 call get_var("mass_predyn_co", mass_predyn_co, found) 728 if (found) then 729 found_startfi_co = .true. 730 else 731 write(*,*) "phyetat0: <mass_predyn_co> not in file" 732 endif 733 734 call get_var("mass_predyn_o2", mass_predyn_o2, found) 735 if (found) then 736 found_startfi_o2 = .true. 737 else 738 write(*,*) "phyetat0: <mass_predyn_o2> not in file" 739 endif 740 741 call get_var("mass_predyn_h2", mass_predyn_h2, found) 742 if (found) then 743 found_startfi_h2 = .true. 744 else 745 write(*,*) "phyetat0: <mass_predyn_h2> not in file" 746 endif 747 748 call get_var("mass_predyn_ho2", mass_predyn_ho2, found) 749 if (found) then 750 found_startfi_ho2 = .true. 751 else 752 write(*,*) "phyetat0: <mass_predyn_ho2> not in file" 753 endif 754 755 call get_var("mass_predyn_h2o2", mass_predyn_h2o2, found) 756 if (found) then 757 found_startfi_h2o2 = .true. 758 else 759 write(*,*) "phyetat0: <mass_predyn_h2o2> not in file" 760 endif 761 762 call get_var("mass_predyn_n2", mass_predyn_n2, found) 763 if (found) then 764 found_startfi_n2 = .true. 765 else 766 write(*,*) "phyetat0: <mass_predyn_n2> not in file" 767 endif 768 769 call get_var("mass_predyn_ar", mass_predyn_ar, found) 770 if (found) then 771 found_startfi_ar = .true. 772 else 773 write(*,*) "phyetat0: <mass_predyn_ar> not in file" 774 endif 775 776 call get_var("mass_predyn_he", mass_predyn_he, found) 777 if (found) then 778 found_startfi_he = .true. 779 else 780 write(*,*) "phyetat0: <mass_predyn_he> not in file" 781 endif 782 endif ! if (startphy_file .and. call_mass_fixer_dyn) 783 720 784 ! tracer on surface 721 785 if (nq.ge.1) then -
trunk/LMDZ.MARS/libf/phymars/phyredem.F90
r3964 r4150 198 198 use iostart, only: open_restartphy, close_restartphy, put_var, put_field 199 199 use tracer_mod, only: noms ! tracer names 200 use tracer_mod, only: igcm_co, igcm_o2, igcm_h2, igcm_ho2, igcm_h2o2, igcm_n2, igcm_ar, igcm_he 200 201 use nonoro_gwd_ran_mod, only: du_nonoro_gwd, dv_nonoro_gwd 201 202 use compute_dtau_mod, only: dtau … … 206 207 use comslope_mod, only: nslope 207 208 use paleoclimate_mod, only: paleoclimate 209 use tracer_mass_fixer_dyn_mod, only: call_mass_fixer_dyn, mass_predyn 208 210 use callkeys_mod, only: calltherm, dustinjection, calllott_nonoro 209 211 use callkeys_mod, only: CLFvarying … … 392 394 endif 393 395 396 ! Correction to tracer mass non-conservations in dynamics 397 if (call_mass_fixer_dyn) then 398 if (igcm_co .ne. 0) then 399 call put_var("mass_predyn_co", "Global mass of CO before the last physiq step ends", mass_predyn(igcm_co)) 400 endif 401 if (igcm_o2 .ne. 0) then 402 call put_var("mass_predyn_o2", "Global mass of O2 before the last physiq step ends", mass_predyn(igcm_o2)) 403 endif 404 if (igcm_h2 .ne. 0) then 405 call put_var("mass_predyn_h2", "Global mass of H2 before the last physiq step ends", mass_predyn(igcm_h2)) 406 endif 407 if (igcm_ho2 .ne. 0) then 408 call put_var("mass_predyn_ho2", "Global mass of HO2 before the last physiq step ends", mass_predyn(igcm_ho2)) 409 endif 410 if (igcm_h2o2 .ne. 0) then 411 call put_var("mass_predyn_h2o2", "Global mass of H2O2 before the last physiq step ends", mass_predyn(igcm_h2o2)) 412 endif 413 if (igcm_n2 .ne. 0) then 414 call put_var("mass_predyn_n2", "Global mass of N2 before the last physiq step ends", mass_predyn(igcm_n2)) 415 endif 416 if (igcm_ar .ne. 0) then 417 call put_var("mass_predyn_ar", "Global mass of Ar before the last physiq step ends", mass_predyn(igcm_ar)) 418 endif 419 if (igcm_he .ne. 0) then 420 call put_var("mass_predyn_he", "Global mass of He before the last physiq step ends", mass_predyn(igcm_he)) 421 endif 422 endif 423 394 424 ! Close file 395 425 call close_restartphy -
trunk/LMDZ.MARS/libf/phymars/phys_state_var_init_mod.F90
r4009 r4150 65 65 use comslope_mod, ONLY: nslope,end_comslope_h,ini_comslope_h 66 66 use paleoclimate_mod, ONLY: end_paleoclimate_h,ini_paleoclimate_h 67 use tracer_mass_fixer_dyn_mod, only: ini_tracer_mass_fixer_dyn, & 68 end_tracer_mass_fixer_dyn 67 69 use netcdf 68 70 #ifndef MESOSCALE … … 200 202 call ini_paleoclimate_h(ngrid,nslope) 201 203 204 ! allocate arrays in "tracer_mass_fixer_dyn_mod" 205 call end_tracer_mass_fixer_dyn 206 call ini_tracer_mass_fixer_dyn(nq) 207 202 208 END SUBROUTINE phys_state_var_init 203 209 -
trunk/LMDZ.MARS/libf/phymars/physiq_mod.F
r4143 r4150 275 275 REAL,INTENT(in) :: pt(ngrid,nlayer) ! temperature (K) 276 276 REAL,INTENT(in) :: pq(ngrid,nlayer,nq) ! tracers (.../kg_of_air) 277 REAL pq_corrdyn(ngrid,nlayer,nq) ! tracer mass mixing ratio after correcting278 ! mass non-conservations in dynamics279 277 REAL,INTENT(in) :: flxw(ngrid,nlayer) ! vertical mass flux (ks/s) at lower boundary of layer 280 278 … … 286 284 REAL,INTENT(out) :: pdt(ngrid,nlayer) ! temperature tendency (K/s) 287 285 REAL,INTENT(out) :: pdq(ngrid,nlayer,nq) ! tracer tendencies (../kg/s) 288 REAL pdq_corrdyn(ngrid,nlayer,nq) ! tracer mass mixing ratio tendencies in order to correct289 ! mass non-conservations in dynamics290 286 REAL,INTENT(out) :: pdpsrf(ngrid) ! surface pressure tendency (Pa/s) 291 287 … … 451 447 real colden(ngrid,nq) ! vertical column of tracers 452 448 real mass(nq) ! global mass of tracers (g) 453 real, allocatable, save :: mass_predyn(:) ! tracer mass in the whole atmosphere454 ! before dynamics455 real mass_postdyn(nq) ! tracer mass in the whole atmosphere after dynamics456 457 !$OMP THREADPRIVATE(mass_predyn)458 459 real masscorrfac(nq) ! mass correction factor for non-conservations in dynamics460 449 REAL mtot(ngrid) ! Total mass of water vapor (kg/m2) 461 450 REAL mstormdtot(ngrid) ! Total mass of stormdust tracer (kg/m2) … … 826 815 & presnivs,pseudoalt,mlayer) 827 816 #endif 828 829 allocate(mass_predyn(nq))830 831 817 ENDIF ! (end of "if firstcall") 832 818 … … 892 878 zplay(:,:) = pplay(:,:) 893 879 ps(:) = pplev(:,1) 894 895 c Correct mass non-conservation in dynamics896 c ~~~~~~~~~~~~~~~~~~897 call compute_global_mass(pq, ngrid, nlayer, nq, zplev,898 & mass_postdyn)899 900 if (.not.firstcall) then ! At first call, mass_predyn does not exist901 do iq = 1, nq902 if (noms(iq) .ne. "dust_mass" .and.903 & noms(iq) .ne. "dust_number" .and.904 & noms(iq) .ne. "ccn_mass" .and.905 & noms(iq) .ne. "ccn_number" .and.906 & noms(iq) .ne. "ccnco2_mass" .and.907 & noms(iq) .ne. "ccnco2_number" .and.908 & noms(iq) .ne. "stormdust_mass" .and.909 & noms(iq) .ne. "stormdust_number" .and.910 & noms(iq) .ne. "topdust_mass" .and.911 & noms(iq) .ne. "topdust_number") then912 masscorrfac(iq) = mass_predyn(iq)/mass_postdyn(iq)913 endif914 enddo915 916 pq_corrdyn = pq917 do ig = 1, ngrid918 do l = 1, min(nlayer, 40) ! Correction only applied to the lowest 40 layers919 do iq = 1, nq920 if (noms(iq) .ne. "dust_mass" .and.921 & noms(iq) .ne. "dust_number" .and.922 & noms(iq) .ne. "ccn_mass" .and.923 & noms(iq) .ne. "ccn_number" .and.924 & noms(iq) .ne. "ccnco2_mass" .and.925 & noms(iq) .ne. "ccnco2_number" .and.926 & noms(iq) .ne. "stormdust_mass" .and.927 & noms(iq) .ne. "stormdust_number" .and.928 & noms(iq) .ne. "topdust_mass" .and.929 & noms(iq) .ne. "topdust_number" .and.930 & iq .ne. igcm_co2) then931 ! Correcting species other than CO2932 pq_corrdyn(ig, l, iq) =933 & pq(ig, l, iq) * masscorrfac(iq)934 ! Adjust CO2 to compensate for mass creation/loss935 pq_corrdyn(ig, l, igcm_co2) =936 & pq_corrdyn(ig, l, igcm_co2) -937 & pq(ig, l, iq) * (masscorrfac(iq) - 1.)938 endif939 enddo940 enddo941 enddo942 943 pdq_corrdyn = (pq_corrdyn - pq)/ptimestep ! Mass fixer pdq944 pdq = pdq + pdq_corrdyn945 endif946 880 947 881 !#ifndef MESOSCALE … … 2634 2568 ENDDO 2635 2569 ENDDO 2636 2637 call compute_global_mass(zq, ngrid, nlayer, nq, zplev,2638 & mass_predyn)2639 2570 2640 2571 ! Density … … 4199 4130 END SUBROUTINE physiq 4200 4131 4201 subroutine compute_global_mass(zq, ngrid, nlayer, nq, zplev, mass)4202 4203 use tracer_mod, only: mmol4204 use comcstfi_h, only: g4205 use geometry_mod, only: cell_area4206 use tracer_mod, only: noms4207 use planetwide_mod, only: planetwide_sumval4208 4209 real, intent(in) :: zq(ngrid, nlayer, nq)4210 integer, intent(in) :: ngrid4211 integer, intent(in) :: nlayer4212 integer, intent(in) :: nq4213 real, intent(in) :: zplev(ngrid, nlayer + 1)4214 real, intent(out) :: mass(nq)4215 real colden(ngrid, nq)4216 integer iq, ig, l4217 4218 do iq = 1, nq4219 if (noms(iq) .ne. "dust_mass" .and.4220 & noms(iq) .ne. "dust_number" .and.4221 & noms(iq) .ne. "ccn_mass" .and.4222 & noms(iq) .ne. "ccn_number" .and.4223 & noms(iq) .ne. "ccnco2_mass" .and.4224 & noms(iq) .ne. "ccnco2_number" .and.4225 & noms(iq) .ne. "stormdust_mass" .and.4226 & noms(iq) .ne. "stormdust_number" .and.4227 & noms(iq) .ne. "topdust_mass" .and.4228 & noms(iq) .ne. "topdust_number") then4229 4230 do ig = 1, ngrid4231 colden(ig, iq) = 0.4232 end do4233 do l = 1, nlayer4234 do ig = 1, ngrid4235 colden(ig, iq) = colden(ig, iq) + zq(ig, l, iq)*4236 & (zplev(ig, l) - zplev(ig, l+1))*4237 & 6.022e22/(mmol(iq)*g)4238 end do4239 end do4240 4241 call planetwide_sumval(colden(:, iq)/6.022e234242 & *mmol(iq)*1.e4*cell_area, mass(iq))4243 4244 end if4245 end do4246 4247 end subroutine4248 4249 4132 END MODULE physiq_mod
Note: See TracChangeset
for help on using the changeset viewer.
