Changeset 3015


Ignore:
Timestamp:
Jul 25, 2023, 9:56:32 AM (16 months ago)
Author:
emillour
Message:

Mars PCM:
Code cleanup in diffusion, turn variables from diffusion.h into module
variables in moldiff_red.F90 (turn it into a module in the process).
Also turn moldiffcoeff_red.F and thermosphere.F into modules.
EM

Location:
trunk/LMDZ.MARS
Files:
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/changelog.txt

    r3012 r3015  
    41324132and then broadcast the result to all cores.
    41334133While at it, also turned nltecool.F and nlte_tcool.F into modules.
     4134
     4135== 25/07/2023 == EM
     4136Code cleanup in diffusion, turn variables from diffusion.h into module
     4137variables in moldiff_red.F90 (turn it into a module in the process).
     4138Also turn moldiffcoeff_red.F and thermosphere.F into modules.
     4139
  • trunk/LMDZ.MARS/libf/aeronomars/moldiff_red.F90

    r2611 r3015  
     1MODULE moldiff_red_mod
     2
     3  real*8,parameter :: Pdiff=15. ! pressure (Pa) below which diffusion is computed
     4  real*8,parameter :: tdiffmin=5d0
     5  real*8,parameter :: dzres=2d0 ! grid resolution (km) for diffusion
     6 
     7CONTAINS
     8
    19subroutine moldiff_red(ngrid,nlayer,nq,pplay,pplev,pt,pdt,pq,pdq,&
    210                       ptimestep,zzlay,pdteuv,pdtconduc,pdqdiff,&
     
    715use planetwide_mod, only: planetwide_sumval
    816USE mod_phys_lmdz_para, only: is_master,bcast
     17use moldiffcoeff_red_mod, only: moldiffcoeff_red
    918
    1019implicit none
    11 
    12 include "diffusion.h"
    1320
    1421! July 2014 JYC ADD BALISTIC Transport coupling to compute wup for H and H2
     
    320327
    321328! The number of diffusion layers is variable
    322 ! and fixed by the resolution (dzres) specified in diffusion.h
     329! and fixed by the resolution (dzres) specified as module variable
    323330! I fix a minimum  number of layers 40
    324331
     
    397404!       enddo
    398405
    399 ! The diffusion is computed above il0 computed from Pdiff in diffusion.h
     406! The diffusion is computed above il0 computed from Pdiff
     407! (defined above as module variable)
    400408! No change below il0
    401409       
     
    674682       if (i_d.ne.1000) call planetwide_sumval(PhiauxD,PhiEscD)
    675683
    676       return
    677       end
     684
     685end subroutine moldiff_red
    678686
    679687!    ********************************************************************
     
    780788      enddo
    781789
    782       end
     790      end subroutine tridagbloc
    783791
    784792      subroutine tridag(a,b,c,r,u,n)
     
    802810        u(j)=u(j)-gam(j+1)*u(j+1)
    80381112    continue
    804       return
    805       end
     812
     813      end subroutine tridag
    806814
    807815!    ********************************************************************
     
    841849        B(I)=SUM/A(I,I)
    84285014    CONTINUE
    843       RETURN
    844       END
     851
     852      END SUBROUTINE LUBKSB
    845853
    846854!    ********************************************************************
     
    927935      IF(A(N,N).EQ.0.)A(N,N)=TINY
    928936      ierr =0
    929       RETURN
    930       END
     937
     938      END SUBROUTINE LUDCMP
    931939
    932940        SUBROUTINE TMNEW(T1,DT1,DT2,DT3,T2,dtime,nl,ig)
     
    948956
    949957        ENDDO
    950         END
     958        END SUBROUTINE TMNEW
    951959
    952960        SUBROUTINE QMNEW(Q1,DQ,Q2,dtime,nl,nq,gc,ig)
     
    967975        ENDDO
    968976        ENDDO
    969         END
     977        END SUBROUTINE QMNEW
    970978
    971979        SUBROUTINE HSCALE(p,hp,nl)
     
    983991        hp(l)=-log(P(l+1)/P(l-1))
    984992        ENDDO
    985         END
     993        END SUBROUTINE HSCALE
    986994
    987995        SUBROUTINE MMOY(massemoy,mmol,qq,gc,nl,nq)
     
    10001008        enddo
    10011009
    1002         END
     1010        END SUBROUTINE MMOY
    10031011
    10041012        SUBROUTINE DMMOY(M,H,DM,nl)
     
    10141022        enddo
    10151023
    1016         END
     1024        END SUBROUTINE DMMOY
    10171025
    10181026        SUBROUTINE ZVERT(P,T,M,Z,nl,ig)
     
    10451053        enddo
    10461054
    1047         END
     1055        END SUBROUTINE ZVERT
    10481056
    10491057        SUBROUTINE RHOTOT(P,T,M,qq,rhoN,rhoK,nl,nq)
     
    10651073        enddo
    10661074
    1067         END
     1075        END SUBROUTINE RHOTOT
    10681076
    10691077        SUBROUTINE UPPER_RESOL(P,T,Z,M,R,Rk,                            &
     
    11561164        Praf(nl)=Nraf(nl)*kbolt*Traf(nl)
    11571165        Mraf(nl)=1D0/sum(Qraf(nl,:)/dble(mmol(gc(:))))
    1158         END
     1166        END SUBROUTINE UPPER_RESOL
    11591167
    11601168        SUBROUTINE CORRMASS(qq,qint,FacMass,nl,nq)
     
    11691177        enddo
    11701178
    1171         END     
     1179        END SUBROUTINE CORRMASS
    11721180
    11731181
     
    11991207        D(l)=(1D0-Nk(l,nn)/N(l))/interm
    12001208        enddo
    1201         END
     1209        END SUBROUTINE DCOEFF
    12021210 
    12031211        SUBROUTINE HSCALEREAL(nn,Nk,Dz,H,nl,nq)
     
    12281236!       enddo
    12291237
    1230         END
     1238        END SUBROUTINE HSCALEREAL
    12311239       
    12321240        SUBROUTINE VELVERT(nn,T,H,D,Dz,masse,W,nl)
     
    12591267!       enddo
    12601268
    1261         END
     1269        END SUBROUTINE VELVERT
    12621270
    12631271        SUBROUTINE TIMEDIFF(nn,H,W,TIME,nl)
     
    12731281        ENDDO
    12741282
    1275         END
     1283        END SUBROUTINE TIMEDIFF
    12761284
    12771285
     
    13371345!       stop
    13381346
    1339         END
     1347        END SUBROUTINE DIFFPARAM
    13401348
    13411349
     
    13731381
    13741382
    1375         END
     1383        END SUBROUTINE MATCOEFF
    13761384
    13771385        SUBROUTINE Checkmass(X,Y,nl,nn)
     
    13881396        print*,'no conservation for mass',Xtot,Ytot,nn
    13891397        endif
    1390         END
     1398        END SUBROUTINE Checkmass
    13911399
    13921400        SUBROUTINE Checkmass2(qold,qnew,P,il,nl,nn,nq)
     
    14101418        ENDIF
    14111419
    1412         END
     1420        END SUBROUTINE Checkmass2
    14131421
    14141422        SUBROUTINE GCMGRID_P(Z,P,Q,T,Nk,Rk,qq,qnew,tt,tnew,             &
     
    15111519        enddo
    15121520
    1513         END
     1521        END SUBROUTINE GCMGRID_P
    15141522
    15151523        SUBROUTINE GCMGRID_P2(Z,P,Q,T,Nk,Rk,qq,qnew,tt,tnew             &
     
    16131621        enddo
    16141622
    1615         END
     1623        END SUBROUTINE GCMGRID_P2
    16161624       
     1625
     1626END MODULE moldiff_red_mod
  • trunk/LMDZ.MARS/libf/aeronomars/moldiffcoeff_red.F

    r2615 r3015  
     1      MODULE moldiffcoeff_red_mod
     2     
     3      IMPLICIT NONE
     4     
     5      CONTAINS
     6
    17      subroutine moldiffcoeff_red(dij,indic,gcmind,ncompdiff2)
    28
     
    1218c
    1319c=======================================================================
    14 #include "callkeys.h"
    15 #include "diffusion.h"
     20      include "callkeys.h"
    1621
    1722c-----------------------------------------------------------------------
     
    294299      endif
    295300
    296 
    297       return   
    298       end
     301      end subroutine moldiffcoeff_red
    299302     
     303      END MODULE moldiffcoeff_red_mod
  • trunk/LMDZ.MARS/libf/aeronomars/thermosphere.F

    r2823 r3015  
     1      MODULE thermosphere_mod
     2     
     3      IMPLICIT NONE
     4     
     5      CONTAINS
     6     
    17      subroutine thermosphere(ngrid,nlayer,nq,
    28     &     pplev,pplay,dist_sol,
     
    612     $     PhiEscH,PhiEscH2,PhiEscD)
    713
     14      use moldiff_red_mod, only: moldiff_red
    815      use conc_mod, only: rnew, cpnew
    916      USE comcstfi_h, only: r, cpp
     
    8289      endif
    8390
    84       end
     91      end subroutine thermosphere
    8592
     93      END MODULE thermosphere_mod
    8694
  • trunk/LMDZ.MARS/libf/phymars/physiq_mod.F

    r3013 r3015  
    2626      use nltecool_mod, only: nltecool
    2727      use nlte_tcool_mod, only: nlte_tcool
     28      use thermosphere_mod, only: thermosphere
    2829      use tracer_mod, only: noms, mmol, igcm_co2, igcm_n2, igcm_co2_ice,
    2930     &                      igcm_co, igcm_o, igcm_h2o_vap, igcm_h2o_ice,
Note: See TracChangeset for help on using the changeset viewer.