Changeset 710 for trunk/LMDZ.MARS/libf


Ignore:
Timestamp:
Jun 28, 2012, 10:02:21 AM (13 years ago)
Author:
emillour
Message:

Mars GCM:

  • Decreased time step for molecular diffusion (diffusion.h) for better stability
  • Added test in moldiff_red.F90 to enforce that the system can't be stuck in an infinite loop.
  • The creation and output of coefficients in file 'coeffs.dat' in moldiff_red.F is now controled by an internal flag (by default set to false).

JYC + EM

Location:
trunk/LMDZ.MARS/libf/aeronomars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/libf/aeronomars/diffusion.h

    r645 r710  
    1010
    1111      parameter (Pdiff=15.)      ! pressure below which diffusion is computed
    12       parameter (tdiffmin=10d0)
     12      parameter (tdiffmin=5d0)
    1313      parameter (dzres=2d0)      ! grid resolution (km) for diffusion
    1414     
  • trunk/LMDZ.MARS/libf/aeronomars/moldiff_red.F90

    r658 r710  
    9797      integer,save :: ncompdiff
    9898      integer,dimension(:),allocatable,save :: gcmind ! array of GCM indexes
    99       integer ierr
     99      integer ierr,compteur
    100100
    101101      logical,save :: firstcall=.true.
     
    312312
    313313        CALL GCMGRID_P(Zraf,Praf,Qraf,Traf,Nrafk,Rrafk,qq,qint,tt,tint  &
    314      &    ,pp,mmol,gcmind,nlraf,ncompdiff,nlayermx)
     314     &    ,pp,mmol,gcmind,nlraf,ncompdiff,nlayermx,ig)
    315315
    316316! We compute the mass correction factor of each specie at each pressure level
     
    554554
    555555        CALL GCMGRID_P2(Zraf,Praf,Qraf,Traf,Nrafk,Rrafk,qq,qnew,tt,tnew,&
    556      &   pp,mmol,gcmind,nlraf,ncompdiff,nlayermx,FacMass)
     556     &   pp,mmol,gcmind,nlraf,ncompdiff,nlayermx,FacMass,ig)
    557557
    558558        CALL RHOTOT(pp,tt,massemoy,qnew,RHOT,RHOK,nlayermx,ncompdiff)
     
    561561        do l=il0,nlayermx
    562562        write(*,'(i2,1x,19(e12.4,1x))') l,zz(l),tt(l),RHOK(l,1)/sum(RHOK(l,:)),RHOKINIT(l,1)/sum(RHOKINIT(l,:)),&
     563     &  RHOK(l,2)/sum(RHOK(l,:)),RHOKINIT(l,2)/sum(RHOKINIT(l,:)),&
     564     &  RHOK(l,6)/sum(RHOK(l,:)),RHOKINIT(l,6)/sum(RHOKINIT(l,:)),&
    563565     &  RHOK(l,5)/sum(RHOK(l,:)),RHOKINIT(l,5)/sum(RHOKINIT(l,:)),&
    564      &  RHOK(l,3)/sum(RHOK(l,:)),RHOKINIT(l,3)/sum(RHOKINIT(l,:)),&
    565      &  RHOK(l,6)/sum(RHOK(l,:)),RHOKINIT(l,6)/sum(RHOKINIT(l,:)),&
    566566     &  RHOK(l,7)/sum(RHOK(l,:)),RHOKINIT(l,7)/sum(RHOKINIT(l,:))
    567567        enddo
     
    13521352
    13531353        SUBROUTINE GCMGRID_P(Z,P,Q,T,Nk,Rk,qq,qnew,tt,tnew,             &
    1354      &    pp,M,gc,nl,nq,nlx)
     1354     &    pp,M,gc,nl,nq,nlx,ig)
    13551355        IMPLICIT NONE
    13561356#include "dimensions.h"
    1357         INTEGER :: nl,nq,nlx,il,nn,iP
     1357        INTEGER :: nl,nq,nlx,il,nn,iP,ig,compteur
    13581358        INTEGER,DIMENSION(1) :: indP
    13591359        INTEGER,DIMENSION(nq) :: gc
     
    14121412        Pnew2=Pnew
    14131413
     1414        compteur=0
    14141415        do while (pnew2 .ge. pp(il))   
     1416        compteur=compteur+1
    14151417        do nn=1,nq
    14161418        Hi=Konst*T(nl)/dble(M(gc(nn)))/g
     
    14211423        Znew=Znew2
    14221424        Znew2=Znew2+Dz
     1425        if (compteur .ge. 100000) then
     1426        print*,'error moldiff_red infinite loop'
     1427        print*,ig,il,pp(il),tt(nl),pnew2,qnew(il,:),Znew2
     1428        stop
     1429        endif
    14231430!       print*,'test',Pnew2,Znew2,Nnew(nq),pp(il)
    14241431        enddo
     
    14461453
    14471454        SUBROUTINE GCMGRID_P2(Z,P,Q,T,Nk,Rk,qq,qnew,tt,tnew             &
    1448      &   ,pp,M,gc,nl,nq,nlx,facM)
     1455     &   ,pp,M,gc,nl,nq,nlx,facM,ig)
    14491456        IMPLICIT NONE
    14501457#include "dimensions.h"
    1451         INTEGER :: nl,nq,nlx,il,nn,iP
     1458        INTEGER :: nl,nq,nlx,il,nn,iP,ig,compteur
    14521459        INTEGER,DIMENSION(1) :: indP
    14531460        INTEGER,DIMENSION(nq) :: gc
     
    15051512        Pnew2=Pnew
    15061513
     1514        compteur=0
    15071515        do while (pnew2 .ge. pp(il))   
     1516        compteur=compteur+1
    15081517        do nn=1,nq
    15091518        Hi=Konst*T(nl)/dble(M(gc(nn)))/g
     
    15141523        Znew=Znew2
    15151524        Znew2=Znew2+Dz
     1525        if (compteur .ge. 100000) then
     1526        print*,'pb moldiff_red infinite loop'
     1527        print*,ig,nl,T(nl),pnew2,qnew(il,:),Znew2
     1528        stop
     1529        endif
     1530
    15161531!       print*,'test',Pnew2,Znew2,Nnew(nq),pp(il)
    15171532        enddo
  • trunk/LMDZ.MARS/libf/aeronomars/moldiffcoeff_red.F

    r645 r710  
    8787      real dnh
    8888      logical,save :: firstcall=.true.
     89      logical,parameter :: outputcoeffs=.false. ! to output 'coeffs.dat' file,
     90                                                ! set outputcoeffs=.true.
    8991
    9092! Initializations at first call (and some sanity checks)
     
    253255        if (noms(n) .eq. 'o') g_o=n
    254256        enddo
    255         print*,'gh2',g_h2,g_h,g_o
    256 
    257        print*,'moldiffcoef: COEFF CALC'
    258        open(56,file='coeffs.dat',status='unknown')
     257        print*,'moldiffcoeff_red: gh2',g_h2,g_h,g_o
     258
     259       print*,'moldiffcoeff_red: COEFF CALC'
     260
    259261      do n=1,ncompdiff2
    260262        dijref=0.
     
    283285      enddo
    284286
    285       do n=1,ncompdiff2
     287      if (outputcoeffs) then
     288       ! output coefficients in 'coeffs.dat' file
     289       open(56,file='coeffs.dat',status='unknown')
     290       do n=1,ncompdiff2
    286291        do nn=n,ncompdiff2
    287292          write(56,*) n,nn,dij(n,nn)    !*1.e5/1.381e-23/(273**1.75)
    288293        enddo
    289       enddo
    290       close(56)
     294       enddo
     295       close(56)
     296      endif
    291297
    292298
Note: See TracChangeset for help on using the changeset viewer.