Changeset 470


Ignore:
Timestamp:
Dec 13, 2011, 12:15:50 PM (13 years ago)
Author:
aslmd
Message:

LMDZ.GENERIC

12/12/2011 == AS

  • Use of allocatable arrays to set corrk stuff through reading *.dat files, without the need to change radinc_h manually.
  • Allocation is done in sugas_corrk which is within firstcall loop in callcorrk.
  • Note that N_LGAUSS is still a parameter. It is not supposed to change much.
  • Compiles fine. Tested with debugging options through pgdbg. Runs fine. Exact same results in Early Mars test case.

Modified files:
M 469 libf/phystd/physiq.F90
M 469 libf/phystd/sugas_corrk.F90
M 469 libf/phystd/callcorrk.F90
M 469 libf/phystd/radinc_h.F90
M 469 libf/phystd/radcommon_h.F90

Location:
trunk/LMDZ.GENERIC
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.GENERIC/README

    r426 r470  
    552552  libraries before compilation, which enforces that the gcm will fail to
    553553  compile if any routine failed to compile.
     554
     555== 12/12/2011 == AS
     556- Use of allocatable arrays to set corrk stuff through reading *.dat files, without the need to change radinc_h manually.
     557- Allocation is done in sugas_corrk which is within firstcall loop in callcorrk.
     558- Note that N_LGAUSS is still a parameter. It is not supposed to change much.
     559- Compiles fine. Tested with debugging options through pgdbg. Runs fine. Exact same results in Early Mars test case.
     560
     561Modified files:
     562M              469   libf/phystd/physiq.F90
     563M              469   libf/phystd/sugas_corrk.F90
     564M              469   libf/phystd/callcorrk.F90
     565M              469   libf/phystd/radinc_h.F90
     566M              469   libf/phystd/radcommon_h.F90
  • trunk/LMDZ.GENERIC/libf/phystd/callcorrk.F90

    r374 r470  
    892892      endif
    893893
     894      !!! see physiq.F for explanations about CLFvarying. This is temporary.
     895      if (lastcall .and. .not.CLFvarying) then
     896        IF( ALLOCATED( gasi ) ) DEALLOCATE( gasi )
     897        IF( ALLOCATED( gasv ) ) DEALLOCATE( gasv )
     898        IF( ALLOCATED( pgasref ) ) DEALLOCATE( pgasref )
     899        IF( ALLOCATED( tgasref ) ) DEALLOCATE( tgasref )
     900        IF( ALLOCATED( wrefvar ) ) DEALLOCATE( wrefvar )
     901        IF( ALLOCATED( pfgasref ) ) DEALLOCATE( pfgasref )
     902      endif
     903
    894904    end subroutine callcorrk
  • trunk/LMDZ.GENERIC/libf/phystd/physiq.F90

    r368 r470  
    724724              if(CLFvarying)then
    725725
     726               !!! THIS IS NOT A VERY GOOD STRATEGY HERE (everything should be in callcorrk)
     727               !!! ---> PROBLEMS WITH ALLOCATED ARRAYS
     728               !!! (temporary solution in callcorrk: do not deallocate if CLFvarying ...)
     729
    726730                 clearsky=.true.
    727731                 call callcorrk(ngrid,nlayer,pq,nq,qsurf,           &
  • trunk/LMDZ.GENERIC/libf/phystd/radcommon_h.F90

    r135 r470  
    7272      REAL*8 blamv(L_NSPECTV+1) ! these are needed by suaer.F90
    7373
    74       real*8 gasi(L_NTREF,L_PINT,L_REFVAR,L_NSPECTI,L_NGAUSS)
    75       real*8 gasv(L_NTREF,L_PINT,L_REFVAR,L_NSPECTV,L_NGAUSS)
     74      !!! ALLOCATABLE STUFF SO THAT DIMENSIONS ARE READ in *.dat FILES -- AS 12/2011 
     75      REAL*8, DIMENSION(:,:,:,:,:), ALLOCATABLE :: gasi, gasv
     76      REAL*8, DIMENSION(:), ALLOCATABLE :: PGASREF, TGASREF, WREFVAR, PFGASREF
    7677      real*8 FZEROI(L_NSPECTI)
    7778      real*8 FZEROV(L_NSPECTV)
    78       real*8 PGASREF(L_NPREF), TGASREF(L_NTREF)
    7979      real*8 pgasmin, pgasmax
    8080      real*8 tgasmin, tgasmax
     
    8888      real gir(L_NSPECTI,naerkind,nsizemax)
    8989
    90       real*8 WREFVAR(L_REFVAR)
    9190
    9291! Reference wavelengths used to compute reference optical depth (m)
     
    119118
    120119      real*8 PTOP, TAUREF(L_LEVELS+1)
    121       real*8 pfgasref(L_PINT) ! finer reference grid for some reason
    122120
    123121      real*8, parameter :: UBARI = 0.5D0
  • trunk/LMDZ.GENERIC/libf/phystd/radinc_h.F90

    r368 r470  
    6060      integer, parameter :: L_NLEVRAD  = llm+1
    6161
    62 !     Below are various parameter combinations that will work for the
    63 !     radiative datasets indicated. For the moment, you must change these
    64 !     values manually before compiling, each time you want to change the
    65 !     dataset.
    66  
     62      !!!! THIS IS SET IN sugas_corrk
     63      !!!! [use of allocatable arrays] -- AS 12/2011
     64      integer :: L_NPREF, L_NTREF, L_REFVAR, L_PINT
     65
     66!!! THIS ONE DOES NOT CHANGE MUCH... IT CAN BE REGARDED AS A CONSTANT.
    6767      integer, parameter :: L_NGAUSS  = 17
    68 
    69       integer, parameter :: L_NPREF   = 9
    70       integer, parameter :: L_NTREF   = 7
    71       integer, parameter :: L_REFVAR  = 7   ! earth / earlymars
    72 !      ! CO2_H2Ovar / N2OCO2rich_H2Ovar / N2OCO2poor_H2Ovar
    73 !       integer, parameter :: L_REFVAR = 4    ! N2_CH4
    74 
    75 !      integer, parameter :: L_NPREF   = 8
    76 !      integer, parameter :: L_NTREF   = 11
    77 !      integer, parameter :: L_REFVAR  = 8   ! N2_H2Ovar
    78 
    79 !      integer, parameter :: L_NPREF   = 8
    80 !      integer, parameter :: L_NTREF   = 5
    81 !      integer, parameter :: L_REFVAR  = 1   ! therm_test2
    82 
    83 !      integer, parameter :: L_NPREF   = 12
    84 !      integer, parameter :: L_NTREF   = 20
    85 !      integer, parameter :: L_REFVAR  = 1   ! null (for H2 etc.)
    86 
    87 !      integer, parameter :: L_NPREF   = 10
    88 !      integer, parameter :: L_NTREF   = 5
    89 !      integer, parameter :: L_REFVAR  = 7   ! N2_CO2var
    90 
    91 !      integer, parameter :: L_NPREF   = 8
    92 !      integer, parameter :: L_NTREF   = 6
    93 !      integer, parameter :: L_REFVAR  = 1   ! pureCO2
    94 
    95 !      integer, parameter :: L_NPREF   = 7
    96 !      integer, parameter :: L_NTREF   = 5
    97 !      integer, parameter :: L_REFVAR  = 1   ! degraded_pure
    98 
    99 !      integer, parameter :: L_NPREF   = 9
    100 !      integer, parameter :: L_NTREF   = 14
    101 !      integer, parameter :: L_REFVAR  = 1   ! megaCO2
    10268
    10369      integer, parameter :: L_NSPECTI = NBinfrared
    10470      integer, parameter :: L_NSPECTV = NBvisible
    10571
    106       integer, parameter :: L_PINT    = (L_NPREF-1)*5+1
    10772      integer, parameter :: NAERKIND  = 2
    10873      real,    parameter :: L_TAUMAX  = 35
  • trunk/LMDZ.GENERIC/libf/phystd/sugas_corrk.F90

    r374 r470  
    3434
    3535      integer n, nt, np, nh, ng, nw, m, i
    36       integer L_NGAUSScheck, L_NPREFcheck, L_NTREFcheck, L_REFVARcheck
     36      integer L_NGAUSScheck
    3737
    3838      character(len=100) :: file_id
    3939      character(len=300) :: file_path
    4040
    41       real*8 gasi8(L_NTREF,L_NPREF,L_REFVAR,L_NSPECTI,L_NGAUSS)
    42       real*8 gasv8(L_NTREF,L_NPREF,L_REFVAR,L_NSPECTV,L_NGAUSS)
     41      !! ALLOCATABLE ARRAYS -- AS 12/2011
     42      REAL*8, DIMENSION(:,:,:,:,:), ALLOCATABLE :: gasi8, gasv8
    4343
    4444      real*8 x, xi(4), yi(4), ans, p
     
    103103      enddo
    104104
    105       ! check the array size is correct, load the coefficients
    106       open(111,file=file_path(1:LEN_TRIM(file_path)),form='formatted')
    107       read(111,*) L_REFVARcheck
    108       if(.not.(L_REFVARcheck.eq.L_REFVAR)) then   
    109          print*,   L_REFVARcheck
    110          print*,   L_REFVAR
    111          print*,'The size of your radiative transfer mixing ratio array does '
    112          print*,'not match the value given in Q.dat, exiting.'
    113          print*,'Check the value of L_NREFVAR in radinc_h.F90.'
    114          call abort
    115       endif
     105      ! GET array size, load the coefficients
     106      open(111,file=TRIM(file_path),form='formatted')
     107      read(111,*) L_REFVAR
     108      IF( .NOT. ALLOCATED( wrefvar ) ) ALLOCATE( WREFVAR(L_REFVAR) )
    116109      read(111,*) wrefvar
    117110      close(111)
     
    165158      read(111,*) gweight
    166159      close(111)
    167 
     160 
    168161      ! display the values
    169162      print*,'Correlated-k g-space grid:'
     
    194187         call abort
    195188      endif
    196       
    197       ! check the array size is correct, load the coefficients
     189     
     190      ! GET array size, load the coefficients
    198191      open(111,file=TRIM(file_path),form='formatted')
    199       read(111,*) L_NPREFcheck
    200       if(.not.(L_NPREFcheck.eq.L_NPREF)) then
    201          print*,'The size of your radiative transfer pressure array does '
    202          print*,'not match the value given in p.dat, exiting.'
    203          call abort
    204       endif
     192      read(111,*) L_NPREF
     193      IF( .NOT. ALLOCATED( pgasref ) ) ALLOCATE( PGASREF(L_NPREF) )
    205194      read(111,*) pgasref
    206195      close(111)
     196      L_PINT = (L_NPREF-1)*5+1
     197      IF( .NOT. ALLOCATED( pfgasref ) ) ALLOCATE( PFGASREF(L_PINT) )
     198
    207199
    208200      ! display the values
     
    244236      endif
    245237
    246       ! check the array size is correct, load the coefficients
     238      ! GET array size, load the coefficients
    247239      open(111,file=TRIM(file_path),form='formatted')
    248       read(111,*) L_NTREFcheck
    249       if(.not.(L_NTREFcheck.eq.L_NTREF)) then
    250          print*,'The size of your radiative transfer temperature array does '
    251          print*,'not match the value given in T.dat, exiting.'
    252          call abort
    253       endif
     240      read(111,*) L_NTREF
     241      IF( .NOT. ALLOCATED( tgasref ) ) ALLOCATE( TGASREF(L_NTREF) )
    254242      read(111,*) tgasref
    255243      close(111)
     
    264252      tgasmin = tgasref(1)
    265253      tgasmax = tgasref(L_NTREF)
     254
     255
     256!-----------------------------------------------------------------------
     257!-----------------------------------------------------------------------
     258! ALLOCATE THE MULTIDIM ARRAYS IN radcommon_h
     259      PRINT *, L_NTREF,L_NPREF,L_REFVAR
     260      IF( .NOT. ALLOCATED( gasi8 ) ) ALLOCATE( gasi8(L_NTREF,L_NPREF,L_REFVAR,L_NSPECTI,L_NGAUSS) )
     261      IF( .NOT. ALLOCATED( gasv8 ) ) ALLOCATE( gasv8(L_NTREF,L_NPREF,L_REFVAR,L_NSPECTV,L_NGAUSS) )
     262      IF( .NOT. ALLOCATED( gasi ) ) ALLOCATE( gasi(L_NTREF,L_PINT,L_REFVAR,L_NSPECTI,L_NGAUSS) )
     263      IF( .NOT. ALLOCATED( gasv ) ) ALLOCATE( gasv(L_NTREF,L_PINT,L_REFVAR,L_NSPECTV,L_NGAUSS) )
     264!-----------------------------------------------------------------------
     265!-----------------------------------------------------------------------
     266
     267
    266268
    267269!=======================================================================
     
    308310         read(111,*) gasi8
    309311         close(111)
    310       
     312     
    311313         do nw=1,L_NSPECTI
    312314            fzeroi(nw) = 0.
     
    530532      enddo
    531533
     534      !!! DEALLOCATE LOCAL ARRAYS
     535      IF( ALLOCATED( gasi8 ) ) DEALLOCATE( gasi8 )
     536      IF( ALLOCATED( gasv8 ) ) DEALLOCATE( gasv8 )
     537      IF( ALLOCATED( pgasref ) ) DEALLOCATE( pgasref )
     538
     539
    532540      return
    533541    end subroutine sugas_corrk
Note: See TracChangeset for help on using the changeset viewer.