readOHfield.f90 4.57 KB
Newer Older
Matthias Langer's avatar
 
Matthias Langer committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
!**********************************************************************
! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010         *
! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa,             *
! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann   *
!                                                                     *
! This file is part of FLEXPART.                                      *
!                                                                     *
! FLEXPART is free software: you can redistribute it and/or modify    *
! it under the terms of the GNU General Public License as published by*
! the Free Software Foundation, either version 3 of the License, or   *
! (at your option) any later version.                                 *
!                                                                     *
! FLEXPART is distributed in the hope that it will be useful,         *
! but WITHOUT ANY WARRANTY; without even the implied warranty of      *
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the       *
! GNU General Public License for more details.                        *
!                                                                     *
! You should have received a copy of the GNU General Public License   *
! along with FLEXPART.  If not, see <http://www.gnu.org/licenses/>.   *
!**********************************************************************

subroutine readOHfield

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
!*****************************************************************************
!                                                                            *
! Reads the OH field into memory                                             *
!                                                                            *
! AUTHOR: R.L. Thompson, Nov 2014                                            *
!                                                                            *
! UPDATES:                                                                   *
!   03/2018 SEC: Converted original netCDF files to binary format            *
!*****************************************************************************
!                                                                            *
! Variables:                                                                 *
!                                                                            *
! path(numpath)              contains the path names                         *
! lonOH(nxOH)                longitude of OH fields                          *
! latOH(nyOH)                latitude of OH fields                           *
! altOH(nzOH)                altitude of OH fields                           *
! etaOH(nzOH)                eta-levels of OH fields                         *
! OH_field(nxOH,nyOH,nzOH,m) OH concentration (molecules/cm3)                *
!                                                                            *
!                                                                            *
!*****************************************************************************
Matthias Langer's avatar
 
Matthias Langer committed
45
46
47
48
49
50
51

  use oh_mod
  use par_mod
  use com_mod

  implicit none

52
53
54
  character(len=150) :: thefile
  character(len=2) :: mm
  integer :: nid,ierr,xid,yid,zid,vid,m
55
  integer :: i,j,k,l
56
  real, dimension(:), allocatable :: etaOH
Matthias Langer's avatar
 
Matthias Langer committed
57

58
59
60
61
62
!  real, parameter :: gasct=8.314   ! gas constant
!  real, parameter :: mct=0.02894   ! kg mol-1
!  real, parameter :: g=9.80665     ! m s-2
!  real, parameter :: lrate=0.0065  ! K m-1
  real, parameter :: scalehgt=7000. ! scale height in metres
Matthias Langer's avatar
 
Matthias Langer committed
63

64

65
66
67
  open(unitOH,file=trim(ohfields_path) &
       //'OH_FIELDS/OH_variables.bin',status='old', &
       form='UNFORMATTED', iostat=ierr, convert='little_endian')
68
69

  if(ierr.ne.0) then
70
    write(*,*) 'Cannot read binary OH fields in ',trim(ohfields_path)//'OH_FIELDS/OH_variables.bin'
71
72
73
    stop
  endif

74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
  read(unitOH) nxOH
  read(unitOH) nyOH
  read(unitOH) nzOH
  write(*,*) nxOH,nyOH,nzOH

! allocate variables
  allocate(lonOH(nxOH))
  allocate(latOH(nyOH))
  allocate(etaOH(nzOH))
  allocate(altOH(nzOH))
  allocate(OH_field(nxOH,nyOH,nzOH,12))
  allocate(OH_hourly(nxOH,nyOH,nzOH,2))

  read(unitOH) (lonjr(i),i=1,360)
  read(unitOH) (latjr(i),i=1,180)
  read(unitOH) (((jrate_average(i,j,k),i=1,360),j=1,180),k=1,12)
  read(unitOH) (lonOH(i),i=1,nxOH)
  read(unitOH) (latOH(i),i=1,nyOH)
  read(unitOH) (lonOH(i),i=1,nxOH)

  read(unitOH) (altOH(i),i=1,nzOH)
  read(unitOH) ((((OH_field(i,j,k,l),i=1,nxOH),j=1,nyOH),k=1,nzOH),l=1,12)
  read(unitOH) ((((OH_hourly(i,j,k,l),i=1,nxOH),j=1,nyOH),k=1,nzOH),l=1,2)
  write(*,*) 'nzOH: ',nzOH,(altOH(i),i=1,nzOH) 
Matthias Langer's avatar
 
Matthias Langer committed
98

99
end subroutine readOHfield
Matthias Langer's avatar
 
Matthias Langer committed
100