8 use deallocate_structures
12 type(type_coreprof
),
pointer :: coreprof(:)
13 type(type_coretransp
),
pointer :: coretransp(:)
14 type(type_coresource
),
pointer :: coresource(:)
15 type(type_coreimpur
),
pointer :: coreimpur(:)
16 type(type_equilibrium
),
pointer :: equilibrium(:)
17 type(type_toroidfield
),
pointer :: toroidfield(:)
18 type(type_neoclassic
),
pointer :: neoclassic_neo(:), neoclassic_neowes(:), neoclassic_itmneoart(:), neoclassic_neos(:)
20 integer :: idx, shot, run, interpol, nrho, irho, nion, iion
22 character(len=17) :: filename
26 SUBROUTINE neo(EQUILIBRIUM,COREPROF,NEOCLASSIC)
29 TYPE (type_equilibrium
),
POINTER :: equilibrium(:)
30 TYPE (type_coreprof
),
POINTER :: coreprof(:)
31 TYPE (type_neoclassic
),
POINTER :: neoclassic(:)
36 SUBROUTINE neowes(EQUILIBRIUM,COREPROF,NEOCLASSIC)
39 TYPE (type_equilibrium
),
POINTER :: equilibrium(:)
40 TYPE (type_coreprof
),
POINTER :: coreprof(:)
41 TYPE (type_neoclassic
),
POINTER :: neoclassic(:)
47 SUBROUTINE itmneoart(EQUILIBRIUM,COREPROF,NEOCLASSIC)
50 TYPE (type_equilibrium
),
POINTER :: equilibrium(:)
51 TYPE (type_coreprof
),
POINTER :: coreprof(:)
52 TYPE (type_neoclassic
),
POINTER :: neoclassic(:)
53 END SUBROUTINE itmneoart
59 SUBROUTINE signeojbs(EQUILIBRIUM,COREPROF,NEOCLASSIC)
62 TYPE (type_equilibrium
),
POINTER :: equilibrium(:)
63 TYPE (type_coreprof
),
POINTER :: coreprof(:)
64 TYPE (type_neoclassic
),
POINTER :: neoclassic(:)
65 END SUBROUTINE signeojbs
83 allocate(coreprof(1),coretransp(1),coresource(1), &
84 coreimpur(1),equilibrium(1),toroidfield(1))
86 CALL euitm_open(
'euitm', shot, run, idx)
87 CALL euitm_get_slice(idx,
'coreprof', coreprof(1), time, interpol)
88 CALL euitm_get_slice(idx,
'equilibrium', equilibrium(1), time, interpol)
89 CALL euitm_get_slice(idx,
'toroidfield', toroidfield(1), time, interpol)
92 CALL euitm_get_slice(idx,
'coretransp', coretransp(1), time, interpol)
93 CALL euitm_get_slice(idx,
'coresource', coresource(1), time, interpol)
94 CALL euitm_get_slice(idx,
'coreimpur', coreimpur(1), time, interpol)
96 write(filename,
'(''CPO_'',I6.6,''_'',I6.6)') shot, run
97 inquire(file=filename, exist=exist)
99 write(*,*) filename,
' already exists'
101 call open_write_file(1, filename)
102 call write_cpo(coreprof(1),
'coreprof')
103 call write_cpo(coretransp(1),
'coretransp')
104 call write_cpo(coresource(1),
'coresource')
105 call write_cpo(coreimpur(1),
'coreimpur')
106 call write_cpo(equilibrium(1),
'equilibrium')
107 call write_cpo(toroidfield(1),
'toroidfield')
108 call close_write_file
111 write(filename,
'(''CPO_'',I6.6,''_'',I6.6)') shot, run
112 call open_read_file(1, filename)
113 call read_cpo(coreprof(1),
'coreprof')
114 call read_cpo(coretransp(1),
'coretransp')
115 call read_cpo(coresource(1),
'coresource')
116 call read_cpo(coreimpur(1),
'coreimpur')
117 call read_cpo(equilibrium(1),
'equilibrium')
118 call read_cpo(toroidfield(1),
'toroidfield')
122 nrho=
size(coreprof(1)%rho_tor)
123 nion=
size(coreprof(1)%ni%value,dim=2)
124 allocate(coreprof(1)%rho_tor_norm(nrho))
125 coreprof(1)%rho_tor_norm = coreprof(1)%rho_tor / coreprof(1)%rho_tor(nrho)
126 equilibrium(1)%eqgeometry%elongation=1.0_r8
127 if(.not.
associated(coreprof(1)%profiles1d%pe%value))
then
128 write(*,*)
'Calculating coreprof(1)%profiles1d%pe%value'
129 allocate(coreprof(1)%profiles1d%pe%value(nrho))
130 coreprof(1)%profiles1d%pe%value = coreprof(1)%te%value * coreprof(1)%ne%value * itm_ev
132 if(.not.
associated(coreprof(1)%profiles1d%pi%value))
then
133 write(*,*)
'Calculating coreprof(1)%profiles1d%pi%value'
134 allocate(coreprof(1)%profiles1d%pi%value(nrho,nion))
135 coreprof(1)%profiles1d%pi%value = coreprof(1)%ti%value * coreprof(1)%ni%value * itm_ev
137 if(.not.
associated(coreprof(1)%profiles1d%pr_th%value))
then
138 write(*,*)
'Calculating coreprof(1)%profiles1d%pr_th%value'
139 allocate(coreprof(1)%profiles1d%pr_th%value(nrho))
140 coreprof(1)%profiles1d%pr_th%value = coreprof(1)%profiles1d%pe%value + sum(coreprof(1)%profiles1d%pi%value,dim=2)
143 write(*,*) (maxval(equilibrium(1)%coord_sys%position%z)-minval(equilibrium(1)%coord_sys%position%z))/ &
144 (maxval(equilibrium(1)%coord_sys%position%r)-minval(equilibrium(1)%coord_sys%position%r))
146 call
neo(equilibrium,coreprof,neoclassic_neo)
147 call
neowes(equilibrium,coreprof,neoclassic_neowes)
149 call signeojbs(equilibrium,coreprof,neoclassic_neos)
151 if(coreprof(1)%rho_tor(1).eq.0.0_r8)
then
152 coreprof(1)%rho_tor(1)=coreprof(1)%rho_tor(2)/1e10_r8
155 call itmneoart(equilibrium,coreprof,neoclassic_itmneoart)
158 open(10,file=
'neo.dat')
159 write(10,
'(a,4(i4))')
'# ',nrho, nion, shot, run
160 do irho=1,
size(neoclassic_neo(1)%sigma)
161 write(10,1000) neoclassic_neo(1)%rho_tor(irho), &
162 neoclassic_neo(1)%sigma(irho), &
163 neoclassic_neo(1)%jboot(irho), &
164 neoclassic_neo(1)%ne_neo%flux(irho), &
165 neoclassic_neo(1)%ne_neo%diff_eff(irho), &
166 neoclassic_neo(1)%ne_neo%vconv_eff(irho), &
167 neoclassic_neo(1)%te_neo%flux(irho), &
168 neoclassic_neo(1)%te_neo%diff_eff(irho), &
169 neoclassic_neo(1)%te_neo%vconv_eff(irho), &
170 (neoclassic_neo(1)%ni_neo%flux(irho,iion),iion=1,nion), &
171 (neoclassic_neo(1)%ni_neo%diff_eff(irho,iion),iion=1,nion), &
172 (neoclassic_neo(1)%ni_neo%vconv_eff(irho,iion),iion=1,nion), &
173 (neoclassic_neo(1)%ti_neo%flux(irho,iion),iion=1,nion), &
174 (neoclassic_neo(1)%ti_neo%diff_eff(irho,iion),iion=1,nion), &
175 (neoclassic_neo(1)%ti_neo%vconv_eff(irho,iion),iion=1,nion)
179 open(10,file=
'neowes.dat')
180 write(10,
'(a,4(i4))')
'# ',nrho, nion, shot, run
181 do irho=1,
size(neoclassic_neowes(1)%sigma)
182 write(10,1000) neoclassic_neowes(1)%rho_tor(irho), &
183 neoclassic_neowes(1)%sigma(irho), &
184 neoclassic_neowes(1)%jboot(irho), &
185 neoclassic_neowes(1)%ne_neo%flux(irho), &
186 neoclassic_neowes(1)%ne_neo%diff_eff(irho), &
187 neoclassic_neowes(1)%ne_neo%vconv_eff(irho), &
188 neoclassic_neowes(1)%te_neo%flux(irho), &
189 neoclassic_neowes(1)%te_neo%diff_eff(irho), &
190 neoclassic_neowes(1)%te_neo%vconv_eff(irho), &
191 (neoclassic_neowes(1)%ni_neo%flux(irho,iion),iion=1,nion), &
192 (neoclassic_neowes(1)%ni_neo%diff_eff(irho,iion),iion=1,nion), &
193 (neoclassic_neowes(1)%ni_neo%vconv_eff(irho,iion),iion=1,nion), &
194 (neoclassic_neowes(1)%ti_neo%flux(irho,iion),iion=1,nion), &
195 (neoclassic_neowes(1)%ti_neo%diff_eff(irho,iion),iion=1,nion), &
196 (neoclassic_neowes(1)%ti_neo%vconv_eff(irho,iion),iion=1,nion)
201 open(10,file=
'itmneoart.dat')
202 write(10,
'(a,4(i4))')
'# ',nrho, nion, shot, run
203 do irho=1,
size(neoclassic_itmneoart(1)%sigma)
204 write(10,1000) neoclassic_itmneoart(1)%rho_tor(irho), &
205 neoclassic_itmneoart(1)%sigma(irho), &
206 neoclassic_itmneoart(1)%jboot(irho), &
207 neoclassic_itmneoart(1)%ne_neo%flux(irho), &
208 neoclassic_itmneoart(1)%ne_neo%diff_eff(irho), &
209 neoclassic_itmneoart(1)%ne_neo%vconv_eff(irho), &
210 neoclassic_itmneoart(1)%te_neo%flux(irho), &
211 neoclassic_itmneoart(1)%te_neo%diff_eff(irho), &
212 neoclassic_itmneoart(1)%te_neo%vconv_eff(irho), &
213 (neoclassic_itmneoart(1)%ni_neo%flux(irho,iion),iion=1,nion), &
214 (neoclassic_itmneoart(1)%ni_neo%diff_eff(irho,iion),iion=1,nion), &
215 (neoclassic_itmneoart(1)%ni_neo%vconv_eff(irho,iion),iion=1,nion), &
216 (neoclassic_itmneoart(1)%ti_neo%flux(irho,iion),iion=1,nion), &
217 (neoclassic_itmneoart(1)%ti_neo%diff_eff(irho,iion),iion=1,nion), &
218 (neoclassic_itmneoart(1)%ti_neo%vconv_eff(irho,iion),iion=1,nion)
224 open(10,file=
'neos.dat')
225 write(10,
'(a,4(i4))')
'# ',nrho, nion, shot, run
226 do irho=1,
size(neoclassic_neos(1)%sigma)
227 write(10,1000) neoclassic_neos(1)%rho_tor(irho), &
228 neoclassic_neos(1)%sigma(irho), &
229 neoclassic_neos(1)%jboot(irho)
247 if(
associated(coreprof(1)%psi%sigma_par%value))
then
248 open(10,file=
'sigma_par.dat')
249 do irho=1,
size(coreprof(1)%psi%sigma_par%value)
250 write(10,1000) coreprof(1)%rho_tor(irho), coreprof(1)%psi%sigma_par%value(irho)
255 open(10,file=
'rho_tor_te_ne.dat')
256 do irho=1,
size(coreprof(1)%psi%sigma_par%value)
257 write(10,1000) coreprof(1)%rho_tor(irho), coreprof(1)%te%value(irho), coreprof(1)%ne%value(irho)
261 call deallocate_cpo(coreprof)
262 call deallocate_cpo(coretransp)
263 call deallocate_cpo(coresource)
264 call deallocate_cpo(coreimpur)
265 call deallocate_cpo(equilibrium)
266 call deallocate_cpo(toroidfield)
267 call deallocate_cpo(neoclassic_neo)
269 call deallocate_cpo(neoclassic_neos)
271 call deallocate_cpo(neoclassic_neowes)
273 call deallocate_cpo(neoclassic_itmneoart)
276 1000
format(1
p,100(100g15.6))
subroutine neowes(eq, coreprof, neoclassic)
real(r8) function p(a, x, xr, xs, yr, ys, psi, psir, F_dia)
subroutine neo(equilibrium, coreprof, neoclassic)