1 | program avbp2prissma
2 |
3 | * ===============================================================
4 | * Copyright (c) CERFACS (all rights reserved)
5 | * ===============================================================
6 |
7 | c ******************************************************************
8 | c *
9 | c * Extract a solution from AVBP to initialisze PRISSMA
10 | c *
11 | c * author: D. Poitoui (april 2010)
12 | c *
13 | c ******************************************************************
14 |
15 | use avbp_solution
16 | use avbp_mesh
17 | use avbp_coor
18 | use avbp_ms
19 | use avbp_ifp
20 | use avbp_premix
21 | use avbp_species
22 |
23 | implicit none
24 |
25 | integer :: i, n
26 | character*80 :: namefile, path, propfile, kextfile
27 | double precision :: soot, kabs, kscat
28 | double precision, dimension(:,:), allocatable :: Xspec_dom
29 |
30 | c read choices file
31 |
32 | open(unit=1,file='avbp2prissma.choices',form='formatted')
33 | read(1,*) namefile
34 | read(1,*) meshfile
35 | read(1,*) premixfile
36 | read(1,*) speciesfile
37 | read(1,*) ifpfile
38 | read(1,*) path
39 | close(1)
40 |
41 | propfile = path(1:len_trim(path))//'/Properties.txt'
42 | kextfile = path(1:len_trim(path))//'/K_Extinction.txt'
43 |
44 | c read data from AVBP files
45 |
46 | call readcoor
47 |
48 | solutfile = namefile(1:len_trim(namefile))//'.h5'
49 |
50 | call readsolution
51 |
52 | call readspecies
53 | call createmsmemory
54 | call ms_convert_chem
55 | call ms_compute_variables
56 |
57 | c convert mass fractions into molar fractions
58 |
59 | allocate(Xspec_dom(1:5,1:sol_nnode))
60 | print*
61 | print*, "Warning : input_species.dat must be ordered like"
62 | print*, "input_premix.dat"
63 | print*
64 | Xspec_dom = 0.
65 |
66 | do i=1,sol_neqs
67 | select case (trim(species_name(i)))
68 | case ('H2O')
69 | n = 1
70 | case ('CO2')
71 | n = 2
72 | case ('CO')
73 | n = 3
74 | case ('O2')
75 | n = 4
76 | case ('N2')
77 | n = 5
78 | case default
79 | n = 0
80 | end select
81 |
82 | if (n.ne.0) then
83 | Xspec_dom(n,:) = (ms_Yspec(i,:)*ms_Wmean(:))/ms_mol_mass(i)
84 | ! print*, ms_Yspec(i,1)
85 | ! print*, ms_Wmean(1)
86 | ! print*, ms_mol_mass(i)
87 | ! print*, Xspec_dom(n,1)
88 | print*, trim(species_name(i)),n,'Max =', &
89 | & maxval(Xspec_dom(n,:))
90 | endif
91 |
92 | enddo
93 |
94 | ! print*, coor(:,coor_nnode), ":", ms_Yspec(:,coor_nnode)
95 |
96 | open(unit=2,file=propfile,form='formatted')
97 | open(unit=3,file=kextfile,form='formatted')
98 |
99 | do n=1, coor_nnode
100 |
101 | ! soot = ms_tempe(n)/maxval(ms_tempe)
102 | soot = 0.d0
103 | kabs = 0.d0
104 | kscat = 0.d0
105 |
106 | ms_press(n) = ms_press(n) / 101325.
107 |
108 | write(2,*) n,ms_tempe(n),ms_press(n), &
109 | & (Xspec_dom(i,n),i=1,5), soot
110 |
111 | write(3,*) n, kabs, kscat
112 |
113 | enddo
114 |
115 | close(2)
116 | close(3)
117 | call destroymsmemory
118 |
119 | end
120 |
121 |
avbp2prissma.f could be called by: