solinit_avbp.F [SRC] [CPP] [JOB] [SCAN]
TOOLS / SOLINIT_AVBP / SRC



   1 | include(dom.inc)
   2 | 
   3 |       PROGRAM solinit_avbp
   4 | 
   5 | !       ================================================================!
   6 | !                                                                       !
   7 | !       solinit_avbp.F : Creates an initial solution for PRISSMA        !
   8 | !                        from an AVBP solution test file created by     !
   9 | !                        the tool avbp2prissma                          !
  10 | !                                                                       !
  11 | !       author    : D. POITOU (april 2008)                              !
  12 | !                                                                       !
  13 | !       ================================================================!
  14 | 
  15 |         IMPLICIT NONE
  16 | 
  17 |         include 'dom_constants.h'
  18 | 
  19 |         DOM_INT      :: ntcells, ntnodes, ntfaces, inode, i_cnodes
  20 |         DOM_INT      :: i, j, k, icell, cnnode(8)
  21 |         DOM_REAL     :: r, d, x_ref, y_ref, z_ref, R_ref, L_ref, T_ref
  22 | 
  23 |         CHARACTER*80 :: nodesfile, clnodefile, propfile, propfile2
  24 |         CHARACTER*80 :: gdatafile, path,sol_avbp, kextfile
  25 | 
  26 |         DOM_REAL     :: T, P, XH2O, XCO2, XCO
  27 |         DOM_REAL     :: XO2, XN2, XSOOT, XFUEL
  28 |         DOM_REAL     :: YH2O, YCO2, YCO
  29 |         DOM_REAL     :: YO2, YN2, YFUEL
  30 |         DOM_REAL     :: W_FUEL, W_TOT,soot
  31 |         DOM_REAL     :: kscat, kabs
  32 | 
  33 |         DOM_REAL, ALLOCATABLE, DIMENSION(:) :: T_n, P_n, XH2O_n, XCO2_n
  34 |         DOM_REAL, ALLOCATABLE, DIMENSION(:) :: XCO_n, XO2_n, XN2_n
  35 |         DOM_REAL, ALLOCATABLE, DIMENSION(:) :: XSOOT_n
  36 |         DOM_REAL, ALLOCATABLE, DIMENSION(:) :: kscattering_n
  37 |         DOM_REAL, ALLOCATABLE, DIMENSION(:) :: kabsorption_n
  38 |         DOM_REAL, ALLOCATABLE, DIMENSION(:) :: x, y, z
  39 | 
  40 | !       ------------------!
  41 | !       Read choices file !
  42 | !       ------------------!
  43 | 
  44 |         OPEN (FILE_CHCS , FILE='solinit_avbp.choices', FORM='FORMATTED')
  45 |         READ (FILE_CHCS,*) path
  46 |         CLOSE(FILE_CHCS)
  47 | 
  48 | !       -----------!
  49 | !       Open files !
  50 | !       -----------!
  51 | 
  52 |         nodesfile  = path(1:len_trim(path))//'/Nodelist.in'
  53 |         clnodefile = path(1:len_trim(path))//'/Cellnodes.in'
  54 |         propfile   = path(1:len_trim(path))//'/Properties.in'
  55 |         propfile2  = path(1:len_trim(path))//'/Properties.txt'
  56 |         gdatafile  = path(1:len_trim(path))//'/Global.in'
  57 |         kextfile   = path(1:len_trim(path))//'/K_Extinction.in'
  58 | 
  59 |         OPEN(FILE_NODES, FILE=nodesfile , FORM='UNFORMATTED')
  60 |         OPEN(FILE_CLNOD, FILE=clnodefile, FORM='UNFORMATTED')
  61 |         OPEN(FILE_GDATA, FILE=gdatafile , FORM='UNFORMATTED')
  62 |         OPEN(FILE_KEXT , FILE=kextfile  , FORM='UNFORMATTED')
  63 | 
  64 | !       ----------------------!
  65 | !       Read Global mesh data !
  66 | !       ----------------------!
  67 | 
  68 |         READ(FILE_GDATA) ntcells, ntnodes, ntfaces
  69 |         CLOSE(FILE_GDATA)
  70 | 
  71 | !       -----------------!
  72 | !       Allocate vectors !
  73 | !       -----------------!
  74 | 
  75 |         ALLOCATE(T_n    (ntnodes))
  76 |         ALLOCATE(P_n    (ntnodes))
  77 |         ALLOCATE(XH2O_n (ntnodes))
  78 |         ALLOCATE(XCO2_n (ntnodes))
  79 |         ALLOCATE(XCO_n  (ntnodes))
  80 |         ALLOCATE(XO2_n  (ntnodes))
  81 |         ALLOCATE(XN2_n  (ntnodes))
  82 |         ALLOCATE(XSOOT_n(ntnodes))
  83 |         ALLOCATE(x      (ntnodes))
  84 |         ALLOCATE(y      (ntnodes))
  85 |         ALLOCATE(z      (ntnodes))
  86 | 
  87 |         ALLOCATE(kscattering_n(ntnodes))
  88 |         ALLOCATE(kabsorption_n(ntnodes))
  89 | 
  90 | !       -----------------------------!
  91 | !       Read node positions and data !
  92 | !       -----------------------------!
  93 | 
  94 |         kscattering_n = 0.
  95 |         kabsorption_n = 0.
  96 | 
  97 |         OPEN(FILE_PROP , FILE=propfile2 , FORM='FORMATTED')
  98 |         DO i=1, ntnodes
  99 |           READ(FILE_PROP,*) inode,T_n(i),P_n(i),XH2O_n(i),XCO2_n(i),    &
 100 |      &                    XCO_n(i),XO2_n(i),XN2_n(i), XSOOT_n(i) 
 101 |         ENDDO
 102 |         CLOSE(FILE_PROP)
 103 | 
 104 | !       ---------------------!
 105 | !       Gather data to cells !
 106 | !       ---------------------!
 107 | 
 108 |         OPEN(FILE_PROP , FILE=propfile  , FORM='UNFORMATTED')
 109 | 
 110 |         DO i=1, ntcells
 111 | 
 112 |           cnnode = 0
 113 |           READ(FILE_CLNOD) icell, i_cnodes,(cnnode(j),j=1,i_cnodes)
 114 | 
 115 |           T     = 0
 116 |           P     = 0
 117 |           XH2O  = 0
 118 |           XCO2  = 0
 119 |           XCO   = 0
 120 |           XO2   = 0
 121 |           XN2   = 0
 122 |           XSOOT = 0
 123 |           kscat = 0.
 124 |           kabs  = 0.
 125 | 
 126 |           DO j=1, i_cnodes
 127 |             k = cnnode(j)
 128 |             T     = T     + T_n(k)
 129 |             P     = P     + P_n(k)
 130 |             XH2O  = XH2O  + XH2O_n(k)
 131 |             XCO2  = XCO2  + XCO2_n(k)
 132 |             XCO   = XCO   + XCO_n(k)
 133 |             XO2   = XO2   + XO2_n(k)
 134 |             XN2   = XN2   + XN2_n(k)
 135 |             XSOOT = XSOOT + XSOOT_n(k)
 136 |             kscat = kscat + kscattering_n(k)
 137 |             kabs  = kabs  + kabsorption_n(k)
 138 |           ENDDO
 139 | 
 140 |           T     = T     / real(i_cnodes)
 141 |           P     = P     / real(i_cnodes)
 142 |           XH2O  = XH2O  / real(i_cnodes)
 143 |           XCO2  = XCO2  / real(i_cnodes)
 144 |           XCO   = XCO   / real(i_cnodes)
 145 |           XO2   = XO2   / real(i_cnodes)
 146 |           XN2   = XN2   / real(i_cnodes)
 147 |           XSOOT = XSOOT / real(i_cnodes)
 148 |           kabs  = kabs  / real(i_cnodes)
 149 |           kscat = kscat / real(i_cnodes)
 150 | 
 151 |           XFUEL = ABS(1 - (XH2O+XCO2+XCO+XO2+XN2) )
 152 |           W_TOT = XFUEL*W_FUEL + XCO2*W_CO2 + XO2*W_O2 + XH2O*W_H2O +   &
 153 |      &            XCO*W_CO + XN2*W_N2
 154 | 
 155 | !         ------------------------------!
 156 | !         Convert Molar->Mass fractions !
 157 | !         ------------------------------!
 158 | 
 159 |           YH2O  = XH2O  * (W_H2O /W_TOT)
 160 |           YCO2  = XCO2  * (W_CO2 /W_TOT)
 161 |           YCO   = XCO   * (W_CO  /W_TOT)
 162 |           YO2   = XO2   * (W_O2  /W_TOT)
 163 |           YN2   = XN2   * (W_N2  /W_TOT)
 164 |           YFUEL = XFUEL * (W_FUEL/W_TOT)
 165 | 
 166 | !         ---------------------------!
 167 | !         Write 'Properties.in' file !
 168 | !         ---------------------------!
 169 | 
 170 |           WRITE(FILE_PROP) i, T, P, XH2O, XCO2, XCO, XO2, XN2, XSOOT
 171 |           WRITE(FILE_KEXT ) i, kabs, kscat
 172 | 
 173 |         ENDDO
 174 | 
 175 |         CLOSE(FILE_CLNOD)
 176 |         CLOSE(FILE_PROP )
 177 |         CLOSE(FILE_KEXT )
 178 | 
 179 |         WRITE(*,*) " Initial solution file successfully written"
 180 |         WRITE(*,*) " from the avbp solution"
 181 | 
 182 |       END PROGRAM solinit_avbp


solinit_avbp.F could be called by:
Makefile [TOOLS/SOLINIT_AVBP] - 45 - 50 - 56 - 88
solinit_avbp.F [TOOLS/SOLINIT_AVBP/SRC] - 3
solinit_avbp [TOOLS/SCRIPTS] - 31 - 32 - 33