Changeset d7935de in flexpart.git for src/readoutgrid_nest.f90


Ignore:
Timestamp:
Sep 11, 2018, 6:06:31 PM (6 years ago)
Author:
pesei <petra seibert at univie ac at>
Branches:
univie
Children:
93786a1
Parents:
34f1452
Message:

modify most input read subroutines

changed some variable names (mostly for I-N reasons)
includes two names appearing also in timemanager, com_mod
corrected a few mistakes
simplified some parts of code
changed options/RELEASES which is in nml fmt correspondingly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/readoutgrid_nest.f90

    r8a65cb0 rd7935de  
    2929  !                                                                            *
    3030  !     4 June 1996                                                            *
     31  !     HSO, 1 July 2014: Add optional namelist input                          *
     32  !     PS, 6/2015-9/2018: read regular input with free format                 *
     33  !       and rename some variables                                            *
    3134  !                                                                            *
    3235  !*****************************************************************************
     
    5356  real,parameter :: eps=1.e-4
    5457
    55   integer :: readerror
     58  integer :: ios
    5659
    57   ! declare namelist
    58   namelist /outgridn/ &
    59     outlon0n,outlat0n, &
    60     numxgridn,numygridn, &
    61     dxoutn,dyoutn
     60! declare namelist
     61  namelist /nml_outgridn/ &
     62    outlon0n,outlat0n,numxgridn,numygridn,dxoutn,dyoutn
    6263
    6364  ! helps identifying failed namelist input
     
    6768  !**********************************************************
    6869
    69   open(unitoutgrid,file=path(1)(1:length(1))//'OUTGRID_NEST',form='formatted',status='old',err=999)
     70  open(unitoutgrid,file=path(1)(1:length(1))//'OUTGRID_NEST',form='formatted',&
     71    status='old',err=999)
    7072
    7173  ! try namelist input
    72   read(unitoutgrid,outgridn,iostat=readerror)
     74  read(unitoutgrid,nml_outgridn,iostat=ios)
    7375  close(unitoutgrid)
    7476
    75   if ((dxoutn.le.0).or.(readerror.ne.0)) then
     77  if (dxoutn.le.0 .or.ios.ne.0) then
    7678
    77     open(unitoutgrid,file=path(1)(1:length(1))//'OUTGRID_NEST',status='old',err=999)
     79    open(unitoutgrid,file=path(1)(1:length(1))//'OUTGRID_NEST',status='old',&
     80      err=999)
    7881    call skplin(5,unitoutgrid)
    7982
    80     ! 1. Read horizontal grid specifications
    81     !****************************************
     83  ! Read horizontal grid specifications
     84  ! ***********************************
    8285
    8386    call skplin(3,unitoutgrid)
    84     read(unitoutgrid,'(4x,f11.4)') outlon0n
     87    read(unitoutgrid,*) outlon0n
    8588    call skplin(3,unitoutgrid)
    86     read(unitoutgrid,'(4x,f11.4)') outlat0n
     89    read(unitoutgrid,*) outlat0n
    8790    call skplin(3,unitoutgrid)
    88     read(unitoutgrid,'(4x,i5)') numxgridn
     91    read(unitoutgrid,*) numxgridn
    8992    call skplin(3,unitoutgrid)
    90     read(unitoutgrid,'(4x,i5)') numygridn
     93    read(unitoutgrid,*) numygridn
    9194    call skplin(3,unitoutgrid)
    92     read(unitoutgrid,'(4x,f12.5)') dxoutn
     95    read(unitoutgrid,*) dxoutn
    9396    call skplin(3,unitoutgrid)
    94     read(unitoutgrid,'(4x,f12.5)') dyoutn
     97    read(unitoutgrid,*) dyoutn
    9598
    9699    close(unitoutgrid)
     
    99102  ! write outgrid_nest file in namelist format to output directory if requested
    100103  if (nmlout.and.lroot) then
    101     open(unitoutgrid,file=path(2)(1:length(2))//'OUTGRID_NEST.namelist',err=1000)
    102     write(unitoutgrid,nml=outgridn)
     104    open(unitoutgrid,file=path(2)(1:length(2))//'OUTGRID_NEST.namelist',&
     105      err=1000)
     106    write(unitoutgrid,nml=nml_outgridn)
    103107    close(unitoutgrid)
    104108  endif
    105109
    106   allocate(orooutn(0:numxgridn-1,0:numygridn-1),stat=stat)
    107   if (stat.ne.0) write(*,*)'ERROR: could not allocate orooutn'
    108   allocate(arean(0:numxgridn-1,0:numygridn-1),stat=stat)
    109   if (stat.ne.0) write(*,*)'ERROR: could not allocate arean'
    110   allocate(volumen(0:numxgridn-1,0:numygridn-1,numzgrid),stat=stat)
    111   if (stat.ne.0) write(*,*)'ERROR: could not allocate volumen'
     110  allocate(orooutn(0:numxgridn-1,0:numygridn-1),stat=ios)
     111  if (ios.ne.0) write(*,*)'ERROR: could not allocate orooutn'
     112  allocate(arean(0:numxgridn-1,0:numygridn-1),stat=ios)
     113  if (ios.ne.0) write(*,*)'ERROR: could not allocate arean'
     114  allocate(volumen(0:numxgridn-1,0:numygridn-1,numzgrid),stat=ios)
     115  if (ios.ne.0) write(*,*)'ERROR: could not allocate volumen'
    112116
    113117  ! Check validity of output grid (shall be within model domain)
     
    118122  xr1=xlon0+real(nxmin1)*dx
    119123  yr1=ylat0+real(nymin1)*dy
    120   if ((outlon0n+eps.lt.xlon0).or.(outlat0n+eps.lt.ylat0) &
    121        .or.(xr.gt.xr1+eps).or.(yr.gt.yr1+eps)) then
     124  if (outlon0n+eps.lt.xlon0 .or. outlat0n+eps.lt.ylat0 &
     125    .or. xr.gt.xr1+eps .or. yr.gt.yr1+eps) then
    122126    write(*,*) ' #### FLEXPART MODEL ERROR! PART OF OUTPUT    ####'
    123127    write(*,*) ' #### NEST IS OUTSIDE MODEL DOMAIN. CHANGE    ####'
    124128    write(*,*) ' #### FILE OUTGRID IN DIRECTORY               ####'
    125     write(*,'(a)') path(1)(1:length(1))
     129    write(*,'(a)') trim(path(1))
    126130    stop
    127131  endif
     
    133137999 write(*,*) ' #### FLEXPART MODEL ERROR! FILE "OUTGRID"    #### '
    134138  write(*,*) ' #### CANNOT BE OPENED IN THE DIRECTORY       #### '
    135   write(*,'(a)') path(1)(1:length(1))
     139  write(*,'(a)') trim(path(1))
    136140  stop
    137141
    1381421000 write(*,*) ' #### FLEXPART MODEL ERROR! FILE "OUTGRID"    #### '
    139143  write(*,*) ' #### CANNOT BE OPENED IN THE DIRECTORY       #### '
    140   write(*,'(a)') path(2)(1:length(2))
     144  write(*,'(a)') trim(path(2))
    141145  stop
    142146
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG