- Timestamp:
- Apr 3, 2024, 11:49:58 AM (8 months ago)
- Location:
- trunk/LMDZ.MARS
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/changelog.txt
r3282 r3289 4583 4583 when the first (at every time step) variable sent to wstats() was not part of 4584 4584 those listed in stats.def 4585 4586 == 21/03/2024 == Jliu 4587 Fix several bugs in photochemistry related to the submit-crash-resubmit 4588 problem: Some of the integers in the related routines are not set in 4589 privatethreads. Consequently, the additives such as n=n+1 are accumulated with 4590 threads, causing systermatic problems in the routine. This update fixed the 4591 submit-crash-resubmit problem. The simulated results are same with previous 4592 simulations as tested. -
trunk/LMDZ.MARS/libf/aeronomars/calchim_mod.F90
r3012 r3289 32 32 use comcstfi_h, only: pi 33 33 use chemistrydata_mod, only: read_phototable 34 use photolysis_mod, only: init_photolysis , nphot34 use photolysis_mod, only: init_photolysis !, nphot 35 35 use iono_h, only: temp_elect 36 36 use wstats_mod, only: wstats … … 168 168 integer :: ig_vl1 169 169 170 integer :: nb_reaction_3_max ! number of quadratic reactions 171 integer :: nb_reaction_4_max ! number of bimolecular reactions 172 integer :: nquench ! number of quenching + heterogeneous reactions 173 integer :: nphotion ! number of photoionizations 174 integer :: nb_reaction_4_ion ! quadratic reactions for ionosphere 175 integer :: nb_reaction_4_deut ! quadratic reactions for deuterium chem 176 integer :: nb_phot_max ! total number of photolysis+photoionizations+quenching reactions 177 170 integer, save :: nb_reaction_3_max ! number of quadratic reactions 171 integer, save :: nb_reaction_4_max ! number of bimolecular reactions 172 integer, parameter :: nb_reaction_3_max0 = 6 ! number of quadratic reactions 173 integer, parameter :: nb_reaction_4_max0 = 31 ! number of bimolecular reactions 174 integer, parameter :: nquench = 9 ! number of quenching + heterogeneous reactions 175 integer, save :: nphotion ! number of photoionizations 176 integer, parameter :: nphotion0 = 0 ! number of photoionizations 177 integer, save :: nphot ! number of photolysis 178 integer, parameter :: nphot0 = 13 ! number of photolysis 179 ! is incremented by +2 in calchim if deuterium chemisty) 180 integer, parameter :: nb_reaction_4_ion = 64 ! quadratic reactions for ionosphere 181 integer, parameter :: nb_reaction_4_deut = 35 ! quadratic reactions for deuterium chem 182 integer, save :: nb_phot_max ! total number of photolysis+photoionizations+quenching reactions 183 integer, parameter :: nb_phot_max0 = 0 ! total number of photolysis+photoionizations+quenching reactions 184 !$OMP THREADPRIVATE(nb_reaction_3_max,nb_reaction_4_max,nphotion,nphot,nb_phot_max) 178 185 179 186 real :: latvl1, lonvl1 … … 757 764 write(*,*) 'calchim: tracer indices=',niq(:) 758 765 759 766 nphot = nphot0 ! number of photolysis 767 ! is incremented by +2 in calchim if deuterium chemisty) 760 768 if (photochem) then 761 769 if (jonline) then 762 770 print*,'calchim: Read UV absorption cross-sections' 763 771 !Add two photodissociations in deuterium chemistry included 764 if(deutchem) nphot = nphot + 2772 if(deutchem) nphot = nphot0 + 2 765 773 call init_photolysis ! on-line photolysis 766 774 else … … 843 851 if (photochem) then 844 852 ! set number of reactions, depending on ion chemistry or not 845 nb_reaction_4_ion = 64846 nb_reaction_4_deut = 35853 ! nb_reaction_4_ion = 64 854 ! nb_reaction_4_deut = 35 847 855 848 856 !Default numbers if no ion and no deuterium chemistry included 849 857 850 nb_reaction_4_max = 31 ! set number of bimolecular reactions 851 nb_reaction_3_max = 6 ! set number of quadratic reactions 852 nquench = 9 ! set number of quenching + heterogeneous 853 nphotion = 0 ! set number of photoionizations 854 858 ! nb_reaction_4_max = 31 ! set number of bimolecular reactions 859 ! nb_reaction_3_max = 6 ! set number of quadratic reactions 860 ! nquench = 9 ! set number of quenching + heterogeneous 861 ! nphotion = 0 ! set number of photoionizations 862 nb_reaction_4_max = nb_reaction_4_max0 ! set number of bimolecular reactions 863 nb_reaction_3_max = nb_reaction_3_max0 ! set number of quadratic reactions 864 nphotion = nphotion0 ! set number of photoionizations 865 nb_phot_max = nb_phot_max0 855 866 if (ionchem) then 856 nb_reaction_4_max = nb_reaction_4_max + nb_reaction_4_ion857 nphotion = 18 ! set number of photoionizations867 nb_reaction_4_max = nb_reaction_4_max0 + nb_reaction_4_ion 868 nphotion = nphotion0 + 18 ! set number of photoionizations 858 869 endif 859 870 if(deutchem) then … … 864 875 ! numerically as a photolysis: 865 876 866 nb_phot_max = nphot + nphotion + nquench 867 877 nb_phot_max = nb_phot_max0 + nphot + nphotion + nquench 878 ! print*, 'nb_phot_max = ', nb_phot_max 879 ! print*, 'nb_reaction_4_max=', nb_reaction_4_max 880 ! print*, 'nb_reaction_3_max=', nb_reaction_3_max 868 881 ! call main photochemistry routine 869 882 -
trunk/LMDZ.MARS/libf/aeronomars/photochemistry.F90
r3141 r3289 161 161 !integer,parameter :: i_hdo2 = 38 162 162 163 integer :: i_last164 163 integer, save :: i_last 164 !$OMP THREADPRIVATE(i_last) 165 165 !Tracer indexes for photionization coeffs 166 166 … … 180 180 181 181 integer :: ilay 182 integer :: ind_norec183 integer :: ind_orec184 182 integer, save :: ind_norec 183 integer, save :: ind_orec 184 !$OMP THREADPRIVATE(ind_norec, ind_orec) 185 185 real :: ctimestep ! standard timestep for the chemistry (s) 186 186 real :: dt_guess ! first-guess timestep (s) … … 503 503 em_no(:)=c(:,i_o)*c(:,i_n)*v_4(:,ind_norec) !2.8e-17*(300./temp(:)))**0.5 504 504 em_o2(:)=0.75*c(:,i_o)*c(:,i_o)*c(:,i_co2)*v_3(:,ind_orec) !2.5*9.46e-34*exp(485./temp(:))*dens(:) 505 505 !print*, "ind_norec= ", ind_norec 506 !print*, "ind_orec= ", ind_orec 506 507 !=================================================================== 507 508 ! save chemical species for the gcm … … 659 660 660 661 use comcstfi_h 661 use photolysis_mod, only : nphot662 !use photolysis_mod, only : nphot 662 663 663 664 implicit none … … 675 676 logical, intent(in) :: deutchem 676 677 integer :: lswitch ! interface level between lower 678 integer,parameter :: nphot0 =13 677 679 ! atmosphere and thermosphere chemistries 678 680 real, dimension(nlayer) :: dens ! total number density (molecule.cm-3) … … 695 697 real (kind = 8), dimension(nlayer,nb_reaction_3_max) :: v_3 696 698 real (kind = 8), dimension(nlayer,nb_reaction_4_max) :: v_4 697 integer :: ind_norec698 integer :: ind_orec699 integer, intent(out) :: ind_norec 700 integer, intent(out) :: ind_orec 699 701 700 702 !---------------------------------------------------------------------- … … 703 705 704 706 integer :: ilev 705 integer :: nb_phot, nb_reaction_3, nb_reaction_4 707 integer, save :: nb_phot, nb_reaction_3, nb_reaction_4 708 !$OMP THREADPRIVATE(nb_phot, nb_reaction_3, nb_reaction_4) 706 709 real :: ak0, ak1, xpo, rate, rate1, rate2 707 710 real :: k1a0, k1b0, k1ainf, k1a, k1b, fc, fx, x, y, gam … … 737 740 ! initialisation 738 741 !---------------------------------------------------------------------- 739 740 nb_phot = nphot + nphotion ! initialised to the number of photolysis + number of photoionization rates742 nb_phot = 0 743 nb_phot = nphot0 + nphotion ! initialised to the number of photolysis + number of photoionization rates 741 744 nb_reaction_3 = 0 742 745 nb_reaction_4 = 0 … … 776 779 v_3(:,nb_reaction_3) = a002(:) 777 780 ind_orec=nb_reaction_3 778 781 ! print*,"ind_orec",ind_orec 779 782 !--- a003: o + o3 -> o2 + o2 780 783 … … 1200 1203 v_4(:,nb_reaction_4) = d007(:) 1201 1204 ind_norec = nb_reaction_4 1202 1205 ! print*,"ind_norec=",ind_norec 1203 1206 !--- d008: n + ho2 -> no + oh 1204 1207
Note: See TracChangeset
for help on using the changeset viewer.