source: trunk/LMDZ.MARS/libf/phymars/thermcell_dqup.F90 @ 1242

Last change on this file since 1242 was 1212, checked in by aslmd, 11 years ago

LMDZ.MARS + MESOSCALE

A quite major commit, at least for MESOSCALE.
In a word: any ngrid deserves to be free.

  • no need to recompile when changing number of horizontal grid points or number of processors
  • latest version of LMDZ.MARS physics can be used
  • WARNING! Nesting is still yet to be fixed (since r1027)

Also some small bug fixes to LMDZ.MARS.

Changes in LMDZ.MARS


--> fixed a potential bug in thermal plume model because zlmax was computed both in thermcell_main_mars and calltherm_interface... so made it an OUT argument of calltherm_interface. also: changed the name to limz. and added precompiling flags to avoid the use of planetwide in MESOSCALE. in MESOSCALE we just go high enough (nlayer-5) and do not care about computational cost (although we certainly gain from not using MAXVAL).
--> moved allocations upward in inifis. does not change anything for GCM, but make MESOSCALE modifications simpler, and overall make inifis better organized: first allocations, then reading callphys.def file.
--> added precompiling flags around lines that are both useless for MESOSCALE (notably I/O) and recently adapted to parallel computations in the GCM
--> tidied up what is MESOSCALE vs. GCM in surfini

Changes in MESOSCALE


--> changed makemeso to allow dynamically set nx ny nprocs
--> changed makemeso to remove links to Fortran code adapted to parallel GCM and useless for mesoscale
--> changed ngridmx to ngrid in inifis includes

  • Property svn:executable set to *
File size: 3.5 KB
RevLine 
[337]1!=======================================================================
[1033]2! THERMCELL_DQUP
3!=======================================================================
[337]4!
[1028]5!   Compute the thermals contribution of explicit thermals
6!   to vertical transport in the PBL.
7!   dq is computed once upward, entrainment and detrainment mass fluxes
8!   are known.
[628]9!
10!   Version with sub-timestep for Martian thin layers
11!
[337]12!=======================================================================
[1033]13! Author : A. Colaitis 2011-01-05 (with updates 2011-2013)
14! Institution : Laboratoire de Meteorologie Dynamique (LMD) Paris, France
15! -----------------------------------------------------------------------
16! Corresponding author : A. Spiga aymeric.spiga_AT_upmc.fr
17! -----------------------------------------------------------------------
18! Reference paper:
19! A. Colaïtis, A. Spiga, F. Hourdin, C. Rio, F. Forget, and E. Millour.
20! A thermal plume model for the Martian convective boundary layer.
21! Journal of Geophysical Research (Planets), 118:1468-1487, July 2013.
22! http://dx.doi.org/10.1002/jgre.20104
23! http://arxiv.org/abs/1306.6215
24! -----------------------------------------------------------------------
[337]25
[1033]26      subroutine thermcell_dqup(ngrid,nlayer,ptimestep,fm,entr,detr,  &
[1212]27     &    masse0,q_therm,dq_therm,ndt,limz)
[1033]28      implicit none
29
[337]30! ============================ INPUTS ============================
31
[1028]32      INTEGER, INTENT(IN) :: ngrid,nlayer ! number of grid points and number of levels
33      REAL, INTENT(IN) :: ptimestep ! timestep (s)
[1032]34      REAL, INTENT(IN) :: fm(ngrid,nlayer+1) ! upward mass flux
35      REAL, INTENT(IN) :: entr(ngrid,nlayer) ! entrainment mass flux
36      REAL, INTENT(IN) :: detr(ngrid,nlayer) ! detrainment mass flux
37      REAL, INTENT(IN) :: q_therm(ngrid,nlayer) ! initial profil of q
38      REAL, INTENT(IN) :: masse0(ngrid,nlayer) ! mass of cells
[1028]39      INTEGER, INTENT(IN) :: ndt ! number of subtimesteps
[1212]40      INTEGER, INTENT(IN) :: limz ! index of maximum layer
[337]41
42! ============================ OUTPUTS ===========================
43
[1032]44      REAL, INTENT(OUT) :: dq_therm(ngrid,nlayer)  ! dq/dt -> derivative
[337]45
46! ============================ LOCAL =============================
47
[1032]48      REAL q(ngrid,nlayer)
49      REAL qa(ngrid,nlayer)
[628]50      INTEGER ig,k,i
[1032]51      REAL invflux0(ngrid,nlayer)
[628]52      REAL ztimestep
[621]53
[337]54! =========== Init ==============================================
55
[1028]56      qa(:,:)=q_therm(:,:) !q profile in the updraft
57      q(:,:)=q_therm(:,:) !mean q profile
[337]58
[628]59! ====== Computing q ============================================
[1028]60! Based on equation 14 in appendix 4.2
[621]61
[628]62      dq_therm(:,:)=0.
63      ztimestep=ptimestep/real(ndt)
64      invflux0(:,:)=ztimestep/masse0(:,:)     
[621]65
[1028]66      do i=1,ndt !subtimestep loop
[628]67
[1028]68        do ig=1,ngrid
69           qa(ig,1)=q(ig,1)
70       enddo
[621]71
[1212]72        do k=2,limz
[1032]73           do ig=1,ngrid
[1028]74              if ((fm(ig,k+1)+detr(ig,k))*ptimestep.gt.  &
75     &        1.e-5*masse0(ig,k)) then
76                 qa(ig,k)=(fm(ig,k)*qa(ig,k-1)+entr(ig,k)*q(ig,k))  &
77     &           /(fm(ig,k+1)+detr(ig,k))
78              else
79                 qa(ig,k)=q(ig,k)
80              endif
81           enddo
82        enddo
[337]83
[1212]84        do k=1,limz
[1028]85          q(:,k)=q(:,k)+         &
86     &    (detr(:,k)*qa(:,k)-entr(:,k)*q(:,k) &
[628]87     &    -fm(:,k)*q(:,k)+fm(:,k+1)*q(:,k+1))  &
[1028]88     &    *invflux0(:,k)
89        enddo
[619]90
[628]91      enddo !of do i=1,ndt
[337]92
[628]93! ====== Derivative ==============================================
[621]94
[1212]95         do k=1,limz
[621]96          dq_therm(:,k)=(q(:,k)-q_therm(:,k))/ptimestep
97         enddo
[337]98
[628]99! ==============
100
[337]101      return
102      end
[628]103
Note: See TracBrowser for help on using the repository browser.