~fluidity-core/fluidity/exorcised

« back to all changes in this revision

Viewing changes to multiphase/src/multi_IO.F90

  • Committer: saunde01
  • Date: 2011-03-23 13:15:31 UTC
  • Revision ID: svn-v4:5bf5533e-7014-46e3-b1bb-cce4b9d03719:trunk:3310
As discussed in the Dev meeting and in emails, this commit renames the multiphase directory to legacy_reservoir_prototype, and adds an obvious warning to the top of the README file to warn unsuspecting users of the experimental nature of the code. Iterations on the exact wording very welcome

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
!    Copyright (C) 2006 Imperial College London and others.
2
 
!    
3
 
!    Please see the AUTHORS file in the main source directory for a full list
4
 
!    of copyright holders.
5
 
!
6
 
!    Prof. C Pain
7
 
!    Applied Modelling and Computation Group
8
 
!    Department of Earth Science and Engineering
9
 
!    Imperial College London
10
 
!
11
 
!    amcgsoftware@imperial.ac.uk
12
 
!    
13
 
!    This library is free software; you can redistribute it and/or
14
 
!    modify it under the terms of the GNU Lesser General Public
15
 
!    License as published by the Free Software Foundation,
16
 
!    version 2.1 of the License.
17
 
!
18
 
!    This library is distributed in the hope that it will be useful,
19
 
!    but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 
!    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21
 
!    Lesser General Public License for more details.
22
 
!
23
 
!    You should have received a copy of the GNU Lesser General Public
24
 
!    License along with this library; if not, write to the Free Software
25
 
!    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
26
 
!    USA
27
 
 
28
 
module printout
29
 
 
30
 
  implicit none
31
 
 
32
 
contains
33
 
 
34
 
  subroutine open_output_file(output_channel,output_name,output_name_length,file_format)
35
 
 
36
 
    integer,                           intent(in) :: output_channel,output_name_length
37
 
    character(len=12),                 intent(in) :: file_format    
38
 
    character(len=output_name_length), intent(in) :: output_name
39
 
 
40
 
    ! local variables
41
 
    integer :: ierror
42
 
 
43
 
    write(357,*) 'In open_output_file'
44
 
 
45
 
    open(output_channel,file=trim(output_name),status='replace',form=trim(file_format),action='write',iostat=ierror) 
46
 
 
47
 
    if (ierror .ne. 0) then       
48
 
       write(*,*) 'Problem opening output file ',trim(output_name)  
49
 
       stop 446       
50
 
    end if ! if (ierror .ne. 0) then      
51
 
 
52
 
    write(357,*) 'Leaving open_output_file'
53
 
 
54
 
  end subroutine open_output_file
55
 
 
56
 
  !----------------------------------------------------------------
57
 
 
58
 
  subroutine write_integer_to_string(integer_variable,string_variable,len_string_variable)
59
 
 
60
 
    ! write an integer to a string
61
 
 
62
 
    integer, intent(in) :: integer_variable,len_string_variable
63
 
    character(len=len_string_variable), intent(inout) :: string_variable
64
 
 
65
 
    write(357,*) 'In write_integer_to_string'
66
 
 
67
 
    if (integer_variable .lt. 10) then
68
 
 
69
 
       if (len_string_variable .lt. 1) then
70
 
 
71
 
          write(*,*) 'Write integer to string error - string to short,len_string_variable,integer_variable', &
72
 
               len_string_variable,integer_variable 
73
 
          stop 29134
74
 
 
75
 
       end if ! if (len_string_variable .lt. 1) then
76
 
 
77
 
       write(unit=string_variable,fmt='(I1)') integer_variable
78
 
 
79
 
    else if ((integer_variable .ge. 10) .and. (integer_variable .lt. 100)) then
80
 
 
81
 
       if (len_string_variable .lt. 2) then
82
 
 
83
 
          write(*,*) 'Write integer to string error - string to short,len_string_variable,integer_variable', &
84
 
               len_string_variable,integer_variable 
85
 
          stop 29134
86
 
 
87
 
       end if ! if (len_string_variable .lt. 2) then
88
 
 
89
 
       write(unit=string_variable,fmt='(I2)') integer_variable
90
 
 
91
 
    else if ((integer_variable .ge. 100) .and. (integer_variable .lt. 1000)) then
92
 
 
93
 
       if (len_string_variable .lt. 3) then
94
 
 
95
 
          write(*,*) 'Write integer to string error - string to short,len_string_variable,integer_variable', &
96
 
               len_string_variable,integer_variable 
97
 
          stop 29134
98
 
 
99
 
       end if ! if (len_string_variable .lt. 3) then
100
 
 
101
 
       write(unit=string_variable,fmt='(I3)') integer_variable
102
 
 
103
 
    else if ((integer_variable .ge. 1000) .and. (integer_variable .lt. 10000)) then
104
 
 
105
 
       if (len_string_variable .lt. 4) then
106
 
 
107
 
          write(*,*) 'Write integer to string error - string to short,len_string_variable,integer_variable', &
108
 
               len_string_variable,integer_variable 
109
 
          stop 29134
110
 
 
111
 
       end if ! if (len_string_variable .lt. 4) then
112
 
 
113
 
       write(unit=string_variable,fmt='(I4)') integer_variable
114
 
 
115
 
    else if ((integer_variable .ge. 10000) .and. (integer_variable .lt. 100000)) then
116
 
 
117
 
       if (len_string_variable .lt. 5) then
118
 
 
119
 
          write(*,*) 'Write integer to string error - string to short,len_string_variable,integer_variable', &
120
 
               len_string_variable,integer_variable 
121
 
          stop 29134
122
 
 
123
 
       end if ! if (len_string_variable .lt. 5) then
124
 
 
125
 
       write(unit=string_variable,fmt='(I5)') integer_variable
126
 
 
127
 
    else if ((integer_variable .ge. 100000) .and. (integer_variable .lt. 1000000)) then
128
 
 
129
 
       if (len_string_variable .lt. 6) then
130
 
 
131
 
          write(*,*) 'Write integer to string error - string to short,len_string_variable,integer_variable', &
132
 
               len_string_variable,integer_variable 
133
 
          stop 29134
134
 
 
135
 
       end if ! if (len_string_variable .lt. 6) then
136
 
 
137
 
       write(unit=string_variable,fmt='(I6)') integer_variable
138
 
 
139
 
    else if ((integer_variable .ge. 1000000) .and. (integer_variable .lt. 10000000)) then
140
 
 
141
 
       if (len_string_variable .lt. 7) then
142
 
 
143
 
          write(*,*) 'Write integer to string error - string to short,len_string_variable,integer_variable', &
144
 
               len_string_variable,integer_variable 
145
 
          stop 29134
146
 
 
147
 
       end if ! if (len_string_variable .lt. 7) then
148
 
 
149
 
       write(unit=string_variable,fmt='(I7)') integer_variable
150
 
 
151
 
    else if ((integer_variable .ge. 10000000) .and. (integer_variable .lt. 100000000)) then
152
 
 
153
 
       if (len_string_variable .lt. 8) then
154
 
 
155
 
          write(*,*) 'Write integer to string error - string to short,len_string_variable,integer_variable', &
156
 
               len_string_variable,integer_variable 
157
 
          stop 29134
158
 
 
159
 
       end if ! if (len_string_variable .lt. 8) then
160
 
 
161
 
       write(unit=string_variable,fmt='(I8)') integer_variable
162
 
 
163
 
    else
164
 
 
165
 
       write(*,*) 'Write integer to string error - integer to big,integer_variable',integer_variable
166
 
       stop 29135
167
 
 
168
 
    end if ! if (integer_variable .lt. 10) then
169
 
 
170
 
    write(357,*) 'Leaving write_integer_to_string'
171
 
 
172
 
  end subroutine write_integer_to_string
173
 
 
174
 
  ! -----------------------------------------------------------------------------------------
175
 
 
176
 
  subroutine output_fem_sol_of_cv( unit, totele, cv_nonods, x_nonods, nphase, &
177
 
       cv_nloc, x_nloc, cv_ndgln, x_ndgln, x, femt )
178
 
 
179
 
    implicit none
180
 
 
181
 
    integer, intent( in ) :: unit, totele, cv_nonods, x_nonods, nphase, cv_nloc, x_nloc
182
 
    integer, dimension( totele * cv_nloc ), intent( in ) :: cv_ndgln
183
 
    integer, dimension( totele * x_nloc ), intent( in ) :: x_ndgln
184
 
    real, dimension( x_nonods ), intent( in ) :: x
185
 
    real, dimension( cv_nonods * nphase ), intent( in ) :: femt
186
 
 
187
 
    ! Local variables
188
 
    integer :: ele, cv_iloc
189
 
 
190
 
    write(357,*) 'In output_fem_sol_of_cv'
191
 
 
192
 
    do ele = 1, totele
193
 
       do cv_iloc = 1, cv_nloc
194
 
          write( unit ,* ) x( x_ndgln(( ele - 1 ) * x_nloc + cv_iloc )), &
195
 
               femt( cv_ndgln(( ele - 1 ) * cv_nloc + cv_iloc ))
196
 
       end do
197
 
    end do
198
 
 
199
 
    write(357,*) 'Leaving output_fem_sol_of_cv'
200
 
 
201
 
  end subroutine output_fem_sol_of_cv
202
 
 
203
 
  ! -----------------------------------------------------------------------------------------
204
 
 
205
 
  subroutine generate_name_dump( itime, unit, field, field_no )
206
 
    implicit none
207
 
    integer, intent( in ) :: itime
208
 
    integer, intent( inout ) :: unit
209
 
    character( len = 50 ), intent( in ) :: field
210
 
    integer, intent( in ) :: field_no
211
 
 
212
 
    ! Local variables
213
 
    character( len = 50 ) :: file_name_in, file_name_out, dump
214
 
    integer :: iaux, k, k1, k2, k3
215
 
 
216
 
    write(357,*) 'In generate_name_dump'
217
 
 
218
 
    iaux = 9997
219
 
    file_name_in = 'test_'
220
 
    k1 = index( file_name_in, ' ' ) - 1 
221
 
    k2 = index( field, ' ' ) - 1 
222
 
    dump = '.d.'
223
 
    k3 =  index( dump, ' ' ) - 1 
224
 
    file_name_in = file_name_in( 1 : k1 ) // field( 1 : k2 ) // dump( 1 : k3 )
225
 
    !file_name_in = trim( trim( file_name_in )//trim( field )//trim( dump )
226
 
 
227
 
    open( iaux, file = 'tempfile', status = 'unknown' )
228
 
    k = index( file_name_in, ' ' ) - 1
229
 
    write( iaux, 222 ) file_name_in( 1 : k ), itime
230
 
    !trim( file_name_in ), '.d.', itime
231
 
 
232
 
    rewind( unit = iaux )
233
 
    read( iaux, * ) file_name_out
234
 
    k = index( file_name_out, ' ' ) - 1
235
 
    !unit = itime + field_no
236
 
    unit = 100000 + field_no
237
 
    open( unit, file = trim( file_name_out ), status = 'unknown' )
238
 
 
239
 
    close( iaux )
240
 
 
241
 
 
242
 
222 format( a, i0 )
243
 
    !222 format( a, a3, i0 )
244
 
 
245
 
    write(357,*) 'Leaving generate_name_dump'
246
 
 
247
 
  end subroutine generate_name_dump
248
 
 
249
 
  ! -----------------------------------------------------------------------------------------
250
 
 
251
 
  subroutine printing_field_array( unit, totele, &
252
 
       cv_nonods, x_nonods, x_nloc, x_ndgln, cv_nloc, cv_ndgln, &
253
 
       pos_x, field_length, field, iphase )
254
 
    implicit none
255
 
    integer, intent( in ) :: unit, totele, x_nloc, cv_nonods, x_nonods, cv_nloc, iphase
256
 
    integer, dimension( totele * x_nloc ), intent( in ) :: x_ndgln
257
 
    integer, dimension( totele * cv_nloc ), intent( in ) :: cv_ndgln
258
 
    real, dimension( x_nonods ), intent( in ) :: pos_x
259
 
    integer, intent( in ) :: field_length
260
 
    real, dimension( field_length ), intent( in ) :: field
261
 
 
262
 
    ! Local variables
263
 
    integer :: cv_iloc, ele, xi_nod, xi_nod_plus, xi_nod_minus, field_nod
264
 
    real :: x_coord
265
 
 
266
 
    write(357,*) 'In printing_field_array'
267
 
 
268
 
    Loop_Elements: do ele = 1, totele
269
 
 
270
 
       cv_iloc = 1
271
 
       xi_nod =      x_ndgln(( ele - 1 ) * x_nloc  + cv_iloc )
272
 
       xi_nod_plus = x_ndgln(( ele - 1 ) * x_nloc  + cv_iloc + 1 )
273
 
       field_nod = cv_ndgln(( ele - 1 ) * cv_nloc + cv_iloc ) + ( iphase - 1 ) * cv_nonods
274
 
       x_coord = pos_x( xi_nod ) + pos_x( xi_nod_plus )
275
 
       x_coord =  0.5 * x_coord
276
 
       write( unit, * ) pos_x( xi_nod ), field( field_nod )
277
 
       write( unit, * ) x_coord, field( field_nod )
278
 
 
279
 
       do cv_iloc = 2, cv_nloc - 1
280
 
 
281
 
          xi_nod =       x_ndgln(( ele - 1 ) * x_nloc  + cv_iloc )
282
 
          xi_nod_plus  = x_ndgln(( ele - 1 ) * x_nloc  + cv_iloc + 1 )
283
 
          xi_nod_minus = x_ndgln(( ele - 1 ) * x_nloc  + cv_iloc - 1 )
284
 
          x_coord = pos_x( xi_nod ) + pos_x( xi_nod_minus )
285
 
          x_coord = 0.5 * x_coord
286
 
          field_nod = cv_ndgln(( ele - 1 ) * cv_nloc + cv_iloc ) + ( iphase - 1 ) * cv_nonods
287
 
          write( unit, * ) x_coord, field( field_nod )
288
 
          x_coord = pos_x( xi_nod ) + pos_x( xi_nod_plus )
289
 
          x_coord =  0.5 * x_coord
290
 
          write( unit, * ) x_coord, field( field_nod )
291
 
 
292
 
       end do
293
 
 
294
 
       cv_iloc = cv_nloc
295
 
       xi_nod =       x_ndgln(( ele - 1 ) * x_nloc  + cv_iloc )
296
 
       xi_nod_minus = x_ndgln(( ele - 1 ) * x_nloc  + cv_iloc - 1 )
297
 
       x_coord = pos_x( xi_nod ) + pos_x( xi_nod_minus )
298
 
       x_coord = 0.5 * x_coord
299
 
       field_nod = cv_ndgln(( ele - 1 ) * cv_nloc + cv_iloc ) + ( iphase - 1 ) * cv_nonods
300
 
       write( unit, * ) x_coord, field( field_nod )
301
 
       write( unit, * ) pos_x( xi_nod ), field( field_nod )
302
 
 
303
 
    end do Loop_Elements
304
 
 
305
 
    write(357,*) 'Leaving printing_field_array'
306
 
 
307
 
  end subroutine printing_field_array
308
 
 
309
 
  ! -----------------------------------------------------------------------------------------
310
 
 
311
 
  subroutine printing_veloc_field( unit, totele, &
312
 
       xu_nonods, xu_nloc, xu_ndgln, u_nloc, u_ndgln, &
313
 
       pos_x, u_nonods, field_length, field, iphase )
314
 
    implicit none
315
 
    integer, intent( in ) :: unit, totele, xu_nonods, xu_nloc
316
 
    integer, dimension( totele * xu_nloc ), intent( in ) :: xu_ndgln
317
 
    integer, intent( in ) :: u_nloc
318
 
    integer, dimension( totele * u_nloc ), intent( in ) :: u_ndgln
319
 
    real, dimension( xu_nonods ), intent( in ) :: pos_x
320
 
    integer, intent( in ) :: u_nonods
321
 
    integer, intent( in ) :: field_length
322
 
    real, dimension( field_length ), intent( in ) :: field
323
 
    integer, intent( in ) :: iphase
324
 
 
325
 
    ! Local variables
326
 
    integer :: x_iloc, ele, xi_nod, xi_nod_plus, &
327
 
         xi_nod_minus, field_nod
328
 
    real :: x_coord
329
 
 
330
 
    write(357,*) 'In printing_veloc_field'
331
 
 
332
 
    Loop_Elements: do ele = 1, totele
333
 
 
334
 
       x_iloc = 1
335
 
       xi_nod =      xu_ndgln(( ele - 1 ) * xu_nloc  + x_iloc )
336
 
       xi_nod_plus = xu_ndgln(( ele - 1 ) * xu_nloc  + x_iloc + 1 )
337
 
       field_nod = u_ndgln(( ele - 1 ) * u_nloc + x_iloc ) + ( iphase - 1 ) * u_nonods
338
 
       x_coord = pos_x( xi_nod ) + pos_x( xi_nod_plus )
339
 
       x_coord =  0.5 * x_coord
340
 
       write( unit, * ) pos_x( xi_nod ), field( field_nod )
341
 
       write( unit, * ) x_coord, field( field_nod )
342
 
 
343
 
       do x_iloc = 2, xu_nloc - 1
344
 
 
345
 
          xi_nod =       xu_ndgln(( ele - 1 ) * xu_nloc  + x_iloc )
346
 
          xi_nod_plus  = xu_ndgln(( ele - 1 ) * xu_nloc  + x_iloc + 1 )
347
 
          xi_nod_minus = xu_ndgln(( ele - 1 ) * xu_nloc  + x_iloc - 1 )
348
 
          x_coord = pos_x( xi_nod ) + pos_x( xi_nod_minus )
349
 
          x_coord = 0.5 * x_coord
350
 
          field_nod = u_ndgln(( ele - 1 ) * u_nloc + x_iloc ) + ( iphase - 1 ) * u_nonods ! Is this correct? check later!
351
 
          write( unit, * ) x_coord, field( field_nod )
352
 
          x_coord = pos_x( xi_nod ) + pos_x( xi_nod_plus )
353
 
          x_coord =  0.5 * x_coord
354
 
          write( unit, * ) x_coord, field( field_nod )
355
 
 
356
 
       end do
357
 
 
358
 
       x_iloc = xu_nloc
359
 
       xi_nod =       xu_ndgln(( ele - 1 ) * xu_nloc  + x_iloc )
360
 
       xi_nod_minus = xu_ndgln(( ele - 1 ) * xu_nloc  + x_iloc - 1 )
361
 
       x_coord = pos_x( xi_nod ) + pos_x( xi_nod_minus )
362
 
       x_coord = 0.5 * x_coord
363
 
       field_nod = u_ndgln(( ele - 1 ) * u_nloc + x_iloc ) + ( iphase - 1 ) * u_nonods
364
 
       write( unit, * ) x_coord, field( field_nod )
365
 
       write( unit, * ) pos_x( xi_nod ), field( field_nod )
366
 
 
367
 
    end do Loop_Elements
368
 
 
369
 
    write(357,*) 'Leaving printing_veloc_field'
370
 
 
371
 
  end subroutine printing_veloc_field
372
 
 
373
 
  ! -----------------------------------------------------------------------------------------
374
 
 
375
 
  subroutine printing_fw_field( unit, totele, &
376
 
       cv_nonods, cv_nloc, cv_ndgln, &
377
 
       field_length, field )
378
 
    implicit none
379
 
    integer, intent( in ) :: unit, totele, cv_nonods, cv_nloc
380
 
    integer, dimension( totele * cv_nloc ), intent( in ) :: cv_ndgln
381
 
    integer, intent( in ) :: field_length
382
 
    real, dimension( field_length ), intent( in ) :: field
383
 
 
384
 
    ! Local variables
385
 
    integer :: cv_iloc, ele, cv_nod
386
 
    real :: visc1, visc2, s_gc, s_or, fw, kr1, kr2, sat
387
 
 
388
 
    write(357,*) 'In printing_fw_field'
389
 
 
390
 
    Loop_ELE: DO ELE = 1, TOTELE
391
 
 
392
 
       Loop_CVNLOC: DO CV_ILOC = 1, CV_NLOC
393
 
 
394
 
          CV_NOD = CV_NDGLN(( ELE - 1) * CV_NLOC + CV_ILOC )
395
 
 
396
 
          VISC1 = 0.4E-2
397
 
          VISC2 = 0.5E-2
398
 
          S_GC = 0.2 ! here S_gc --> S_wi
399
 
          S_OR = 0.3
400
 
 
401
 
          SAT = max( 0.0, FIELD( CV_NOD + CV_NONODS )) ! Second phase
402
 
          KR2 = ( 1. - ( 1. - SAT - S_GC ) / MAX( 1.E-5, 1. - S_GC - S_OR )) **2
403
 
          KR2 = KR2 / REAL( CV_NLOC )
404
 
 
405
 
          SAT = MAX( 0.0, FIELD( CV_NOD )) ! First phase
406
 
          KR1 = 0.7 * (( SAT - S_GC ) / MAX( 1.E-5, 1. - S_GC - S_OR )) **2
407
 
          KR1 = KR1 / REAL( CV_NLOC )
408
 
 
409
 
          FW = FW + 1. / ( 1. + VISC1 / KR1 * KR2 / VISC2 )
410
 
          FW = FW / REAL( CV_NLOC )
411
 
 
412
 
       END DO Loop_CVNLOC
413
 
 
414
 
       write( unit, * ) SAT, KR1
415
 
 
416
 
    END DO Loop_ELE
417
 
 
418
 
    write(357,*) 'Leaving printing_fw_field'
419
 
 
420
 
  end subroutine printing_fw_field
421
 
 
422
 
  ! -----------------------------------------------------------------------------------------
423
 
 
424
 
  subroutine check_sparsity( &
425
 
       u_pha_nonods, cv_pha_nonods, &
426
 
       u_nonods, cv_nonods, totele, &
427
 
       mx_ncolacv, ncolacv, finacv, colacv, midacv, & ! CV multi-phase eqns (e.g. vol frac, temp)
428
 
       nlenmcy, mx_ncolmcy, ncolmcy, finmcy, colmcy, midmcy, & ! Force balance plus cty multi-phase eqns
429
 
       mxnele, ncolele, midele, finele, colele, & ! Element connectivity 
430
 
       mx_ncoldgm_pha, ncoldgm_pha, coldgm_pha, findgm_pha, middgm_pha, & ! Force balance sparsity  
431
 
       mx_nct, ncolct, findct, colct, & ! CT sparsity - global cty eqn
432
 
       mx_nc, ncolc, findc, colc, & ! C sparsity operating on pressure in force balance
433
 
       mx_ncolcmc, ncolcmc, findcmc, colcmc, midcmc, & ! pressure matrix for projection method
434
 
       mx_ncolm, ncolm, findm, colm, midm )
435
 
    use spact
436
 
 
437
 
    implicit none
438
 
    integer, intent( in ) :: u_pha_nonods, cv_pha_nonods, u_nonods, cv_nonods, totele
439
 
    integer, intent ( in ) :: mx_ncolacv, ncolacv
440
 
    integer, dimension( cv_pha_nonods + 1 ), intent (in ) :: finacv
441
 
    integer, dimension( mx_ncolacv ), intent (in ) :: colacv
442
 
    integer, dimension( cv_pha_nonods ), intent (in ) :: midacv
443
 
    integer, intent ( in ) :: nlenmcy, mx_ncolmcy, ncolmcy
444
 
    integer, dimension( nlenmcy + 1 ), intent (in ) :: finmcy
445
 
    integer, dimension( mx_ncolmcy ), intent (in ) :: colmcy
446
 
    integer, dimension( nlenmcy ), intent (in ) :: midmcy
447
 
    integer, intent ( in ) :: mxnele, ncolele
448
 
    integer, dimension( totele ), intent (in ) :: midele
449
 
    integer, dimension( totele + 1 ), intent (in ) :: finele
450
 
    integer, dimension( mxnele ), intent (in ) :: colele
451
 
    integer, intent ( in ) :: mx_ncoldgm_pha, ncoldgm_pha
452
 
    integer, dimension( mx_ncoldgm_pha ), intent (in ) :: coldgm_pha
453
 
    integer, dimension( u_pha_nonods + 1 ), intent (in ) :: findgm_pha
454
 
    integer, dimension( u_pha_nonods ), intent (in ) :: middgm_pha
455
 
    integer, intent ( in ) :: mx_nct, ncolct
456
 
    integer, dimension( cv_nonods + 1 ), intent (in ) :: findct
457
 
    integer, dimension( mx_nct ), intent (in ) :: colct
458
 
    integer, intent ( in ) :: mx_nc, ncolc
459
 
    integer, dimension( u_nonods + 1 ), intent (in ) :: findc
460
 
    integer, dimension( mx_nc ), intent (in ) :: colc
461
 
    integer, intent ( in ) :: mx_ncolcmc, ncolcmc
462
 
    integer, dimension( cv_nonods + 1 ), intent (in ) :: findcmc
463
 
    integer, dimension( mx_ncolcmc ), intent (in ) :: colcmc
464
 
    integer, dimension( cv_nonods ), intent (in ) :: midcmc
465
 
    integer, intent ( in ) :: mx_ncolm, ncolm
466
 
    integer, dimension( cv_nonods + 1 ), intent (in ) :: findm
467
 
    integer, dimension( ncolm ), intent (in ) :: colm
468
 
    integer, dimension( cv_nonods ), intent (in ) :: midm
469
 
 
470
 
    ! Local variables
471
 
    integer, dimension( : ), allocatable :: dummy
472
 
 
473
 
    write(357,*) 'In check_sparsity'
474
 
 
475
 
    open( 15, file = 'CheckSparsityMatrix.dat', status = 'unknown' )
476
 
    write( 15, * )'########## FINMCY, MIDMCY, COLMCY ##################'
477
 
    write(15, * )'NCOLMCY:', NCOLMCY
478
 
    call checksparsity( .true., 15, NCOLMCY, NLENMCY, MX_NCOLMCY, FINMCY, MIDMCY, COLMCY )
479
 
 
480
 
    write( 15, * )'########## FINACV, COLACV, MIDACV ##################'
481
 
    write(15, * )'NCOLACV:', NCOLACV
482
 
    call checksparsity( .true., 15, NCOLACV, CV_PHA_NONODS, MX_NCOLACV, FINACV, MIDACV, COLACV  )
483
 
 
484
 
    write( 15, * )'########## FINELE, MIDELE, COLELE  ##################'
485
 
    write(15, * )'NCOLELE:',NCOLELE 
486
 
    call checksparsity( .true., 15, NCOLELE, TOTELE, MXNELE, FINELE, MIDELE, COLELE )
487
 
 
488
 
    allocate( dummy( CV_NONODS ))
489
 
    write( 15, * )'########## FINDCT, COLCT ##################'
490
 
    write(15, * )'NCOLCT:', NCOLCT
491
 
    call checksparsity( .false., 15, NCOLCT, CV_NONODS, MX_NCT, FINDCT, dummy, COLCT  )
492
 
    deallocate( dummy )
493
 
 
494
 
    allocate( dummy( U_NONODS ))
495
 
    write( 15, * )'########## FINDC, COLC ##################'
496
 
    write(15, * )'NCOLC:', NCOLC
497
 
    call checksparsity( .false., 15, NCOLC, U_NONODS, MX_NC, FINDC, dummy, COLC )
498
 
    deallocate( dummy )
499
 
 
500
 
    write( 15, * )'########## FINDGM_PHA, MIDDGM_PHA, COLDGM_PHA ##################'
501
 
    write(15, * )'NCOLDGM_PHA:',NCOLDGM_PHA 
502
 
    call checksparsity( .true., 15, NCOLDGM_PHA, U_PHA_NONODS, MX_NCOLDGM_PHA, FINDGM_PHA, MIDDGM_PHA, COLDGM_PHA )
503
 
 
504
 
    write( 15, * )'########## FINDCMC, MIDCMC, COLCMC ##################'
505
 
    write(15, * )'NCOLCMC:',NCOLCMC 
506
 
    call checksparsity( .true., 15, NCOLCMC, CV_NONODS, MX_NCOLCMC, FINDCMC, MIDCMC, COLCMC )
507
 
 
508
 
    write( 15, * )'########## FINDM, MIDM, COLM ##################'
509
 
    write(15, * )'NCOLM:',NCOLM 
510
 
    call checksparsity( .true., 15, NCOLM, CV_NONODS, MX_NCOLM, FINDM, MIDM, COLM )
511
 
 
512
 
    close( 15 )
513
 
 
514
 
    write(357,*) 'Leaving check_sparsity'
515
 
 
516
 
    return
517
 
 
518
 
  end subroutine check_sparsity
519
 
 
520
 
  subroutine mirror_data( unit_debug, problem, nphase, ncomp, totele, ndim, nlev, &
521
 
       u_nloc, xu_nloc, cv_nloc, x_nloc, p_nloc, &
522
 
       cv_snloc,  p_snloc, stotel, &
523
 
       ncoef, nuabs_coefs, &
524
 
       u_ele_type, p_ele_type, mat_ele_type, cv_ele_type, &
525
 
       cv_sele_type, u_sele_type, &
526
 
       ntime, nits, ndpset, &
527
 
       dt, patmos, p_ini, t_ini, &
528
 
       t_beta, v_beta, t_theta, v_theta, u_theta, &
529
 
       t_disopt, u_disopt, v_disopt, t_dg_vel_int_opt, &
530
 
       u_dg_vel_int_opt, v_dg_vel_int_opt, w_dg_vel_int_opt, &
531
 
       domain_length, u_snloc, mat_nloc, cv_nonods, u_nonods, &
532
 
       p_nonods, mat_nonods, ncp_coefs, x_nonods, xu_nonods, &
533
 
       nlenmcy, &
534
 
       nopt_vel_upwind_coefs, &
535
 
       u_ndgln, xu_ndgln, cv_ndgln, x_ndgln, p_ndgln, &
536
 
       mat_ndgln, u_sndgln, cv_sndgln, x_sndgln, p_sndgln, &
537
 
       wic_vol_bc, wic_d_bc, wic_u_bc, wic_p_bc, wic_t_bc, & 
538
 
       suf_vol_bc, suf_d_bc, suf_cpd_bc, suf_t_bc, suf_p_bc, &
539
 
       suf_u_bc, &
540
 
       suf_u_bc_rob1, suf_u_bc_rob2, &
541
 
       opt_vel_upwind_coefs, &
542
 
       x, xu, nu, ug, &
543
 
       uabs_option, u_abs_stab, u_absorb, &
544
 
       u_source, &
545
 
       u, &
546
 
       den, satura, comp, p, cv_p, volfra_pore, perm )
547
 
 
548
 
    implicit none
549
 
    integer, intent( in ) :: unit_debug,problem, nphase, ncomp, totele, ndim, nlev, &
550
 
         u_nloc, xu_nloc, cv_nloc, x_nloc, p_nloc, &
551
 
         cv_snloc,  p_snloc, stotel, &
552
 
         ncoef, nuabs_coefs, &
553
 
         u_ele_type, p_ele_type, mat_ele_type, cv_ele_type, &
554
 
         cv_sele_type, u_sele_type, &
555
 
         ntime, nits, ndpset, &
556
 
         t_disopt, u_disopt, v_disopt, t_dg_vel_int_opt, &
557
 
         u_dg_vel_int_opt, v_dg_vel_int_opt, w_dg_vel_int_opt, &
558
 
         nopt_vel_upwind_coefs, &
559
 
         u_snloc, mat_nloc, cv_nonods, u_nonods, &
560
 
         p_nonods, mat_nonods, ncp_coefs, x_nonods, xu_nonods, &
561
 
         nlenmcy
562
 
    real, intent( in ) :: dt, patmos, p_ini, t_ini, t_beta, v_beta, &
563
 
         t_theta, v_theta, u_theta, domain_length
564
 
    integer, dimension( stotel * nphase ), intent( in ) :: wic_vol_bc, wic_d_bc, wic_u_bc, wic_p_bc, wic_t_bc
565
 
    real, dimension( stotel * cv_snloc * nphase ), intent( in ) :: suf_vol_bc, suf_d_bc, suf_cpd_bc, suf_t_bc
566
 
    real, dimension( stotel * p_snloc * nphase ), intent( in ) :: suf_p_bc
567
 
    real, dimension( stotel * u_snloc * nphase ), intent( in ) :: suf_u_bc
568
 
    real, dimension( stotel * u_snloc * nphase ), intent( in ) :: suf_u_bc_rob1, suf_u_bc_rob2
569
 
    integer, dimension( totele * u_nloc ), intent( in ) :: u_ndgln
570
 
    integer, dimension( totele * xu_nloc ), intent( in ) :: xu_ndgln
571
 
    integer, dimension( totele * cv_nloc ), intent( in ) :: cv_ndgln
572
 
    integer, dimension( totele * cv_nloc ), intent( in ) :: x_ndgln
573
 
    integer, dimension( totele * p_nloc ), intent( in ) :: p_ndgln
574
 
    integer, dimension( totele * mat_nloc ), intent( in ) :: mat_ndgln
575
 
    integer, dimension( stotel * u_snloc ), intent( in ) :: u_sndgln
576
 
    integer, dimension( stotel * cv_snloc ), intent( in ) :: cv_sndgln, x_sndgln
577
 
    integer, dimension( stotel * p_snloc ), intent( in ) :: p_sndgln
578
 
    real, dimension( nopt_vel_upwind_coefs ), intent( in ) :: opt_vel_upwind_coefs
579
 
    real, dimension( x_nonods ), intent( in ) :: x
580
 
    real, dimension( xu_nonods ), intent( in ) :: xu
581
 
    real, dimension( u_nonods * nphase ), intent( in ) ::  nu, ug
582
 
    integer, dimension( nphase ), intent( in ) :: uabs_option
583
 
    real, dimension( mat_nonods, ndim * nphase, ndim * nphase ), intent( in ) :: u_abs_stab, u_absorb
584
 
    real, dimension( u_nonods * nphase ), intent( in ) :: u_source
585
 
    real, dimension( u_nonods * nphase ), intent( in ) :: u
586
 
    real, dimension( cv_nonods * nphase ), intent( in ) :: den, satura
587
 
    real, dimension( cv_nonods * nphase * ncomp ), intent( in ) :: comp 
588
 
    real, dimension( cv_nonods ), intent( in ) :: p, cv_p
589
 
    real, dimension( totele ), intent( in ) :: volfra_pore
590
 
    real, dimension( totele , ndim, ndim ), intent( in ) :: perm
591
 
    ! Local variables
592
 
    integer :: i, j, k
593
 
 
594
 
    write(357,*) 'In mirror_data'
595
 
 
596
 
    write( unit_debug, 201 ) 'problem, nphase, ncomp, totele, ndim, nlev: ', &
597
 
         problem, nphase, ncomp, totele, ndim, nlev
598
 
 
599
 
    write( unit_debug, 201 ) 'u_nloc, xu_nloc, cv_nloc, x_nloc, p_nloc: ' , &
600
 
         u_nloc, xu_nloc, cv_nloc, x_nloc, p_nloc
601
 
 
602
 
    write( unit_debug, 201 ) 'ncoef, nuabs_coefs, u_ele_type, p_ele_type, mat_ele_type: ', &
603
 
         ncoef, nuabs_coefs, u_ele_type, p_ele_type, mat_ele_type
604
 
 
605
 
    write( unit_debug, 201 ) 'cv_ele_type, cv_sele_type, u_sele_type, ntime, nits: ', &
606
 
         cv_ele_type, cv_sele_type, u_sele_type, ntime, nits
607
 
 
608
 
    write( unit_debug, 201 ) 'ndpset, t_disopt, u_disopt, v_disopt, t_dg_vel_int_opt: ', &
609
 
         ndpset, t_disopt, u_disopt, v_disopt, t_dg_vel_int_opt
610
 
 
611
 
    write( unit_debug, 201 ) 'u_dg_vel_int_opt, v_dg_vel_int_opt, w_dg_vel_int_opt, u_snloc, mat_nloc: ', & 
612
 
         u_dg_vel_int_opt, v_dg_vel_int_opt, w_dg_vel_int_opt, u_snloc, mat_nloc
613
 
 
614
 
    write( unit_debug, 201 ) 'cv_nonods, u_nonods, p_nonods, mat_nonods, ncp_coefs: ', &
615
 
         cv_nonods, u_nonods, p_nonods, mat_nonods, ncp_coefs
616
 
 
617
 
    write( unit_debug, 202 ) 'x_nonods, xu_nonods, nlenmcy: ', &
618
 
         x_nonods, xu_nonods, nlenmcy
619
 
 
620
 
    write( unit_debug, 203 ) 'dt, patmos, p_ini, t_ini: ', dt, patmos, p_ini, t_ini
621
 
 
622
 
    write( unit_debug, 204 ) 't_beta, v_beta, t_theta, v_theta, u_theta: ', &
623
 
         t_beta, v_beta, t_theta, v_theta, u_theta
624
 
 
625
 
    write( unit_debug, * ) 'domain_length: ', domain_length
626
 
 
627
 
    write( unit_debug, * ) '############################################'
628
 
 
629
 
    write( unit_debug, * ) 'wic_vol_bc( stotel * nphase ):', ( wic_vol_bc( i ), i = 1, stotel * nphase )
630
 
 
631
 
    write( unit_debug, * ) 'wic_d_bc( stotel * nphase ):', ( wic_d_bc( i ), i = 1, stotel * nphase )
632
 
 
633
 
    write( unit_debug, * ) 'wic_u_bc( stotel * nphase ):', ( wic_u_bc( i ), i = 1, stotel * nphase )
634
 
 
635
 
    write( unit_debug, * ) 'wic_p_bc( stotel * nphase ):', ( wic_p_bc( i ), i = 1, stotel * nphase )
636
 
 
637
 
    write( unit_debug, * ) 'wic_t_bc( stotel * nphase ):', ( wic_t_bc( i ), i = 1, stotel * nphase )
638
 
 
639
 
    write( unit_debug, * ) '############################################'
640
 
 
641
 
    write( unit_debug, * ) 'suf_vol_bc( stotel * cv_snloc * nphase ):', &
642
 
         ( suf_vol_bc( i ), i = 1, stotel * cv_snloc * nphase )
643
 
 
644
 
    write( unit_debug, * ) 'suf_d_bc( stotel * cv_snloc * nphase ):', &
645
 
         ( suf_d_bc( i ), i = 1, stotel * cv_snloc * nphase )
646
 
 
647
 
    write( unit_debug, * ) 'suf_cpd_bc( stotel * cv_snloc * nphase ):', &
648
 
         ( suf_cpd_bc( i ), i = 1, stotel * cv_snloc * nphase )
649
 
 
650
 
    write( unit_debug, * ) 'suf_t_bc( stotel * cv_snloc * nphase ):', &
651
 
         ( suf_t_bc( i ), i = 1, stotel * cv_snloc * nphase )
652
 
 
653
 
    write( unit_debug, * ) 'suf_p_bc( stotel * p_snloc * nphase ):', &
654
 
         ( suf_p_bc( i ), i = 1, stotel * p_snloc * nphase )
655
 
 
656
 
    write( unit_debug, * ) 'suf_u_bc( stotel * u_snloc * nphase ):', &
657
 
         ( suf_u_bc( i ), i = 1, stotel * u_snloc * nphase )
658
 
 
659
 
    write( unit_debug, * ) 'suf_u_bc_rob1( stotel * u_snloc * nphase ):', &
660
 
         ( suf_u_bc_rob1( i ), i = 1, stotel * u_snloc * nphase )
661
 
 
662
 
    write( unit_debug, * ) 'suf_u_bc_rob2( stotel * u_snloc * nphase ):', &
663
 
         ( suf_u_bc_rob2( i ), i = 1, stotel * u_snloc * nphase  )
664
 
 
665
 
    write( unit_debug, * ) 'suf_t_bc_rob1( stotel * cv_snloc * nphase ):', &
666
 
         ( suf_u_bc_rob1( i ), i = 1, stotel * cv_snloc * nphase )
667
 
 
668
 
    write( unit_debug, * ) 'suf_t_bc_rob2( stotel * cv_snloc * nphase ):', &
669
 
         ( suf_u_bc_rob2( i ), i = 1, stotel * cv_snloc * nphase  )
670
 
 
671
 
    write( unit_debug, * ) '############################################'
672
 
 
673
 
    write( unit_debug, * ) 'opt_vel_upwind_coefs( nopt_vel_upwind_coefs ):', &
674
 
         ( opt_vel_upwind_coefs( i ), i = 1, nopt_vel_upwind_coefs )
675
 
 
676
 
    write( unit_debug, * ) 'x( x_nonods ):', ( x( i ), i = 1, x_nonods )
677
 
 
678
 
    write( unit_debug, * ) 'xu( xu_nonods ):', ( xu( i ), i = 1, xu_nonods )
679
 
 
680
 
    write( unit_debug, * ) 'nu( u_nonods * nphase ):', &
681
 
         ( nu( i ), i = 1, u_nonods * nphase )
682
 
 
683
 
    write( unit_debug, * ) 'ug( u_nonods * nphase ):', &
684
 
         ( ug( i ), i = 1, u_nonods * nphase )
685
 
 
686
 
    write( unit_debug, * ) 'uabs_option( nphase ):', &
687
 
         ( uabs_option( i ), i = 1, nphase )
688
 
 
689
 
    write( unit_debug, * ) '############################################'
690
 
 
691
 
    write( unit_debug, * ) 'u_ndgln', size( u_ndgln ), ( u_ndgln( i ), i = 1, totele * u_nloc )
692
 
    write( unit_debug, * ) 'xu_ndgln', size( xu_ndgln ), ( xu_ndgln( i ), i = 1, totele * xu_nloc )
693
 
    write( unit_debug, * ) 'cv_ndgln', size( cv_ndgln ), ( cv_ndgln( i ), i = 1, totele * cv_nloc )
694
 
    write( unit_debug, * ) 'x_ndgln', size( x_ndgln ), ( x_ndgln( i ), i = 1,  totele * cv_nloc )
695
 
    write( unit_debug, * ) 'p_ndgln',  size( p_ndgln ), ( p_ndgln( i ), i = 1, totele * p_nloc )
696
 
    write( unit_debug, * ) 'mat_ndgln', size( mat_ndgln ), ( mat_ndgln( i ), i = 1, totele * mat_nloc )
697
 
    write( unit_debug, * ) 'u_sndgln', size( u_sndgln), ( u_sndgln( i ), i = 1, stotel * u_snloc )
698
 
    write( unit_debug, * ) 'cv_sndgln', size( cv_sndgln ), ( cv_sndgln( i ), i = 1, stotel * cv_snloc )
699
 
    write( unit_debug, * ) 'x_sndgln',  size( x_sndgln ),( x_sndgln( i ), i = 1, stotel * cv_snloc )
700
 
    write( unit_debug, * ) 'p_sndgln', size( p_sndgln ), ( p_sndgln( i ), i = 1, stotel * p_snloc )
701
 
 
702
 
    write( unit_debug, * ) '############################################'
703
 
 
704
 
    write( unit_debug, * ) 'u_abs_stab( mat_nonods, ndim * nphase, ndim * nphase ):'
705
 
    do i = 1, mat_nonods
706
 
       do j = 1, ndim * nphase
707
 
          write( unit_debug, * ) i , j, ( u_abs_stab( i, j, k ), k = 1, ndim * nphase )
708
 
       end do
709
 
    end do
710
 
 
711
 
    write( unit_debug, * ) '############################################'
712
 
 
713
 
    write( unit_debug, * ) 'u_absorb( mat_nonods, ndim * nphase, ndim * nphase ):'
714
 
    do i = 1, mat_nonods
715
 
       do j = 1, ndim * nphase
716
 
          write( unit_debug, * ) i , j, ( u_absorb( i, j, k ), k = 1, ndim * nphase )
717
 
       end do
718
 
    end do
719
 
 
720
 
    write( unit_debug, * ) '############################################'
721
 
 
722
 
    write( unit_debug, * ) 'u_source( u_nonods * nphase ):', &
723
 
         ( u_source( i ), i = 1, u_nonods * nphase )
724
 
 
725
 
    write( unit_debug, * ) '############################################'
726
 
 
727
 
 
728
 
    write( unit_debug, * ) 'u( u_nonods * nphase ):', &
729
 
         ( u( i ), i = 1, u_nonods * nphase )
730
 
 
731
 
    write( unit_debug, * ) 'den( cv_nonods * nphase ):', &
732
 
         ( den( i ), i = 1, cv_nonods * nphase )
733
 
 
734
 
    write( unit_debug, * ) 'satura( cv_nonods * nphase ):', &
735
 
         ( satura( i ), i = 1, cv_nonods * nphase )
736
 
 
737
 
    write( unit_debug, * ) 'comp( cv_nonods * nphase * ncomp ):', &
738
 
         ( comp( i ), i = 1, cv_nonods * nphase * ncomp )
739
 
 
740
 
    write( unit_debug, * ) 'p( cv_nonods ):', &
741
 
         ( p( i ), i = 1, cv_nonods )
742
 
 
743
 
    write( unit_debug, * ) 'cv_p( cv_nonods ):', &
744
 
         ( cv_p( i ), i = 1, cv_nonods )
745
 
 
746
 
    write( unit_debug, * ) 'volfra_pore( totele ):', &
747
 
         ( volfra_pore( i ), i = 1, totele )
748
 
 
749
 
    write( unit_debug, * ) 'perm( totele, ndim, ndim ):'
750
 
    do i = 1, totele
751
 
       do j = 1, ndim
752
 
          write( unit_debug, * ) i , j, ( perm( i, j, k ), k = 1, ndim )
753
 
       end do
754
 
    end do
755
 
 
756
 
    !write( unit_debug, * ) '(  ):', &
757
 
    !     ( ( i ), i = 1,  )
758
 
 
759
 
    write( unit_debug, * ) '############################################'
760
 
 
761
 
 
762
 
201 format( a, 1x, 5i5 )
763
 
202 format( a, 1x, 3i5 )
764
 
203 format( a, 1x, 4g10.4 )
765
 
204 format( a, 1x, 5g10.4 )
766
 
 
767
 
    write(357,*) 'Leaving mirror_data'
768
 
 
769
 
    return
770
 
  end subroutine mirror_data
771
 
 
772
 
  subroutine mirror_array_int( unit_debug, name, ndim, array )
773
 
    implicit none
774
 
    integer, intent( in ) :: unit_debug
775
 
    character( len = 50 ), intent( in ) :: name
776
 
    integer, intent( in ) :: ndim
777
 
    integer, dimension( ndim ), intent( in ) :: array
778
 
 
779
 
    ! Local variables
780
 
    integer :: idim, k
781
 
 
782
 
    k = index( name, ' ' ) - 1
783
 
    write( unit_debug, * ) name( 1 : k ), ( array( idim ), idim = 1, ndim )
784
 
 
785
 
    return
786
 
  end subroutine mirror_array_int
787
 
 
788
 
 
789
 
  subroutine mirror_array_real( unit_debug, name, ndim, array )
790
 
    implicit none
791
 
    integer, intent( in ) :: unit_debug
792
 
    character( len = 50 ), intent( in ) :: name
793
 
    integer, intent( in ) :: ndim
794
 
    real, dimension( ndim ), intent( in ) :: array
795
 
 
796
 
    ! Local variables
797
 
    integer :: idim, k
798
 
 
799
 
    k = index( name, ' ' ) - 1
800
 
    write( unit_debug, * ) name( 1 : k ), ( array( idim ), idim = 1, ndim )
801
 
 
802
 
    return
803
 
  end subroutine mirror_array_real
804
 
 
805
 
 
806
 
  subroutine mirror_matrix_int( unit_debug, name, ndim1, ndim2, array )
807
 
    implicit none
808
 
    integer, intent( in ) :: unit_debug
809
 
    character( len = 50 ), intent( in ) :: name
810
 
    integer, intent( in ) :: ndim1, ndim2
811
 
    integer, dimension( ndim1, ndim2 ), intent( in ) :: array
812
 
 
813
 
    ! Local variables
814
 
    integer :: idim1, idim2, k
815
 
 
816
 
    k = index( name, ' ' ) - 1
817
 
 
818
 
    write( unit_debug, * ) name( 1 : k )
819
 
    do idim1 = 1, ndim1
820
 
       write( unit_debug, * ) ( array( idim1, idim2 ), idim2 = 1, ndim2 )
821
 
    end do
822
 
 
823
 
    return
824
 
  end subroutine mirror_matrix_int
825
 
 
826
 
  subroutine mirror_matrix_real( unit_debug, name, ndim1, ndim2, array )
827
 
    implicit none
828
 
    integer, intent( in ) :: unit_debug
829
 
    character( len = 50 ), intent( in ) :: name
830
 
    integer, intent( in ) :: ndim1, ndim2
831
 
    real, dimension( ndim1, ndim2 ), intent( in ) :: array
832
 
 
833
 
    ! Local variables
834
 
    integer :: idim1, idim2, k
835
 
 
836
 
    k = index( name, ' ' ) - 1
837
 
 
838
 
    write( unit_debug, * ) name( 1 : k )
839
 
    do idim1 = 1, ndim1
840
 
       write( unit_debug, * ) ( array( idim1, idim2 ), idim2 = 1, ndim2 )
841
 
    end do
842
 
 
843
 
    return
844
 
  end subroutine mirror_matrix_real
845
 
 
846
 
end module printout
847
 
 
848
 
 
849
 
 
850
 
module input_var
851
 
 
852
 
contains
853
 
 
854
 
 
855
 
  subroutine get_entry( unit, len_name, ior, ifile, fcn_name, value_real, value_bool )
856
 
    implicit none
857
 
    integer, intent( in ) :: unit, len_name
858
 
    integer, intent( inout ) :: ior ! ior=13 indicates a non-scalar, ie, array, matrix or tensor
859
 
    character( len = len_name ), intent( inout ) :: ifile, fcn_name
860
 
    real, intent( inout ) :: value_real
861
 
    logical, intent( inout ) :: value_bool
862
 
    ! Local variables
863
 
    character( len = len_name ) :: name
864
 
    integer, parameter :: nexit = 4
865
 
    character( len = nexit ), parameter :: exit_file = 'exit'
866
 
    integer :: k
867
 
    real :: dummy_real
868
 
 
869
 
    !write(357,*) 'In get_entry'
870
 
 
871
 
    ior = 1
872
 
    ifile = ' '
873
 
 
874
 
    value_real = 0.
875
 
    value_bool = .true.
876
 
 
877
 
    read( unit, * ) name
878
 
    write( 357, * ) name
879
 
    if( ( name( 1 : 1 ) == '#' ) .or. ( name( 1 : 1 ) == ' ' ) ) then
880
 
       ior = 0
881
 
    else
882
 
       k = index( name, ' ' ) - 1
883
 
       if( name( 1 : nexit ) == exit_file ) then 
884
 
          ior = -1000
885
 
          return
886
 
       elseif(( name( 1 : 9 ) == 'lump_eqns' ) .or. &
887
 
           ( name( 1 : 21 ) == 'volfra_use_theta_flux' ) .or. ( name( 1 : 21 ) == 'volfra_get_theta_flux' ) .or. &
888
 
           ( name( 1 : 19 ) == 'comp_use_theta_flux' ) .or. ( name( 1 : 19 ) == 'comp_get_theta_flux' )) then
889
 
          backspace( unit )
890
 
          read( unit, * ) name, value_bool
891
 
          k = index( name, ' ' ) - 1
892
 
          ifile( 1 : k ) = name( 1 : k )
893
 
          ior = 5
894
 
       else
895
 
          backspace( unit )
896
 
          read( unit, * ) name, value_real
897
 
 
898
 
          if( value_real < -1000. ) then
899
 
             backspace( unit )
900
 
             read( unit, * ) name, dummy_real, fcn_name
901
 
             k = index( name, ' ' ) - 1
902
 
             ifile( 1 : k ) = name( 1 : k )
903
 
             fcn_name = trim( fcn_name )
904
 
             ior = 13
905
 
          elseif( abs( value_real + 1000. ) < 1.e-6 ) then ! so value is -1000
906
 
 ! Real or integer array
907
 
             backspace( unit )
908
 
             read( unit, * ) name, dummy_real, fcn_name
909
 
             k = index( name, ' ' ) - 1
910
 
             ifile( 1 : k ) = name( 1 : k )
911
 
             fcn_name = trim( fcn_name )
912
 
             ior = 15
913
 
          elseif( abs( value_real + 999. ) < 1.e-6 ) then ! so value is -999
914
 
! 2 x 2 matrix
915
 
             backspace( unit )
916
 
             read( unit, * ) name, dummy_real, fcn_name
917
 
             k = index( name, ' ' ) - 1
918
 
             ifile( 1 : k ) = name( 1 : k )
919
 
             fcn_name = trim( fcn_name )
920
 
             ior = 16
921
 
          elseif( abs( value_real + 998. ) < 1.e-6 ) then ! so value is -998
922
 
! 3 x 3 matrix
923
 
             backspace( unit )
924
 
             read( unit, * ) name, dummy_real, fcn_name
925
 
             k = index( name, ' ' ) - 1
926
 
             ifile( 1 : k ) = name( 1 : k )
927
 
             fcn_name = trim( fcn_name )
928
 
             ior = 17
929
 
          elseif( abs( value_real + 997  ) < 1.e-6 ) then ! so value is -997
930
 
! 4 x 4 matrix
931
 
             backspace( unit )
932
 
             read( unit, * ) name, dummy_real, fcn_name
933
 
             k = index( name, ' ' ) - 1
934
 
             ifile( 1 : k ) = name( 1 : k )
935
 
             fcn_name = trim( fcn_name )
936
 
             ior = 18
937
 
          else
938
 
             k = index( name, ' ' ) - 1
939
 
             ifile( 1 : k ) = name( 1 : k )
940
 
             ior = 3
941
 
          end if
942
 
 
943
 
       end if
944
 
    end if
945
 
 
946
 
    return
947
 
  end subroutine get_entry
948
 
 
949
 
  subroutine Scalar_Int_Val( unit, len_name, fcn_name, scalar_int )
950
 
    implicit none
951
 
    integer, intent( in ) :: unit, len_name
952
 
    character( len = len_name ), intent( in ) :: fcn_name
953
 
    integer, intent ( inout ) :: scalar_int
954
 
    ! Local variables
955
 
    integer :: idim, k
956
 
 
957
 
    k = index( fcn_name, ' ' ) - 1
958
 
    call system( 'rm -f fvalues' )
959
 
    call system( './' // fcn_name( 1 : k ) // ' > fvalues ' )
960
 
    open( unit + 1, file = 'fvalues', status = 'unknown' )
961
 
 
962
 
    read( unit + 1, * ) scalar_int
963
 
 
964
 
    close( unit + 1 )
965
 
 
966
 
    return
967
 
  end subroutine Scalar_Int_Val
968
 
 
969
 
  subroutine Scalar_Real_Val( unit, len_name, fcn_name, scalar_real )
970
 
    implicit none
971
 
    integer, intent( in ) :: unit, len_name
972
 
    character( len = len_name ), intent( in ) :: fcn_name
973
 
    real, intent ( inout ) :: scalar_real
974
 
    ! Local variables
975
 
    integer :: idim, k
976
 
 
977
 
    k = index( fcn_name, ' ' ) - 1
978
 
    call system( 'rm -f fvalues' )
979
 
    call system( './' // fcn_name( 1 : k ) // ' > fvalues ' )
980
 
    open( unit + 1, file = 'fvalues', status = 'unknown' )
981
 
 
982
 
    read( unit + 1, * ) scalar_real
983
 
 
984
 
    close( unit + 1 )
985
 
 
986
 
    return
987
 
  end subroutine Scalar_Real_Val
988
 
 
989
 
 
990
 
  subroutine Array_Int_Set( unit, ior, ndim, len_name, fcn_name, array )
991
 
    implicit none
992
 
    integer, intent( in ) :: unit, ior, ndim, len_name
993
 
    character( len = len_name ), intent( in ) :: fcn_name
994
 
    integer, dimension( ndim ), intent( inout ) :: array
995
 
    ! Local variables
996
 
    integer :: idim, k
997
 
 
998
 
    if (ior == 15 ) then
999
 
 
1000
 
       call system( 'rm -f filedim' )
1001
 
       open( unit + 1, file = 'filedim', status = 'unknown' )
1002
 
       write( unit + 1, * ) ndim
1003
 
       close( unit + 1 )
1004
 
 
1005
 
    endif
1006
 
 
1007
 
    k = index( fcn_name, ' ' ) - 1
1008
 
    call system( 'rm -f fvalues' )
1009
 
    call system( './' // fcn_name( 1 : k ) // ' > fvalues ' )
1010
 
    open( unit + 1, file = 'fvalues', status = 'unknown' )
1011
 
 
1012
 
    do idim = 1, ndim
1013
 
       read( unit + 1, * ) array( idim )
1014
 
    end do
1015
 
 
1016
 
    close( unit + 1 )
1017
 
 
1018
 
    return
1019
 
  end subroutine Array_Int_Set
1020
 
 
1021
 
 
1022
 
  subroutine Array_Real_Set( unit, ior, ndim, len_name, fcn_name, array )
1023
 
    implicit none
1024
 
    integer, intent( in ) :: unit, ior, ndim, len_name
1025
 
    character( len = len_name ), intent( in ) :: fcn_name
1026
 
    real, dimension( ndim ), intent( inout ) :: array
1027
 
    ! Local variables
1028
 
    integer :: idim, k
1029
 
 
1030
 
    print*, 'ndim:', ndim
1031
 
    if (ior == 15 ) then
1032
 
 
1033
 
       call system( 'rm -f filedim' )
1034
 
       open( unit + 699, file = 'filedim', status = 'unknown' )
1035
 
       write( unit + 699, * ) ndim
1036
 
       close( unit + 699 )
1037
 
 
1038
 
    endif
1039
 
 
1040
 
    k = index( fcn_name, ' ' ) - 1
1041
 
    call system( 'rm -f fvalues' )
1042
 
    call system( './' // fcn_name( 1 : k ) // ' > fvalues' )
1043
 
    open( unit + 699, file = 'fvalues', status = 'unknown' )
1044
 
 
1045
 
    do idim = 1, ndim
1046
 
       read( unit + 699, * ) array( idim )
1047
 
    end do
1048
 
 
1049
 
    close( unit + 699 )
1050
 
 
1051
 
    return
1052
 
  end subroutine Array_Real_Set
1053
 
 
1054
 
 
1055
 
  subroutine Array_Matrix2_Set( unit, ior, ndim1, ndim2, len_name, fcn_name, matrix )
1056
 
    implicit none
1057
 
    integer, intent( in ) :: unit, ior, ndim1, ndim2, len_name
1058
 
    character( len = len_name ), intent( in ) :: fcn_name
1059
 
    real, dimension( ndim1, ndim2 ), intent( inout ) :: matrix
1060
 
    ! Local variables
1061
 
    integer :: idim1, idim2, k
1062
 
 
1063
 
    if (ior == 16 ) then
1064
 
 
1065
 
       open( unit + 563, file = 'filedim', status = 'unknown' )
1066
 
       write( unit + 563, * ) ndim1, ndim2
1067
 
       close( unit + 563 )
1068
 
 
1069
 
    endif
1070
 
 
1071
 
    k = index( fcn_name, ' ' ) - 1
1072
 
    call system( 'rm -f fvalues' )
1073
 
    call system( './' // fcn_name( 1 : k ) // ' > fvalues ' )
1074
 
    open( unit + 563, file = 'fvalues', status = 'unknown' )
1075
 
 
1076
 
    do idim1 = 1, ndim1
1077
 
       do idim2 = 1, ndim2
1078
 
          read( unit + 563, * ) matrix( idim1, idim2 )
1079
 
       end do
1080
 
    end do
1081
 
 
1082
 
    close( unit + 563 )
1083
 
 
1084
 
    return
1085
 
  end subroutine Array_Matrix2_Set
1086
 
 
1087
 
 
1088
 
 
1089
 
  subroutine Array_Matrix3_Set( unit, ior, ndim1, ndim2, ndim3, len_name, fcn_name, matrix )
1090
 
    implicit none
1091
 
    integer, intent( in ) :: unit, ior, ndim1, ndim2, ndim3, len_name
1092
 
    character( len = len_name ), intent( in ) :: fcn_name
1093
 
    real, dimension( ndim1, ndim2, ndim3 ), intent( inout ) :: matrix
1094
 
    ! Local variables
1095
 
    integer :: idim1, idim2, idim3, k
1096
 
 
1097
 
    if (ior == 17 ) then
1098
 
 
1099
 
       open( unit + 1, file = 'filedim', status = 'unknown' )
1100
 
       write( unit + 1, * ) ndim1, ndim2, ndim3
1101
 
       close( unit + 1 )
1102
 
    endif
1103
 
 
1104
 
    k = index( fcn_name, ' ' ) - 1
1105
 
    call system( 'rm -f fvalues' )
1106
 
    call system( './' // fcn_name( 1 : k ) // ' > fvalues ' )
1107
 
    open( unit + 1, file = 'fvalues', status = 'unknown' )
1108
 
 
1109
 
    do idim1 = 1, ndim1
1110
 
       do idim2 = 1, ndim2
1111
 
          do idim3 = 1, ndim3
1112
 
             read( unit + 1, * ) matrix( idim1, idim2, idim3 )
1113
 
          end do
1114
 
       end do
1115
 
    end do
1116
 
 
1117
 
    close( unit + 1 )
1118
 
 
1119
 
    return
1120
 
  end subroutine Array_Matrix3_Set
1121
 
 
1122
 
 
1123
 
  subroutine Array_Matrix4_Set( unit, ior, ndim1, ndim2, ndim3, ndim4, len_name, fcn_name, matrix )
1124
 
    implicit none
1125
 
    integer, intent( in ) :: unit, ior, ndim1, ndim2, ndim3, ndim4, len_name
1126
 
    character( len = len_name ), intent( in ) :: fcn_name
1127
 
    real, dimension( ndim1, ndim2, ndim3, ndim4 ), intent( inout ) :: matrix
1128
 
    ! Local variables
1129
 
    integer :: idim1, idim2, idim3, idim4, k
1130
 
 
1131
 
    if (ior == 18 ) then
1132
 
 
1133
 
       open( unit + 1, file = 'filedim', status = 'unknown' )
1134
 
       write( unit + 1, * ) ndim1, ndim2, ndim3, ndim4
1135
 
       close( unit + 1 )
1136
 
 
1137
 
    endif
1138
 
 
1139
 
    k = index( fcn_name, ' ' ) - 1
1140
 
    call system( 'rm -f fvalues' )
1141
 
    call system( './' // fcn_name( 1 : k ) // ' > fvalues ' )
1142
 
    open( unit + 1, file = 'fvalues', status = 'unknown' )
1143
 
 
1144
 
    do idim1 = 1, ndim1
1145
 
       do idim2 = 1, ndim2
1146
 
          do idim3 = 1, ndim3
1147
 
             do idim4 = 1, ndim4
1148
 
                read( unit + 1, * ) matrix( idim1, idim2, idim3, idim4 )
1149
 
             end do
1150
 
          end do
1151
 
       end do
1152
 
    end do
1153
 
 
1154
 
    close( unit + 1 )
1155
 
 
1156
 
    return
1157
 
  end subroutine Array_Matrix4_Set
1158
 
 
1159
 
 
1160
 
  subroutine read_scalar( unit, option_debug, problem, nphase, ncomp, totele, ndim, nlev, &
1161
 
       u_nloc, xu_nloc, cv_nloc, x_nloc, p_nloc, &
1162
 
       cv_snloc, u_snloc, p_snloc, x_snloc, stotel, &
1163
 
       ncoef, nuabs_coefs, &
1164
 
       u_ele_type, p_ele_type, mat_ele_type, cv_ele_type, &
1165
 
       cv_sele_type, u_sele_type, ntime, nits, nits_internal, noit_dim, &
1166
 
       nits_flux_lim_volfra, nits_flux_lim_comp, &
1167
 
       ndpset, &
1168
 
       dt, patmos, p_ini, t_ini, &
1169
 
       t_beta, v_beta, t_theta, v_theta, u_theta, &
1170
 
       t_disopt, u_disopt, v_disopt, t_dg_vel_int_opt, &
1171
 
       u_dg_vel_int_opt, v_dg_vel_int_opt, w_dg_vel_int_opt, &
1172
 
       lump_eqns, & 
1173
 
       volfra_use_theta_flux, volfra_get_theta_flux, comp_use_theta_flux, comp_get_theta_flux, &
1174
 
       capil_pres_opt, ncapil_pres_coef, comp_diffusion_opt, ncomp_diff_coef, &
1175
 
       domain_length )
1176
 
    implicit none
1177
 
 
1178
 
    integer, intent( in ) :: unit
1179
 
    integer, intent( inout ) :: option_debug, problem, nphase, ncomp, totele, ndim, nlev, &
1180
 
         u_nloc, xu_nloc, cv_nloc, x_nloc, p_nloc, &
1181
 
         cv_snloc, u_snloc, p_snloc, x_snloc, stotel, &
1182
 
         ncoef, nuabs_coefs, &
1183
 
         u_ele_type, p_ele_type, mat_ele_type, cv_ele_type, &
1184
 
         cv_sele_type, u_sele_type, ntime, nits, nits_internal, noit_dim, &
1185
 
         nits_flux_lim_volfra, nits_flux_lim_comp, &
1186
 
         ndpset
1187
 
    real, intent( inout ) :: dt, patmos, p_ini, t_ini, &
1188
 
         t_beta, v_beta, t_theta, v_theta, u_theta
1189
 
    integer, intent( inout ) :: t_disopt, u_disopt, v_disopt, t_dg_vel_int_opt, &
1190
 
         u_dg_vel_int_opt, v_dg_vel_int_opt, w_dg_vel_int_opt
1191
 
    logical, intent( inout ) :: lump_eqns, &
1192
 
       volfra_use_theta_flux, volfra_get_theta_flux, comp_use_theta_flux, comp_get_theta_flux
1193
 
    integer, intent( inout ) :: capil_pres_opt, ncapil_pres_coef, &
1194
 
         comp_diffusion_opt, ncomp_diff_coef
1195
 
    real, intent( inout ) :: domain_length
1196
 
    ! Local variables
1197
 
    integer, parameter :: len_name = 50
1198
 
    character( len = len_name ) :: ifile, fcn_name
1199
 
    integer :: ior, k
1200
 
    real :: value_real
1201
 
    logical :: value_bool
1202
 
 
1203
 
    ior = 0
1204
 
    ncomp = 0
1205
 
 
1206
 
    do while ( .not. ( ior == -1000 ))
1207
 
       call get_entry( unit, len_name, ior, ifile, fcn_name, value_real, value_bool )
1208
 
 
1209
 
       Conditional_IOR: if ( ior > 0 ) then
1210
 
          k = index( ifile, ' ') - 1
1211
 
 
1212
 
          Select Case ( ifile( 1 : k ))
1213
 
 
1214
 
          Case( 'option_debug' );
1215
 
            option_debug = real( value_real )
1216
 
 
1217
 
          Case( 'problem' );
1218
 
             problem = real( value_real )
1219
 
 
1220
 
          Case( 'nphase' );
1221
 
             nphase = int( value_real )
1222
 
 
1223
 
          Case( 'ncomp' );
1224
 
             ncomp = int( value_real )
1225
 
 
1226
 
          Case( 'totele' );
1227
 
             totele = int( value_real )
1228
 
 
1229
 
          Case( 'ndim' );
1230
 
             ndim = int( value_real )
1231
 
 
1232
 
          Case( 'nlev' );
1233
 
             nlev = int( value_real )
1234
 
 
1235
 
          Case( 'u_nloc' );
1236
 
             u_nloc = int( value_real )
1237
 
 
1238
 
          Case( 'xu_nloc' );
1239
 
             xu_nloc = int( value_real )
1240
 
 
1241
 
          Case( 'cv_nloc' );
1242
 
             cv_nloc = int( value_real )
1243
 
 
1244
 
          Case( 'x_nloc' );
1245
 
             x_nloc = int( value_real )
1246
 
 
1247
 
          Case( 'p_nloc' );
1248
 
             p_nloc = int( value_real )
1249
 
 
1250
 
          Case( 'cv_snloc' );
1251
 
             cv_snloc = int( value_real )
1252
 
 
1253
 
          Case( 'u_snloc' );
1254
 
             u_snloc = int( value_real )
1255
 
 
1256
 
          Case( 'p_snloc' );
1257
 
             p_snloc = int( value_real )
1258
 
 
1259
 
          Case( 'x_snloc' );
1260
 
             x_snloc = int( value_real )
1261
 
 
1262
 
          Case( 'stotel' );
1263
 
             stotel = int( value_real )
1264
 
 
1265
 
          Case( 'ncoef' );
1266
 
             ncoef = int( value_real )
1267
 
 
1268
 
          Case( 'nuabs_coefs' );
1269
 
             nuabs_coefs = int( value_real )
1270
 
 
1271
 
          Case( 'u_ele_type' );
1272
 
             u_ele_type = int( value_real )
1273
 
 
1274
 
          Case( 'p_ele_type' );
1275
 
             p_ele_type = int( value_real )
1276
 
 
1277
 
          Case( 'mat_ele_type' );
1278
 
             mat_ele_type = int( value_real )
1279
 
 
1280
 
          Case( 'cv_ele_type' );
1281
 
             cv_ele_type = int( value_real )
1282
 
 
1283
 
          Case( 'cv_sele_type' );
1284
 
             cv_sele_type = int( value_real )
1285
 
 
1286
 
          Case( 'u_sele_type' );
1287
 
             u_sele_type = int( value_real )
1288
 
 
1289
 
          Case( 'ntime' );
1290
 
             ntime = int( value_real )
1291
 
 
1292
 
          Case( 'nits' );
1293
 
             nits = int( value_real )
1294
 
 
1295
 
          Case( 'nits_internal' );
1296
 
             nits_internal = int( value_real )
1297
 
 
1298
 
          Case( 'noit_dim' );
1299
 
             noit_dim = int( value_real )
1300
 
 
1301
 
          Case( 'nits_flux_lim_volfra' );
1302
 
             nits_flux_lim_volfra = int( value_real )
1303
 
 
1304
 
          Case( 'nits_flux_lim_comp' );
1305
 
             nits_flux_lim_comp = int( value_real )
1306
 
 
1307
 
          Case( 'ndpset' );
1308
 
             ndpset = int( value_real )
1309
 
 
1310
 
          Case( 'v_disopt' );
1311
 
             v_disopt = int( value_real )
1312
 
 
1313
 
          Case( 't_disopt' );
1314
 
             t_disopt = int( value_real )
1315
 
 
1316
 
          Case( 'u_disopt' );
1317
 
             u_disopt = int( value_real )
1318
 
 
1319
 
          Case( 't_dg_vel_int_opt' );
1320
 
             t_dg_vel_int_opt = int( value_real )
1321
 
 
1322
 
          Case( 'u_dg_vel_int_opt' );
1323
 
             u_dg_vel_int_opt = int( value_real )
1324
 
 
1325
 
          Case( 'v_dg_vel_int_opt' );
1326
 
             v_dg_vel_int_opt = int( value_real )
1327
 
 
1328
 
          Case( 'w_dg_vel_int_opt' );
1329
 
             w_dg_vel_int_opt = int( value_real )
1330
 
 
1331
 
          Case( 'lump_eqns' );
1332
 
             lump_eqns = value_bool
1333
 
 
1334
 
          Case( 'volfra_use_theta_flux' );
1335
 
             volfra_use_theta_flux = value_bool
1336
 
 
1337
 
          Case( 'volfra_get_theta_flux' );
1338
 
             volfra_get_theta_flux = value_bool
1339
 
 
1340
 
          Case( 'comp_use_theta_flux' );
1341
 
             comp_use_theta_flux = value_bool
1342
 
 
1343
 
          Case( 'comp_get_theta_flux' );
1344
 
             comp_get_theta_flux = value_bool
1345
 
 
1346
 
          Case( 'capil_pres_opt' );
1347
 
             capil_pres_opt = int( value_real )
1348
 
 
1349
 
          Case( 'ncapil_pres_coef' );
1350
 
             ncapil_pres_coef = int( value_real )
1351
 
 
1352
 
          Case( 'comp_diffusion_opt' );
1353
 
             comp_diffusion_opt = int( value_real )
1354
 
 
1355
 
          Case( 'ncomp_diff_coef' );
1356
 
             ncomp_diff_coef = int( value_real )
1357
 
 
1358
 
          Case( 'domain_length' );
1359
 
             domain_length = int( value_real )
1360
 
 
1361
 
          Case( 'dt' );
1362
 
             dt = value_real
1363
 
 
1364
 
          Case( 'patmos' );
1365
 
             patmos = value_real
1366
 
 
1367
 
          Case( 'p_ini' );
1368
 
             p_ini = value_real
1369
 
 
1370
 
          Case( 't_ini' );
1371
 
             t_ini = value_real
1372
 
 
1373
 
          Case( 't_beta' );
1374
 
             t_beta = value_real
1375
 
 
1376
 
          Case( 'v_beta' );
1377
 
             v_beta = value_real
1378
 
 
1379
 
          Case( 't_theta' );
1380
 
             t_theta = value_real
1381
 
 
1382
 
          Case( 'v_theta' );
1383
 
             v_theta = value_real
1384
 
 
1385
 
          Case( 'u_theta' );
1386
 
             u_theta = value_real
1387
 
 
1388
 
          Case DEFAULT
1389
 
             write( 357, * ) 'Option not found in read_scalar subrt.', ifile( 1 : k ) 
1390
 
             STOP 1877
1391
 
 
1392
 
          end Select
1393
 
 
1394
 
       end if Conditional_IOR
1395
 
 
1396
 
    end do
1397
 
 
1398
 
    return
1399
 
 
1400
 
  end subroutine read_scalar
1401
 
 
1402
 
 
1403
 
  subroutine read_all( unit, nphase, ncomp, totele, ndim, &
1404
 
       cv_snloc, u_snloc, p_snloc, stotel, &
1405
 
       ncoef, nuabs_coefs, ncp_coefs, & 
1406
 
       cv_nonods, u_nonods, &
1407
 
       mat_nonods, x_nonods, xu_nonods, &
1408
 
       nopt_vel_upwind_coefs, &
1409
 
       wic_vol_bc, wic_d_bc, wic_u_bc, wic_p_bc, wic_t_bc, wic_comp_bc, & 
1410
 
       suf_vol_bc, suf_d_bc, suf_cpd_bc, suf_t_bc, suf_p_bc, &
1411
 
       suf_u_bc, suf_v_bc, suf_w_bc, suf_one_bc, suf_comp_bc, &
1412
 
       suf_u_bc_rob1, suf_u_bc_rob2, suf_v_bc_rob1, suf_v_bc_rob2, &
1413
 
       suf_w_bc_rob1, suf_w_bc_rob2, suf_t_bc_rob1, suf_t_bc_rob2, &
1414
 
       suf_vol_bc_rob1, suf_vol_bc_rob2, &
1415
 
       suf_comp_bc_rob1, suf_comp_bc_rob2, &
1416
 
       opt_vel_upwind_coefs, &
1417
 
       volfra_error, volfra_relax, volfra_relax_diag, volfra_relax_row, volfra_relax_number_iterations, & 
1418
 
       scalar_error, scalar_relax, scalar_relax_diag, scalar_relax_row, scalar_relax_number_iterations, & 
1419
 
       global_error, global_relax, global_relax_diag, global_relax_row, global_relax_number_iterations, & 
1420
 
       velocity_error, velocity_relax, velocity_relax_diag, velocity_relax_row, velocity_relax_number_iterations, & 
1421
 
       pressure_error, pressure_relax, pressure_relax_diag, pressure_relax_row, pressure_relax_number_iterations, & 
1422
 
       mass_matrix_error, mass_matrix_relax, mass_matrix_relax_diag, mass_matrix_relax_row, mass_matrix_relax_number_iterations, &
1423
 
       in_ele_upwind, dg_ele_upwind, & 
1424
 
       x, y, z, xu, yu, zu, nu, nv, nw, ug, vg, wg, &
1425
 
       uabs_option, uabs_coefs, u_abs_stab, &
1426
 
       u_absorb, t_absorb, v_absorb, comp_absorb, &
1427
 
       u_source, t_source, v_source, comp_source, udiffusion, tdiffusion, &
1428
 
       ncomp_diff_coef, comp_diffusion, comp_diff_coef, &
1429
 
       ncapil_pres_coef, capil_pres_coef, & 
1430
 
       u, v, w, &
1431
 
       den, satura, comp, volfra, t, cv_one, p, cv_p, volfra_pore, perm, &
1432
 
       K_Comp, alpha_beta, &
1433
 
       eos_option, cp_option, eos_coefs, cp_coefs )
1434
 
 
1435
 
    implicit none
1436
 
    integer, intent( in ) :: unit, nphase, ncomp, totele, ndim, &
1437
 
         cv_snloc, u_snloc, p_snloc, stotel, &
1438
 
         ncoef, nuabs_coefs, ncp_coefs, & 
1439
 
         cv_nonods, u_nonods, &
1440
 
         mat_nonods, x_nonods, xu_nonods, &
1441
 
         nopt_vel_upwind_coefs
1442
 
    integer, dimension( stotel * nphase ), intent( inout ) :: wic_vol_bc, wic_d_bc, wic_u_bc, wic_p_bc, wic_t_bc, wic_comp_bc 
1443
 
    real, dimension( stotel * cv_snloc * nphase ), intent( inout ) :: suf_vol_bc, suf_d_bc, suf_cpd_bc, suf_t_bc
1444
 
    real, dimension( stotel * p_snloc * nphase ), intent( inout ) :: suf_p_bc
1445
 
    real, dimension( stotel * u_snloc * nphase ), intent( inout ) :: suf_u_bc, suf_v_bc, suf_w_bc
1446
 
    real, dimension( stotel * cv_snloc * nphase ), intent( inout ) :: suf_one_bc
1447
 
    real, dimension( stotel * cv_snloc * nphase * ncomp ), intent( inout ) :: suf_comp_bc
1448
 
    real, dimension( stotel * u_snloc * nphase ), intent( inout ) :: suf_u_bc_rob1, suf_u_bc_rob2, suf_v_bc_rob1, suf_v_bc_rob2, &
1449
 
         suf_w_bc_rob1, suf_w_bc_rob2
1450
 
    real, dimension( stotel * cv_snloc * nphase ), intent( inout ) :: suf_t_bc_rob1, suf_t_bc_rob2
1451
 
    real, dimension( stotel * cv_snloc * nphase ), intent( inout ) :: suf_vol_bc_rob1, suf_vol_bc_rob2
1452
 
    real, dimension( stotel * cv_snloc * nphase ), intent( inout ) :: suf_comp_bc_rob1, suf_comp_bc_rob2
1453
 
    real, dimension( nopt_vel_upwind_coefs ), intent( inout ) :: opt_vel_upwind_coefs
1454
 
    real, intent( inout ) :: volfra_error, volfra_relax, volfra_relax_diag, volfra_relax_row,  & 
1455
 
         scalar_error, scalar_relax, scalar_relax_diag, scalar_relax_row, & 
1456
 
         global_error, global_relax, global_relax_diag, global_relax_row, & 
1457
 
         velocity_error, velocity_relax, velocity_relax_diag, velocity_relax_row, & 
1458
 
         pressure_error, pressure_relax, pressure_relax_diag, pressure_relax_row, &
1459
 
         mass_matrix_error, mass_matrix_relax, mass_matrix_relax_diag, mass_matrix_relax_row 
1460
 
    integer, intent( inout ) :: volfra_relax_number_iterations, scalar_relax_number_iterations, &
1461
 
         global_relax_number_iterations,  velocity_relax_number_iterations, &
1462
 
         pressure_relax_number_iterations, mass_matrix_relax_number_iterations, &
1463
 
         in_ele_upwind, dg_ele_upwind
1464
 
    real, dimension( x_nonods ), intent( inout ) :: x, y, z
1465
 
    real, dimension( xu_nonods ), intent( inout ) :: xu, yu, zu
1466
 
    real, dimension( u_nonods * nphase ), intent( inout ) ::  nu, nv, nw, ug, vg, wg
1467
 
    integer, dimension( nphase ), intent( inout ) :: uabs_option
1468
 
    real, dimension( nphase, nuabs_coefs ), intent( inout ) :: uabs_coefs
1469
 
    real, dimension( mat_nonods, ndim * nphase, ndim * nphase ), intent( inout ) :: u_abs_stab, u_absorb
1470
 
    real, dimension( cv_nonods, nphase, nphase ), intent( inout ) :: t_absorb, v_absorb
1471
 
    real, dimension( cv_nonods * nphase, nphase, nphase ), intent( inout ) :: comp_absorb
1472
 
    real, dimension( u_nonods * nphase ), intent( inout ) :: u_source
1473
 
    real, dimension( cv_nonods * nphase ), intent( inout ) :: t_source, v_source, comp_source
1474
 
    real, dimension( mat_nonods, ndim, ndim, nphase ), intent( inout ) :: udiffusion, tdiffusion
1475
 
 
1476
 
    integer, intent( in ) :: ncomp_diff_coef
1477
 
    real, dimension( mat_nonods, ndim, ndim, nphase ), intent( inout ) :: comp_diffusion
1478
 
    real, dimension( ncomp, ncomp_diff_coef, nphase ), intent( inout ) :: comp_diff_coef
1479
 
    integer, intent( in ) :: ncapil_pres_coef
1480
 
    real, dimension( ncapil_pres_coef, nphase, nphase ), intent( inout ) :: &
1481
 
         capil_pres_coef
1482
 
 
1483
 
    real, dimension( u_nonods * nphase ), intent( inout ) :: u, v, w
1484
 
    real, dimension( cv_nonods * nphase ), intent( inout ) :: den, satura
1485
 
    real, dimension( cv_nonods * nphase * ncomp ), intent( inout ) :: comp
1486
 
    real, dimension( cv_nonods * nphase ), intent( inout ) :: volfra, t, cv_one
1487
 
    real, dimension( cv_nonods ), intent( inout ) :: p, cv_p
1488
 
    real, dimension( totele ), intent( inout ) :: volfra_pore
1489
 
    real, dimension( totele , ndim, ndim ), intent( inout ) :: perm
1490
 
    real, dimension( ncomp, nphase, nphase ), intent( inout ) :: K_Comp
1491
 
    real, intent( inout ) :: alpha_beta
1492
 
    integer, dimension( nphase ), intent( inout ) :: eos_option, cp_option
1493
 
    real, dimension( nphase, ncoef ), intent( inout ) :: eos_coefs
1494
 
    real, dimension( nphase, ncp_coefs ), intent( inout ) :: cp_coefs
1495
 
 
1496
 
 
1497
 
    ! Local variables
1498
 
    integer, parameter :: len_name = 50
1499
 
    character( len = len_name ) :: ifile, fcn_name
1500
 
    integer :: ior, k
1501
 
    real :: value_real
1502
 
    logical :: value_bool
1503
 
 
1504
 
    write(357,*) 'In read_all'
1505
 
 
1506
 
    ior = 0
1507
 
    do while ( .not. ( ior == -1000 ))
1508
 
 
1509
 
 
1510
 
       call get_entry( unit, len_name, ior, ifile, fcn_name, value_real, value_bool )
1511
 
 
1512
 
       Conditional_IOR: if ( ior > 0 ) then
1513
 
          k = index( ifile, ' ') - 1
1514
 
          Select Case ( ifile( 1 : k ))
1515
 
 
1516
 
             ! Scalar:
1517
 
          Case( 'alpha_beta' );
1518
 
             if( ior == 13 ) then
1519
 
                call Scalar_Real_Val( unit, len_name, fcn_name, alpha_beta )
1520
 
             else
1521
 
                alpha_beta = value_real
1522
 
             endif
1523
 
 
1524
 
          Case( 'volfra_error' );
1525
 
             if( ior == 13 ) then
1526
 
                call Scalar_Real_Val( unit, len_name, fcn_name, volfra_error )
1527
 
             else
1528
 
                volfra_error = value_real
1529
 
             endif
1530
 
 
1531
 
          Case( 'scalar_error' );
1532
 
             if( ior == 13 ) then
1533
 
                call Scalar_Real_Val( unit, len_name, fcn_name, scalar_error )
1534
 
             else
1535
 
                scalar_error = value_real
1536
 
             endif
1537
 
 
1538
 
          Case( 'global_error' );
1539
 
             if( ior == 13 ) then
1540
 
                call Scalar_Real_Val( unit, len_name, fcn_name, global_error )
1541
 
             else
1542
 
                global_error = value_real
1543
 
             endif
1544
 
 
1545
 
          Case( 'velocity_error' );
1546
 
             if( ior == 13 ) then
1547
 
                call Scalar_Real_Val( unit, len_name, fcn_name, velocity_error )
1548
 
             else
1549
 
                velocity_error = value_real
1550
 
             endif
1551
 
 
1552
 
          Case( 'pressure_error' );
1553
 
             if( ior == 13 ) then
1554
 
                call Scalar_Real_Val( unit, len_name, fcn_name, pressure_error )
1555
 
             else
1556
 
                pressure_error = value_real
1557
 
             endif
1558
 
 
1559
 
          Case( 'mass_matrix_error' );
1560
 
             if( ior == 13 ) then
1561
 
                call Scalar_Real_Val( unit, len_name, fcn_name, mass_matrix_error )
1562
 
             else
1563
 
                mass_matrix_error = value_real
1564
 
             endif
1565
 
 
1566
 
          Case( 'volfra_relax' );
1567
 
             if( ior == 13 ) then
1568
 
                call Scalar_Real_Val( unit, len_name, fcn_name, volfra_relax )
1569
 
             else
1570
 
                volfra_relax = value_real
1571
 
             endif
1572
 
 
1573
 
          Case( 'scalar_relax' );
1574
 
             if( ior == 13 ) then
1575
 
                call Scalar_Real_Val( unit, len_name, fcn_name, scalar_relax )
1576
 
             else
1577
 
                scalar_relax = value_real
1578
 
             endif
1579
 
 
1580
 
          Case( 'global_relax' );
1581
 
             if( ior == 13 ) then
1582
 
                call Scalar_Real_Val( unit, len_name, fcn_name, global_relax )
1583
 
             else
1584
 
                global_relax = value_real
1585
 
             endif
1586
 
 
1587
 
          Case( 'velocity_relax' );
1588
 
             if( ior == 13 ) then
1589
 
                call Scalar_Real_Val( unit, len_name, fcn_name, velocity_relax )
1590
 
             else
1591
 
                velocity_relax = value_real
1592
 
             endif
1593
 
 
1594
 
          Case( 'pressure_relax' );
1595
 
             if( ior == 13 ) then
1596
 
                call Scalar_Real_Val( unit, len_name, fcn_name, pressure_relax )
1597
 
             else
1598
 
                pressure_relax = value_real
1599
 
             endif
1600
 
 
1601
 
          Case( 'mass_matrix_relax' );
1602
 
             if( ior == 13 ) then
1603
 
                call Scalar_Real_Val( unit, len_name, fcn_name, mass_matrix_relax )
1604
 
             else
1605
 
                mass_matrix_relax = value_real
1606
 
             endif
1607
 
 
1608
 
          Case( 'volfra_relax_diag' );
1609
 
             if( ior == 13 ) then
1610
 
                call Scalar_Real_Val( unit, len_name, fcn_name, volfra_relax_diag )
1611
 
             else
1612
 
                volfra_relax_diag = value_real
1613
 
             endif
1614
 
 
1615
 
          Case( 'scalar_relax_diag' );
1616
 
             if( ior == 13 ) then
1617
 
                call Scalar_Real_Val( unit, len_name, fcn_name, scalar_relax_diag )
1618
 
             else
1619
 
                scalar_relax_diag = value_real
1620
 
             endif
1621
 
 
1622
 
          Case( 'global_relax_diag' );
1623
 
             if( ior == 13 ) then
1624
 
                call Scalar_Real_Val( unit, len_name, fcn_name, global_relax_diag )
1625
 
             else
1626
 
                global_relax_diag = value_real
1627
 
             endif
1628
 
 
1629
 
          Case( 'velocity_relax_diag' );
1630
 
             if( ior == 13 ) then
1631
 
                call Scalar_Real_Val( unit, len_name, fcn_name, velocity_relax_diag )
1632
 
             else
1633
 
                velocity_relax_diag = value_real
1634
 
             endif
1635
 
 
1636
 
          Case( 'pressure_relax_diag' );
1637
 
             if( ior == 13 ) then
1638
 
                call Scalar_Real_Val( unit, len_name, fcn_name, pressure_relax_diag )
1639
 
             else
1640
 
                pressure_relax_diag = value_real
1641
 
             endif
1642
 
 
1643
 
          Case( 'mass_matrix_relax_diag' );
1644
 
             if( ior == 13 ) then
1645
 
                call Scalar_Real_Val( unit, len_name, fcn_name, mass_matrix_relax_diag )
1646
 
             else
1647
 
                mass_matrix_relax_diag = value_real
1648
 
             endif
1649
 
 
1650
 
          Case( 'volfra_relax_row' );
1651
 
             if( ior == 13 ) then
1652
 
                call Scalar_Real_Val( unit, len_name, fcn_name, volfra_relax_row )
1653
 
             else
1654
 
                volfra_relax_row = value_real
1655
 
             endif
1656
 
 
1657
 
          Case( 'scalar_relax_row' );
1658
 
             if( ior == 13 ) then
1659
 
                call Scalar_Real_Val( unit, len_name, fcn_name, scalar_relax_row )
1660
 
             else
1661
 
                scalar_relax_row = value_real
1662
 
             endif
1663
 
 
1664
 
          Case( 'global_relax_row' );
1665
 
             if( ior == 13 ) then
1666
 
                call Scalar_Real_Val( unit, len_name, fcn_name, global_relax_row )
1667
 
             else
1668
 
                global_relax_row = value_real
1669
 
             endif
1670
 
 
1671
 
          Case( 'velocity_relax_row' );
1672
 
             if( ior == 13 ) then
1673
 
                call Scalar_Real_Val( unit, len_name, fcn_name, velocity_relax_row )
1674
 
             else
1675
 
                velocity_relax_row = value_real
1676
 
             endif
1677
 
 
1678
 
          Case( 'pressure_relax_row' );
1679
 
             if( ior == 13 ) then
1680
 
                call Scalar_Real_Val( unit, len_name, fcn_name, pressure_relax_row )
1681
 
             else
1682
 
                pressure_relax_row = value_real
1683
 
             endif
1684
 
 
1685
 
          Case( 'mass_matrix_relax_row' );
1686
 
             if( ior == 13 ) then
1687
 
                call Scalar_Real_Val( unit, len_name, fcn_name, mass_matrix_relax_row )
1688
 
             else
1689
 
                mass_matrix_relax_row = value_real
1690
 
             endif
1691
 
 
1692
 
          Case( 'volfra_relax_number_iterations' );
1693
 
             if( ior == 13 ) then
1694
 
                call Scalar_Int_Val( unit, len_name, fcn_name, volfra_relax_number_iterations )
1695
 
             else
1696
 
                volfra_relax_number_iterations = int( value_real )
1697
 
             endif
1698
 
 
1699
 
          Case( 'scalar_relax_number_iterations' );
1700
 
             if( ior == 13 ) then
1701
 
                call Scalar_Int_Val( unit, len_name, fcn_name, scalar_relax_number_iterations )
1702
 
             else
1703
 
                scalar_relax_number_iterations = int( value_real )
1704
 
             endif
1705
 
 
1706
 
          Case( 'global_relax_number_iterations' );
1707
 
             if( ior == 13 ) then
1708
 
                call Scalar_Int_Val( unit, len_name, fcn_name, global_relax_number_iterations )
1709
 
             else
1710
 
                global_relax_number_iterations = int( value_real )
1711
 
             endif
1712
 
 
1713
 
          Case( 'velocity_relax_number_iterations' );
1714
 
             if( ior == 13 ) then
1715
 
                call Scalar_Int_Val( unit, len_name, fcn_name, velocity_relax_number_iterations )
1716
 
             else
1717
 
                velocity_relax_number_iterations = int( value_real )
1718
 
             endif
1719
 
 
1720
 
          Case( 'pressure_relax_number_iterations' );
1721
 
             if( ior == 13 ) then
1722
 
                call Scalar_Int_Val( unit, len_name, fcn_name, pressure_relax_number_iterations )
1723
 
             else
1724
 
                pressure_relax_number_iterations = int( value_real )
1725
 
             endif
1726
 
 
1727
 
          Case( 'mass_matrix_relax_number_iterations' );
1728
 
             if( ior == 13 ) then
1729
 
                call Scalar_Int_Val( unit, len_name, fcn_name, mass_matrix_relax_number_iterations )
1730
 
             else
1731
 
                mass_matrix_relax_number_iterations = int( value_real )
1732
 
             endif
1733
 
 
1734
 
          Case( 'in_ele_upwind' );
1735
 
             if( ior == 13 ) then
1736
 
                call Scalar_Int_Val( unit, len_name, fcn_name, in_ele_upwind )
1737
 
             else
1738
 
                in_ele_upwind = int( value_real )
1739
 
             endif
1740
 
 
1741
 
          Case( 'dg_ele_upwind' );
1742
 
             if( ior == 13 ) then
1743
 
                call Scalar_Int_Val( unit, len_name, fcn_name, dg_ele_upwind )
1744
 
             else
1745
 
                dg_ele_upwind = int( value_real )
1746
 
             endif
1747
 
 
1748
 
 
1749
 
             ! Integer arrays:
1750
 
          Case( 'wic_vol_bc' );
1751
 
 
1752
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1753
 
                call Array_Int_Set( unit, ior, stotel * nphase, len_name, fcn_name, wic_vol_bc )
1754
 
             else
1755
 
                wic_vol_bc = int( value_real )
1756
 
             endif
1757
 
 
1758
 
          Case( 'wic_d_bc' );
1759
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1760
 
                call Array_Int_Set( unit, ior, stotel * nphase, len_name, fcn_name, wic_d_bc )
1761
 
             else
1762
 
                wic_d_bc = int( value_real )
1763
 
             endif
1764
 
 
1765
 
          Case( 'wic_u_bc' );
1766
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1767
 
                call Array_Int_Set( unit, ior, stotel * nphase, len_name, fcn_name, wic_u_bc )
1768
 
             else
1769
 
                wic_u_bc = int( value_real )
1770
 
             endif
1771
 
 
1772
 
          Case( 'wic_p_bc' );
1773
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1774
 
                call Array_Int_Set( unit, ior, stotel * nphase, len_name, fcn_name, wic_p_bc )
1775
 
             else
1776
 
                wic_p_bc = int( value_real )
1777
 
             endif
1778
 
 
1779
 
          Case( 'wic_t_bc' );
1780
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1781
 
                call Array_Int_Set( unit, ior, stotel * nphase, len_name, fcn_name, wic_t_bc )
1782
 
             else
1783
 
                wic_t_bc = int( value_real )
1784
 
             endif
1785
 
 
1786
 
          Case( 'wic_comp_bc' );
1787
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1788
 
                call Array_Int_Set( unit, ior, stotel * nphase, len_name, fcn_name, wic_comp_bc )
1789
 
             else
1790
 
                wic_comp_bc = int( value_real )
1791
 
             endif
1792
 
 
1793
 
          Case( 'uabs_option' );
1794
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1795
 
                call Array_Int_Set( unit, ior, nphase, len_name, fcn_name, uabs_option )
1796
 
             else
1797
 
                uabs_option = int( value_real )
1798
 
             endif
1799
 
 
1800
 
          Case( 'eos_option' );
1801
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1802
 
                call Array_Int_Set( unit, ior, nphase, len_name, fcn_name, eos_option )
1803
 
             else
1804
 
                eos_option = int( value_real )
1805
 
             endif
1806
 
 
1807
 
          Case( 'cp_option' );
1808
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1809
 
                call Array_Int_Set( unit, ior, nphase, len_name, fcn_name, cp_option )
1810
 
             else
1811
 
                cp_option = int( value_real )
1812
 
             endif
1813
 
 
1814
 
             ! Real arrays:
1815
 
          Case( 'suf_vol_bc' );
1816
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1817
 
                call Array_Real_Set( unit, ior, stotel * cv_snloc * nphase, len_name, fcn_name, suf_vol_bc )
1818
 
             else
1819
 
                suf_vol_bc = value_real
1820
 
             endif
1821
 
 
1822
 
          Case( 'suf_d_bc' );
1823
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1824
 
                call Array_Real_Set( unit, ior, stotel * cv_snloc * nphase, len_name, fcn_name, suf_d_bc )
1825
 
             else
1826
 
                suf_d_bc = value_real
1827
 
             endif
1828
 
 
1829
 
          Case( 'suf_cpd_bc' );
1830
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1831
 
                call Array_Real_Set( unit, ior, stotel * cv_snloc * nphase, len_name, fcn_name, suf_cpd_bc )
1832
 
             else
1833
 
                suf_cpd_bc = value_real
1834
 
             endif
1835
 
 
1836
 
          Case( 'suf_t_bc' );
1837
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1838
 
                call Array_Real_Set( unit, ior, stotel * cv_snloc * nphase, len_name, fcn_name, suf_t_bc )
1839
 
             else
1840
 
                suf_t_bc = value_real
1841
 
             endif
1842
 
 
1843
 
          Case( 'suf_p_bc' );
1844
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1845
 
                call Array_Real_Set( unit, ior, stotel * p_snloc * nphase, len_name, fcn_name, suf_p_bc )
1846
 
             else
1847
 
                suf_p_bc = value_real
1848
 
             endif
1849
 
 
1850
 
          Case( 'suf_u_bc' );
1851
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1852
 
                call Array_Real_Set( unit, ior, stotel * u_snloc * nphase, len_name, fcn_name, suf_u_bc )
1853
 
             else
1854
 
                suf_u_bc = value_real
1855
 
             endif
1856
 
 
1857
 
          Case( 'suf_v_bc' );
1858
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1859
 
                call Array_Real_Set( unit, ior, stotel * u_snloc * nphase, len_name, fcn_name, suf_v_bc )
1860
 
             else
1861
 
                suf_v_bc = value_real
1862
 
             endif
1863
 
 
1864
 
          Case( 'suf_w_bc' );
1865
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1866
 
                call Array_Real_Set( unit, ior, stotel * u_snloc * nphase, len_name, fcn_name, suf_w_bc )
1867
 
             else
1868
 
                suf_w_bc = value_real
1869
 
             endif
1870
 
 
1871
 
          Case( 'suf_one_bc' );
1872
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1873
 
                call Array_Real_Set( unit, ior, stotel * cv_snloc * nphase, len_name, fcn_name, suf_one_bc )
1874
 
             else
1875
 
                suf_one_bc = value_real
1876
 
             endif
1877
 
 
1878
 
          Case( 'suf_comp_bc' );
1879
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1880
 
                call Array_Real_Set( unit, ior, stotel * cv_snloc * nphase * ncomp, len_name, fcn_name, suf_comp_bc )
1881
 
             else
1882
 
                suf_comp_bc = value_real
1883
 
             endif
1884
 
 
1885
 
          Case( 'suf_u_bc_rob1' );
1886
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1887
 
                call Array_Real_Set( unit, ior, stotel * u_snloc * nphase, len_name, fcn_name, suf_u_bc_rob1 )
1888
 
             else
1889
 
                suf_u_bc_rob1 = value_real
1890
 
             endif
1891
 
 
1892
 
          Case( 'suf_u_bc_rob2' );
1893
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1894
 
                call Array_Real_Set( unit, ior, stotel * u_snloc * nphase, len_name, fcn_name, suf_u_bc_rob2 )
1895
 
             else
1896
 
                suf_u_bc_rob2 = value_real
1897
 
             endif
1898
 
 
1899
 
          Case( 'suf_v_bc_rob1' );
1900
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1901
 
                call Array_Real_Set( unit, ior, stotel * u_snloc * nphase, len_name, fcn_name, suf_v_bc_rob1 )
1902
 
             else
1903
 
                suf_v_bc_rob1 = value_real
1904
 
             endif
1905
 
 
1906
 
          Case( 'suf_v_bc_rob2' );
1907
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1908
 
                call Array_Real_Set( unit, ior, stotel * u_snloc * nphase, len_name, fcn_name, suf_v_bc_rob2 )
1909
 
             else
1910
 
                suf_v_bc_rob2 = value_real
1911
 
             endif
1912
 
 
1913
 
          Case( 'suf_w_bc_rob1' );
1914
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1915
 
                call Array_Real_Set( unit, ior, stotel * u_snloc * nphase, len_name, fcn_name, suf_w_bc_rob1 )
1916
 
             else
1917
 
                suf_w_bc_rob1 = value_real
1918
 
             endif
1919
 
 
1920
 
          Case( 'suf_w_bc_rob2' );
1921
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1922
 
                call Array_Real_Set( unit, ior, stotel * u_snloc * nphase, len_name, fcn_name, suf_w_bc_rob2 )
1923
 
             else
1924
 
                suf_w_bc_rob2 = value_real
1925
 
             endif
1926
 
 
1927
 
          Case( 'suf_t_bc_rob1' );
1928
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1929
 
                call Array_Real_Set( unit, ior, stotel * cv_snloc * nphase, len_name, fcn_name, suf_t_bc_rob1 )
1930
 
             else
1931
 
                suf_t_bc_rob1 = value_real
1932
 
             endif
1933
 
 
1934
 
          Case( 'suf_t_bc_rob2' );
1935
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1936
 
                call Array_Real_Set( unit, ior, stotel * cv_snloc * nphase, len_name, fcn_name, suf_t_bc_rob2 )
1937
 
             else
1938
 
                suf_t_bc_rob2 = value_real
1939
 
             endif
1940
 
 
1941
 
          Case( 'suf_vol_bc_rob1' );
1942
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1943
 
                call Array_Real_Set( unit, ior, stotel * cv_snloc * nphase, len_name, fcn_name, suf_vol_bc_rob1 )
1944
 
             else
1945
 
                suf_vol_bc_rob1 = value_real
1946
 
             endif
1947
 
 
1948
 
          Case( 'suf_vol_bc_rob2' );
1949
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1950
 
                call Array_Real_Set( unit, ior, stotel * cv_snloc * nphase, len_name, fcn_name, suf_vol_bc_rob2 )
1951
 
             else
1952
 
                suf_vol_bc_rob2 = value_real
1953
 
             endif
1954
 
 
1955
 
          Case( 'suf_comp_bc_rob1' );
1956
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1957
 
                call Array_Real_Set( unit, ior, stotel * cv_snloc * nphase, len_name, fcn_name, suf_comp_bc_rob1 )
1958
 
             else
1959
 
                suf_comp_bc_rob1 = value_real
1960
 
             endif
1961
 
 
1962
 
          Case( 'suf_comp_bc_rob2' );
1963
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1964
 
                call Array_Real_Set( unit, ior, stotel * cv_snloc * nphase, len_name, fcn_name, suf_comp_bc_rob2 )
1965
 
             else
1966
 
                suf_comp_bc_rob2 = value_real
1967
 
             endif
1968
 
 
1969
 
          Case( 'opt_vel_upwind_coefs' );
1970
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1971
 
                call Array_Real_Set( unit, ior, nopt_vel_upwind_coefs, len_name, fcn_name, opt_vel_upwind_coefs )
1972
 
             else
1973
 
                opt_vel_upwind_coefs = value_real
1974
 
             endif
1975
 
 
1976
 
          Case( 'x' );
1977
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1978
 
                call Array_Real_Set( unit, ior, x_nonods, len_name, fcn_name, x )
1979
 
             else
1980
 
                x = value_real
1981
 
             endif
1982
 
 
1983
 
          Case( 'y' );
1984
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1985
 
                call Array_Real_Set( unit, ior, x_nonods, len_name, fcn_name, y )
1986
 
             else
1987
 
                y = value_real
1988
 
             endif
1989
 
 
1990
 
          Case( 'z' );
1991
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1992
 
                call Array_Real_Set( unit, ior, x_nonods, len_name, fcn_name, z )
1993
 
             else
1994
 
                z = value_real
1995
 
             endif
1996
 
 
1997
 
          Case( 'xu' );
1998
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
1999
 
                call Array_Real_Set( unit, ior, xu_nonods, len_name, fcn_name, xu )
2000
 
             else
2001
 
                xu = value_real
2002
 
             endif
2003
 
 
2004
 
          Case( 'yu' );
2005
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
2006
 
                call Array_Real_Set( unit, ior, xu_nonods, len_name, fcn_name, yu )
2007
 
             else
2008
 
                yu = value_real
2009
 
             endif
2010
 
 
2011
 
          Case( 'zu' );
2012
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
2013
 
                call Array_Real_Set( unit, ior, xu_nonods, len_name, fcn_name, zu )
2014
 
             else
2015
 
                zu = value_real
2016
 
             endif
2017
 
 
2018
 
          Case( 'nu' );
2019
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
2020
 
                call Array_Real_Set( unit, ior, u_nonods * nphase, len_name, fcn_name, nu )
2021
 
             else
2022
 
                nu = value_real
2023
 
             endif
2024
 
 
2025
 
          Case( 'nv' );
2026
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
2027
 
                call Array_Real_Set( unit, ior, u_nonods * nphase, len_name, fcn_name, nv )
2028
 
             else
2029
 
                nv = value_real
2030
 
             endif
2031
 
 
2032
 
          Case( 'nw' );
2033
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
2034
 
                call Array_Real_Set( unit, ior, u_nonods * nphase, len_name, fcn_name, nw )
2035
 
             else
2036
 
                nw = value_real
2037
 
             endif
2038
 
 
2039
 
          Case( 'ug' );
2040
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
2041
 
                call Array_Real_Set( unit, ior, u_nonods * nphase, len_name, fcn_name, ug )
2042
 
             else
2043
 
                ug = value_real
2044
 
             endif
2045
 
 
2046
 
          Case( 'vg' );
2047
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
2048
 
                call Array_Real_Set( unit, ior, u_nonods * nphase, len_name, fcn_name, vg )
2049
 
             else
2050
 
                vg = value_real
2051
 
             endif
2052
 
 
2053
 
          Case( 'wg' );
2054
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
2055
 
                call Array_Real_Set( unit, ior, u_nonods * nphase, len_name, fcn_name, wg )
2056
 
             else
2057
 
                wg = value_real
2058
 
             endif
2059
 
 
2060
 
          Case( 'u_source' );
2061
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
2062
 
                call Array_Real_Set( unit, ior, u_nonods * nphase, len_name, fcn_name, u_source )
2063
 
             else
2064
 
                u_source = value_real
2065
 
             endif
2066
 
 
2067
 
          Case( 't_source' );
2068
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
2069
 
                call Array_Real_Set( unit, ior, cv_nonods * nphase, len_name, fcn_name, t_source )
2070
 
             else
2071
 
                t_source = value_real
2072
 
             endif
2073
 
 
2074
 
          Case( 'v_source' );
2075
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
2076
 
                call Array_Real_Set( unit, ior, cv_nonods * nphase, len_name, fcn_name, v_source )
2077
 
             else
2078
 
                v_source = value_real
2079
 
             endif
2080
 
 
2081
 
          Case( 'comp_source' );
2082
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
2083
 
                call Array_Real_Set( unit, ior, cv_nonods * nphase, len_name, fcn_name, comp_source )
2084
 
             else
2085
 
                comp_source = value_real
2086
 
             endif
2087
 
 
2088
 
          Case( 'u' );
2089
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
2090
 
                call Array_Real_Set( unit, ior, u_nonods * nphase, len_name, fcn_name, u )
2091
 
             else
2092
 
                u  = value_real
2093
 
             endif
2094
 
 
2095
 
          Case( 'v' );
2096
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
2097
 
                call Array_Real_Set( unit, ior, u_nonods * nphase, len_name, fcn_name, v )
2098
 
             else
2099
 
                v = value_real
2100
 
             endif
2101
 
 
2102
 
          Case( 'w' );
2103
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
2104
 
                call Array_Real_Set( unit, ior, u_nonods * nphase, len_name, fcn_name, w )
2105
 
             else
2106
 
                w = value_real
2107
 
             endif
2108
 
 
2109
 
          Case( 'den' );
2110
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
2111
 
                call Array_Real_Set( unit, ior, cv_nonods * nphase, len_name, fcn_name, den )
2112
 
             else
2113
 
                den = value_real
2114
 
             endif
2115
 
 
2116
 
          Case( 'satura' );
2117
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
2118
 
                call Array_Real_Set( unit, ior, cv_nonods * nphase, len_name, fcn_name, satura )
2119
 
             else
2120
 
                satura = value_real
2121
 
             endif
2122
 
 
2123
 
          Case( 'comp' );
2124
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
2125
 
                call Array_Real_Set( unit, ior, cv_nonods * nphase * ncomp, len_name, fcn_name, comp )
2126
 
             else
2127
 
                comp = value_real
2128
 
             endif
2129
 
 
2130
 
          Case( 'volfra' );
2131
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
2132
 
                call Array_Real_Set( unit, ior, cv_nonods * nphase , len_name, fcn_name, volfra )
2133
 
             else
2134
 
                volfra = value_real
2135
 
             endif
2136
 
 
2137
 
          Case( 't' );
2138
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
2139
 
                call Array_Real_Set( unit, ior, cv_nonods * nphase , len_name, fcn_name, t )
2140
 
             else
2141
 
                t = value_real
2142
 
             endif
2143
 
 
2144
 
          Case( 'cv_one' );
2145
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
2146
 
                call Array_Real_Set( unit, ior, cv_nonods * nphase , len_name, fcn_name, cv_one )
2147
 
             else
2148
 
                cv_one = value_real
2149
 
             endif
2150
 
 
2151
 
          Case( 'p' );
2152
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
2153
 
                call Array_Real_Set( unit, ior, cv_nonods, len_name, fcn_name, p )
2154
 
             else
2155
 
                p = value_real
2156
 
             endif
2157
 
 
2158
 
          Case( 'cv_p' );
2159
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
2160
 
                call Array_Real_Set( unit, ior, cv_nonods, len_name, fcn_name, cv_p )
2161
 
             else
2162
 
                cv_p = value_real
2163
 
             endif
2164
 
 
2165
 
          Case( 'volfra_pore' );
2166
 
             if(( ior == 13 ) .or. ( ior == 15 )) then
2167
 
                call Array_Real_Set( unit, ior, totele, len_name, fcn_name, volfra_pore )
2168
 
             else
2169
 
                volfra_pore = value_real
2170
 
             endif
2171
 
 
2172
 
          Case( 'K_Comp' );
2173
 
             if(( ior == 13 ) .or. ( ior == 17 )) then
2174
 
                call Array_Matrix3_Set( unit, ior, ncomp, nphase, nphase, len_name, fcn_name, K_Comp )
2175
 
             else
2176
 
                K_Comp = value_real
2177
 
             endif
2178
 
 
2179
 
             ! Matrices and Tensors ( x , y )
2180
 
          Case( 'uabs_coefs' );
2181
 
             if(( ior == 13 ) .or. ( ior == 16 )) then
2182
 
                call Array_Matrix2_Set( unit, ior, nphase, nuabs_coefs, len_name, fcn_name, uabs_coefs )
2183
 
             else
2184
 
                uabs_coefs = value_real
2185
 
             endif
2186
 
 
2187
 
          Case( 'eos_coefs' );
2188
 
             if(( ior == 13 ) .or. ( ior == 16 )) then
2189
 
                call Array_Matrix2_Set( unit, ior, nphase, ncoef, len_name, fcn_name, eos_coefs )
2190
 
             else
2191
 
                eos_coefs = value_real
2192
 
             endif
2193
 
 
2194
 
          Case( 'cp_coefs' );
2195
 
             if(( ior == 13 ) .or. ( ior == 16 )) then
2196
 
                call Array_Matrix2_Set( unit, ior, nphase, ncp_coefs, len_name, fcn_name, cp_coefs )
2197
 
             else
2198
 
                cp_coefs = value_real
2199
 
             endif
2200
 
 
2201
 
             ! Matrices and Tensors ( x , y , z)
2202
 
 
2203
 
          Case( 'comp_diff_coef' );
2204
 
             if(( ior == 13 ) .or. ( ior == 17 )) then
2205
 
                call Array_Matrix3_Set( unit, ior, ncomp, ncomp_diff_coef, nphase, len_name, fcn_name, comp_diff_coef )
2206
 
             else
2207
 
                comp_diff_coef = value_real
2208
 
             endif
2209
 
 
2210
 
          Case( 'capil_pres_coef' );
2211
 
             if(( ior == 13 ) .or. ( ior == 17 )) then
2212
 
                call Array_Matrix3_Set( unit, ior, ncapil_pres_coef, nphase, nphase, len_name, fcn_name, capil_pres_coef )
2213
 
             else
2214
 
                capil_pres_coef = value_real
2215
 
             endif
2216
 
 
2217
 
          Case( 'u_abs_stab' );
2218
 
             if(( ior == 13 ) .or. ( ior == 17 )) then
2219
 
                call Array_Matrix3_Set( unit, ior,  mat_nonods, ndim * nphase, ndim * nphase , len_name, fcn_name, u_abs_stab )
2220
 
             else
2221
 
                u_abs_stab = value_real
2222
 
             endif
2223
 
 
2224
 
          Case( 'u_absorb' );
2225
 
             if(( ior == 13 ) .or. ( ior == 17 )) then
2226
 
                call Array_Matrix3_Set( unit, ior,  mat_nonods, ndim * nphase, ndim * nphase , len_name, fcn_name, u_absorb )
2227
 
             else
2228
 
                u_absorb = value_real
2229
 
             endif
2230
 
 
2231
 
          Case( 't_absorb' );
2232
 
             if(( ior == 13 ) .or. ( ior == 17 )) then
2233
 
                call Array_Matrix3_Set( unit, ior,  cv_nonods, nphase, nphase, len_name, fcn_name, t_absorb )
2234
 
             else
2235
 
                t_absorb  = value_real
2236
 
             endif
2237
 
 
2238
 
          Case( 'v_absorb' );
2239
 
             if(( ior == 13 ) .or. ( ior == 17 )) then
2240
 
                call Array_Matrix3_Set( unit, ior,  cv_nonods, nphase, nphase, len_name, fcn_name, v_absorb )
2241
 
             else
2242
 
                v_absorb  = value_real
2243
 
             endif
2244
 
 
2245
 
          Case( 'perm' );
2246
 
             if(( ior == 13 ) .or. ( ior == 17 )) then
2247
 
                call Array_Matrix3_Set( unit, ior, totele, ndim, ndim, len_name, fcn_name, perm )
2248
 
             else
2249
 
                perm = value_real
2250
 
             endif
2251
 
 
2252
 
             ! Matrices and Tensors ( x , y , z , w)
2253
 
          Case( 'udiffusion' );
2254
 
             if(( ior == 13 ) .or. ( ior == 18 )) then
2255
 
                call Array_Matrix4_Set( unit, ior,  mat_nonods, ndim, ndim, nphase, len_name, fcn_name, udiffusion )
2256
 
             else
2257
 
                udiffusion = value_real
2258
 
             endif
2259
 
 
2260
 
          Case( 'tdiffusion' );
2261
 
             if(( ior == 13 ) .or. ( ior == 18 )) then
2262
 
                call Array_Matrix4_Set( unit, ior,  mat_nonods, ndim, ndim, nphase, len_name, fcn_name, tdiffusion )
2263
 
             else
2264
 
                tdiffusion = value_real
2265
 
             endif
2266
 
 
2267
 
          Case( 'comp_diffusion' );
2268
 
             if(( ior == 13 ) .or. ( ior == 18 )) then
2269
 
                call Array_Matrix4_Set( unit, ior, mat_nonods, ndim, ndim, nphase, len_name, fcn_name, comp_diffusion )
2270
 
             else
2271
 
                comp_diffusion = value_real
2272
 
             endif
2273
 
 
2274
 
          Case DEFAULT;
2275
 
             write( 375, * ) 'Option not found - read_all subrt., ', ifile( 1 : k ) 
2276
 
             stop 788
2277
 
 
2278
 
          end Select
2279
 
 
2280
 
       end if Conditional_IOR
2281
 
 
2282
 
    end do
2283
 
 
2284
 
    write(357,*) 'Leaving read_all'
2285
 
 
2286
 
    return
2287
 
  end subroutine read_all
2288
 
 
2289
 
 
2290
 
  subroutine readin_bc( unit_input, nphase, stotel, cv_snloc, p_snloc, u_snloc, &
2291
 
       wic_vol_bc, wic_d_bc, wic_u_bc, wic_p_bc, wic_t_bc, & 
2292
 
       suf_vol_bc, suf_d_bc, suf_cpd_bc, suf_t_bc, suf_p_bc, &
2293
 
       suf_u_bc, suf_v_bc, suf_w_bc, suf_one_bc, &
2294
 
       suf_u_bc_rob1, suf_u_bc_rob2, suf_v_bc_rob1, suf_v_bc_rob2, &
2295
 
       suf_w_bc_rob1, suf_w_bc_rob2, suf_t_bc_rob1, suf_t_bc_rob2  )
2296
 
    implicit none
2297
 
    integer, intent( in ) :: unit_input
2298
 
    integer, intent( in ) :: nphase, stotel, cv_snloc, p_snloc, u_snloc
2299
 
    integer, dimension( stotel * nphase ), intent( inout ) :: wic_vol_bc, wic_d_bc, wic_u_bc, wic_p_bc, wic_t_bc
2300
 
    real, dimension( stotel * cv_snloc * nphase ), intent( inout ) :: suf_vol_bc, suf_d_bc, suf_cpd_bc, suf_t_bc
2301
 
    real, dimension( stotel * p_snloc * nphase ), intent( inout ) :: suf_p_bc
2302
 
    real, dimension( stotel * u_snloc * nphase ), intent( inout ) :: suf_u_bc, suf_v_bc, suf_w_bc
2303
 
    real, dimension( stotel * cv_snloc * nphase ), intent( inout ) :: suf_one_bc
2304
 
    real, dimension( stotel * u_snloc * nphase ), intent( inout ) :: suf_u_bc_rob1, suf_u_bc_rob2, suf_v_bc_rob1, suf_v_bc_rob2, &
2305
 
         suf_w_bc_rob1, suf_w_bc_rob2
2306
 
    real, dimension( stotel * cv_snloc * nphase ), intent( inout ) :: suf_t_bc_rob1, suf_t_bc_rob2
2307
 
 
2308
 
    ! Local variables
2309
 
    character( len = 150) :: title
2310
 
 
2311
 
    write(357,*) 'In readin_bc'
2312
 
 
2313
 
    read( unit_input, * ) title( 1 : 150 )
2314
 
    read( unit_input, * ) title( 1 : 150 )
2315
 
    read( unit_input, * ) title( 1 : 150 )
2316
 
    read( unit_input, * ) title( 1 : 150 )
2317
 
    call input_int( unit_input, stotel * nphase, wic_vol_bc )
2318
 
    call input_int( unit_input, stotel * nphase, wic_d_bc )
2319
 
    call input_int( unit_input, stotel * nphase, wic_u_bc )
2320
 
    call input_int( unit_input, stotel * nphase, wic_p_bc )
2321
 
    call input_int( unit_input, stotel * nphase, wic_t_bc )
2322
 
 
2323
 
    call input_real( unit_input, stotel * cv_snloc * nphase, suf_vol_bc )
2324
 
    call input_real( unit_input, stotel * cv_snloc * nphase, suf_d_bc )
2325
 
    call input_real( unit_input, stotel * cv_snloc * nphase, suf_cpd_bc )
2326
 
    call input_real( unit_input, stotel * cv_snloc * nphase, suf_t_bc )
2327
 
 
2328
 
    call input_real( unit_input, stotel * p_snloc * nphase, suf_p_bc )
2329
 
 
2330
 
    call input_real( unit_input, stotel * u_snloc * nphase, suf_u_bc )
2331
 
    call input_real( unit_input, stotel * u_snloc * nphase, suf_v_bc )
2332
 
    call input_real( unit_input, stotel * u_snloc * nphase, suf_w_bc )
2333
 
 
2334
 
    call input_real( unit_input, stotel * cv_snloc * nphase, suf_one_bc )
2335
 
 
2336
 
    call input_real( unit_input, stotel * u_snloc * nphase, suf_u_bc_rob1 )
2337
 
    call input_real( unit_input, stotel * u_snloc * nphase, suf_u_bc_rob2 )
2338
 
    call input_real( unit_input, stotel * u_snloc * nphase, suf_v_bc_rob1 )
2339
 
    call input_real( unit_input, stotel * u_snloc * nphase, suf_v_bc_rob2 )
2340
 
    call input_real( unit_input, stotel * u_snloc * nphase, suf_w_bc_rob1 )
2341
 
    call input_real( unit_input, stotel * u_snloc * nphase, suf_w_bc_rob2 )
2342
 
    call input_real( unit_input, stotel * cv_snloc * nphase, suf_t_bc_rob1 )
2343
 
    call input_real( unit_input, stotel * cv_snloc * nphase, suf_t_bc_rob2 )
2344
 
 
2345
 
    write(357,*) 'Leaving readin_bc'
2346
 
 
2347
 
    return
2348
 
  end subroutine readin_bc
2349
 
 
2350
 
  subroutine reading_initial_position_velocities( unit_input, nphase, &
2351
 
       x_nonods, xu_nonods, u_nonods, &
2352
 
       x, y, z, xu, yu, zu, nu, nv, nw, ug, vg, wg )
2353
 
 
2354
 
    implicit none
2355
 
    integer, intent( in ) :: unit_input, nphase, x_nonods, xu_nonods,u_nonods
2356
 
    real, dimension( x_nonods ), intent( inout ) :: x, y, z
2357
 
    real, dimension( xu_nonods ), intent( inout ) :: xu, yu, zu
2358
 
    real, dimension( u_nonods * nphase ), intent( inout ) ::  nu, nv, nw, ug, vg, wg
2359
 
 
2360
 
    write(357,*) 'In reading_initial_position_velocities'
2361
 
 
2362
 
    call input_real( unit_input, x_nonods, x )
2363
 
    call input_real( unit_input, x_nonods, y )
2364
 
    call input_real( unit_input, x_nonods, z )
2365
 
 
2366
 
    call input_real( unit_input, xu_nonods, xu )
2367
 
    call input_real( unit_input, xu_nonods, yu )
2368
 
    call input_real( unit_input, xu_nonods, zu )
2369
 
 
2370
 
    call input_real( unit_input, u_nonods * nphase, nu )
2371
 
    call input_real( unit_input, u_nonods * nphase, nv )
2372
 
    call input_real( unit_input, u_nonods * nphase, nw )
2373
 
 
2374
 
    call input_real( unit_input, u_nonods * nphase, ug )
2375
 
    call input_real( unit_input, u_nonods * nphase, vg )
2376
 
    call input_real( unit_input, u_nonods * nphase, wg )
2377
 
 
2378
 
    write(357,*) 'Leaving reading_initial_position_velocities'
2379
 
 
2380
 
    return
2381
 
  end subroutine reading_initial_position_velocities
2382
 
 
2383
 
 
2384
 
  subroutine input_int( unit, n, array )
2385
 
    implicit none
2386
 
    integer, intent( in ) :: unit, n
2387
 
    integer, dimension( n ), intent( inout ) :: array
2388
 
 
2389
 
    ! Local variables
2390
 
    character( len = 100 ) :: description, fcn_name
2391
 
    integer :: value, i, k, npos, length
2392
 
    integer, dimension( : ), allocatable :: ind
2393
 
 
2394
 
    read( unit, 101 ) description
2395
 
    read( unit, * ) value
2396
 
    if( value < -1000 ) then ! Pre-defined function that can be used
2397
 
       read( unit, * ) fcn_name
2398
 
       k = index( fcn_name, ' ' ) - 1
2399
 
       call system( 'rm -f fvalues' )
2400
 
       call system( './' // fcn_name( 1 : k ) // ' > fvalues ' )
2401
 
       open( unit + 1, file = 'fvalues', status = 'unknown' )
2402
 
       read( unit + 1, * ) length
2403
 
       do i = 1, length
2404
 
          read( unit + 1 , * ) array( i )
2405
 
       end do
2406
 
       close( unit + 1 )
2407
 
    else
2408
 
       array( 1 : n ) = value
2409
 
       ! For specific values in the array, specify number of index (if negative, it is assumed 
2410
 
       ! the array is filled with one single value as described by the previous 'read' statement.
2411
 
       ! syntax is:
2412
 
       ! 2 
2413
 
       ! 1 6 5 8 --> two index to be modified, 1 and 6, and array in these positions  assumed 
2414
 
       ! values of 5 and 8
2415
 
       read( unit, * ) npos
2416
 
       if( npos > n )then
2417
 
          print*, 'number of index is larger the size of the array'
2418
 
          stop 119
2419
 
       elseif( npos < 0 ) then
2420
 
          return
2421
 
       else
2422
 
          allocate( ind( npos ))
2423
 
          read( unit, * ) (ind( i ), i = 1, npos ), ( array ( ind( i )), i = 1, npos )
2424
 
       end if
2425
 
    end if
2426
 
 
2427
 
101 format( a100)
2428
 
 
2429
 
    return
2430
 
  end subroutine input_int
2431
 
 
2432
 
  subroutine input_real( unit, n, array )
2433
 
    implicit none
2434
 
    integer, intent( in ) :: unit, n
2435
 
    real, dimension( n ), intent( inout ) :: array
2436
 
 
2437
 
    ! Local variables
2438
 
    character( len = 100 ) :: description, fcn_name
2439
 
    real :: value
2440
 
    integer :: i, npos, k, length
2441
 
    integer, dimension( : ), allocatable :: ind
2442
 
 
2443
 
    read( unit, 101 ) description
2444
 
    read( unit, * ) value
2445
 
    if( value < -1000. ) then ! pre-defined function that can be used
2446
 
       read( unit, * ) fcn_name
2447
 
       k = index( fcn_name, ' ' ) - 1
2448
 
       call system( 'rm -f fvalues' )
2449
 
       call system( './' // fcn_name( 1 : k ) // ' > fvalues ' )
2450
 
       open( unit + 1, file = 'fvalues', status = 'unknown' )
2451
 
       read( unit + 1, * ) length
2452
 
       do i = 1, length
2453
 
          read( unit + 1 , * ) array( i )
2454
 
       end do
2455
 
       close( unit + 1 )
2456
 
    else
2457
 
       array( 1 : n ) = value
2458
 
       ! For specific values in the array, specify number of index (if negative, it is assumed 
2459
 
       ! the array is filled with one single value as described by the previous 'read' statement.
2460
 
       ! syntax is:
2461
 
       ! 2 
2462
 
       ! 1 6 5 8 --> two index to be modified, 1 and 6, and array in these positions  assumed 
2463
 
       ! values of 5 and 8
2464
 
       read( unit, * ) npos
2465
 
       if( npos > n )then
2466
 
          print*, 'number of index is larger the size of the array'
2467
 
          stop 119
2468
 
       elseif( npos < 0 ) then
2469
 
          return
2470
 
       else
2471
 
          allocate( ind( npos ))
2472
 
          read( unit, * ) (ind( i ), i = 1, npos ), ( array ( ind( i )), i = 1, npos )
2473
 
       end if
2474
 
    end if
2475
 
 
2476
 
101 format( a100)
2477
 
 
2478
 
    return
2479
 
  end subroutine input_real
2480
 
 
2481
 
  subroutine input_matrix( unit, ndim1, ndim2, array )
2482
 
    ! Here, user can either provide a single value for all components of
2483
 
    ! the tensor or use a external function to design the tensor with 
2484
 
    ! input array( i, j, k ) 
2485
 
    implicit none
2486
 
    integer, intent( in ) :: unit, ndim1, ndim2
2487
 
    real, dimension( ndim1, ndim2 ), intent( inout ) :: array
2488
 
    ! Local variables
2489
 
    character( len = 100 ) :: description, fcn_name
2490
 
    integer :: i, j,  k, length1, length2 
2491
 
    real :: value
2492
 
 
2493
 
    read( unit, 101 ) description
2494
 
    read( unit, * ) value
2495
 
    if( value < -1000. ) then ! pre-defined function that can be used
2496
 
       read( unit, * ) fcn_name
2497
 
       k = index( fcn_name, ' ' ) - 1
2498
 
       call system( 'rm -f fvalues' )
2499
 
       call system( './' // fcn_name( 1 : k ) // ' > fvalues ' )
2500
 
       open( unit + 1, file = 'fvalues', status = 'unknown' )
2501
 
       read( unit + 1, * ) length1, length2 
2502
 
       if( ( length1 > ndim1 ) .or. ( length2 > ndim2 ))then
2503
 
          print*, 'Matrix dimension exceeded'
2504
 
          stop 910
2505
 
       end if
2506
 
       do i = 1, length1
2507
 
          do j = 1, length2
2508
 
             read( unit + 1 , * ) array( i, j )
2509
 
          end do
2510
 
       end do
2511
 
       close( unit + 1 )
2512
 
    else
2513
 
       array( 1 : ndim1, 1 : ndim2 ) = value
2514
 
    end if
2515
 
 
2516
 
101 format( a100)
2517
 
 
2518
 
    return
2519
 
  end subroutine input_matrix
2520
 
 
2521
 
 
2522
 
  subroutine input_tensor( unit, ndim1, ndim2, ndim3, array )
2523
 
    ! Here, user can either provide a single value for all components of
2524
 
    ! the tensor or use a external function to design the tensor with 
2525
 
    ! input array( i, j, k ) 
2526
 
    implicit none
2527
 
    integer, intent( in ) :: unit, ndim1, ndim2, ndim3
2528
 
    real, dimension( ndim1, ndim2, ndim3 ), intent( inout ) :: array
2529
 
    ! Local variables
2530
 
    character( len = 100 ) :: description, fcn_name
2531
 
    integer :: i, j,  k, length1, length2, length3 
2532
 
    real :: value
2533
 
 
2534
 
    read( unit, 102 ) description
2535
 
    read( unit, * ) value
2536
 
    if( value < -1000. ) then ! pre-defined function that can be used
2537
 
       read( unit, * ) fcn_name
2538
 
       k = index( fcn_name, ' ' ) - 1
2539
 
       call system( 'rm -f fvalues' )
2540
 
       call system( './' // fcn_name( 1 : k ) // ' > fvalues ' )
2541
 
       open( unit + 1, file = 'fvalues', status = 'unknown' )
2542
 
       read( unit + 1, * ) length1, length2, length3 
2543
 
       if( ( length1 > ndim1 ) .or. ( length2 > ndim2 ) .or. &
2544
 
            ( length3 > ndim3 ))then
2545
 
          print*, 'Tensor dimension exceeded'
2546
 
          stop 909
2547
 
       end if
2548
 
       do i = 1, length1
2549
 
          do j = 1, length2
2550
 
             do k = 1, length3
2551
 
                read( unit + 1 , * ) array( i, j, k )
2552
 
             end do
2553
 
          end do
2554
 
       end do
2555
 
       close( unit + 1 )
2556
 
    else
2557
 
       array( 1 : ndim1, 1 : ndim2, 1 : ndim3  ) = value
2558
 
    end if
2559
 
 
2560
 
102 format( a100 )
2561
 
 
2562
 
    return
2563
 
  end subroutine input_tensor
2564
 
 
2565
 
 
2566
 
 
2567
 
  subroutine input_tensor2( unit, ndim1, ndim2, ndim3, ndim4, array )
2568
 
    ! Here, user can either provide a single value for all components of
2569
 
    ! the tensor or use a external function to design the tensor with 
2570
 
    ! input array( i, j, k ) 
2571
 
    implicit none
2572
 
    integer, intent( in ) :: unit, ndim1, ndim2, ndim3, ndim4
2573
 
    real, dimension( ndim1, ndim2, ndim3, ndim4 ), intent( inout ) :: array
2574
 
    ! Local variables
2575
 
    character( len = 100 ) :: description, fcn_name
2576
 
    integer :: i, j,  k, l, length1, length2, length3, length4 
2577
 
    real :: value
2578
 
 
2579
 
    read( unit, 101 ) description
2580
 
    read( unit, * ) value
2581
 
    if( value < -1000. ) then ! pre-defined function that can be used
2582
 
       read( unit, * ) fcn_name
2583
 
       k = index( fcn_name, ' ' ) - 1
2584
 
       call system( 'rm -f fvalues' )
2585
 
       call system( './' // fcn_name( 1 : k ) // ' > fvalues ' )
2586
 
       open( unit + 1, file = 'fvalues', status = 'unknown' )
2587
 
       read( unit + 1, * ) length1, length2, length3 
2588
 
       if( ( length1 > ndim1 ) .or. ( length2 > ndim2 ) .or. &
2589
 
            ( length3 > ndim3 ) .or. ( length4 > ndim4 ))then
2590
 
          print*, 'Tensor dimension exceeded'
2591
 
          stop 910
2592
 
       end if
2593
 
       do i = 1, length1
2594
 
          do j = 1, length2
2595
 
             do k = 1, length3
2596
 
                do l = 1, length4
2597
 
                   read( unit + 1 , * ) array( i, j, k, l )
2598
 
                end do
2599
 
             end do
2600
 
          end do
2601
 
       end do
2602
 
       close( unit + 1 )
2603
 
    else
2604
 
       array( 1 : ndim1, 1 : ndim2, 1 : ndim3, ndim4  ) = value
2605
 
    end if
2606
 
 
2607
 
101 format( a100)
2608
 
 
2609
 
    return
2610
 
  end subroutine input_tensor2
2611
 
 
2612
 
 
2613
 
  subroutine allocating_global_nodes( ndim, totele, domain_length, &
2614
 
       u_nloc, xu_nloc, cv_nloc, x_nloc, p_nloc, mat_nloc, &
2615
 
       cv_snloc, u_snloc, p_snloc, stotel, &
2616
 
       cv_nonods, u_nonods, x_nonods, xu_nonods, &
2617
 
       u_ele_type, cv_ele_type, &
2618
 
       x, xu, &
2619
 
       u_ndgln, xu_ndgln, cv_ndgln, x_ndgln, p_ndgln, &
2620
 
       mat_ndgln, u_sndgln, cv_sndgln, p_sndgln )
2621
 
    use printout
2622
 
 
2623
 
    implicit none
2624
 
    integer, intent( in ) :: ndim, totele
2625
 
    real, intent( in ) :: domain_length
2626
 
    integer, intent( in ) :: u_nloc, xu_nloc, cv_nloc, x_nloc, p_nloc, mat_nloc, &
2627
 
         cv_snloc, u_snloc, p_snloc, stotel, &
2628
 
         cv_nonods, u_nonods, x_nonods, xu_nonods, &
2629
 
         u_ele_type, cv_ele_type
2630
 
    real, dimension( x_nonods ), intent( inout )  :: x    
2631
 
    real, dimension( xu_nonods ), intent( inout ) :: xu
2632
 
    integer, dimension( totele * u_nloc ), intent( inout )  :: u_ndgln
2633
 
    integer, dimension( totele * xu_nloc ), intent( inout )  :: xu_ndgln
2634
 
    integer, dimension( totele * cv_nloc ), intent( inout )  :: cv_ndgln
2635
 
    integer, dimension( totele * cv_nloc ), intent( inout )  :: x_ndgln
2636
 
    integer, dimension( totele * p_nloc ), intent( inout )  :: p_ndgln
2637
 
    integer, dimension( totele * mat_nloc ), intent( inout )  :: mat_ndgln
2638
 
    integer, dimension( stotel * u_snloc ), intent( inout )  :: u_sndgln
2639
 
    integer, dimension( stotel * cv_snloc ), intent( inout )  :: cv_sndgln
2640
 
    integer, dimension( stotel * p_snloc ), intent( inout )  :: p_sndgln
2641
 
 
2642
 
    ! Local variables:
2643
 
    integer :: u_nloc2, u_nod, xu_nod, cv_nod, x_nod, mat_nod, p_nod
2644
 
    real :: dx
2645
 
    integer :: ele, iloc, cv_iloc
2646
 
    character( len = 100 ) :: name
2647
 
 
2648
 
    write(357,*) 'In allocating_global_nodes'
2649
 
 
2650
 
    Conditional_NDIM: if( ndim == 1 ) then ! This needs to be updated for 2-3D
2651
 
 
2652
 
       dx = domain_length / real( totele )
2653
 
       cv_sndgln( 1 ) = 1
2654
 
       cv_sndgln( 2 ) = cv_nonods
2655
 
       p_sndgln( 1 ) = 1
2656
 
       p_sndgln( 2 ) = cv_nonods
2657
 
 
2658
 
       if( cv_ele_type == 2 ) then
2659
 
          u_nloc2 = u_nloc / cv_nloc
2660
 
          do cv_iloc = 1, cv_nloc 
2661
 
             u_sndgln( cv_iloc ) = 1 + ( cv_iloc -1 ) * u_nloc2
2662
 
             u_sndgln( cv_iloc + cv_nloc ) = u_nonods - u_nloc + cv_iloc * u_nloc2
2663
 
          end do
2664
 
       else
2665
 
          u_sndgln( 1 ) = 1
2666
 
          u_sndgln( 2 ) = u_nonods
2667
 
       end if
2668
 
       name = '####u_sndgln####'
2669
 
       call mirror_array_int( 357, name,  stotel * u_snloc, u_sndgln )
2670
 
 
2671
 
       u_nod = 0
2672
 
       xu_nod = 0 
2673
 
       cv_nod = 0
2674
 
       x_nod = 0
2675
 
       mat_nod = 0
2676
 
       p_nod = 0
2677
 
 
2678
 
       Loop_Elements: do ele = 1, totele
2679
 
 
2680
 
          Loop_U: do iloc = 1, u_nloc ! storing velocity nodes
2681
 
             u_nod = u_nod + 1
2682
 
             u_ndgln( ( ele - 1 ) * u_nloc + iloc ) = u_nod
2683
 
          end do Loop_U
2684
 
 
2685
 
          Loop_XU:do iloc = 1, xu_nloc
2686
 
             xu_nod = xu_nod + 1
2687
 
             xu_ndgln( ( ele - 1 ) * xu_nloc + iloc ) = xu_nod
2688
 
             if ( xu_nloc == 1 ) then
2689
 
                xu( xu_nod ) = ( real( ele - 1 ) + 0.5 ) * dx
2690
 
             else
2691
 
                if( u_ele_type == 2 ) then
2692
 
                   xu( xu_nod ) = real( ele - 1 ) * dx + real ( mod( iloc, cv_nloc ) - 1 ) &
2693
 
                        * dx / real ( u_nloc - 1 )
2694
 
                else
2695
 
                   xu( xu_nod ) = real( ele - 1 ) * dx + real ( iloc - 1 ) &
2696
 
                        * dx / real ( u_nloc - 1 )
2697
 
                end if
2698
 
             end if
2699
 
          end do Loop_XU
2700
 
          if( xu_nloc /= 1 ) xu_nod = xu_nod - 1
2701
 
 
2702
 
          Loop_P: do iloc = 1, p_nloc
2703
 
             p_nod = p_nod + 1
2704
 
             p_ndgln( ( ele - 1 ) * p_nloc + iloc ) = p_nod
2705
 
          end do Loop_P
2706
 
          !if( problem == 2 ) p_nod = p_nod - 1
2707
 
          if( cv_nonods /= totele * cv_nloc ) p_nod = p_nod - 1
2708
 
 
2709
 
          Loop_CV: do iloc = 1, cv_nloc
2710
 
             cv_nod = cv_nod + 1
2711
 
             cv_ndgln( ( ele - 1 ) * cv_nloc + iloc ) = cv_nod
2712
 
          end do Loop_CV
2713
 
          !if( problem == 2 ) cv_nod = cv_nod - 1
2714
 
          if( cv_nonods /= totele * cv_nloc ) cv_nod = cv_nod - 1
2715
 
 
2716
 
          Loop_X: do iloc = 1, x_nloc
2717
 
             x_nod = x_nod + 1
2718
 
             x_ndgln( ( ele - 1 ) * x_nloc + iloc ) = x_nod
2719
 
             if ( x_nloc == 1 ) then
2720
 
                x( x_nod ) = ( real( ele - 1 ) + 0.5 ) * dx 
2721
 
             else
2722
 
                x( x_nod ) = real( ele - 1 ) * dx + real( iloc - 1 ) * dx / real ( x_nloc - 1 )
2723
 
             end if
2724
 
          end do Loop_X
2725
 
          if( x_nloc /= 1 ) x_nod = x_nod - 1
2726
 
 
2727
 
          Loop_Mat: do iloc = 1, mat_nloc
2728
 
             mat_nod = mat_nod + 1
2729
 
             mat_ndgln( ( ele - 1 ) * mat_nloc + iloc ) = mat_nod
2730
 
          end do Loop_Mat
2731
 
 
2732
 
       end do Loop_Elements
2733
 
 
2734
 
    end if Conditional_NDIM
2735
 
 
2736
 
    write(357,*) 'Leaving allocating_global_nodes'
2737
 
 
2738
 
 
2739
 
    return
2740
 
  end subroutine allocating_global_nodes
2741
 
 
2742
 
 
2743
 
  ! Initialising T and Told:
2744
 
  subroutine initialise_scalar_fields( &
2745
 
       problem, ndim, nphase, totele, domain_length, &
2746
 
       x_nloc, cv_nloc, x_nonods, cv_nonods,  &
2747
 
       x_ndgln, cv_ndgln, &
2748
 
       x, told, t )
2749
 
    implicit none
2750
 
    integer, intent( in ) :: problem, ndim, nphase, totele
2751
 
    real, intent( in ) :: domain_length
2752
 
    integer, intent( in ) ::x_nloc, cv_nloc, x_nonods, cv_nonods
2753
 
    integer, dimension( totele * cv_nloc ) :: x_ndgln, cv_ndgln
2754
 
    real, dimension( x_nonods ), intent( in )  :: x
2755
 
    real, dimension( cv_nonods * nphase ), intent( inout )  :: told, t
2756
 
    ! Local variables
2757
 
    integer :: iloc, ele, x_nod, cv_nod
2758
 
    real :: dx
2759
 
 
2760
 
    write(357,*) 'In initialise_scalar_fields'
2761
 
 
2762
 
    Conditional_NDIM: if ( ndim == 1 ) then ! This may change for 2-3D
2763
 
 
2764
 
       dx = domain_length / real( totele )
2765
 
       t = 0.
2766
 
       Loop_Element: do ele = 1, totele
2767
 
          do iloc = 1, cv_nloc
2768
 
             x_nod = x_ndgln( ( ele - 1 ) * x_nloc + iloc )
2769
 
             cv_nod = cv_ndgln( ( ele - 1 ) * cv_nloc + iloc )
2770
 
 
2771
 
             Select case( problem )
2772
 
 
2773
 
             case( -1, 0 ); ! CV-Adv test-case
2774
 
                if( ( x( x_nod ) > 0.199 ) .and. ( x( x_nod ) < 0.401 )) t( cv_nod ) = 1.
2775
 
                if( problem == 0 ) t( cv_nod ) = exp( -(( x( x_nod ) - 0.6 ) / 0.2 )**2 )
2776
 
 
2777
 
             case( 1, 2 ); ! BL problem
2778
 
                if( x( x_nod ) < dx ) t( cv_nod ) = 0.5
2779
 
 
2780
 
             case DEFAULT
2781
 
                write(357,*) 'It is necessary to set up -1 < problem < 1'
2782
 
                stop 1789
2783
 
 
2784
 
             end Select
2785
 
 
2786
 
          end do
2787
 
       end do Loop_Element
2788
 
       told = t
2789
 
 
2790
 
    end if Conditional_NDIM
2791
 
 
2792
 
    write(357,*) 'Leaving initialise_scalar_fields'
2793
 
 
2794
 
    return
2795
 
  end subroutine initialise_scalar_fields
2796
 
 
2797
 
 
2798
 
  integer function Combination( n, r )
2799
 
    ! This function performs the combinatorial:
2800
 
    ! C(n,r) = n! / ( (n-r)! r! )
2801
 
    implicit none
2802
 
    integer :: n, r
2803
 
 
2804
 
    Combination = Permut( n ) / ( Permut( n - r ) * Permut( r ))
2805
 
 
2806
 
    return
2807
 
  end function Combination
2808
 
 
2809
 
  integer function Permut( n )
2810
 
    ! This function performs probabilistic permutation:
2811
 
    ! P(n) = n!
2812
 
    implicit none
2813
 
    integer :: n
2814
 
    integer :: i
2815
 
 
2816
 
    permut = 1
2817
 
    do i = 1, n
2818
 
       permut = permut * i
2819
 
    end do
2820
 
 
2821
 
    return
2822
 
  end function permut
2823
 
 
2824
 
end module input_var
2825