ETS  \$Id: Doxyfile 2162 2020-02-26 14:16:09Z g2dpc $
 All Classes Files Functions Variables Pages
fc2k_database_transport.F90
Go to the documentation of this file.
1  SUBROUTINE database_transport(USER, MACHINE, VERSION, SHOT, RUN, INTERPOL, TIME, COREPROF, CORETRANSP_OUT, RHO_INTERPOL)
2 
4  USE deallocate_structures
5 
6  USE itm_constants
7  USE euitm_routines
8  USE euitm_schemas
10  USE copy_structures
11 
12  IMPLICIT NONE
13 
14 
15 ! + + + + + + + + + + + + + + + + + + + + + + + + + + + +
16 ! +++ CPOs:
17  REAL (R8) :: time !Time
18  INTEGER :: shot, run !shot and run numbers
19  INTEGER :: idx !index (internal)
20 
21  TYPE (type_coreprof), POINTER :: coreprof(:)
22  TYPE (type_coretransp), POINTER :: coretransp_out(:)
23  TYPE (type_coretransp), POINTER :: coretransp_db(:)
24  TYPE (type_coretransp), POINTER :: coretransp_tmp(:)
25 
26  INTEGER, PARAMETER :: nslice = 1 !number of CPO ocurancies in the work flow
27  INTEGER :: nrho1, nrho2
28  INTEGER :: nnucl1
29  INTEGER :: nion1
30  INTEGER :: nimp1
31  INTEGER, ALLOCATABLE :: nzimp1(:)
32  INTEGER :: nneut1
33  INTEGER, ALLOCATABLE :: ncomp1(:)
34  INTEGER, ALLOCATABLE :: ntype1(:)
35 
36 
37 
38 
39  INTEGER :: interpol !interpolation index
40  INTEGER :: rho_interpol
41 
42  CHARACTER(len=10) :: cpopath
43  CHARACTER(len=5), PARAMETER :: treename = 'euitm'
44  CHARACTER(*) :: user
45  CHARACTER(*) :: machine
46  CHARACTER(*) :: version
47 
48 
49 
50 ! +++ allocate and define grid of output CPO:
51  nrho1 = SIZE(coreprof(1)%rho_tor, dim=1)
52  CALL get_comp_dimensions(coreprof(1)%COMPOSITIONS, nnucl1, nion1, nimp1, nzimp1, nneut1, ntype1, ncomp1)
53  CALL allocate_coretransp_cpo(nslice, nrho1, nnucl1, nion1, nimp1, nzimp1, nneut1, ntype1, ncomp1, coretransp_out)
54  call deallocate_cpo(coretransp_out(1)%COMPOSITIONS)
55  CALL copy_cpo(coreprof(1)%COMPOSITIONS, coretransp_out(1)%COMPOSITIONS)
56  coretransp_out(1)%VALUES(1)%rho_tor = coreprof(1)%rho_tor
57 
58 
59 
60 ! +++ Retrieve CPO from the data base:
61  cpopath = 'coretransp'
62  ALLOCATE (coretransp_db(1))
63 
64 #ifdef UAL
65  CALL euitm_open_env(treename, shot, run, idx, user, machine, version)
66  CALL euitm_get_slice(idx, cpopath, coretransp_db(1), time, interpol)
67 #else
68  WRITE (6,*) 'ERROR>>> NO CORETRANSP CPO IN THE DATABASE FOR SELECTED SHOT:', shot, run
69  CALL allocate_coretransp_cpo(nslice, nrho1, nnucl1, nion1, nimp1, nzimp1, nneut1, ntype1, ncomp1, coretransp_db)
70  call deallocate_cpo(coretransp_db(1)%COMPOSITIONS)
71  CALL copy_cpo(coreprof(1)%COMPOSITIONS, coretransp_db(1)%COMPOSITIONS)
72  coretransp_db(1)%VALUES(1)%rho_tor = coreprof(1)%rho_tor
73 #endif
74 
75 
76 
77 ! +++ OUTPUT TRANSPORT CPO:
78  nrho2 = SIZE (coretransp_db(1)%VALUES(1)%rho_tor, dim=1)
79 
80  IF (rho_interpol.NE.0) &
81  coretransp_db(1)%VALUES(1)%rho_tor = coretransp_db(1)%VALUES(1)%rho_tor &
82  / coretransp_db(1)%VALUES(1)%rho_tor(nrho2) &
83  * coretransp_out(1)%VALUES(1)%rho_tor(nrho1)
84 
85 
86 
87 ! +++ Check:
88  IF (SIZE(coretransp_db(1)%VALUES).GT.1) THEN
89  ALLOCATE (coretransp_tmp(1))
90  ALLOCATE (coretransp_tmp(1)%VALUES(1))
91  CALL copy_cpo(coretransp_db(1)%VALUES(1), coretransp_tmp(1)%VALUES(1))
92  CALL deallocate_cpo(coretransp_db(1)%VALUES)
93  ALLOCATE (coretransp_db(1)%VALUES(1))
94  CALL copy_cpo(coretransp_tmp(1)%VALUES(1), coretransp_db(1)%VALUES(1))
95  END IF
96 
97 
98 ! +++ Interpolate CPO:
99  CALL interpolate_transp(coretransp_db(1), coretransp_out(1), 0)
100 
101 
102 
103 ! +++ ADD IDENTIFIER TO OUTPUT CPO VALUES(1):
104  ALLOCATE (coretransp_out(1)%VALUES(1)%transportid%id(1))
105  ALLOCATE (coretransp_out(1)%VALUES(1)%transportid%description(1))
106  coretransp_out(1)%VALUES(1)%transportid%id = 'database'
107  coretransp_out(1)%VALUES(1)%transportid%flag = 10
108  coretransp_out(1)%VALUES(1)%transportid%description = 'Transport specified by a database entry'
109 
110 
111 
112  CALL deallocate_cpo(coretransp_db)
113  IF (ALLOCATED(nzimp1)) DEALLOCATE (nzimp1)
114  IF (ALLOCATED(ncomp1)) DEALLOCATE (ncomp1)
115  IF (ALLOCATED(ntype1)) DEALLOCATE (ntype1)
116 
117 #ifdef UAL
118  CALL euitm_close(idx, treename, shot, run)
119 #endif
120 
121 
122  RETURN
123 
124 
125  END SUBROUTINE database_transport
126 ! + + + + + + + + + + + + + + + + + + + + + + + + + + + +
127 ! + + + + + + + + + + + + + + + + + + + + + + + + + + + +
128 
129 
130 
131 
132 
133 
subroutine euitm_open_env(name, shot, run, retIdx, user, tokamak, version)
subroutine get_comp_dimensions(COMPOSITIONS, NNUCL, NION, NIMP, NZIMP, NNEUT, NTYPE, NCOMP)
subroutine interpolate_transp(CORETRANSP_IN, CORETRANSP_OUT, NEGATIVE_DIFF)
This module contains routines for allocation/deallocation if CPOs used in ETS.
subroutine database_transport(USER, MACHINE, VERSION, SHOT, RUN, INTERPOL, TIME, COREPROF, CORETRANSP_OUT, RHO_INTERPOL)
subroutine euitm_close(idx)
subroutine allocate_coretransp_cpo(NSLICE, NRHO, NNUCL, NION, NIMP, NZIMP, NNEUT, NTYPE, NCOMP, CORETRANSP)
This routine allocates CORETRANSP CPO.