summaryrefslogtreecommitdiff
path: root/Donjon/src/NAP.f
blob: 5f0c48b3d71dde87a6b6e4b0cc74f5bb3f0271f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
*DECK NAP
      SUBROUTINE NAP(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
*
*-----------------------------------------------------------------------
*
*Purpose:
* - Construct an 'enriched' multicompo with additional information  
* needed by Pin Power Reconstruction.
* - Performed the Pin Power Reconstruction
* - Split geometry from homogeneous to heterogeneous assemblies
*     Note : this function is also called directly from the RESINI: module
*
*Copyright:
* Copyright (C) 2014 Ecole Polytechnique de Montreal.
*
*Author(s): 
* R. Chambon
*
*Parameters: input
* NENTRY  number of data structures transfered to this module.
* HENTRY  name of the data structures.
* IENTRY  data structure type where:
*         IENTRY=1 for LCM memory object;
*         IENTRY=2 for XSM file;
*         IENTRY=3 for sequential binary file;
*         IENTRY=4 for sequential ASCII file.
* JENTRY  access permission for the data structure where:
*         JENTRY=0 for a data structure in creation mode;
*         JENTRY=1 for a data structure in modifications mode;
*         JENTRY=2 for a data structure in read-only mode.
* KENTRY  data structure pointer.
*
*Comments:
* The NAP: calling specifications are:
* Option 1: 
* COMPO := NAP: COMPO TRKNAM FLUNAM :: (descnap1) ;
* Option 2: 
* MAP := NAP: MAP TRKNAM FLUNAM MATEX MACRES :: (descnap2) ;
* Option 3: 
* GEONEW := NAP: GEOOLD COMPO :: (descnap3) ;
* where
*   COMPO : name of the \emph{multicompo} data structure (L\_COMPO signature) 
*     where the detailed subregion properties will be stored.
*   TRKNAM : name of the read-only \emph{tracking} data structure 
*     (L\_TRACK signature) containing the tracking. 
*   FLUNAM : name of the read-only \emph{fluxunk} data structure 
*     (L\_FLUX signature) containing a transport solution.
*   MAP : name of the \emph{map} data structure (L\_MAP signature) containing 
*     fuel regions description, global and local parameter information (burnup, 
*     fuel/coolant temperatures, coolant density, etc). A previous call to the 
*     FLPOW: module is highly recommended prior to the pin-power reconstruction 
*     to normalize the flux and compute the assembly power. If not, the 
*     pin-power reconstruction  will be normalized using the whole core power 
*     instead of a normalization for each assembly.
*   MATEX : name of the read-only \emph{matex} data structure 
*     (L\_MATEX signature). The object corresponds to the heterogeneously 
*     splited geometry.
*   MACRES : name of the read-only \emph{macrolib} data structure 
*     (L\_MACROLIB signature) containing a cross section for the fuel. The 
*     \emph{macrolib} data structure must have been created with a 
*     \emph{multicompo} data structure with pin level properties (transport 
*     flux, H-factor, infinite domain diffusion flux).
*   GEONEW : name of the created \emph{geometry} data structure 
*     (L\_GEOM signature) containing the detailed core geometry definition at 
*     heterogeneous assembly level.
*   GEOOLD : name of the read-only \emph{geometry} data structure 
*     (L\_GEOM signature) containing the core geometry definition with 
*     homogeneous assembly (only 1 mesh per assembly mandatory).
*   (descnap1) : structure containing the input data to this module to compute 
*     additional properties for subregions
*   (descnap2) : structure containing the input data to this module to perform 
*     pin power reconstruction
*   (descnap3) : structure containing the input data to this module to 
*     automatically define the core geometry with heterogeneous assembly
*
*-----------------------------------------------------------------------
*
      USE GANLIB
      IMPLICIT NONE
*----
*  SUBROUTINE ARGUMENTS
*----
      INTEGER      NENTRY,IENTRY(NENTRY),JENTRY(NENTRY)
      TYPE(C_PTR)  KENTRY(NENTRY)
      CHARACTER    HENTRY(NENTRY)*12
*----
*  LOCAL VARIABLES
*----
      INTEGER IOUT,MAXPAR,MAXLIN,MAXVAL,NSTATE,MAXADD
      REAL REPS
      PARAMETER (REPS=1.0E-4,IOUT=6,MAXPAR=50,MAXLIN=50,MAXVAL=200,
     1 NSTATE=40,MAXADD=10)
      TYPE(C_PTR) IPCPO,IPFLU,IPTRK,IPMAP,IPMTX,IPGNW,IPGOD,IPMPP,IPMAC
      CHARACTER TEXT*12,HSIGN*12
      INTEGER KCHAR(3)
      INTEGER IEN,I
      LOGICAL ldebug

      IPMAP=C_NULL_PTR
      IPMTX=C_NULL_PTR
      IPGNW=C_NULL_PTR
      IPGOD=C_NULL_PTR
      IPCPO=C_NULL_PTR
      IPMPP=C_NULL_PTR
      IPMAC=C_NULL_PTR
      
      ldebug=.false.
      if(ldebug)write(6,*) 'NAP begin debug'
*----
*  PARAMETER VALIDATION
*----
      IF(NENTRY.LE.2)CALL XABORT('@NAP: AT LEAST 3 PARAMETERS'
     > //' EXPECTED.')
      
      IF((IENTRY(1).NE.1).AND.(IENTRY(1).NE.2))CALL XABORT('@NAP'
     1 //': LCM OBJECT EXPECTED AT LHS.')
* NAPGEO
      if(ldebug)write(6,*) 'NAP begin NAPGEO'
      IF(JENTRY(1).EQ.0) THEN 
        IPGNW=KENTRY(1)
        DO IEN=2,3
          IF((IENTRY(1).NE.1).AND.(IENTRY(1).NE.2))CALL XABORT('@NAP'
     1     //': LCM OBJECT EXPECTED AT RHS.')
          CALL LCMGET(KENTRY(IEN),'SIGNATURE',KCHAR)
          WRITE(HSIGN,'(3A4)') (KCHAR(I),I=1,3)
          IF(HSIGN.EQ.'L_GEOM')THEN
            IPGOD=KENTRY(IEN)
          ELSEIF(HSIGN.EQ.'L_MULTICOMPO')THEN
            IPCPO=KENTRY(IEN)
          ELSE
              CALL XABORT('@NAP: COMPO OR GEOM OBJECT EXPECTED.')
          ENDIF
        ENDDO
        GOTO 3000
      ENDIF
* NAPCPO + NAPPPR
      if(ldebug)write(6,*) 'NAP begin NAPCPO + NAPPPR'
      CALL LCMGET(KENTRY(1),'SIGNATURE',KCHAR)
      WRITE(HSIGN,'(3A4)') (KCHAR(I),I=1,3)
      IF(HSIGN.EQ.'L_MULTICOMPO')THEN
        IPCPO=KENTRY(1)
      ELSEIF(HSIGN.EQ.'L_MAP')THEN
        IPMAP=KENTRY(1)
      ELSE
        CALL XABORT('@NAP: L_MULTICOMPO or L_MAP EXPECTED.')
      ENDIF
      DO 5 IEN=2,3
        IF((IENTRY(IEN).NE.1).AND.(IENTRY(IEN).NE.2))CALL XABORT('@N'
     1 //'AP: LCM OBJECT EXPECTED AT RHS.')
        IF(JENTRY(IEN).NE.2)CALL XABORT('@NAP: LCM OBJECT IN READ-ON'
     1 //'LY MODE EXPECTED AT RHS.')
        CALL LCMGET(KENTRY(IEN),'SIGNATURE',KCHAR)
        WRITE(HSIGN,'(3A4)') (KCHAR(I),I=1,3)
        IF(HSIGN.EQ.'L_FLUX')THEN
          IPFLU=KENTRY(IEN)
        ELSEIF(HSIGN.EQ.'L_TRACK')THEN
          IPTRK=KENTRY(IEN)
        ELSE
            CALL XABORT('@NAP: FLUX OR TRACKING OBJECT EXPECTED.')
        ENDIF
    5 CONTINUE
      IF(NENTRY.EQ.3) GOTO 1000
* NAPPPR
      if(ldebug)write(6,*) 'NAP begin NAPPPR'
      DO 7 IEN=4,NENTRY
        IF((IENTRY(IEN).NE.1).AND.(IENTRY(IEN).NE.2))CALL XABORT('@N'
     1   //'AP: LCM OBJECT EXPECTED AT RHS.')
        IF(JENTRY(IEN).NE.2)CALL XABORT('@NAP: LCM OBJECT IN READ-ON'
     1   //'LY MODE EXPECTED AT RHS.')
        CALL LCMGET(KENTRY(IEN),'SIGNATURE',KCHAR)
        WRITE(HSIGN,'(3A4)') (KCHAR(I),I=1,3)
C        IF(HSIGN.EQ.'L_MAP')THEN
C          IPMPP=KENTRY(IEN)
C        ELSEIF((HSIGN.EQ.'L_MATEX'))THEN
        IF((HSIGN.EQ.'L_MATEX'))THEN
          IPMTX=KENTRY(IEN)
        ELSEIF((HSIGN.EQ.'L_MACROLIB'))THEN
          IPMAC=KENTRY(IEN)
        ELSE
          TEXT=HENTRY(IEN)
          CALL XABORT('@NAP: SIGNATURE OF '//TEXT//' IS '//HSIGN//
     1    '. L_MATEX or L_MACROLIB EXPECTED.')
        ENDIF
    7 CONTINUE
      GOTO 2000
*----
*  enriched L_MULTICOMPO  computation
*----
 1000 CALL NAPCPO(IPCPO,IPTRK,IPFLU,NSTATE)
      GOTO 9000
*----
*  Pin Power Reconstruction
*----
 2000 CALL NAPPPR(IPMAP,IPTRK,IPFLU,IPMTX,IPMAC,NSTATE)
      GOTO 9000
*----
*  Automatic geometry unfolding
*----
 3000 CALL NAPGEO(IPGNW,IPGOD,IPCPO,NSTATE)
      GOTO 9000
*----
* END
*----
*
 9000 RETURN
      END