22 type (type_equilibrium
),
pointer :: euitm_equilibrium_in(:)
23 type (type_equilibrium
),
pointer :: euitm_equilibrium_out(:)
24 type (type_param
),
save :: code_parameters
26 logical,
save :: first = .true.
27 integer,
save :: ncall = 0
28 character*32 :: filename =
'EQ_######'
31 subroutine chease (euitm_equilibrium_in, euitm_equilibrium_out, code_parameters)
34 type (type_equilibrium
),
pointer :: euitm_equilibrium_in(:)
35 type (type_equilibrium
),
pointer :: euitm_equilibrium_out(:)
36 type (type_param
) :: code_parameters
41 call fill_param(code_parameters,
'XML/chease.xml',
'',
'XML/chease.xsd')
45 if(
associated(euitm_equilibrium_in(1)%profiles_1d%jparallel))
then
46 maxabs = maxval(abs(euitm_equilibrium_in(1)%profiles_1d%jphi))
47 write(*,*)
'max( | jphi | ) = ', maxabs
48 if(maxabs .EQ. 0.0_r8)
then
49 write(*,*)
'chease_wrapper copied jparallel to jphi [ERROR]'
50 if(.not.
associated(euitm_equilibrium_in(1)%profiles_1d%jphi)) &
51 allocate(euitm_equilibrium_in(1)%profiles_1d%jphi(
size(euitm_equilibrium_in(1)%profiles_1d%jparallel)))
52 euitm_equilibrium_in(1)%profiles_1d%jphi = euitm_equilibrium_in(1)%profiles_1d%jparallel
55 if(
associated(euitm_equilibrium_in(1)%profiles_1d%psi))
then
56 write(*,*)
'chease_wrapper set psi_bound and psi_ax [ERROR]'
57 write(*,*) euitm_equilibrium_in(1)%global_param%psi_ax, euitm_equilibrium_in(1)%profiles_1d%psi(1)
58 write(*,*) euitm_equilibrium_in(1)%global_param%psi_bound, euitm_equilibrium_in(1)%profiles_1d%psi(
size(euitm_equilibrium_in(1)%profiles_1d%psi))
59 euitm_equilibrium_in(1)%global_param%psi_ax = euitm_equilibrium_in(1)%profiles_1d%psi(1)
60 euitm_equilibrium_in(1)%global_param%psi_bound = &
61 euitm_equilibrium_in(1)%profiles_1d%psi(
size(euitm_equilibrium_in(1)%profiles_1d%psi))
65 call
f_par_axis(
size(euitm_equilibrium_in(1)%profiles_1d%rho_tor), &
66 euitm_equilibrium_in(1)%profiles_1d%rho_tor,euitm_equilibrium_in(1)%profiles_1d%pressure)
70 write(filename(4:9),
'(I6.6)') ncall
71 write(*,*)
'Writing EQUILIBRIUM ', trim(filename)//
'.IN'
72 call open_write_file(1, trim(filename)//
'.IN')
73 call write_cpo(euitm_equilibrium_in(1),
'equilibrium')
75 write(*,*)
'associated(euitm_equilibrium_out) ',
associated(euitm_equilibrium_out)
76 CALL chease(euitm_equilibrium_in, euitm_equilibrium_out, code_parameters)
77 write(*,*)
'Writing EQUILIBRIUM ', trim(filename)//
'.OUT'
78 call open_write_file(1, trim(filename)//
'.OUT')
79 call write_cpo(euitm_equilibrium_out(1),
'equilibrium')
81 if(.not.
associated(euitm_equilibrium_out(1)%profiles_1d%jparallel))
then
82 write(*,*)
'chease_wrapper copied jphi to jparallel [ERROR]'
83 allocate(euitm_equilibrium_out(1)%profiles_1d%jparallel(
size(euitm_equilibrium_out(1)%profiles_1d%jphi)))
84 euitm_equilibrium_out(1)%profiles_1d%jparallel = euitm_equilibrium_out(1)%profiles_1d%jphi
86 maxabs = maxval(abs(euitm_equilibrium_out(1)%profiles_1d%jparallel))
87 write(*,*)
'max( | jparallel | ) = ', maxabs
88 if(maxabs .EQ. 0.0_r8)
then
89 write(*,*)
'chease_wrapper copied jphi to jparallel [ERROR]'
90 euitm_equilibrium_out(1)%profiles_1d%jparallel = euitm_equilibrium_out(1)%profiles_1d%jphi
subroutine chease_wrapper(euitm_equilibrium_in, euitm_equilibrium_out)
subroutine f_par_axis(n, r, f)
This subroutine finds f(r_1=0) from f(r_2), f(r_3) d/dr f(r_1)=0.