1 | include(dom.inc)
2 |
3 | PROGRAM solinit
4 |
5 | ! ================================================================!
6 | ! !
7 | ! solinit.F : Creates an initial solution for PRISSMA !
8 | ! !
9 | ! author : J. AMAYA (october 2007) !
10 | ! !
11 | ! ================================================================!
12 |
13 | IMPLICIT NONE
14 |
15 | include 'dom_constants.h'
16 |
17 | DOM_INT :: ntcells, ntnodes, ntfaces, inode, i_cnodes
18 | DOM_INT :: i, j, k, icell, cnnode(8)
19 | DOM_REAL :: r, d, x_ref, y_ref, z_ref, R_ref, L_ref, T_ref
20 |
21 | CHARACTER*80 :: nodesfile, clnodefile, propfile
22 | CHARACTER*80 :: gdatafile, path, kextfile
23 |
24 | DOM_REAL :: T, P, XH2O, XCO2, XCO
25 | DOM_REAL :: XO2, XN2, XSOOT, XFUEL
26 | DOM_REAL :: YH2O, YCO2, YCO
27 | DOM_REAL :: YO2, YN2, YFUEL
28 | DOM_REAL :: W_FUEL, W_TOT
29 | DOM_REAL :: kscat, kabs
30 |
31 | DOM_REAL, ALLOCATABLE, DIMENSION(:) :: T_n, P_n, XH2O_n, XCO2_n
32 | DOM_REAL, ALLOCATABLE, DIMENSION(:) :: XCO_n, XO2_n, XN2_n
33 | DOM_REAL, ALLOCATABLE, DIMENSION(:) :: XSOOT_n
34 | DOM_REAL, ALLOCATABLE, DIMENSION(:) :: kscattering_n
35 | DOM_REAL, ALLOCATABLE, DIMENSION(:) :: kabsorption_n
36 | DOM_REAL, ALLOCATABLE, DIMENSION(:) :: x, y, z
37 |
38 | ! ------------------!
39 | ! Read choices file !
40 | ! ------------------!
41 |
42 | OPEN (FILE_CHCS , FILE='solinit.choices', FORM='FORMATTED')
43 | READ (FILE_CHCS,*) path
44 | CLOSE(FILE_CHCS)
45 |
46 | ! -----------!
47 | ! Open files !
48 | ! -----------!
49 |
50 | nodesfile = path(1:len_trim(path))//'/Nodelist.in'
51 | clnodefile = path(1:len_trim(path))//'/Cellnodes.in'
52 | propfile = path(1:len_trim(path))//'/Properties.in'
53 | gdatafile = path(1:len_trim(path))//'/Global.in'
54 | kextfile = path(1:len_trim(path))//'/K_Extinction.in'
55 |
56 | OPEN(FILE_NODES, FILE=nodesfile , FORM='UNFORMATTED')
57 | OPEN(FILE_CLNOD, FILE=clnodefile, FORM='UNFORMATTED')
58 | OPEN(FILE_GDATA, FILE=gdatafile , FORM='UNFORMATTED')
59 | OPEN(FILE_PROP , FILE=propfile , FORM='UNFORMATTED')
60 | OPEN(FILE_KEXT , FILE=kextfile , FORM='UNFORMATTED')
61 |
62 | ! ----------------------!
63 | ! Read Global mesh data !
64 | ! ----------------------!
65 |
66 | READ(FILE_GDATA) ntcells, ntnodes, ntfaces
67 | CLOSE(FILE_GDATA)
68 |
69 | ! -----------------!
70 | ! Allocate vectors !
71 | ! -----------------!
72 |
73 | ALLOCATE(T_n (ntnodes))
74 | ALLOCATE(P_n (ntnodes))
75 | ALLOCATE(XH2O_n (ntnodes))
76 | ALLOCATE(XCO2_n (ntnodes))
77 | ALLOCATE(XCO_n (ntnodes))
78 | ALLOCATE(XO2_n (ntnodes))
79 | ALLOCATE(XN2_n (ntnodes))
80 | ALLOCATE(XSOOT_n(ntnodes))
81 | ALLOCATE(x (ntnodes))
82 | ALLOCATE(y (ntnodes))
83 | ALLOCATE(z (ntnodes))
84 |
85 | ALLOCATE(kscattering_n(ntnodes))
86 | ALLOCATE(kabsorption_n(ntnodes))
87 |
88 | ! --------------------!
89 | ! Read node positions !
90 | ! --------------------!
91 |
92 | DO i=1, ntnodes
93 | READ(FILE_NODES) inode, x(i), y(i), z(i)
94 | ENDDO
95 |
96 | CLOSE(FILE_NODES)
97 |
98 | ! -------------------------!
99 | ! Fill the nodes with data !
100 | ! -------------------------!
101 |
102 | kscattering_n = 0.
103 | kabsorption_n = 0.
104 |
105 | DO i=1, ntnodes
106 | include 'perso.inc'
107 | ENDDO
108 |
109 | ! ---------------------------!
110 | ! Write 'Properties.in' file !
111 | ! ---------------------------!
112 |
113 | DO i=1, ntnodes
114 |
115 | WRITE(FILE_PROP ) i, T_n(i), P_n(i), XH2O_n(i), XCO2_n(i), &
116 | & XCO_n(i), XO2_n(i), XN2_n(i), XSOOT_n(i)
117 | WRITE(FILE_KEXT ) i, kabsorption_n(i), kscattering_n(i)
118 |
119 | ENDDO
120 |
121 | CLOSE(FILE_CLNOD)
122 | CLOSE(FILE_PROP )
123 | CLOSE(FILE_KEXT )
124 |
125 | WRITE(*,*) " Initial solution file successfully written"
126 |
127 | END PROGRAM solinit
solinit.F could be called by: