read_data.F [SRC] [CPP] [JOB] [SCAN]
SOURCES / INOUTSEQCODE/INOUT [=]



   1 | include(dom.inc)
   2 | 
   3 |       SUBROUTINE read_data
   4 | 
   5 | !       ================================================================!
   6 | !                                                                       !
   7 | !       read_data.F   : Reads all data from input files and allocates   !
   8 | !                       global vectors.                                 !
   9 | !                                                                       !
  10 | !       out           : Global vectors with initialized data obtained   !
  11 | !                       from *.in files.                                !
  12 | !                                                                       !
  13 | !       author        : J. AMAYA (september 2007)                       !
  14 | !                                                                       !
  15 | !       ================================================================!
  16 | 
  17 |         USE mod_pmm
  18 |         USE mod_prissma
  19 |         USE mod_inout
  20 | 
  21 |         IMPLICIT NONE
  22 | 
  23 |         INCLUDE 'dom_constants.h'
  24 | 
  25 |         DOM_INT      :: i, j, k, i2, icell, size, iface, nvert
  26 |         DOM_INT      :: n, i_bande, iquad, k_cell, k_coef, patch
  27 | 
  28 |         DOM_REAL     :: ddata
  29 | 
  30 |         CHARACTER*80 :: ccellsfile, cfacesfile
  31 |         CHARACTER*80 :: facesfile, emisfile, normfile
  32 |         CHARACTER*80 :: quadfile, clfacefile
  33 |         CHARACTER*80 :: clnodefile, nodesfile
  34 |         CHARACTER*80 :: lspecfile, sspecfile, snbwnfile
  35 |         CHARACTER*80 :: c2facfile, facfile
  36 |         CHARACTER*80 :: gdatafile
  37 | 
  38 | !       -----------------------!
  39 | !         Initialize variables !
  40 | !       -----------------------!
  41 |         WRITE(*,*) " PRISSMA: Allocating vetors"
  42 |         IF (ALLOCATED(nbandes))      DEALLOCATE(nbandes)
  43 |         IF (ALLOCATED(nfcelt))       DEALLOCATE(nfcelt)
  44 |         IF (ALLOCATED(epsil))        DEALLOCATE(epsil)
  45 |         IF (ALLOCATED(norm))         DEALLOCATE(norm)
  46 |         IF (ALLOCATED(maxlen))       DEALLOCATE(maxlen)
  47 |         IF (ALLOCATED(s_s))          DEALLOCATE(s_s)
  48 |         IF (ALLOCATED(mu))           DEALLOCATE(mu)
  49 |         IF (ALLOCATED(eta))          DEALLOCATE(eta)
  50 |         IF (ALLOCATED(ksi))          DEALLOCATE(ksi)
  51 |         IF (ALLOCATED(w))            DEALLOCATE(w)
  52 | 
  53 | !       -------------------!
  54 | !         Read input files !
  55 | !       -------------------!
  56 |         WRITE(*,*) " PRISSMA: Seting file names"
  57 |         nodesfile  = path(1:len_trim(path))//'/Nodelist.in'
  58 |         c2facfile  = path(1:len_trim(path))//'/Cell2faces.in'
  59 |         emisfile   = path(1:len_trim(path))//'/Emissivities.in'
  60 |         facfile    = path(1:len_trim(path))//'/Facelist.in'
  61 |         ccellsfile = path(1:len_trim(path))//'/Centercells.in'
  62 |         cfacesfile = path(1:len_trim(path))//'/Centerfaces.in'
  63 |         clnodefile = path(1:len_trim(path))//'/Cellnodes.in'
  64 |         clfacefile = path(1:len_trim(path))//'/CLFaces.in'
  65 |         gdatafile  = path(1:len_trim(path))//'/Global.in'
  66 |         quadfile   = path(1:len_trim(path))//'/Quadrature.in'
  67 |         normfile   = path(1:len_trim(path))//'/Normals.in'
  68 | 
  69 |         WRITE(*,*) " PRISSMA: Opening files"
  70 |         OPEN(FILE_QUADR, FILE=quadfile  , FORM='UNFORMATTED')
  71 |         OPEN(FILE_NODES, FILE=nodesfile , FORM='UNFORMATTED')
  72 |         OPEN(FILE_C2FAC, FILE=c2facfile , FORM='UNFORMATTED')
  73 |         OPEN(FILE_EMIS , FILE=emisfile  , FORM='UNFORMATTED')
  74 |         OPEN(FILE_FAC  , FILE=facfile   , FORM='UNFORMATTED')
  75 |         OPEN(FILE_CCELL, FILE=ccellsfile, FORM='UNFORMATTED')
  76 |         OPEN(FILE_CFACE, FILE=cfacesfile, FORM='UNFORMATTED')
  77 |         OPEN(FILE_CLNOD, FILE=clnodefile, FORM='UNFORMATTED')
  78 |         OPEN(FILE_CLFAC, FILE=clfacefile, FORM='UNFORMATTED')
  79 |         OPEN(FILE_GDATA, FILE=gdatafile , FORM='UNFORMATTED')
  80 |         OPEN(FILE_NORM , FILE=normfile  , FORM='UNFORMATTED')
  81 | 
  82 | !       ----------------------!
  83 | !       Read global mesh data !
  84 | !       ----------------------!
  85 | 
  86 |         READ(FILE_GDATA) i_dom_ncells, i_dom_nnodes,                    &
  87 |      &                   i_dom_nfaces, i_dom_nfacesmax, ndir
  88 | 
  89 |         CLOSE(FILE_GDATA)
  90 | 
  91 | !       -------------------------------!
  92 | !       Read quadrature data from file !
  93 | !       -------------------------------!
  94 | 
  95 |         WRITE(*,*) " >> MASTER: Reading quadrature data"
  96 | 
  97 |         ALLOCATE(mu (ndir))
  98 |         ALLOCATE(eta(ndir))
  99 |         ALLOCATE(ksi(ndir))
 100 |         ALLOCATE(w  (ndir))
 101 | 
 102 |         WRITE(*,*) " >> MASTER total number of directions: ", ndir
 103 |         DO i=1,ndir
 104 |           READ(FILE_QUADR) mu(i), eta(i), ksi(i), w(i)
 105 |         ENDDO
 106 | 
 107 |         CLOSE(FILE_QUADR)
 108 | 
 109 | !       ----------------------------------------------!
 110 | !       Allocate and set properties for radiating gaz !
 111 | !       (to be changed for N gaz radiation)           !
 112 | !       ----------------------------------------------!
 113 | 
 114 |         n_gaz = 3
 115 |         ALLOCATE(nbandes(n_gaz))
 116 |         nbandes         = 0
 117 |         nbandes(GAZ_CO) = 48
 118 |         nbandes(GAZ_C)  = 96
 119 |         nbandes(GAZ_H)  = 367
 120 | 
 121 |         nallbandes = 371
 122 | 
 123 | !       -----------------!
 124 | !       Allocate vectors !
 125 | !       -----------------!
 126 | 
 127 |         WRITE(*,*) " >> master.F.html">MASTER allocating master vectors"
 128 | 
 129 |         ALLOCATE(nfcelt      (i_dom_ncells))
 130 |         ALLOCATE(epsil       (i_dom_nfacesmax,i_dom_ncells))
 131 |         ALLOCATE(norm        (3,i_dom_nfacesmax,i_dom_ncells))
 132 | 
 133 |         IF ( mediumtype.eq.'GRAY' ) THEN
 134 |           ALLOCATE(kabs_gray (i_dom_ncells))
 135 |         ENDIF
 136 | 
 137 | !       --------------------!
 138 | !       Loop over all cells !
 139 | !       --------------------!
 140 | 
 141 |         WRITE(*,*) " >> MASTER: Reading *.in files"
 142 | 
 143 |         DO i=1,i_dom_ncells
 144 | 
 145 |           READ(FILE_EMIS) icell,                                        &
 146 |      &                    nfcelt(icell),                                &
 147 |      &                   (epsil(j,icell),j=1,nfcelt(icell))
 148 | 
 149 |           READ(FILE_NORM) icell,                                        &
 150 |      &                    nfcelt(icell),                                &
 151 |      &                  ((norm(k,j,icell),k=1,3),j=1,nfcelt(icell))
 152 | 
 153 |         ENDDO
 154 | 
 155 |         WRITE(*,*) " >> MASTER: Reading boundary data"
 156 | 
 157 |         READ(FILE_CLFAC) i_dom_nbfaces
 158 | 
 159 | !       -------------------------------------------!
 160 | !       Read data for exponential band integration !
 161 | !       -------------------------------------------!
 162 | 
 163 |         IF (spascheme.eq.EXPON) THEN
 164 | 
 165 |           lspecfile = path(1:len_trim(path))//'/L_SPEC.in'
 166 |           sspecfile = path(1:len_trim(path))//'/S_SPEC.in'
 167 | 
 168 |           ALLOCATE(maxlen (i_dom_ncells,ndir))
 169 |           ALLOCATE(s_s    (i_dom_nfacesmax,i_dom_ncells,ndir))
 170 | 
 171 |           OPEN(FILE_LSPEC,FILE=lspecfile,FORM='unformatted')
 172 |           OPEN(FILE_SSPEC,FILE=sspecfile,FORM='unformatted')
 173 | 
 174 |           s_s =0.
 175 |           DO iquad=1,ndir
 176 | 
 177 |             READ(FILE_LSPEC) (maxlen(k_cell,iquad),                     &
 178 |      &                        k_cell=1,i_dom_ncells)
 179 |             READ(FILE_SSPEC)((s_s(k_coef,k_cell,iquad),                 &
 180 |      &                        k_cell=1,i_dom_ncells),k_coef=1,4)
 181 | 
 182 |           ENDDO
 183 | 
 184 |           CLOSE(FILE_LSPEC)
 185 |           CLOSE(FILE_SSPEC)
 186 | 
 187 |         ENDIF
 188 | 
 189 | !       ------------------!
 190 | !         Close all files !
 191 | !       ------------------!
 192 | 
 193 |         CLOSE(FILE_NODES)
 194 |         CLOSE(FILE_CFACE)
 195 |         CLOSE(FILE_C2FAC)
 196 |         CLOSE(FILE_EMIS)
 197 |         CLOSE(FILE_NORM)
 198 |         CLOSE(FILE_FAC  )
 199 |         CLOSE(FILE_CCELL)
 200 |         CLOSE(FILE_CLNOD)
 201 |         CLOSE(FILE_EXTRN)
 202 |         CLOSE(FILE_CLFAC)
 203 | 
 204 |       END SUBROUTINE read_data