-
Notifications
You must be signed in to change notification settings - Fork 38
/
kind_types.f90
2540 lines (2538 loc) · 74.7 KB
/
kind_types.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
module rename_intrinsics
!
implicit none
!
public
!
intrinsic dot_product
intrinsic matmul
!
end module rename_intrinsics
!
!###############################################################################
!
module compatibility_pgi_mod
!
! Interfaces to PGI built-in (non-standard) intrinsic procedures
!
! NOTE: This is copied from the file 'lib3f.h' which can be found
! in the include directory of the PGI installation.
!
implicit none
!
#ifdef SPECIAL_FOR_PGI
public
!
interface
!
function system(command) result(ierr)
character*(*), intent(in) :: command
integer :: ierr
end function system
!
function ierrno() result(ierr)
integer :: ierr
end function ierrno
!
subroutine gerror(string)
character*(*), intent(out) :: string
end subroutine gerror
!
end interface
!
contains
!
!###############################################################################
!
subroutine execute_command_line(command,wait,exitstat,cmdstat,cmdmsg)
!
!.. Formal Arguments ..
character(len=*), intent(in) :: command
!
!.. Optional Arguments ..
logical, optional, intent(in) :: wait
integer, optional, intent(inout) :: exitstat
integer, optional, intent(inout) :: cmdstat
character(len=*), optional, intent(inout) :: cmdmsg
!
!.. Local Scalars ..
integer :: ierr
character(len=len_trim(adjustl(command))) :: command_string
!
continue
!
if (present(exitstat)) exitstat = 0
if (present(cmdstat)) cmdstat = 0
if (present(cmdmsg)) cmdmsg = ""
!
command_string = trim(adjustl(command))
!
ierr = system( command_string )
!
if (ierr /= 0) then
!
if (present(exitstat)) then
exitstat = ierr
end if
!
if (present(cmdstat)) then
cmdstat = ierrno()
end if
!
if (present(cmdmsg)) then
call gerror( cmdmsg )
end if
!
end if
!
end subroutine execute_command_line
!
!###############################################################################
!
#endif
end module compatibility_pgi_mod
!
!###############################################################################
!
module compatibility_gcc_mod
!
! Interfaces to GCC built-in (non-standard) intrinsic procedures
!
! NOTE: These interfaces are defined based on the definitions of these
! procedures in the GNU Fortran Manual which can be found at
! https://gcc.gnu.org/onlinedocs/gcc-4.9.4/gfortran.pdf
!
! NOTE: The C binding names are based on the result of the command
! `nm -D libgfortran.so | grep -i '\(system\|ierrno\|gerror\)'`
! which shows that these procedures are prefixed with '_gfortran'
! when compiled and linked into the libraries.
!
implicit none
!
#ifdef SPECIAL_FOR_GCC
private
!
public :: system
public :: ierrno
public :: gerror
!
interface
!
function gcc_system(command) result(ierr) bind(c,name="_gfortran_system")
use, intrinsic :: iso_c_binding, only : c_char,c_int
character(kind=c_char), intent(in) :: command(*)
integer(c_int) :: ierr
end function gcc_system
!
! NOTE: There are two version of ierrno()
! _gfortran_ierrno_i4 which returns a 32-bit integer
! _gfortran_ierrno_i8 which returns a 64-bit integer
!
function ierrno() result(ierr) bind(c,name="_gfortran_ierrno_i4")
use, intrinsic :: iso_c_binding, only : c_int
integer(c_int) :: ierr
end function ierrno
!
subroutine gcc_gerror(string) bind(c,name="_gfortran_gerror")
use, intrinsic :: iso_c_binding, only : c_char
character(kind=c_char), intent(out) :: string(*)
end subroutine gcc_gerror
!
end interface
!
contains
!
!###############################################################################
!
function system(command) result(ierr)
!
!.. Use Statements ..
use, intrinsic :: iso_c_binding, only : c_char,c_int,c_null_char
!
!.. Formal Arguments ..
character(len=*), intent(in) :: command
!
!.. Function Result ..
integer(c_int) :: ierr
!
!.. Local Scalars ..
integer :: n,nlen
character(len=len_trim(adjustl(command))) :: command_string
character(len=100) :: frmt
!
!.. Local Arrays ..
character(len=1,kind=c_char) :: c_command(1:len_trim(adjustl(command))+1)
!
continue
!
command_string = trim(adjustl(command))
write (*,100) "command_string",command_string
100 format (a," = '",a,"'")
!
nlen = len(command_string)
do n = 1,nlen
c_command(n) = command_string(n:n)
end do
c_command(nlen+1) = c_null_char
write (frmt,101) nlen+1
101 format ('(a," = ',"'",'",',i0,'(a),"',"'",'")')
!101 format (a," = '",<nlen+1>(a),"'")
write (*,fmt=frmt) "c_command",(c_command(n),n=1,size(c_command))
!
ierr = gcc_system( c_command )
!
end function system
!
!###############################################################################
!
subroutine gerror(string)
!
!.. Use Statements ..
use, intrinsic :: iso_c_binding, only : c_char,c_int,c_null_char
!
!.. Formal Arguments ..
!character(len=:), allocatable, intent(out) :: string
character(len=*), intent(out) :: string
!
!.. Local Scalars ..
integer :: n,nlen,ierr
!
!.. Local Arrays ..
character(len=1,kind=c_char) :: c_string(1:301)
!
continue
!
c_string(:) = c_null_char
!
call gcc_gerror( c_string )
!
do n = 1,size(c_string)
if (c_string(n) == c_null_char) then
nlen = n-1
exit
end if
end do
!
!allocate ( character(len=nlen) :: string , stat=ierr )
!
do n = 1,min(nlen,len(string))
string(n:n) = c_string(n)
end do
!
end subroutine gerror
!
!###############################################################################
!
#endif
end module compatibility_gcc_mod
!
!###############################################################################
!
module base_kind_types
!
!.. Use Statements ..
use iso_fortran_env, only : int32
use iso_fortran_env, only : int64
use iso_fortran_env, only : real32
use iso_fortran_env, only : real64
use iso_fortran_env, only : real128
use iso_fortran_env, only : output_unit
use iso_fortran_env, only : logical_kinds
!
implicit none
!
private
!
! KIND definitions for 32-bit or 64-bit integer variables (IEEE 754)
!
integer, public, parameter :: I4 = int32
integer, public, parameter :: I8 = max( int32 , int64 )
!
! KIND definitions for single or double precision real variables (IEEE 754)
!
integer, public, parameter :: R4 = real32
integer, public, parameter :: R8 = real64
integer, public, parameter :: R16 = max( real64 , real128 )
!
! KIND definitions for logical variables
!
#ifdef SPECIAL_FOR_PGI
integer, public, parameter :: l1k = logical_kinds(1)
#else
#ifdef SPECIAL_FOR_GCC
integer, parameter :: lb_lk = lbound(logical_kinds,dim=1)
integer, parameter :: ub_lk = ubound(logical_kinds,dim=1)
integer, public, parameter :: l1k = min(logical_kinds(min(lb_lk+0,ub_lk)), &
logical_kinds(min(lb_lk+1,ub_lk)), &
logical_kinds(min(lb_lk+2,ub_lk)), &
logical_kinds(min(lb_lk+3,ub_lk)), &
logical_kinds(min(lb_lk+4,ub_lk)))
#else
integer, public, parameter :: l1k = minval(logical_kinds)
#endif
#endif
integer, public, parameter :: ldk = kind(.true.)
!
! Unit for I/O to standard output
!
integer, public, parameter :: iout = output_unit
!
end module base_kind_types
!
!###############################################################################
!
module module_kind_types
!
#include <mpi_defs.h>
!
!.. Use Statements ..
use base_kind_types
use _MPI_MODULE_
#ifdef USE_INTEL_MKL
use blas95, only : dot
#else
use rename_intrinsics, only : dot => dot_product
#endif
#ifndef SPECIAL_FOR_GCC
use, intrinsic :: ieee_arithmetic, only : is_nan => ieee_is_nan
use, intrinsic :: ieee_arithmetic, only : is_finite => ieee_is_finite
use, intrinsic :: ieee_arithmetic, only : is_negative => ieee_is_negative
#endif
!
implicit none
!
public
!
! ####################################
! ####################################
! ##### KIND TYPE PARAMETERS #####
! ####################################
! ####################################
!
! Aliases for kind type parameters
!
integer, parameter :: LK = l1k
integer, parameter :: SP = r4
integer, parameter :: DP = r8
integer, parameter :: QP = r16
integer, parameter :: WP = r8
!
integer, parameter :: WIP = i4
integer, parameter :: INT_MPI = kind(MPI_INTEGER_KIND)
integer, parameter :: INT_METIS = i4
!
! ###########################################
! ###########################################
! ##### NUMERICAL/LOGICAL CONSTANTS #####
! ###########################################
! ###########################################
!
! Definitions for numerical contants
!
real(qp), parameter :: qzero = 0.0_qp
real(qp), parameter :: qhalf = 0.5_qp
real(qp), parameter :: qone = 1.0_qp
real(qp), parameter :: qtwo = 2.0_qp
real(qp), parameter :: qten = 10.0_qp
!
real(wp), parameter :: zero = 0.0_wp
real(wp), parameter :: half = 0.5_wp
real(wp), parameter :: one = 1.0_wp
real(wp), parameter :: s1 = 1.2_wp
real(wp), parameter :: s2 = 0.8_wp
real(wp), parameter :: two = 2.0_wp
real(wp), parameter :: three = 3.0_wp
real(wp), parameter :: four = 4.0_wp
real(wp), parameter :: five = 5.0_wp
real(wp), parameter :: six = 6.0_wp
real(wp), parameter :: seven = 7.0_wp
real(wp), parameter :: eight = 8.0_wp
real(wp), parameter :: nine = 9.0_wp
real(wp), parameter :: ten = 10.0_wp
real(wp), parameter :: twelve = 12.0_wp
real(wp), parameter :: sixteen = 16.0_wp
!
real(wp), parameter :: one8 = one/eight
real(wp), parameter :: one6 = one/six
real(wp), parameter :: one5 = one/five
real(wp), parameter :: one4 = one/four
real(wp), parameter :: one3 = one/three
real(wp), parameter :: two3 = two/three
real(wp), parameter :: three4 = three/four
!
real(wp), parameter :: eps1 = 1.0e-01_wp
real(wp), parameter :: eps2 = 1.0e-02_wp
real(wp), parameter :: eps3 = 1.0e-03_wp
real(wp), parameter :: eps6 = 1.0e-06_wp
real(wp), parameter :: eps7 = 1.0e-07_wp
real(wp), parameter :: eps9 = 1.0e-09_wp
real(wp), parameter :: eps10 = 1.0e-10_wp
real(wp), parameter :: eps11 = 1.0e-11_wp
real(wp), parameter :: eps12 = 1.0e-12_wp
real(wp), parameter :: eps14 = 1.0e-14_wp
real(wp), parameter :: eps17 = 1.0e-17_wp
real(wp), parameter :: small = eps17
!
real(wp), parameter :: pi = 3.14159265358979323846_wp
!
real(wp), parameter :: radians2degrees = two*nine*ten/pi
real(wp), parameter :: degrees2radians = one/radians2degrees
!
real(wp), parameter :: rndoff = epsilon(one)
real(wp), parameter :: tny = tiny(one)
!
logical(lk), parameter :: true = .true.
logical(lk), parameter :: fals = .false.
!
! Constants for cshift and eoshift functions
!
integer, parameter :: to_end = -1
integer, parameter :: to_front = 1
!
! #########################################
! #########################################
! ##### GENERAL GLOBAL PARAMETERS #####
! #########################################
! #########################################
!
! I/O constants
!
integer, parameter :: iorst = 10
!
! Boundary condition constants
!
! Inflow BCs
integer, parameter :: bc_generic_inflow = 1
integer, parameter :: bc_sub_inflow = 2
integer, parameter :: bc_sup_inflow = 3
integer, parameter :: bc_mdot_inflow = 4
! Outflow BCs
integer, parameter :: bc_generic_outflow = 11
integer, parameter :: bc_sub_outflow = 12
integer, parameter :: bc_sup_outflow = 13
integer, parameter :: bc_mdot_outflow = 14
! Generic Inflow/Outflow BCs
integer, parameter :: bc_characteristic = 21
integer, parameter :: bc_generic_freeflow = 22
integer, parameter :: bc_freestream = 23
integer, parameter :: bc_fixed = 24
! Wall BCs
integer, parameter :: bc_slip_wall = 50
integer, parameter :: bc_euler_wall = 51
integer, parameter :: bc_adiabatic_wall = 52
integer, parameter :: bc_isothermal_wall = 53
integer, parameter :: bc_default_wall = bc_adiabatic_wall
! MMS BCs
integer, parameter :: bc_mms_dirichlet = 70
! Other BCs
integer, parameter :: not_a_bc = 0
integer, parameter :: bc_symmetry = 80
integer, parameter :: bc_periodic = 81
integer, parameter :: bc_cpu_bnd = 99
integer, parameter :: bc_unsupported = -9998
integer, parameter :: bc_unknown = -9999
! BC Groups
integer, parameter :: bc_comm(1:2) = [bc_periodic,bc_cpu_bnd]
integer, parameter :: bc_walls(1:5) = [ bc_slip_wall, &
bc_euler_wall, &
bc_symmetry, &
bc_adiabatic_wall, &
bc_isothermal_wall ]
!
integer, parameter :: bc_heirarchy(1:17) = [ bc_isothermal_wall, &
bc_adiabatic_wall, &
bc_euler_wall, &
bc_slip_wall, &
bc_symmetry, &
bc_fixed, &
bc_freestream, &
bc_sub_inflow, &
bc_sup_inflow, &
bc_mdot_inflow, &
bc_generic_inflow, &
bc_sub_outflow, &
bc_sup_outflow, &
bc_mdot_outflow, &
bc_generic_outflow, &
bc_characteristic, &
bc_generic_freeflow ]
integer, parameter :: bc_mms(1:1) = [bc_mms_dirichlet]
!
! Parameters defining workshop test cases
!
integer, parameter :: Generic_MeanFlow = 1
integer, parameter :: Channel_Flow = 2
integer, parameter :: Inviscid_Gaussian_Bump = 3
integer, parameter :: Laminar_BndLyr = 4
integer, parameter :: Shu_Vortex = 5
integer, parameter :: Vortex_Transport = 6
integer, parameter :: Density_Transport = 7
integer, parameter :: Entropy_Transport = 8
integer, parameter :: Taylor_Green_Vortex = 9
integer, parameter :: Nozzle_Jet = 10
integer, parameter :: Double_Mach_Reflection = 11
integer, parameter :: Infinite_Cylinder = 12
integer, parameter :: Freestream_Preservation = 13
integer, parameter :: Advec_Problems(1:2) = [ Density_Transport, &
Entropy_Transport ]
integer, parameter :: Vortex_Problems(1:2) = [ Shu_Vortex, &
Vortex_Transport ]
integer, parameter :: Transport_Problems(1:4) = [ Shu_Vortex, &
Vortex_Transport, &
Advec_Problems ]
!
! Location of 1D solution points
integer, parameter :: Equi_Distant_Points = 0
integer, parameter :: Legendre_Gauss = 1
integer, parameter :: Legendre_Gauss_Lobatto = 2
integer, parameter :: Legendre_Nodes(1:2) = [Legendre_Gauss, &
Legendre_Gauss_Lobatto]
integer, parameter :: Chebyshev_Gauss = 3
integer, parameter :: Chebyshev_Gauss_Lobatto = 4
integer, parameter :: Gauss_Lobatto(1:2) = [Legendre_Gauss_Lobatto, &
Chebyshev_Gauss_Lobatto]
!
! Method for creating triangle solution points
integer, parameter :: AlphaOptimized_TriPoints = 1
integer, parameter :: BarycentricLobatto_TriPoints = 2
!
integer, parameter :: LagrangePolynomial = 1
integer, parameter :: ChainRuleCV = 2
integer, parameter :: ChainRuleUtd = 3
integer, parameter :: DGWeakForm = 4
integer, parameter :: DGStrongForm = 5
integer, parameter :: TestQuadrature = 0
integer, parameter :: TestViscous = 10
integer, parameter :: OnPrimitiveVariables = 1
integer, parameter :: OnConservativeVariables = 2
integer, parameter :: OnFluxes = 3
!
! Choices for correction function
integer, parameter :: Correction_gDG = 1
integer, parameter :: Correction_g2 = 2
integer, parameter :: Correction_gGauss = 3
!
integer, parameter :: project_derivatives = 1
integer, parameter :: derivative_of_proj_fluxes = 2
!
integer, parameter :: invs_flux_ROE = 1
integer, parameter :: invs_flux_HLLC = 2
integer, parameter :: invs_flux_LDFSS = 3
integer, parameter :: invs_flux_Rotated_RHLL = 4
!
integer, parameter :: visc_flux_BR1 = 1
integer, parameter :: visc_flux_BR2 = 2
integer, parameter :: visc_flux_LDG = 3
!
! Parameters giving what set of variables to
! average when computing the common viscous flux.
!
! VISC_INTERFACE_FLUXES : Compute the common viscous flux by averaging the
! left and right viscous interface fluxes which are
! computed using the left and right interface
! solutions and gradients.
! VISC_SOLUTION_AND_GRADIENTS : Compute common solutions and gradients by
! averaging the left and right interface
! solutions and gradients and use these
! values to compute the common viscous flux.
!
integer, parameter :: visc_interface_fluxes = 1
integer, parameter :: visc_solution_and_gradients = 2
!
! Constants for timestepping method
!
integer, parameter :: Constant_Timestep = 0
!
integer, parameter :: Cell_Timestep = 1
integer, parameter :: Global_Cell_Timestep = Cell_Timestep
integer, parameter :: Local_Cell_Timestep = -Cell_Timestep
!
integer, parameter :: Point_Timestep = 2
integer, parameter :: Global_Point_Timestep = Point_Timestep
integer, parameter :: Local_Point_Timestep = -Point_Timestep
!
! RK Parameters
integer, parameter :: Classic_RK = 1
integer, parameter :: TVD2_RK = 2
integer, parameter :: TVD3_RK = 3
integer, parameter :: TVD4_RK = 4
integer, parameter :: CK4_RK = 5
!
! Equation Types
integer, parameter :: Euler_Eqns = 1
integer, parameter :: NavierStokes_Eqns = 2
!
! Turbulence Options
integer, parameter :: laminar_flow = 0
integer, parameter :: k_omega = 1
integer, parameter :: k_omega_1998 = +k_omega
integer, parameter :: k_omega_2006 = -k_omega
!
! Grid Types
integer, parameter :: Internally_Generated_Grid = -1
integer, parameter :: Gambit_Neutral = 1
integer, parameter :: Gmsh_Format = 2
integer, parameter :: Plot3D_Format = 3
integer, parameter :: CGNS_Format = 4
!
! CGNS constants
integer, parameter :: reopen_CGNS = 2
integer, parameter :: open_CGNS = 1
integer, parameter :: add_to_CGNS = 0
integer, parameter :: close_CGNS = -1
integer, parameter :: dump_CGNS = -2
!
! Cell Geometry Family Types
!
type :: geom_family_t
integer :: v = 1
end type geom_family_t
!
type(geom_family_t), parameter :: Complete = geom_family_t( v=1 )
type(geom_family_t), parameter :: Edge_Defined = geom_family_t( v=2 )
type(geom_family_t), parameter :: Face_Defined = geom_family_t( v=3 )
!
interface operator(==)
module procedure geom_family_type_equals
end interface
!
interface operator(/=)
module procedure geom_family_type_not_equal
end interface
!
! Cell Geometry Types
integer, parameter :: Geom_Node = 0
integer, parameter :: Geom_Edge = 1
integer, parameter :: Geom_Tria = 2
integer, parameter :: Geom_Quad = 3
integer, parameter :: Geom_Tetr = 4
integer, parameter :: Geom_Pyra = 5
integer, parameter :: Geom_Pris = 6
integer, parameter :: Geom_Unknown = 7
integer, parameter :: Geom_Hexa = 8
!
integer, parameter :: Geom_Min = min(Geom_Unknown, &
Geom_Node,Geom_Edge, &
Geom_Tria,Geom_Quad, &
Geom_Tetr,Geom_Pyra,Geom_Pris,Geom_Hexa)
!
integer, parameter :: Geom_Max = max(Geom_Unknown, &
Geom_Node,Geom_Edge, &
Geom_Tria,Geom_Quad, &
Geom_Tetr,Geom_Pyra,Geom_Pris,Geom_Hexa)
!
integer, parameter :: Geom_0D(1:1) = [Geom_Node]
integer, parameter :: Geom_1D(1:1) = [Geom_Edge]
integer, parameter :: Geom_2D(1:2) = [Geom_Tria,Geom_Quad]
integer, parameter :: Geom_3D(1:4) = [Geom_Tetr,Geom_Pyra,Geom_Pris,Geom_Hexa]
integer, parameter :: Geom_Valid(1:8) = [Geom_0D,Geom_1D,Geom_2D,Geom_3D]
!
integer, parameter :: geom_of_face(1:4) = [Geom_Node,Geom_Edge, &
Geom_Tria,Geom_Quad]
!
integer, protected, save :: geom_dimen(Geom_Min:Geom_Max)
integer, protected, save :: geom_nodes(Geom_Min:Geom_Max)
integer, protected, save :: geom_edges(Geom_Min:Geom_Max)
integer, protected, save :: geom_faces(Geom_Min:Geom_Max)
integer, protected, save :: cell_face_geom(1:6,Geom_Min:Geom_Max)
integer, protected, save :: num_face_nodes(1:6,Geom_Min:Geom_Max)
integer, protected, save :: num_node_edges(1:8,Geom_Min:Geom_Max)
integer, protected, save :: edge_nodes(1:2,1:12,Geom_Min:Geom_Max)
integer, protected, save :: side_nodes(1:4,1:6,Geom_Min:Geom_Max)
integer, protected, save :: node_edges(1:4,1:8,Geom_Min:Geom_Max)
integer, protected, save :: node_nodes(1:4,1:8,Geom_Min:Geom_Max)
!
integer, protected, save :: nodes_to_geom(0:3,0:8)
!
character(len=100), protected, save :: Geom_String(Geom_Min:Geom_Max)
character(len=9), protected, save :: Geom_Name(Geom_Min:Geom_Max)
!
integer, parameter :: Zmin3D_Face = 1
integer, parameter :: Zmax3D_Face = 2
integer, parameter :: Xmax3D_Face = 3
integer, parameter :: Xmin3D_Face = 4
integer, parameter :: Ymin3D_Face = 5
integer, parameter :: Ymax3D_Face = 6
!
integer, parameter :: Ymin2D_Face = 1
integer, parameter :: Xmax2D_Face = 2
integer, parameter :: Ymax2D_Face = 3
integer, parameter :: Xmin2D_Face = 4
integer, parameter :: Zmin2D_Face = 0
integer, parameter :: Zmax2D_Face = 0
!
integer, parameter :: Xmin1D = 0
integer, parameter :: Xmax1D = 1
!
integer, parameter :: Xmin2D(1:2) = [3,0]
integer, parameter :: Xmax2D(1:2) = [1,2]
integer, parameter :: Ymin2D(1:2) = [0,1]
integer, parameter :: Ymax2D(1:2) = [2,3]
!
integer, parameter :: Xmin3D(1:4) = [0,4,7,3]
integer, parameter :: Xmax3D(1:4) = [1,2,6,5]
integer, parameter :: Ymin3D(1:4) = [0,1,5,4]
integer, parameter :: Ymax3D(1:4) = [3,7,6,2]
integer, parameter :: Zmin3D(1:4) = [0,3,2,1]
integer, parameter :: Zmax3D(1:4) = [4,5,6,7]
!
integer, parameter :: HostFace2D(1:6) = [Xmin2D_Face,Xmax2D_Face, &
Ymin2D_Face,Ymax2D_Face, &
Zmin2D_Face,Zmax2D_Face]
integer, parameter :: HostFace3D(1:6) = [Xmin3D_Face,Xmax3D_Face, &
Ymin3D_Face,Ymax3D_Face, &
Zmin3D_Face,Zmax3D_Face]
!
! Minimum/Maximum Order Allowed
integer, parameter :: Order_Min = 0
integer, parameter :: Order_Max = 25
!
! tria_is_biunit : logical that changes the location of the reference
! nodes in the definition of the reference triangle
! = true -> defined by the three nodes (-1,-1) - ( 1,-1) - (-1, 1)
! = false -> defined by the three nodes ( 0, 0) - ( 1, 0) - ( 0, 1)
!
logical(lk), parameter :: tria_is_biunit = fals
!
! CL : coefficient that gives (2.0 / length of the 1D solution points).
! This is needed because of the difference between how the reference
! triangle and reference quad are defined.
! = 2.0 for triangles if tria_is_biunit is false
! = 1.0 for everything else
!
real(wp), protected, save :: cl(Geom_Min:Geom_Max)
!
! General character variable for storing error messages
!
character(len=1000), save :: error_message
!
! MPI Public Scalars
!
integer(int_mpi), protected, save :: mypnum = 0_int_mpi
integer(int_mpi), protected, save :: ncpu = 1_int_mpi
integer(int_mpi), save :: mpierr
!
integer(int_mpi), protected, save :: mpi_comm_world_val
integer(int_mpi), protected, save :: mpi_comm_self_val
!
integer(int_mpi), parameter :: abort = int( 8 , kind=kind(abort) )
integer(int_mpi), parameter :: stop_mpi = int( 9 , kind=kind(stop_mpi) )
!
integer(int_MPI), parameter :: glb_root = 0_int_mpi
integer(int_MPI), parameter :: host_root = 0_int_mpi
integer(int_MPI), parameter :: cpu_root = 0_int_mpi
!
logical(lk), save :: i_am_cpu_root = true
logical(lk), save :: i_am_host_root = true
!
_MPI_COMM_TYPE_, save :: my_host_comm
_MPI_COMM_TYPE_, save :: my_cpu_comm
_MPI_COMM_TYPE_, save :: host_roots_comm
_MPI_COMM_TYPE_, save :: cpu_roots_comm
!
integer, save :: my_cpu_num = 0
integer, save :: my_host_num = 0
!
character(len=MPI_MAX_PROCESSOR_NAME) :: my_host_name
!
integer(int_mpi), save :: my_cpu_rank = 0_int_mpi
integer(int_mpi), save :: my_host_rank = 0_int_mpi
!
integer(int_mpi), save :: my_host_root = 0_int_mpi
integer(int_mpi), save :: my_cpu_root = 0_int_mpi
!
integer(int_mpi), allocatable, save :: my_cpu_grp(:)
integer(int_mpi), allocatable, save :: my_host_grp(:)
!
integer(int_mpi), allocatable, save :: cpu_roots_grp(:)
integer(int_mpi), allocatable, save :: host_roots_grp(:)
!
! MPI datatypes to match Fortran intrinsic datatypes
!
! working real precision
_MPI_DATA_TYPE_, protected, save :: mpi_flttyp
! half working real precision
_MPI_DATA_TYPE_, protected, save :: mpi_hlftyp
! double working real precision
_MPI_DATA_TYPE_, protected, save :: mpi_dbltyp
! working integer precision
_MPI_DATA_TYPE_, protected, save :: mpi_inttyp
!
logical(lk), private, save :: random_is_initialized = fals
!
! Definition of 1 Work Unit using TauBench Benchmark Test
! Using Intel 2013 compilers
real(wp), parameter :: one_work_unit = 6.9205_wp
! Westmere nodes
!real(wp), parameter :: one_work_unit = 25.551_wp/3.0_wp
! Sandy Bridge nodes
!real(wp), parameter :: one_work_unit = 22.808_wp/3.0_wp
! Ivy Bridge nodes
!real(wp), parameter :: one_work_unit = 19.096_wp/3.0_wp
! Using Intel version 10 compilers
!real(wp), parameter :: one_work_unit = 7.026_wp
!
! Global parameter to help clarify calls to alloc_error
!
logical(lk), parameter :: skip_alloc_pause = fals
!
! Parameters for procedure debug_timer
!
integer, parameter :: start_timer = 0
integer, parameter :: stop_timer = 1
integer, parameter :: entering_procedure = 2
integer, parameter :: leaving_procedure = 3
integer, parameter :: start_accumulation = 4
integer, parameter :: stop_accumulation = 5
integer, parameter :: reset_accumulated_time = 6
integer, parameter :: report_accumulated_time = 7
!
! ############################################################################
! ############################################################################
! ############################################################################
! ################ ###############
! ################ GENERIC INTERFACES FOR GLOBAL FUNCTIONS ###############
! ################ ###############
! ############################################################################
! ############################################################################
! ############################################################################
!
! Generic interface for reallocating arrays of varying types and ranks
!
private :: reallocate1_i4,reallocate1_i8
private :: reallocate1_r4,reallocate1_r8
private :: reallocate1_c
private :: reallocate2_i4,reallocate2_i8
!
interface reallocate
module procedure reallocate1_i4, reallocate1_i8, &
reallocate1_r4, reallocate1_r8, &
reallocate2_i4, reallocate2_i8, &
reallocate2_r4, reallocate2_r8, &
reallocate1_c
end interface reallocate
!
!
!
private :: cross_product_SP,cross_product_DP,cross_product_QP
!
interface cross_product
module procedure cross_product_SP
module procedure cross_product_DP
#ifndef DISABLE_QP
module procedure cross_product_QP
#endif
end interface cross_product
!
!
!
private :: deltafun_DP_LDK,deltafun_DP_LK
!
interface deltafun
module procedure deltafun_DP_LDK
module procedure deltafun_DP_LK
end interface deltafun
!
!
!
private :: deltafun_QP_LDK,deltafun_QP_LK
!
interface deltafun_QP
module procedure deltafun_QP_LDK
module procedure deltafun_QP_LK
end interface deltafun_QP
!
!
!
private :: selfdot_SP,selfdot_DP,selfdot_QP
!
interface selfdot
module procedure selfdot_SP
module procedure selfdot_DP
#ifndef DISABLE_QP
module procedure selfdot_QP
#endif
end interface selfdot
!
!
!
private :: rnorm2_SP,rnorm2_DP,rnorm2_QP
!
#ifdef SPECIAL_FOR_PGI
interface norm2
module procedure rnorm2_SP
module procedure rnorm2_DP
#ifndef DISABLE_QP
module procedure rnorm2_QP
#endif
end interface norm2
#endif
!
!
!
private :: unit_vector_SP,unit_vector_DP,unit_vector_QP
!
interface unit_vector
module procedure unit_vector_SP
module procedure unit_vector_DP
#ifndef DISABLE_QP
module procedure unit_vector_QP
#endif
end interface unit_vector
!
!
!
private :: outerprod_DP,outerprod_QP
!
interface outerprod
module procedure outerprod_DP
#ifndef DISABLE_QP
module procedure outerprod_QP
#endif
end interface outerprod
!
!
!
private :: reciprocal_SP,reciprocal_DP,reciprocal_QP
!
interface reciprocal
module procedure reciprocal_SP
module procedure reciprocal_DP
#ifndef DISABLE_QP
module procedure reciprocal_QP
#endif
end interface reciprocal
!
!
!
private :: chop_WP,chop_SP,chop_DP,chop_QP
!
interface chop
module procedure chop_WP
module procedure chop_SP
module procedure chop_DP
#ifndef DISABLE_QP
module procedure chop_QP
#endif
end interface chop
!
!
!
private :: reflect_DP,reflect_QP
!
interface reflect
module procedure reflect_DP
#ifndef DISABLE_QP
module procedure reflect_QP
#endif
end interface reflect
!
!
!
private :: rotate_2d_DP,rotate_2d_QP
!
interface rotate_2d
module procedure rotate_2d_DP
#ifndef DISABLE_QP
module procedure rotate_2d_QP
#endif
end interface rotate_2d
!
!
!
private :: rotate_DP,rotate_QP
!
interface rotate
module procedure rotate_DP
#ifndef DISABLE_QP
module procedure rotate_QP
#endif
end interface rotate
!
!
!
private :: node_center_SP,node_center_DP,node_center_QP
!
interface node_center
module procedure node_center_SP
module procedure node_center_DP
#ifndef DISABLE_QP
module procedure node_center_QP
#endif
end interface node_center
!
!
!
private :: face_normal_SP,face_normal_DP,face_normal_QP
!
interface face_normal
module procedure face_normal_SP
module procedure face_normal_DP
#ifndef DISABLE_QP
module procedure face_normal_QP
#endif
end interface face_normal
!
!
!
private :: compute_jacobian_SP,compute_jacobian_DP,compute_jacobian_QP
!
interface compute_jacobian
module procedure compute_jacobian_SP
module procedure compute_jacobian_DP
#ifndef DISABLE_QP
module procedure compute_jacobian_QP
#endif
end interface compute_jacobian
!
!
!
private :: reverse_metrics_SP,reverse_metrics_DP,reverse_metrics_QP
!
interface reverse_metrics
module procedure reverse_metrics_SP
module procedure reverse_metrics_DP
#ifndef DISABLE_QP
module procedure reverse_metrics_QP
#endif
end interface reverse_metrics
!
!