Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RADI_CheckParamInput.F90
Go to the documentation of this file.
1 ! *********************************************************************
2 ! * Rocstar Simulation Suite *
3 ! * Copyright@2015, Illinois Rocstar LLC. All rights reserved. *
4 ! * *
5 ! * Illinois Rocstar LLC *
6 ! * Champaign, IL *
7 ! * www.illinoisrocstar.com *
8 ! * sales@illinoisrocstar.com *
9 ! * *
10 ! * License: See LICENSE file in top level of distribution package or *
11 ! * http://opensource.org/licenses/NCSA *
12 ! *********************************************************************
13 ! *********************************************************************
14 ! * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
15 ! * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
16 ! * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
17 ! * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
18 ! * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
19 ! * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
20 ! * Arising FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
21 ! * USE OR OTHER DEALINGS WITH THE SOFTWARE. *
22 ! *********************************************************************
23 !******************************************************************************
24 !
25 ! Purpose: Check RADI parameters either specified by user or set in the code.
26 !
27 ! Description: Fixed parameters and relevancy of physical parameters are
28 ! checked.
29 !
30 ! Input: regions = input parameters contained in radiInput of all regions.
31 !
32 ! Output: Error msg for inconsistency.
33 !
34 ! Notes: If radiation is used in Genx, it should be active in all regions
35 ! or not at all. When this routine is called, radiation is active
36 ! at least in one region.
37 !
38 !******************************************************************************
39 !
40 ! $Id: RADI_CheckParamInput.F90,v 1.4 2008/12/06 08:44:37 mtcampbe Exp $
41 !
42 ! Copyright: (c) 2001 by the University of Illinois
43 !
44 !******************************************************************************
45 
46 #ifdef RFLO
47 SUBROUTINE radi_checkparaminput( regions )
48 #endif
49 #ifdef RFLU
50 SUBROUTINE radi_checkparaminput
51 #endif
52 
53  USE moddatatypes
54  USE moddatastruct, ONLY : t_region
55  USE modglobal, ONLY : t_global
56  USE modradiation, ONLY : t_radi_input
57  USE moderror
58  USE modparameters
60  IMPLICIT NONE
61 
62 ! ... parameters
63  TYPE(t_region), POINTER :: regions(:)
64 
65 ! ... loop variables
66  INTEGER :: ireg
67 
68 ! ... local variables
69  TYPE(t_global), POINTER :: global
70  TYPE(t_radi_input), POINTER :: input
71 
72  LOGICAL :: radiunused
73 
74  REAL(RFREAL), POINTER :: optconst(:,:)
75 
76 !******************************************************************************
77 
78  global => regions(1)%global
79  CALL registerfunction( global,'RADI_CheckParamInput',&
80  'RADI_CheckParamInput.F90' )
81 
82 ! check fixed parameters setting ---------------------------------------------
83 
84  IF ((ycoord - xcoord)/=1 .OR. &
85  (zcoord - ycoord)/=1) THEN
86  CALL errorstop( global,err_radi_fixparam,__line__,'XCOORD,YCOORD,ZCOORD' )
87  ENDIF
88 
89 #ifdef RFLO
90  IF ((kcoord-jcoord /= 1).OR.(jcoord-icoord /= 1).OR.(icoord /= 1)) THEN
91  CALL errorstop( global,err_radi_fixparam,__line__,'I,J,KCOORD' )
92  ENDIF
93 #endif
94 
95  IF (radi_coeff_extinct /=1 .OR. &
96  radi_coeff_scatter /=2 .OR. &
97  radi_coeff_ncomp /=2) THEN
98  CALL errorstop( global,err_radi_fixparam,__line__,'RADI_COEFF_...' )
99  ENDIF
100 
101  IF (radi_angle_ncomp /=2) THEN
102  CALL errorstop( global,err_radi_fixparam,__line__,'RADI_ANGLE_...' )
103  ENDIF
104 
105 ! check RADI parameter selection regionwise ---------------------------------
106 
107  radiunused = .false.
108 
109 #ifdef RFLO
110  DO ireg=1,global%nRegions
111  IF (regions(ireg)%procid==global%myProcid .AND. & ! region active and
112  regions(ireg)%active==active) THEN ! on my processor
113 
114 ! --- radi input check
115 
116  input => regions(ireg)%radiInput
117  optconst => input%optConst
118 
119 ! --- radiation model
120 
121  IF ((input%radiModel /= radi_model_none) .AND. &
122  (input%radiModel /= radi_model_ross) .AND. &
123  (input%radiModel /= radi_model_fldsrc) .AND. &
124  (input%radiModel /= radi_model_fldtran) .AND. &
125  (input%radiModel /= radi_model_rtegray) .AND. &
126  (input%radiModel /= radi_model_rteband)) THEN
127  CALL errorstop( global,err_radi_input,__line__, &
128  'radiation model selected does not exist' )
129  ENDIF
130 
131  IF (regions(ireg)%mixtInput%flowModel /= flow_navst) THEN
132  IF ((input%radiModel == radi_model_ross) .OR. &
133  (input%radiModel == radi_model_fldsrc) .OR. &
134  (input%radiModel == radi_model_fldtran)) THEN
135  CALL errorstop( global,err_radi_input,__line__, &
136  'diffusion approximation models currently only run with NS' )
137  ENDIF
138  ENDIF
139 
140 ! --- radiation active
141 
142  IF (input%radiModel /= radi_model_none) THEN
143 
144 ! ----- active radiation model
145  IF ((input%radiModel == radi_model_fldtran) .OR. &
146  (input%radiModel == radi_model_rtegray) .OR. &
147  (input%radiModel == radi_model_rteband)) THEN
148  CALL errorstop( global,err_radi_input,__line__, &
149  'radiation model selected is not ready yet' )
150  ENDIF
151 
152 ! ----- check for real media, consistency with rocpart and rocsmoke
153  IF (input%media == radi_media_real) THEN
154  IF (optconst(phase_prop_v,radi_phase_dispart) >radi_real_small) THEN
155  IF (.NOT. global%plagUsed) THEN
156  CALL errorstop( global,err_radi_input,__line__, &
157  'real media contains discrete particles but rocpart is off' )
158  ENDIF
159  ENDIF ! optConst
160  IF (optconst(phase_prop_v,radi_phase_conpart) >radi_real_small) THEN
161  IF (.NOT. global%peulUsed) THEN
162  CALL errorstop( global,err_radi_input,__line__, &
163  'real media contains continuum particles but rocsmoke is off' )
164  ENDIF
165  ENDIF
166  ENDIF ! media
167 
168 ! ----- check consistency of optical constants, independent of media
169  IF (optconst(phase_prop_v,radi_phase_gas) <radi_real_small .OR. &
170  optconst(phase_prop_q,radi_phase_gas) <radi_real_small) THEN
171  CALL errorstop( global,err_radi_input,__line__, &
172  'Gas: ext.coef. and vol.frac. should be > 0 or let be default' )
173  ENDIF
174  IF (optconst(phase_prop_v,radi_phase_conpart) >radi_real_small .AND. &
175  optconst(phase_prop_q,radi_phase_conpart) <radi_real_small) THEN
176  CALL errorstop( global,err_radi_input,__line__, &
177  'Con. particles: extinction efficiency should be higher' )
178  ENDIF
179  IF (optconst(phase_prop_v,radi_phase_dispart) >radi_real_small .AND. &
180  optconst(phase_prop_q,radi_phase_dispart) <radi_real_small) THEN
181  CALL errorstop( global,err_radi_input,__line__, &
182  'Disc. particles: extinction efficiency should be higher' )
183  ENDIF
184  IF (optconst(phase_prop_d,radi_phase_gas ) <radi_real_small .OR. &
185  optconst(phase_prop_d,radi_phase_dispart) <radi_real_small .OR. &
186  optconst(phase_prop_d,radi_phase_conpart) <radi_real_small) THEN
187  CALL errorstop( global,err_radi_input,__line__, &
188  'gas molecule and particle diameters should be > (machine) zero' )
189  ENDIF
190 
191 ! ----- intensity angles
192  IF ((lbound(input%angles,1) /= 1) .OR. &
193  (ubound(input%angles,1) /= input%nAng)) THEN
194  CALL errorstop( global,err_radi_input,__line__, &
195  'number of intensity angles is inconsistent' )
196  ENDIF
197 
198 ! ----- radiation numerical solution method of RTE radiation model
199  IF (input%radiModel == radi_model_fldtran) THEN
200 #ifdef RFLO
201  IF (input%spaceDiscr /= fld_discr_cen) THEN
202  CALL errorstop( global,err_radi_fldinput,__line__, &
203  'selected FLD space discretization is not defined' )
204  ENDIF
205 #endif
206  IF (input%spaceOrder /= fld_discr_ord2) THEN
207  CALL errorstop( global,err_radi_fldinput,__line__, &
208  'selected FLD space discretization order is not defined' )
209  ENDIF
210  ENDIF
211 
212 ! ----- radiation numerical solution method of RTE radiation model
213  IF ((input%radiModel == radi_model_rtegray) .OR. &
214  (input%radiModel == radi_model_rteband)) THEN
215 
216 ! ------- DOM:
217  IF ((input%solMethod /= radi_num_dom4) .AND. &
218  (input%solMethod /= radi_num_dom8) .AND. &
219  (input%solMethod /= radi_num_dom16) .AND. &
220  (input%solMethod /= radi_num_fvm)) THEN
221  CALL errorstop( global,err_radi_input,__line__, &
222  'radiation solution method selected does not exist' )
223  ENDIF
224  IF ((input%solMethod == radi_num_dom4) .OR. &
225  (input%solMethod == radi_num_dom8) .OR. &
226  (input%solMethod == radi_num_dom16) .OR. &
227  (input%solMethod == radi_num_fvm)) THEN
228  CALL errorstop( global,err_radi_input,__line__, &
229  'radiation solution method selected is not ready yet' )
230  ENDIF
231  IF ((input%solMethod == radi_num_dom4) .AND. &
232  (input%nOrdin /= 4)) THEN
233  CALL errorstop( global,err_radi_input,__line__, &
234  'number of ordinates inconsistence with method selected' )
235  ENDIF
236  IF ((input%solMethod == radi_num_dom8) .AND. &
237  (input%nOrdin /= 8)) THEN
238  CALL errorstop( global,err_radi_input,__line__, &
239  'number of ordinates inconsistence with method selected' )
240  ENDIF
241  IF ((input%solMethod == radi_num_dom16) .AND. &
242  (input%nOrdin /= 16)) THEN
243  CALL errorstop( global,err_radi_input,__line__, &
244  'number of ordinates inconsistence with method selected' )
245  ENDIF
246  IF ((input%solMethod == radi_num_dom4) .OR. &
247  (input%solMethod == radi_num_dom8) .OR. &
248  (input%solMethod == radi_num_dom16)) THEN
249  IF (input%nAng /= input%nOrdin) THEN
250  CALL errorstop( global,err_radi_input,__line__, &
251  'DOM: nAngle /= nOrdinate' )
252  ENDIF
253  ENDIF
254 
255 ! ------- FVM:
256  IF (input%solMethod == radi_num_fvm) THEN
257  IF (input%nPol < 2 .OR. input%nPol > 50) THEN
258  CALL errorstop( global,err_radi_input,__line__, &
259  'number of polar angles is out of range [2-50]' )
260  ENDIF
261  IF (input%nAzi < 4 .OR. input%nAzi > 100) THEN
262  CALL errorstop( global,err_radi_input,__line__, &
263  'number of azimuthal angles is out of range [4-100]' )
264  ENDIF
265  IF (input%nAng /= (input%nPol+1)*(input%nAzi+1)) THEN
266  CALL errorstop( global,err_radi_input,__line__, &
267  'FVM: nAngle /= (nPolar+1)*(nAzimuthal+1)' )
268  ENDIF
269  ENDIF ! solMethod
270  ENDIF ! radiModel RTE
271 
272  ENDIF ! radiModel active
273 
274 ! --- assign value to radiUnused
275  IF (.NOT. regions(ireg)%mixtInput%radiUsed) THEN
276  radiunused = .true.
277  ENDIF
278 #endif
279 #ifdef RFLU
280  input => radiinput
281  IF (input%radiModel /= radi_model_none) THEN
282  CALL errorstop( global,err_radi_input,__line__, &
283  'RFLU-RADI is not ready yet' )
284  ENDIF
285 #endif
286 
287 #ifdef RFLO
288  ENDIF ! region active
289  ENDDO ! iReg
290 #endif
291 
292 #ifdef GENX
293  IF (radiunused) THEN
294  CALL errorstop( global,err_radi_input,__line__, &
295  'For Genx, radiation should be active in all regions or none at all' )
296  ENDIF
297 #endif
298 
299 ! finalize --------------------------------------------------------------------
300 
301  CALL deregisterfunction( global )
302 
303 END SUBROUTINE radi_checkparaminput
304 
305 !******************************************************************************
306 !
307 ! RCS Revision history:
308 !
309 ! $Log: RADI_CheckParamInput.F90,v $
310 ! Revision 1.4 2008/12/06 08:44:37 mtcampbe
311 ! Updated license.
312 !
313 ! Revision 1.3 2008/11/19 22:17:49 mtcampbe
314 ! Added Illinois Open Source License/Copyright
315 !
316 ! Revision 1.2 2004/09/30 17:10:50 wasistho
317 ! prepared for full FLD radiation model
318 !
319 ! Revision 1.1 2004/09/22 02:35:49 wasistho
320 ! changed file nomenclature from lower to upper case
321 !
322 ! Revision 1.8 2004/09/22 01:30:33 wasistho
323 ! switch LFD to FLD for flux limited diffusion
324 !
325 ! Revision 1.7 2004/09/18 17:40:44 wasistho
326 ! install Limited Flux Diffusion radiation
327 !
328 ! Revision 1.6 2004/03/05 22:09:04 jferry
329 ! created global variables for peul, plag, and inrt use
330 !
331 ! Revision 1.5 2003/08/07 21:58:23 wasistho
332 ! diffusion approx. currently only run with NS
333 !
334 ! Revision 1.4 2003/07/30 22:22:31 wasistho
335 ! enter part and smoke data into radiation
336 !
337 ! Revision 1.3 2003/07/23 03:13:43 wasistho
338 ! cured baby illness
339 !
340 ! Revision 1.2 2003/07/18 01:44:18 wasistho
341 ! check consistency with rocpart and rocsmoke
342 !
343 ! Revision 1.1 2003/07/17 01:16:59 wasistho
344 ! initial activation rocrad
345 !
346 !
347 !
348 !******************************************************************************
349 
350 
351 
352 
353 
354 
355 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine input(X, NNODE, NDC, NCELL, NFCE, NBPTS, NBFACE, ITYP, NPROP, XBNDY, XFAR, YFAR, ZFAR)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469