diff --git a/config/defaults/config.LINUX_GFORTRAN.mk b/config/defaults/config.LINUX_GFORTRAN.mk index 21c2b897e..68ac85be2 100644 --- a/config/defaults/config.LINUX_GFORTRAN.mk +++ b/config/defaults/config.LINUX_GFORTRAN.mk @@ -26,16 +26,12 @@ CC_REAL_PRECISION_FLAG = # so it is included in ${PETSC_LIB}. Otherwise you will have to # specify the HDF5 library. -# ----------- CGNS 3.2.x ------------------ -CGNS_VERSION_FLAG= +# ----------- CGNS ------------------ +# CGNS_VERSION_FLAG= # for CGNS 3.2.x +CGNS_VERSION_FLAG=-DUSECGNSMODULE # for CGNS 3.3.x CGNS_INCLUDE_FLAGS=-I$(CGNS_HOME)/include CGNS_LINKER_FLAGS=-L$(CGNS_HOME)/lib -lcgns -# # ----------- CGNS 3.3.x ------------------ -# CGNS_VERSION_FLAG=-DUSECGNSMODULE -# CGNS_INCLUDE_FLAGS=-I$(HOME)/packages/CGNS/src -# CGNS_LINKER_FLAGS=-L$(HOME)/packages/CGNS/src/lib -lcgns - # ------- Define Compiler Flags ---------------------------------------- FF90_FLAGS = -DHAS_ISNAN -fPIC -fdefault-real-8 -fdefault-double-8 -g -O3 -march=native -ffast-math C_FLAGS = -DHAS_ISNAN -O -fPIC -g diff --git a/config/defaults/config.LINUX_INTEL.mk b/config/defaults/config.LINUX_INTEL.mk index 44674a0a8..52cbc06bd 100644 --- a/config/defaults/config.LINUX_INTEL.mk +++ b/config/defaults/config.LINUX_INTEL.mk @@ -26,16 +26,12 @@ CC_REAL_PRECISION_FLAG = # so it is included in ${PETSC_LIB}. Otherwise you will have to # specify the HDF5 library. -# ----------- CGNS 3.2.x ------------------ -CGNS_VERSION_FLAG= +# ----------- CGNS ------------------ +# CGNS_VERSION_FLAG= # for CGNS 3.2.x +CGNS_VERSION_FLAG=-DUSECGNSMODULE # for CGNS 3.3.x CGNS_INCLUDE_FLAGS=-I$(CGNS_HOME)/include CGNS_LINKER_FLAGS=-L$(CGNS_HOME)/lib -lcgns -# # ----------- CGNS 3.3.x ------------------ -# CGNS_VERSION_FLAG=-DUSECGNSMODULE -# CGNS_INCLUDE_FLAGS=-I$(HOME)/packages/CGNS/src -# CGNS_LINKER_FLAGS=-L$(HOME)/packages/CGNS/src/lib -lcgns - # ------- Define Compiler Flags ---------------------------------------- FF90_FLAGS = -DHAS_ISNAN -fPIC -r8 -O2 -g C_FLAGS = -DHAS_ISNAN -O -fPIC diff --git a/config/defaults/config.LINUX_INTEL_SAFE.mk b/config/defaults/config.LINUX_INTEL_SAFE.mk index 3437f7593..95f38fb9e 100644 --- a/config/defaults/config.LINUX_INTEL_SAFE.mk +++ b/config/defaults/config.LINUX_INTEL_SAFE.mk @@ -30,16 +30,12 @@ CC_REAL_PRECISION_FLAG = # so it is included in ${PETSC_LIB}. Otherwise you will have to # specify the HDF5 library. -# ----------- CGNS 3.2.x ------------------ -CGNS_VERSION_FLAG= +# ----------- CGNS ------------------ +# CGNS_VERSION_FLAG= # for CGNS 3.2.x +CGNS_VERSION_FLAG=-DUSECGNSMODULE # for CGNS 3.3.x CGNS_INCLUDE_FLAGS=-I$(CGNS_HOME)/include CGNS_LINKER_FLAGS=-L$(CGNS_HOME)/lib -lcgns -# # ----------- CGNS 3.3.x ------------------ -# CGNS_VERSION_FLAG=-DUSECGNSMODULE -# CGNS_INCLUDE_FLAGS=-I$(HOME)/packages/CGNS/src -# CGNS_LINKER_FLAGS=-L$(HOME)/packages/CGNS/src/lib -lcgns - # ------- Define Compiler Flags ---------------------------------------- FF90_FLAGS = -DHAS_ISNAN -fPIC -r8 -O1 -g C_FLAGS = -DHAS_ISNAN -O -fPIC diff --git a/config/defaults/config.OSX_GFORTRAN.mk b/config/defaults/config.OSX_GFORTRAN.mk index 479f1787b..d6537801b 100644 --- a/config/defaults/config.OSX_GFORTRAN.mk +++ b/config/defaults/config.OSX_GFORTRAN.mk @@ -29,16 +29,12 @@ CC_REAL_PRECISION_FLAG = # so it is included in ${PETSC_LIB}. Otherwise you will have to # specify the HDF5 library. -# ----------- CGNS 3.2.x ------------------ -CGNS_VERSION_FLAG= +# ----------- CGNS ------------------ +# CGNS_VERSION_FLAG= # for CGNS 3.2.x +CGNS_VERSION_FLAG=-DUSECGNSMODULE # for CGNS 3.3.x CGNS_INCLUDE_FLAGS=-I$(CGNS_HOME)/include CGNS_LINKER_FLAGS=-L$(CGNS_HOME)/lib -lcgns -# # ----------- CGNS 3.3.x ------------------ -# CGNS_VERSION_FLAG=-DUSECGNSMODULE -# CGNS_INCLUDE_FLAGS=-I$(HOME)/packages/CGNS/src -# CGNS_LINKER_FLAGS=-L$(HOME)/packages/CGNS/src/lib -lcgns - # ------- Define Compiler Flags ---------------------------------------- FF90_FLAGS = -DHAS_ISNAN -fPIC -fdefault-real-8 -fdefault-double-8 -g -O3 -march=native -ffast-math C_FLAGS = -DHAS_ISNAN -O -fPIC -g diff --git a/python/reg_tests/mdo_regression_compare.py b/python/reg_tests/mdo_regression_compare.py new file mode 100644 index 000000000..ba0e01399 --- /dev/null +++ b/python/reg_tests/mdo_regression_compare.py @@ -0,0 +1,110 @@ +from __future__ import print_function +# This file contains two functions to help regression testing. The +# first is used to format float values with a specified absolute and +# relative tolerance. This information is used by the second function +# when it takes in two such formatted strings and decides if they are +# sufficiently close to be considered equal. +import os +import sys +REG_FILES_MATCH = 0 +REG_FILES_DO_NOT_MATCH = 1 +REG_ERROR = -1 + +def _reg_str_comp(str1, str2): + '''Compare the float values in str1 and str2 and determine if they + are equal. Returns True if they are the "same", False if different''' + + aux1 = str1.split() + aux2 = str2.split() + + if not aux1[0] == aux2[0] == '@value': + # This line does not need to be compared + return True + + # Extract required tolerances and values + rel_tol = float(aux1[2]) + abs_tol = float(aux1[3]) + val1 = float(aux1[1]) + val2 = float(aux2[1]) + + rel_err = 0 + if val2 != 0: + rel_err = abs((val1-val2)/val2) + else: + rel_err = abs((val1-val2)/(val2 + 1e-16)) + + abs_err = abs(val1-val2) + + if abs_err < abs_tol or rel_err < rel_tol: + return True + else: + return False + + +def reg_file_comp(ref_file, comp_file): + '''Compare the reference file 'ref_file' with 'comp_file'. The + order of these two files matter. The ref_file MUST be given + first. Only values specified by reg_write() are compared. All + other lines are ignored. Floating point values are compared based + on rel_tol and abs_tol''' + + all_ref_lines = [] + ref_values = [] + comp_values = [] + try: + f = open(ref_file, 'r') + except IOError: + print('File %s was not found. Cannot do comparison.'% ref_file) + return REG_ERROR + for line in f.readlines(): + all_ref_lines.append(line) + if line[0:6] == '@value': + ref_values.append(line) + + f.close() + + try: + f = open(comp_file, 'r') + except IOError: + print('File %s was not found. Cannot do comparison.'% comp_file) + return REG_ERROR + + for line in f.readlines(): + if line[0:6] == '@value': + comp_values.append(line) + + f.close() + + # Copy the comp_file to compe_file.orig + os.system('cp %s %s.orig'% (comp_file, comp_file)) + + # We must check that we have the same number of @value's to compare: + if len(ref_values) != len(comp_values): + print('Error: number of @value lines in file not the same!') + return REG_FILES_DO_NOT_MATCH + + # Open the (new) comp_file: + f = open(comp_file,'w') + + # Loop over all the ref_lines, for value lines, do the + # comparison. If comparison is ok, write the ref line, otherwise + # write orig line. + + j = 0 + res = REG_FILES_MATCH + for i in range(len(all_ref_lines)): + line = all_ref_lines[i] + if line[0:6] == '@value': + if _reg_str_comp(line, comp_values[j]) is False: + f.write(comp_values[j]) + res = REG_FILES_DO_NOT_MATCH + else: + f.write(line) + + j += 1 + else: + f.write(line) + + f.close() + + return res diff --git a/python/reg_tests/mdo_regression_helper.py b/python/reg_tests/mdo_regression_helper.py index 9c81fa23e..d00e79048 100644 --- a/python/reg_tests/mdo_regression_helper.py +++ b/python/reg_tests/mdo_regression_helper.py @@ -1,206 +1,205 @@ -from __future__ import print_function -# This file contains two functions to help regression testing. The -# first is used to format float values with a specified absolute and -# relative tolerance. This information is used by the second function -# when it takes in two such formatted strings and decides if they are -# sufficiently close to be considered equal. -import numpy, os -from mpi4py import MPI -import sys -REG_FILES_MATCH = 0 -REG_FILES_DO_NOT_MATCH = 1 -REG_ERROR = -1 - -def printHeader(testName): - if MPI.COMM_WORLD.rank == 0: - print('+' + '-'*78 + '+') - print('| Test Name: ' + '%-66s'%testName + '|') - print('+' + '-'*78 + '+') - - -def reg_write(values, rel_tol=1e-12, abs_tol=1e-12): - '''Write values in special value format''' - values = numpy.atleast_1d(values) - values = values.flatten() - for val in values: - s = '@value %20.13e %g %g'% (val, rel_tol, abs_tol) - print(s) - - return - -def reg_par_write(values, rel_tol=1e-12, abs_tol=1e-12): - """Write value(values) from parallel process in sorted order""" - values = MPI.COMM_WORLD.gather(values) - if MPI.COMM_WORLD.rank == 0: - for i in xrange(len(values)): - print ('Value(s) on processor: %d'%i) - reg_write(values[i], rel_tol, abs_tol) - -def reg_root_write(values, rel_tol=1e-12, abs_tol=1e-12): - """Write values but only on the root proc""" - if MPI.COMM_WORLD.rank == 0: - reg_write(values, rel_tol, abs_tol) - -def reg_par_write_sum(values, rel_tol=1e-12, abs_tol=1e-12): - """Write the sum of sum of the values from all processors.""" - reducedSum = MPI.COMM_WORLD.reduce(numpy.sum(values)) - if MPI.COMM_WORLD.rank == 0: - reg_write(reducedSum, rel_tol, abs_tol) - -def reg_par_write_norm(values, rel_tol=1e-12, abs_tol=1e-12): - """Write the sum of sum of the values from all processors.""" - reducedSum = MPI.COMM_WORLD.reduce(numpy.sum(values**2)) - if MPI.COMM_WORLD.rank == 0: - reg_write(numpy.sqrt(reducedSum), rel_tol, abs_tol) - -def reg_write_dict(d, rel_tol=1e-12, abs_tol=1e-12): - """Write all values in a dictionary in sorted key order""" - for key in sorted(d.keys()): - print ('Dictionary Key: %s'%key) - if isinstance(d[key],dict): - reg_write_dict(d[key], rel_tol, abs_tol) - elif type(d[key]) == bool: - reg_write(int(d[key]), rel_tol, abs_tol) - else: - reg_write(d[key], rel_tol, abs_tol) - -def reg_root_write_dict(d, rel_tol=1e-12, abs_tol=1e-12): - """Only write from the root proc""" - if MPI.COMM_WORLD.rank == 0: - reg_write_dict(d, rel_tol, abs_tol) - -def _reg_str_comp(str1, str2): - '''Compare the float values in str1 and str2 and determine if they - are equal. Returns True if they are the "same", False if different''' - - aux1 = str1.split() - aux2 = str2.split() - - if not aux1[0] == aux2[0] == '@value': - # This line does not need to be compared - return True - - # Extract required tolerances and values - rel_tol = float(aux1[2]) - abs_tol = float(aux1[3]) - val1 = float(aux1[1]) - val2 = float(aux2[1]) - - rel_err = 0 - if val2 != 0: - rel_err = abs((val1-val2)/val2) - else: - rel_err = abs((val1-val2)/(val2 + 1e-16)) - - abs_err = abs(val1-val2) - - if abs_err < abs_tol or rel_err < rel_tol: - return True - else: - return False - - -def reg_file_comp(ref_file, comp_file): - '''Compare the reference file 'ref_file' with 'comp_file'. The - order of these two files matter. The ref_file MUST be given - first. Only values specified by reg_write() are compared. All - other lines are ignored. Floating point values are compared based - on rel_tol and abs_tol''' - - all_ref_lines = [] - ref_values = [] - comp_values = [] - try: - f = open(ref_file, 'r') - except IOError: - print('File %s was not found. Cannot do comparison.'% ref_file) - return REG_ERROR - for line in f.readlines(): - all_ref_lines.append(line) - if line[0:6] == '@value': - ref_values.append(line) - - f.close() - - try: - f = open(comp_file, 'r') - except IOError: - print('File %s was not found. Cannot do comparison.'% comp_file) - return REG_ERROR - - for line in f.readlines(): - if line[0:6] == '@value': - comp_values.append(line) - - f.close() - - # Copy the comp_file to compe_file.orig - os.system('cp %s %s.orig'% (comp_file, comp_file)) - - # We must check that we have the same number of @value's to compare: - if len(ref_values) != len(comp_values): - print('Error: number of @value lines in file not the same!') - return REG_FILES_DO_NOT_MATCH - - # Open the (new) comp_file: - f = open(comp_file,'w') - - # Loop over all the ref_lines, for value lines, do the - # comparison. If comparison is ok, write the ref line, otherwise - # write orig line. - - j = 0 - res = REG_FILES_MATCH - for i in range(len(all_ref_lines)): - line = all_ref_lines[i] - if line[0:6] == '@value': - if _reg_str_comp(line, comp_values[j]) is False: - f.write(comp_values[j]) - res = REG_FILES_DO_NOT_MATCH - else: - f.write(line) - - j += 1 - else: - f.write(line) - - f.close() - - return res - -if __name__ == '__main__': - if len(sys.argv) == 1: - print('Single int write:') - reg_write(1) - - print('Single float write:') - reg_write(3.14159) - - print('List write:') - reg_write([1.0, 3.5, 6.0], 1e-8, 1e-10) - - print('1D Numpy array write') - vals = numpy.linspace(0, numpy.pi, 5) - reg_write(vals, 1e-12, 1e-12) - - print('2D Numpy array write:') - vals = numpy.linspace(0, 9.876, 4).reshape((2, 2)) - reg_write(vals) - - str1 = "@value 3.141592653589793 1e-12 1e-12" - str2 = "@value 3.141592653589999 1e-12 1e-12" - - print('This comp should be True: ', _reg_str_comp(str1, str2)) - - str1 = "@value 3.141592653589793 1e-12 1e-12" - str2 = "@value 3.141592999999999 1e-12 1e-12" - - print('This comp should be False: ', _reg_str_comp(str1, str2)) - - else: - res = reg_file_comp(sys.argv[1], sys.argv[2]) - if res == 0: - print ('Success!') - elif res == 1: - print ('Failure!') - +from __future__ import print_function +# This file contains two functions to help regression testing. The +# first is used to format float values with a specified absolute and +# relative tolerance. This information is used by the second function +# when it takes in two such formatted strings and decides if they are +# sufficiently close to be considered equal. +import numpy, os +from mpi4py import MPI +import sys +REG_FILES_MATCH = 0 +REG_FILES_DO_NOT_MATCH = 1 +REG_ERROR = -1 + +def printHeader(testName): + if MPI.COMM_WORLD.rank == 0: + print('+' + '-'*78 + '+') + print('| Test Name: ' + '%-66s'%testName + '|') + print('+' + '-'*78 + '+') + + +def reg_write(values, rel_tol=1e-12, abs_tol=1e-12): + '''Write values in special value format''' + values = numpy.atleast_1d(values) + values = values.flatten() + for val in values: + s = '@value %20.13e %g %g'% (val, rel_tol, abs_tol) + print(s) + + return + +def reg_par_write(values, rel_tol=1e-12, abs_tol=1e-12): + """Write value(values) from parallel process in sorted order""" + values = MPI.COMM_WORLD.gather(values) + if MPI.COMM_WORLD.rank == 0: + for i in xrange(len(values)): + print ('Value(s) on processor: %d'%i) + reg_write(values[i], rel_tol, abs_tol) + +def reg_root_write(values, rel_tol=1e-12, abs_tol=1e-12): + """Write values but only on the root proc""" + if MPI.COMM_WORLD.rank == 0: + reg_write(values, rel_tol, abs_tol) + +def reg_par_write_sum(values, rel_tol=1e-12, abs_tol=1e-12): + """Write the sum of sum of the values from all processors.""" + reducedSum = MPI.COMM_WORLD.reduce(numpy.sum(values)) + if MPI.COMM_WORLD.rank == 0: + reg_write(reducedSum, rel_tol, abs_tol) + +def reg_par_write_norm(values, rel_tol=1e-12, abs_tol=1e-12): + """Write the sum of sum of the values from all processors.""" + reducedSum = MPI.COMM_WORLD.reduce(numpy.sum(values**2)) + if MPI.COMM_WORLD.rank == 0: + reg_write(numpy.sqrt(reducedSum), rel_tol, abs_tol) + +def reg_write_dict(d, rel_tol=1e-12, abs_tol=1e-12): + """Write all values in a dictionary in sorted key order""" + for key in sorted(d.keys()): + print ('Dictionary Key: %s'%key) + if isinstance(d[key],dict): + reg_write_dict(d[key], rel_tol, abs_tol) + elif type(d[key]) == bool: + reg_write(int(d[key]), rel_tol, abs_tol) + else: + reg_write(d[key], rel_tol, abs_tol) + +def reg_root_write_dict(d, rel_tol=1e-12, abs_tol=1e-12): + """Only write from the root proc""" + if MPI.COMM_WORLD.rank == 0: + reg_write_dict(d, rel_tol, abs_tol) + +def _reg_str_comp(str1, str2): + '''Compare the float values in str1 and str2 and determine if they + are equal. Returns True if they are the "same", False if different''' + + aux1 = str1.split() + aux2 = str2.split() + + if not aux1[0] == aux2[0] == '@value': + # This line does not need to be compared + return True + + # Extract required tolerances and values + rel_tol = float(aux1[2]) + abs_tol = float(aux1[3]) + val1 = float(aux1[1]) + val2 = float(aux2[1]) + + rel_err = 0 + if val2 != 0: + rel_err = abs((val1-val2)/val2) + else: + rel_err = abs((val1-val2)/(val2 + 1e-16)) + + abs_err = abs(val1-val2) + + if abs_err < abs_tol or rel_err < rel_tol: + return True + else: + return False + + +def reg_file_comp(ref_file, comp_file): + '''Compare the reference file 'ref_file' with 'comp_file'. The + order of these two files matter. The ref_file MUST be given + first. Only values specified by reg_write() are compared. All + other lines are ignored. Floating point values are compared based + on rel_tol and abs_tol''' + + all_ref_lines = [] + ref_values = [] + comp_values = [] + try: + f = open(ref_file, 'r') + except IOError: + print('File %s was not found. Cannot do comparison.'% ref_file) + return REG_ERROR + for line in f.readlines(): + all_ref_lines.append(line) + if line[0:6] == '@value': + ref_values.append(line) + + f.close() + + try: + f = open(comp_file, 'r') + except IOError: + print('File %s was not found. Cannot do comparison.'% comp_file) + return REG_ERROR + + for line in f.readlines(): + if line[0:6] == '@value': + comp_values.append(line) + + f.close() + + # Copy the comp_file to compe_file.orig + os.system('cp %s %s.orig'% (comp_file, comp_file)) + + # We must check that we have the same number of @value's to compare: + if len(ref_values) != len(comp_values): + print('Error: number of @value lines in file not the same!') + return REG_FILES_DO_NOT_MATCH + + # Open the (new) comp_file: + f = open(comp_file,'w') + + # Loop over all the ref_lines, for value lines, do the + # comparison. If comparison is ok, write the ref line, otherwise + # write orig line. + + j = 0 + res = REG_FILES_MATCH + for i in range(len(all_ref_lines)): + line = all_ref_lines[i] + if line[0:6] == '@value': + if _reg_str_comp(line, comp_values[j]) is False: + f.write(comp_values[j]) + res = REG_FILES_DO_NOT_MATCH + else: + f.write(line) + + j += 1 + else: + f.write(line) + + f.close() + + return res + +if __name__ == '__main__': + if len(sys.argv) == 1: + print('Single int write:') + reg_write(1) + + print('Single float write:') + reg_write(3.14159) + + print('List write:') + reg_write([1.0, 3.5, 6.0], 1e-8, 1e-10) + + print('1D Numpy array write') + vals = numpy.linspace(0, numpy.pi, 5) + reg_write(vals, 1e-12, 1e-12) + + print('2D Numpy array write:') + vals = numpy.linspace(0, 9.876, 4).reshape((2, 2)) + reg_write(vals) + + str1 = "@value 3.141592653589793 1e-12 1e-12" + str2 = "@value 3.141592653589999 1e-12 1e-12" + + print('This comp should be True: ', _reg_str_comp(str1, str2)) + + str1 = "@value 3.141592653589793 1e-12 1e-12" + str2 = "@value 3.141592999999999 1e-12 1e-12" + + print('This comp should be False: ', _reg_str_comp(str1, str2)) + + else: + res = reg_file_comp(sys.argv[1], sys.argv[2]) + if res == 0: + print ('Success!') + elif res == 1: + print ('Failure!') \ No newline at end of file diff --git a/python/reg_tests/ref/adflow_test6_reg.ref b/python/reg_tests/ref/adflow_test6_reg.ref index b34c66f61..d24054a0c 100644 --- a/python/reg_tests/ref/adflow_test6_reg.ref +++ b/python/reg_tests/ref/adflow_test6_reg.ref @@ -305,7 +305,7 @@ Dictionary Key: lift Dictionary Key: mx @value -1.5697062202258e+05 1e-10 1e-10 Dictionary Key: my -@value 4.2675900979361e+02 1e-10 1e-10 +@value 4.2675900979361e+02 1e-9 1e-9 Dictionary Key: mz @value 1.2857041112516e+05 1e-10 1e-10 Dictionary Key: sepsensor diff --git a/python/reg_tests/run_reg_tests.py b/python/reg_tests/run_reg_tests.py index 12e402161..bf709673a 100644 --- a/python/reg_tests/run_reg_tests.py +++ b/python/reg_tests/run_reg_tests.py @@ -1,13 +1,13 @@ from __future__ import print_function # ============================================================================= -# Standard Python modules +# Standard Python modules # ============================================================================= import os, sys, argparse, glob # ============================================================================= # Extension modules # ============================================================================= -import mdo_regression_helper as reg +import mdo_regression_compare as reg # define scripts to run: module_name = 'adflow' @@ -23,7 +23,7 @@ parser.add_argument("--diff_cmd",default='xxdiff', help='Command to run for displaying diff. Default: xxdiff') -parser.add_argument("--diff", action='store_true', default=False, +parser.add_argument("--diff", action='store_true', default=False, help='Display error diffs for each test.') parser.add_argument("--mpiexec",default='mpirun', @@ -32,7 +32,7 @@ parser.add_argument('--test', metavar='test', type=int, nargs='+', help='tests to run') -parser.add_argument("--solve", action='store_true', default=False, +parser.add_argument("--solve", action='store_true', default=False, help="Force solving on tests that use restart files.") args = parser.parse_args() @@ -61,7 +61,7 @@ print('Running reference for test%d'%iTest) os.system('%s -np %d python tests/test%d.py %s > ref/%s_test%d_reg.ref 2>&1'%( args.mpiexec, args.procs, iTest, solveStr, module_name, iTest)) - + # If we're training, we done (no comparison) sys.exit(0) else: @@ -104,7 +104,6 @@ os.system('cat %s >> adflow_reg.ref'%(refFile)) os.system('cat %s >> adflow_reg'%(curFile)) os.system('cat %s.orig >> adflow_reg.orig'%(curFile)) - -# Exit with code equal to the number of failures -sys.exit(masterRes) +# Exit with code equal to the number of failures +sys.exit(masterRes) \ No newline at end of file diff --git a/python/reg_tests/run_reg_tests_cs.py b/python/reg_tests/run_reg_tests_cs.py index a5ac3362a..0d3b0f4e9 100644 --- a/python/reg_tests/run_reg_tests_cs.py +++ b/python/reg_tests/run_reg_tests_cs.py @@ -6,7 +6,7 @@ # ============================================================================= # Extension modules # ============================================================================= -import mdo_regression_helper as reg +import mdo_regression_compare as reg # define scripts to run: module_name = 'adflow' diff --git a/src/ADT/adtSearch.F90 b/src/ADT/adtSearch.F90 index 2dd7aeb7d..a36e091ee 100644 --- a/src/ADT/adtSearch.F90 +++ b/src/ADT/adtSearch.F90 @@ -1660,9 +1660,11 @@ subroutine search(nCoor, coor, procID, & ! Complete the nonblocking sends of the interpolated data. - nProcRecvCur = 2*nProcRecvCur + !nProcRecvCur = 2*nProcRecvCur do i=1,nProcRecvCur - call mpi_waitany(nProcRecvCur, sendRecvRequest, sizeMessage, & + call mpi_waitany(nProcRecvCur, sendRecvRequest(1,:), sizeMessage, & + mpiStatus, ierr) + call mpi_waitany(nProcRecvCur, sendRecvRequest(2,:), sizeMessage, & mpiStatus, ierr) enddo diff --git a/src/NKSolver/NKSolvers.F90 b/src/NKSolver/NKSolvers.F90 index a4907c2d7..dd0fe6f42 100644 --- a/src/NKSolver/NKSolvers.F90 +++ b/src/NKSolver/NKSolvers.F90 @@ -3,17 +3,9 @@ module NKSolver use constants ! MPI comes from constants, so we need to avoid MPIF_H in PETSc -#include -#if PETSC_VERSION_GE(3,8,0) #include use petsc implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#include "petsc/finclude/petscvec.h90" -#endif ! PETSc Matrices: ! dRdw: This is the actual matrix-free matrix computed with FD @@ -1612,17 +1604,9 @@ end module NKSolver module ANKSolver use constants -#include -#if PETSC_VERSION_GE(3,8,0) #include use petsc implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#include "petsc/finclude/petscvec.h90" -#endif Mat dRdw, dRdwPre Vec wVec, rVec, deltaW, baseRes diff --git a/src/adjoint/adjointAPI.F90 b/src/adjoint/adjointAPI.F90 index dda775007..291344175 100644 --- a/src/adjoint/adjointAPI.F90 +++ b/src/adjoint/adjointAPI.F90 @@ -429,16 +429,9 @@ subroutine saveADjointMatrix(fileName) use ADjointPETSc, only: drdwt use communication, only : adflow_comm_world use utils, only : EChk -#include -#if PETSC_VERSION_GE(3,8,0) #include - use petsc - implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#endif + use petsc + implicit none ! Input params character*(*), intent(in) :: fileName @@ -464,16 +457,9 @@ subroutine saveAdjointPC(fileName) use ADjointPETSc, only: drdwpret use communication, only : adflow_comm_world use utils, only : EChk -#include -#if PETSC_VERSION_GE(3,8,0) #include - use petsc - implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#endif + use petsc + implicit none ! Input params character*(*), intent(in) :: fileName @@ -499,16 +485,9 @@ subroutine saveAdjointRHS(RHS, fileName, nstate) use ADjointPETSc, only: psi_like1 use communication, only : adflow_comm_world use utils, only : EChk -#include -#if PETSC_VERSION_GE(3,8,0) #include - use petsc - implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#endif + use petsc + implicit none ! Input params character*(*), intent(in) :: fileName @@ -707,16 +686,9 @@ subroutine solveAdjoint(RHS, psi, checkSolution, nState) use inputTimeSpectral, only : nTimeIntervalsSpectral use adjointUtils, only : allocDerivativeValues, zeroADSeeds use utils, only : EChk -#include -#if PETSC_VERSION_GE(3,8,0) #include - use petsc - implicit none -#else -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#include "petsc/finclude/petscvec.h90" -#endif + use petsc + implicit none ! Input Parameters real(kind=realType), dimension(nState) :: RHS, psi @@ -727,7 +699,7 @@ subroutine solveAdjoint(RHS, psi, checkSolution, nState) real(kind=alwaysRealType) :: norm real(kind=alwaysRealType), dimension(2) :: time real(kind=alwaysRealType) :: timeAdjLocal, timeAdj - real(kind=realType) :: l2abs, l2rel + real(kind=alwaysRealType) :: l2abs, l2rel integer(kind=intType) :: ierr, nn, sps integer(kind=intType) :: adjConvIts KSPConvergedReason adjointConvergedReason @@ -913,16 +885,9 @@ subroutine setupPETScKsp use adjointUtils, only : setupStateResidualMatrix, setupStandardKSP, setupStandardMultigrid use communication use agmg, only : setupShellPC, destroyShellPC, applyShellPC -#include -#if PETSC_VERSION_GE(3,8,0) #include - use petsc - implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#endif + use petsc + implicit none ! Local variables. logical :: useAD, usePC, useTranspose, useObjective, useCoarseMats @@ -987,17 +952,9 @@ subroutine saveCellCenters(fileName) use adjointVars, only: nCellsLocal use communication use utils, only : setPointers, EChk -#include -#if PETSC_VERSION_GE(3,8,0) #include use petsc implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#include "petsc/finclude/petscvec.h90" -#endif ! Input params character*(*), intent(in) :: fileName @@ -1074,17 +1031,9 @@ subroutine dRdwTMatMult(A, vecX, vecY, ierr) use ADjointVars use inputTimeSpectral use utils, only : EChk -#include -#if PETSC_VERSION_GE(3,8,0) #include - use petsc - implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#include "petsc/finclude/petscvec.h90" -#endif + use petsc + implicit none ! PETSc Arguments @@ -1133,17 +1082,9 @@ subroutine dRdwMatMult(A, vecX, vecY, ierr) #ifndef USE_COMPLEX use masterRoutines, only : master_d #endif -#include -#if PETSC_VERSION_GE(3,8,0) #include - use petsc - implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#include "petsc/finclude/petscvec.h90" -#endif + use petsc + implicit none ! PETSc Arguments Mat A @@ -1218,17 +1159,9 @@ subroutine createPETScVars use utils, only : EChk, setPointers use adjointUtils, only : myMatCreate, destroyPETScVars, statePreAllocation use agmg, only : setupAGMG -#include -#if PETSC_VERSION_GE(3,8,0) #include - use petsc - implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#include "petsc/finclude/petscvec.h90" -#endif + use petsc + implicit none ! Local variables. integer(kind=intType) :: nDimW, nDimX diff --git a/src/adjoint/adjointUtils.F90 b/src/adjoint/adjointUtils.F90 index b8bfd5cc1..9ef216c60 100644 --- a/src/adjoint/adjointUtils.F90 +++ b/src/adjoint/adjointUtils.F90 @@ -43,16 +43,9 @@ subroutine setupStateResidualMatrix(matrix, useAD, usePC, useTranspose, & #ifndef USE_COMPLEX use masterRoutines, only : block_res_state_d #endif -#include -#if PETSC_VERSION_GE(3,8,0) #include - use petsc - implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#endif + use petsc + implicit none ! PETSc Matrix Variable Mat :: matrix @@ -714,7 +707,7 @@ subroutine allocDerivativeValues(level) use inputDiscretization, only : useApproxWallDistance use inputPhysics, only : wallDistanceNeeded use communication, only : adflow_comm_world - use wallDistanceData, only : xSurfVec, xSurfVecd, PETSC_DETERMINE + use wallDistanceData, only : xSurfVec, xSurfVecd!, PETSC_DETERMINE use BCPointers_b use adjointVars, only : derivVarsAllocated use utils, only : EChk, setPointers, getDirAngle @@ -1282,16 +1275,9 @@ subroutine myMatCreate(matrix, blockSize, m, n, nnzDiagonal, nnzOffDiag, & use constants use communication, only : adflow_comm_world use utils, only : EChk, setPointers -#include -#if PETSC_VERSION_GE(3,8,0) #include - use petsc - implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#endif + use petsc + implicit none Mat matrix integer(kind=intType), intent(in) :: blockSize, m, n @@ -1395,16 +1381,9 @@ subroutine setupStandardKSP(kspObject, kspObjectType, gmresRestart, preConSide, ! and if localPreConIts=1 then subKSP is set to preOnly. use constants use utils, only : ECHk -#include -#if PETSC_VERSION_GE(3,8,0) #include - use petsc - implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#endif + use petsc + implicit none ! Input Params KSP kspObject @@ -1564,16 +1543,9 @@ subroutine setupStandardMultigrid(kspObject, kspObjectType, gmresRestart, & use utils, only : ECHk use agmg, only : agmgOuterIts, agmgASMOverlap, agmgFillLevel, agmgMatrixOrdering, & setupShellPC, destroyShellPC, applyShellPC -#include -#if PETSC_VERSION_GE(3,8,0) #include - use petsc - implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#endif + use petsc + implicit none ! Input Params KSP kspObject @@ -1698,18 +1670,9 @@ subroutine statePreAllocation(onProc, offProc, wSize, stencil, N_stencil, & use inputTimeSpectral , only : nTimeIntervalsSpectral use utils, only : setPointers, EChk use sorting, only : unique -#include -#if PETSC_VERSION_GE(3,8,0) #include use petsc implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petscsys.h" -#include "petsc/finclude/petscvec.h" -#include "petsc/finclude/petscvec.h90" -#endif ! Subroutine Arguments integer(kind=intType), intent(in) :: wSize diff --git a/src/adjoint/fortranPC.F90 b/src/adjoint/fortranPC.F90 index d3a868fa8..9b0ccb69a 100644 --- a/src/adjoint/fortranPC.F90 +++ b/src/adjoint/fortranPC.F90 @@ -660,17 +660,9 @@ subroutine PCMatMult(A, vecX, vecY, ierr) use ADjointVars use inputTimeSpectral use utils, only : EChk, setPointers -#include -#if PETSC_VERSION_GE(3,8,0) #include - use petsc - implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#include "petsc/finclude/petscvec.h90" -#endif + use petsc + implicit none ! PETSc Arguments Mat A @@ -738,17 +730,9 @@ subroutine myShellPCApply(pc, vecX, vecY, ierr) use inputTimeSpectral use flowvarrefstate use communication -#include -#if PETSC_VERSION_GE(3,8,0) #include - use petsc - implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#include "petsc/finclude/petscvec.h90" -#endif + use petsc + implicit none ! PETSc Arguments PC pc @@ -780,17 +764,9 @@ subroutine setPCVec(vecX) use inputTimeSpectral use flowVarRefState use utils, only : EChk, setPointers -#include -#if PETSC_VERSION_GE(3,8,0) #include - use petsc - implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#include "petsc/finclude/petscvec.h90" -#endif + use petsc + implicit none ! PETSc Arguments Vec vecX diff --git a/src/adjoint/masterRoutines.F90 b/src/adjoint/masterRoutines.F90 index d2dc30b42..675a03109 100644 --- a/src/adjoint/masterRoutines.F90 +++ b/src/adjoint/masterRoutines.F90 @@ -264,17 +264,10 @@ subroutine master_d(wdot, xdot, forcesDot, dwDot, famLists, funcValues, funcValu use inputOverset, only : oversetUpdateMode use oversetCommUtilities, only : updateOversetConnectivity_d use actuatorRegionData, only : nActuatorRegions -#include -#if PETSC_VERSION_GE(3,8,0) #include - use petsc - implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#include "petsc/finclude/petscvec.h90" -#endif + use petsc + implicit none + ! Input Arguments: real(kind=realType), intent(in), dimension(:) :: wDot, xDot integer(kind=intType), optional, dimension(:, :), intent(in) :: famLists @@ -590,17 +583,9 @@ subroutine master_b(wbar, xbar, extraBar, forcesBar, dwBar, nState, famLists, & use oversetCommUtilities, only : updateOversetConnectivity_b use BCRoutines, only : applyAllBC_block use actuatorRegionData, only : nActuatorRegions -#include -#if PETSC_VERSION_GE(3,8,0) #include - use petsc, only : add_values, scatter_reverse - implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#include "petsc/finclude/petscvec.h90" -#endif + use petsc + implicit none ! Input variables: real(kind=realType), intent(in), dimension(:) :: dwBar diff --git a/src/inputParam/inputParamRoutines.F90 b/src/inputParam/inputParamRoutines.F90 index a18b39b8c..95ae3bd6a 100644 --- a/src/inputParam/inputParamRoutines.F90 +++ b/src/inputParam/inputParamRoutines.F90 @@ -3817,10 +3817,12 @@ subroutine setDefaultValues #ifdef USE_SINGLE_PRECISION precisionGrid = precisionSingle ! Default IO precision depends precisionSol = precisionSingle ! on the default floating -#else ! point type used. Note that + ! point type used. Note that +#else precisionGrid = precisionDouble ! for quadrupole precision the precisionSol = precisionDouble ! IO takes place in double -#endif ! precision. + ! precision. +#endif ! Surface solution defaults to single precision precisionSurfGrid = precisionSingle diff --git a/src/modules/ADjointPETSc.F90 b/src/modules/ADjointPETSc.F90 index 87247b9e1..aafca9bfa 100644 --- a/src/modules/ADjointPETSc.F90 +++ b/src/modules/ADjointPETSc.F90 @@ -4,17 +4,9 @@ module ADjointPETSc ! solution of the discrete adjoint equations. ! use constants -#include -#if PETSC_VERSION_GE(3,8,0) #include use petsc implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#include "petsc/finclude/petscvec.h90" -#endif Mat dRdWT, dRdWPreT diff --git a/src/modules/constants.F90 b/src/modules/constants.F90 index 16901a8ff..5d101337d 100644 --- a/src/modules/constants.F90 +++ b/src/modules/constants.F90 @@ -5,11 +5,8 @@ module constants use precision #ifndef USE_TAPENADE -#include -#if PETSC_VERSION_GE(3,8,0) #include use petsc -#endif #endif implicit none save diff --git a/src/modules/inputParam.F90 b/src/modules/inputParam.F90 index 6af914d30..dbb91e524 100644 --- a/src/modules/inputParam.F90 +++ b/src/modules/inputParam.F90 @@ -787,10 +787,10 @@ module inputADjoint ! It has a high impact on the required memory! ! adjMonStep : Convergence monitor step - real(kind=realType) :: adjRelTol - real(kind=realType) :: adjAbsTol - real(kind=realType) :: adjRelTolRel - real(kind=realType) :: adjDivTol + real(kind=alwaysRealType) :: adjRelTol + real(kind=alwaysRealType) :: adjAbsTol + real(kind=alwaysRealType) :: adjRelTolRel + real(kind=alwaysRealType) :: adjDivTol integer(kind=intType) :: adjMaxIter integer(kind=intType) :: adjRestart integer(kind=intType) :: adjMonStep diff --git a/src/modules/overset.F90 b/src/modules/overset.F90 index 4132ac15a..a2ff1de8b 100644 --- a/src/modules/overset.F90 +++ b/src/modules/overset.F90 @@ -5,17 +5,9 @@ module oversetData use block, only : fringeType use kdtree2_module, only : kdtree2 #ifndef USE_TAPENADE -#include -#if PETSC_VERSION_GE(3,8,0) #include use petsc implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#include "petsc/finclude/petscvec.h90" -#endif #endif ! Helper dataType for communicated overset grid points. This data diff --git a/src/modules/precision.F90 b/src/modules/precision.F90 index 8dde1dca2..03d5cf58b 100644 --- a/src/modules/precision.F90 +++ b/src/modules/precision.F90 @@ -14,10 +14,11 @@ module precision ! omitted the default integer and double precision are used. ! ! + use mpi implicit none save -#include "mpif.h" + ! ! Definition of the integer type used in the entire code. There ! might be a more elegant solution to do this, but be sure that @@ -99,9 +100,6 @@ module precision ! integer(kind=1), private :: adtDummyElementInt - ! Definition of the cgns periodic type. - ! - real(kind=4), private :: dummyCGNSPer ! ! Definition of the kind parameters for the integer and real ! types. @@ -111,7 +109,6 @@ module precision integer, parameter :: realType = kind(dummyReal) integer, parameter :: adtElementType = kind(adtDummyElementInt) integer, parameter :: cgnsRealType = kind(dummyCGNSReal) - integer, parameter :: cgnsPerType = kind(dummyCGNSPer) integer, parameter :: alwaysRealType = kind(dummyReal) integer, parameter :: singleType = kind(dummySingle) integer, parameter :: doubleType = kind(dummyDouble) diff --git a/src/modules/surfaceFamilies.F90 b/src/modules/surfaceFamilies.F90 index c9e2d71aa..a1f51115a 100644 --- a/src/modules/surfaceFamilies.F90 +++ b/src/modules/surfaceFamilies.F90 @@ -2,17 +2,9 @@ module surfaceFamilies use constants #ifndef USE_TAPENADE -#include -#if PETSC_VERSION_GE(3,8,0) #include use petsc implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#include "petsc/finclude/petscvec.h90" -#endif type familyExchange diff --git a/src/modules/wallDistanceData.F90 b/src/modules/wallDistanceData.F90 index b405a35e2..7796abf43 100644 --- a/src/modules/wallDistanceData.F90 +++ b/src/modules/wallDistanceData.F90 @@ -5,17 +5,9 @@ module wallDistanceData use constants #ifndef USE_TAPENADE -#include -#if PETSC_VERSION_GE(3,8,0) #include use petsc implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#include "petsc/finclude/petscvec.h90" -#endif #endif ! xVolume: flatten 1-D vector of all volume nodes for all diff --git a/src/output/tecplotIO.F90 b/src/output/tecplotIO.F90 index 2d75cf5b3..be5742c54 100644 --- a/src/output/tecplotIO.F90 +++ b/src/output/tecplotIO.F90 @@ -706,16 +706,9 @@ subroutine writeTecplotSurfaceFile(fileName, famList) use extraOutput, only : surfWriteBlank use oversetData, only : zipperMesh, zipperMeshes use surfaceUtils -#include -#if PETSC_VERSION_GE(3,8,0) #include - implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#include "petsc/finclude/petscvec.h90" -#endif + use petsc + implicit none ! Input Params character*(*), intent(in) :: fileName @@ -1276,17 +1269,9 @@ subroutine computeSurfaceOutputNodalData(exch, zipper, includeTractions, nodalVa use utils, only : setPointers, EChk use sorting, only : famInList use oversetData, only : zipperMesh -#include -#if PETSC_VERSION_GE(3,8,0) #include - use petsc - implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#include "petsc/finclude/petscvec.h90" -#endif + use petsc + implicit none ! Input Param type(familyExchange) :: exch logical :: includeTractions diff --git a/src/output/writeCGNSGrid.F90 b/src/output/writeCGNSGrid.F90 index 55251b833..51d796340 100644 --- a/src/output/writeCGNSGrid.F90 +++ b/src/output/writeCGNSGrid.F90 @@ -437,7 +437,7 @@ subroutine writeCGNSGridFrame(cgnsZone, ind) integer(kind=intType) :: nn, mm, ll, i, j, k integer(kind=intType) :: s1, s2, s3 - real(kind=cgnsPerType), dimension(3) :: rotCenter, rotRate, translation + real(kind=realType), dimension(3) :: rotCenter, rotRate, translation real(kind=realType) :: LRefInv @@ -598,7 +598,7 @@ subroutine writeCGNSGridFrame(cgnsZone, ind) ! Write the rotation rate and rotation center. - call cg_rotating_write_f(rotRate, rotCenter, ierr) + call cg_rotating_write_f(real(rotRate,4), real(rotCenter,4), ierr) if(ierr /= CG_OK) & call terminate("writeCGNSGridFrame", & "Something wrong when calling & @@ -728,8 +728,8 @@ subroutine writeCGNSGridFrame(cgnsZone, ind) * 180.0_realType/pi call cg_conn_periodic_write_f(cgnsInd, cgnsBase, & - cgnsZone(nn), jj, rotCenter, & - rotRate, translation, ierr) + cgnsZone(nn), jj, real(rotCenter,4), & + real(rotRate,4), real(translation,4), ierr) if(ierr /= CG_OK) & call terminate("writeCGNSGridFrame", & "Something wrong when calling & diff --git a/src/overset/cartMesh.F90 b/src/overset/cartMesh.F90 index af01d3a09..00cdb9613 100644 --- a/src/overset/cartMesh.F90 +++ b/src/overset/cartMesh.F90 @@ -16,19 +16,9 @@ subroutine createCartMesh(level, sps) use blockPointers use surfaceFamilies, only : BCFamGroups use su_cgns -#include -#if PETSC_VERSION_GE(3,8,0) #include + use petsc implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petscsys.h" -#include "petsc/finclude/petscvec.h" -#include "petsc/finclude/petscdmda.h" -#include "petsc/finclude/petscvec.h90" -#include "petsc/finclude/petscdmda.h90" -#endif ! Input Params integer(kind=intType), intent(in) :: level, sps @@ -890,18 +880,9 @@ end subroutine createCartMesh subroutine writeCartMesh(blankVec, cellDims, xMin, h) -#include -#if PETSC_VERSION_GE(3,8,0) #include - use petsc - implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petscsys.h" -#include "petsc/finclude/petscvec.h" -#include "petsc/finclude/petscvec.h90" -#endif + use petsc + implicit none ! Input integer(kind=intType), intent(in), dimension(3) :: cellDims diff --git a/src/overset/oversetUtilities.F90 b/src/overset/oversetUtilities.F90 index 4e34d8bbf..ee9ceb546 100644 --- a/src/overset/oversetUtilities.F90 +++ b/src/overset/oversetUtilities.F90 @@ -2409,18 +2409,9 @@ subroutine getOversetIblank(blkList, n) use communication, only : adflow_comm_world, myid use inputTimeSpectral, only : nTimeIntervalsSpectral use utils, only : setPointers, EChk, terminate -#include -#if PETSC_VERSION_GE(3,8,0) #include - use petsc - implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petscsys.h" -#include "petsc/finclude/petscvec.h" -#include "petsc/finclude/petscvec.h90" -#endif + use petsc + implicit none ! Input/Output integer(kind=intType), intent(in) :: n diff --git a/src/overset/zipperMesh.F90 b/src/overset/zipperMesh.F90 index cffff3c63..5decfe694 100644 --- a/src/overset/zipperMesh.F90 +++ b/src/overset/zipperMesh.F90 @@ -39,17 +39,9 @@ subroutine createZipperMesh(zipperFamList, nZipFam) use gapBoundaries use wallSearches, only : wallSearch -#include -#if PETSC_VERSION_GE(3,8,0) #include - use petsc, only : PETSC_COPY_VALUES, PETSC_DETERMINE, PETSC_NULL_VEC - implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#include "petsc/finclude/petscvec.h90" -#endif + use petsc + implicit none ! Input Parameters integer(kind=intType), intent(in), dimension(nZipFam) :: zipperFamList @@ -490,7 +482,7 @@ subroutine createZipperMesh(zipperFamList, nZipFam) #if PETSC_VERSION_GE(3,8,0) call VecScatterCreate(BCFamExchange(iBCGroup, sps)%nodeValLocal, IS1, & - zipper%localVal, PETSC_NULL_VEC, zipper%scatter, ierr) + zipper%localVal, PETSC_NULL_IS, zipper%scatter, ierr) #else call VecScatterCreate(BCFamExchange(iBCGroup, sps)%nodeValLocal, IS1, & zipper%localVal, PETSC_NULL_OBJECT, zipper%scatter, ierr) diff --git a/src/partitioning/gridChecking.F90 b/src/partitioning/gridChecking.F90 index 153d8edc4..2c10717a1 100644 --- a/src/partitioning/gridChecking.F90 +++ b/src/partitioning/gridChecking.F90 @@ -445,7 +445,7 @@ subroutine check1to1Subfaces integer(kind=intType) :: nMessagesSend, nMessagesReceive integer(kind=intType) :: nBad, nBadGlobal - integer(kind=intType), dimension(3,3) :: tMat + integer(kind=intType), dimension(3,3) :: trMat integer(kind=intType), dimension(0:nProc) :: nFSend, nCoor integer(kind=intType), dimension(nProc) :: nFCount, nCCount @@ -585,17 +585,17 @@ subroutine check1to1Subfaces ll1 = l1(ll); ll2 = L2(ll); ll3 = l3(ll) - tMat(1,1) = sign(1_intType,ll1) * delta(ll1,1_intType) - tMat(1,2) = sign(1_intType,ll1) * delta(ll1,2_intType) - tMat(1,3) = sign(1_intType,ll1) * delta(ll1,3_intType) + trMat(1,1) = sign(1_intType,ll1) * delta(ll1,1_intType) + trMat(1,2) = sign(1_intType,ll1) * delta(ll1,2_intType) + trMat(1,3) = sign(1_intType,ll1) * delta(ll1,3_intType) - tMat(2,1) = sign(1_intType,ll2) * delta(ll2,1_intType) - tMat(2,2) = sign(1_intType,ll2) * delta(ll2,2_intType) - tMat(2,3) = sign(1_intType,ll2) * delta(ll2,3_intType) + trMat(2,1) = sign(1_intType,ll2) * delta(ll2,1_intType) + trMat(2,2) = sign(1_intType,ll2) * delta(ll2,2_intType) + trMat(2,3) = sign(1_intType,ll2) * delta(ll2,3_intType) - tMat(3,1) = sign(1_intType,ll3) * delta(ll3,1_intType) - tMat(3,2) = sign(1_intType,ll3) * delta(ll3,2_intType) - tMat(3,3) = sign(1_intType,ll3) * delta(ll3,3_intType) + trMat(3,1) = sign(1_intType,ll3) * delta(ll3,1_intType) + trMat(3,2) = sign(1_intType,ll3) * delta(ll3,2_intType) + trMat(3,3) = sign(1_intType,ll3) * delta(ll3,3_intType) ! Store the coordinates in realBuf by looping over the ! points of the subface. @@ -613,11 +613,11 @@ subroutine check1to1Subfaces ll3 = k - dknBeg(ll) ic = inBeg(ll) & - + tMat(1,1)*ll1 + tMat(1,2)*ll2 + tMat(1,3)*ll3 + + trMat(1,1)*ll1 + trMat(1,2)*ll2 + trMat(1,3)*ll3 jc = jnBeg(ll) & - + tMat(2,1)*ll1 + tMat(2,2)*ll2 + tMat(2,3)*ll3 + + trMat(2,1)*ll1 + trMat(2,2)*ll2 + trMat(2,3)*ll3 kc = knBeg(ll) & - + tMat(3,1)*ll1 + tMat(3,2)*ll2 + tMat(3,3)*ll3 + + trMat(3,1)*ll1 + trMat(3,2)*ll2 + trMat(3,3)*ll3 ! Store the coordinates in the buffer. diff --git a/src/partitioning/loadBalance.F90 b/src/partitioning/loadBalance.F90 index 1bdc06e11..48a8bedae 100644 --- a/src/partitioning/loadBalance.F90 +++ b/src/partitioning/loadBalance.F90 @@ -1809,7 +1809,7 @@ subroutine externalFacesSubblock(cgnsID, ii, jj, nSubPerCGNS, & integer(kind=intType) :: diBeg, diEnd, djBeg, djEnd integer(kind=intType) :: dkBeg, dkEnd - integer(kind=intType), dimension(3,3) :: tMat + integer(kind=intType), dimension(3,3) :: trMat integer(kind=intType), dimension(:,:,:), pointer :: ranges @@ -1922,17 +1922,17 @@ subroutine externalFacesSubblock(cgnsID, ii, jj, nSubPerCGNS, & L2 = cgnsDoms(cgnsID)%conn1to1(j)%l2 l3 = cgnsDoms(cgnsID)%conn1to1(j)%l3 - tMat(1,1) = sign(1_intType,l1) * delta(l1,1_intType) - tMat(2,1) = sign(1_intType,l1) * delta(l1,2_intType) - tMat(3,1) = sign(1_intType,l1) * delta(l1,3_intType) + trMat(1,1) = sign(1_intType,l1) * delta(l1,1_intType) + trMat(2,1) = sign(1_intType,l1) * delta(l1,2_intType) + trMat(3,1) = sign(1_intType,l1) * delta(l1,3_intType) - tMat(1,2) = sign(1_intType,l2) * delta(l2,1_intType) - tMat(2,2) = sign(1_intType,l2) * delta(l2,2_intType) - tMat(3,2) = sign(1_intType,l2) * delta(l2,3_intType) + trMat(1,2) = sign(1_intType,l2) * delta(l2,1_intType) + trMat(2,2) = sign(1_intType,l2) * delta(l2,2_intType) + trMat(3,2) = sign(1_intType,l2) * delta(l2,3_intType) - tMat(1,3) = sign(1_intType,l3) * delta(l3,1_intType) - tMat(2,3) = sign(1_intType,l3) * delta(l3,2_intType) - tMat(3,3) = sign(1_intType,l3) * delta(l3,3_intType) + trMat(1,3) = sign(1_intType,l3) * delta(l3,1_intType) + trMat(2,3) = sign(1_intType,l3) * delta(l3,2_intType) + trMat(3,3) = sign(1_intType,l3) * delta(l3,3_intType) ! Determine the corresponding donor range of the subface ! iBeg, iEnd; jBeg, jEnd; kBeg, kEnd. @@ -1942,22 +1942,22 @@ subroutine externalFacesSubblock(cgnsID, ii, jj, nSubPerCGNS, & l3 = kBeg - cgnsDoms(cgnsID)%conn1to1(j)%kBeg diBeg = cgnsDoms(cgnsID)%conn1to1(j)%diBeg & - + tMat(1,1)*l1 + tMat(1,2)*l2 + tMat(1,3)*l3 + + trMat(1,1)*l1 + trMat(1,2)*l2 + trMat(1,3)*l3 djBeg = cgnsDoms(cgnsID)%conn1to1(j)%djBeg & - + tMat(2,1)*l1 + tMat(2,2)*l2 + tMat(2,3)*l3 + + trMat(2,1)*l1 + trMat(2,2)*l2 + trMat(2,3)*l3 dkBeg = cgnsDoms(cgnsID)%conn1to1(j)%dkBeg & - + tMat(3,1)*l1 + tMat(3,2)*l2 + tMat(3,3)*l3 + + trMat(3,1)*l1 + trMat(3,2)*l2 + trMat(3,3)*l3 l1 = iEnd - cgnsDoms(cgnsID)%conn1to1(j)%iBeg L2 = jEnd - cgnsDoms(cgnsID)%conn1to1(j)%jBeg l3 = kEnd - cgnsDoms(cgnsID)%conn1to1(j)%kBeg diEnd = cgnsDoms(cgnsID)%conn1to1(j)%diBeg & - + tMat(1,1)*l1 + tMat(1,2)*l2 + tMat(1,3)*l3 + + trMat(1,1)*l1 + trMat(1,2)*l2 + trMat(1,3)*l3 djEnd = cgnsDoms(cgnsID)%conn1to1(j)%djBeg & - + tMat(2,1)*l1 + tMat(2,2)*l2 + tMat(2,3)*l3 + + trMat(2,1)*l1 + trMat(2,2)*l2 + trMat(2,3)*l3 dkEnd = cgnsDoms(cgnsID)%conn1to1(j)%dkBeg & - + tMat(3,1)*l1 + tMat(3,2)*l2 + tMat(3,3)*l3 + + trMat(3,1)*l1 + trMat(3,2)*l2 + trMat(3,3)*l3 ! Make sure that the donor indices are positive running ! indices. If they must be swapped, the corresponding @@ -2067,7 +2067,7 @@ subroutine externalFacesSubblock(cgnsID, ii, jj, nSubPerCGNS, & ! Transform the donor range in the original donor block ! back the a subface range in the original cgns block. - ! The inverse of the transformation matrix tMat is + ! The inverse of the transformation matrix trMat is ! the transpose. l1 = iBeg - cgnsDoms(cgnsID)%conn1to1(j)%diBeg @@ -2075,22 +2075,22 @@ subroutine externalFacesSubblock(cgnsID, ii, jj, nSubPerCGNS, & l3 = kBeg - cgnsDoms(cgnsID)%conn1to1(j)%dkBeg iBeg = cgnsDoms(cgnsID)%conn1to1(j)%iBeg & - + tMat(1,1)*l1 + tMat(2,1)*l2 + tMat(3,1)*l3 + + trMat(1,1)*l1 + trMat(2,1)*l2 + trMat(3,1)*l3 jBeg = cgnsDoms(cgnsID)%conn1to1(j)%jBeg & - + tMat(1,2)*l1 + tMat(2,2)*l2 + tMat(3,2)*l3 + + trMat(1,2)*l1 + trMat(2,2)*l2 + trMat(3,2)*l3 kBeg = cgnsDoms(cgnsID)%conn1to1(j)%kBeg & - + tMat(1,3)*l1 + tMat(2,3)*l2 + tMat(3,3)*l3 + + trMat(1,3)*l1 + trMat(2,3)*l2 + trMat(3,3)*l3 l1 = iEnd - cgnsDoms(cgnsID)%conn1to1(j)%diBeg L2 = jEnd - cgnsDoms(cgnsID)%conn1to1(j)%djBeg l3 = kEnd - cgnsDoms(cgnsID)%conn1to1(j)%dkBeg iEnd = cgnsDoms(cgnsID)%conn1to1(j)%iBeg & - + tMat(1,1)*l1 + tMat(2,1)*l2 + tMat(3,1)*l3 + + trMat(1,1)*l1 + trMat(2,1)*l2 + trMat(3,1)*l3 jEnd = cgnsDoms(cgnsID)%conn1to1(j)%jBeg & - + tMat(1,2)*l1 + tMat(2,2)*l2 + tMat(3,2)*l3 + + trMat(1,2)*l1 + trMat(2,2)*l2 + trMat(3,2)*l3 kEnd = cgnsDoms(cgnsID)%conn1to1(j)%kBeg & - + tMat(1,3)*l1 + tMat(2,3)*l2 + tMat(3,3)*l3 + + trMat(1,3)*l1 + trMat(2,3)*l2 + trMat(3,3)*l3 ! Store the subface range of the new block, i.e. ! An offset must be subtracted. diff --git a/src/partitioning/readCGNSGrid.F90 b/src/partitioning/readCGNSGrid.F90 index 16892889f..6267a5798 100644 --- a/src/partitioning/readCGNSGrid.F90 +++ b/src/partitioning/readCGNSGrid.F90 @@ -470,7 +470,7 @@ subroutine readZoneInfo(cgnsBase, nZone, sortedFamName, & integer(kind=intType) :: ii, nn - real(kind=cgnsPertype), dimension(3) :: rotCenter, rotRate + real(kind=realType), dimension(3) :: rotCenter, rotRate real(kind=realType) :: mult, trans @@ -732,7 +732,7 @@ subroutine readZoneInfo(cgnsBase, nZone, sortedFamName, & ! No family information specified. ! Try to read the rotation rate and center. - call cg_rotating_read_f(rotRate, rotCenter, ierr) + call cg_rotating_read_f(real(rotRate,4), real(rotCenter,4), ierr) if(ierr == error) & call terminate("readZoneInfo", & "Something wrong when calling & @@ -1174,8 +1174,8 @@ subroutine read1to1Conn(cgnsInd, cgnsBase, nZone) character(len=maxCGNSNameLen) :: connectName type(cgns1to1ConnType), pointer, dimension(:) :: conn1to1 - real(kind=cgnsPerType), dimension(3) :: rotCenter, rotAngles - real(kind=cgnsPerType), dimension(3) :: tlation + real(kind=realType), dimension(3) :: rotCenter, rotAngles + real(kind=realType), dimension(3) :: tlation ! Determine the number of 1 to 1 connectivities stored in the ! CGNS file for this zone. @@ -1236,7 +1236,7 @@ subroutine read1to1Conn(cgnsInd, cgnsBase, nZone) call cg_1to1_periodic_read_f(cgnsInd, cgnsBase, nZone, i, & - rotCenter, rotAngles, tlation, ierr) + real(rotCenter,4), real(rotAngles,4), real(tlation,4), ierr) if(ierr == CG_OK)then call readPeriodicSubface1to1(cgnsInd, cgnsBase, nZone, i, & cgnsDoms(nZone)%conn1to1(i)%connectName, & @@ -1279,7 +1279,7 @@ subroutine checkTransform(transform, nZone, n1to1, printWarning) integer(kind=intType), dimension(3) :: haloDir, donorDir integer(kind=intType), dimension(3,2) :: zoneRange, donorRange - integer(kind=intType), dimension(3,3) :: tMat + integer(kind=intType), dimension(3,3) :: trMat character(len=maxCGNSNameLen) :: zoneName, connectName character(len=2*maxStringLen) :: errorMessage @@ -1412,17 +1412,17 @@ subroutine checkTransform(transform, nZone, n1to1, printWarning) L2 = transform(2) l3 = transform(3) - tMat(1,1) = sign(1_intType,l1) * delta(l1,1_intType) - tMat(2,1) = sign(1_intType,l1) * delta(l1,2_intType) - tMat(3,1) = sign(1_intType,l1) * delta(l1,3_intType) + trMat(1,1) = sign(1_intType,l1) * delta(l1,1_intType) + trMat(2,1) = sign(1_intType,l1) * delta(l1,2_intType) + trMat(3,1) = sign(1_intType,l1) * delta(l1,3_intType) - tMat(1,2) = sign(1_intType,l2) * delta(l2,1_intType) - tMat(2,2) = sign(1_intType,l2) * delta(l2,2_intType) - tMat(3,2) = sign(1_intType,l2) * delta(l2,3_intType) + trMat(1,2) = sign(1_intType,l2) * delta(l2,1_intType) + trMat(2,2) = sign(1_intType,l2) * delta(l2,2_intType) + trMat(3,2) = sign(1_intType,l2) * delta(l2,3_intType) - tMat(1,3) = sign(1_intType,l3) * delta(l3,1_intType) - tMat(2,3) = sign(1_intType,l3) * delta(l3,2_intType) - tMat(3,3) = sign(1_intType,l3) * delta(l3,3_intType) + trMat(1,3) = sign(1_intType,l3) * delta(l3,1_intType) + trMat(2,3) = sign(1_intType,l3) * delta(l3,2_intType) + trMat(3,3) = sign(1_intType,l3) * delta(l3,3_intType) ! Apply the transformation matrix to haloDir. @@ -1430,9 +1430,9 @@ subroutine checkTransform(transform, nZone, n1to1, printWarning) L2 = haloDir(2) l3 = haloDir(3) - haloDir(1) = tMat(1,1)*l1 + tMat(1,2)*l2 + tMat(1,3)*l3 - haloDir(2) = tMat(2,1)*l1 + tMat(2,2)*l2 + tMat(2,3)*l3 - haloDir(3) = tMat(3,1)*l1 + tMat(3,2)*l2 + tMat(3,3)*l3 + haloDir(1) = trMat(1,1)*l1 + trMat(1,2)*l2 + trMat(1,3)*l3 + haloDir(2) = trMat(2,1)*l1 + trMat(2,2)*l2 + trMat(2,3)*l3 + haloDir(3) = trMat(3,1)*l1 + trMat(3,2)*l2 + trMat(3,3)*l3 ! If the transformation matrix is correct haloDir == donorDir. ! If this is not the case, there are two possibilities. Either @@ -2854,15 +2854,15 @@ subroutine readPeriodicSubface(cgnsInd, cgnsBase, zone, conn, & integer :: jj integer :: mass, len, time, temp, angle - real(kind=cgnsPerType), dimension(3) :: rotCenter, rotAngles - real(kind=cgnsPerType), dimension(3) :: tlation + real(kind=realType), dimension(3) :: rotCenter, rotAngles + real(kind=realType), dimension(3) :: tlation real(kind=realType) :: mult, trans ! Check if this is a periodic boundary. call cg_conn_periodic_read_f(cgnsInd, cgnsBase, zone, conn, & - rotCenter, rotAngles, tlation, ierr) + real(rotCenter,4), real(rotAngles,4), real(tlation,4), ierr) testPeriodic: if(ierr == CG_OK) then @@ -2997,14 +2997,14 @@ subroutine readPeriodicSubface1to1(cgnsInd, cgnsBase, zone, conn, & integer :: jj integer :: mass, len, time, temp, angle - real(kind=cgnsPerType), dimension(3) :: rotCenter, rotAngles - real(kind=cgnsPerType), dimension(3) :: tlation + real(kind=realType), dimension(3) :: rotCenter, rotAngles + real(kind=realType), dimension(3) :: tlation real(kind=realType) :: mult, trans ! Check if this is a periodic boundary. call cg_1to1_periodic_read_f(cgnsInd, cgnsBase, zone, conn, & - rotCenter, rotAngles, tlation, ierr) + real(rotCenter,4), real(rotAngles,4), real(tlation,4), ierr) testPeriodic: if(ierr == CG_OK) then diff --git a/src/preprocessing/pointMatchedCommPattern.F90 b/src/preprocessing/pointMatchedCommPattern.F90 index e1dca42a1..8db6875e3 100644 --- a/src/preprocessing/pointMatchedCommPattern.F90 +++ b/src/preprocessing/pointMatchedCommPattern.F90 @@ -827,7 +827,7 @@ subroutine determineFaceHalos(level) integer(kind=intType), dimension(3) :: myOffset, donorOffset integer(kind=intType), dimension(3) :: step - integer(kind=intType), dimension(3,3) :: tMat + integer(kind=intType), dimension(3,3) :: trMat integer(kind=intType), dimension(3,2) :: myCellRange integer(kind=intType), dimension(3,2) :: myNodeRange integer(kind=intType), dimension(3,2) :: donorCellRange @@ -1011,29 +1011,29 @@ subroutine determineFaceHalos(level) ! Determine the complete transformation matrix from the ! given shorthand. - tMat(1,1) = sign(1_intType,l1(mm)) * delta(l1(mm),1_intType) - tMat(2,1) = sign(1_intType,l1(mm)) * delta(l1(mm),2_intType) - tMat(3,1) = sign(1_intType,l1(mm)) * delta(l1(mm),3_intType) + trMat(1,1) = sign(1_intType,l1(mm)) * delta(l1(mm),1_intType) + trMat(2,1) = sign(1_intType,l1(mm)) * delta(l1(mm),2_intType) + trMat(3,1) = sign(1_intType,l1(mm)) * delta(l1(mm),3_intType) - tMat(1,2) = sign(1_intType,l2(mm)) * delta(l2(mm),1_intType) - tMat(2,2) = sign(1_intType,l2(mm)) * delta(l2(mm),2_intType) - tMat(3,2) = sign(1_intType,l2(mm)) * delta(l2(mm),3_intType) + trMat(1,2) = sign(1_intType,l2(mm)) * delta(l2(mm),1_intType) + trMat(2,2) = sign(1_intType,l2(mm)) * delta(l2(mm),2_intType) + trMat(3,2) = sign(1_intType,l2(mm)) * delta(l2(mm),3_intType) - tMat(1,3) = sign(1_intType,l3(mm)) * delta(l3(mm),1_intType) - tMat(2,3) = sign(1_intType,l3(mm)) * delta(l3(mm),2_intType) - tMat(3,3) = sign(1_intType,l3(mm)) * delta(l3(mm),3_intType) + trMat(1,3) = sign(1_intType,l3(mm)) * delta(l3(mm),1_intType) + trMat(2,3) = sign(1_intType,l3(mm)) * delta(l3(mm),2_intType) + trMat(3,3) = sign(1_intType,l3(mm)) * delta(l3(mm),3_intType) ! Determine the offset of the donor block. - donorOffset(1) = tMat(1,1)*myOffset(1) & - + tMat(1,2)*myOffset(2) & - + tMat(1,3)*myOffset(3) - donorOffset(2) = tMat(2,1)*myOffset(1) & - + tMat(2,2)*myOffset(2) & - + tMat(2,3)*myOffset(3) - donorOffset(3) = tMat(3,1)*myOffset(1) & - + tMat(3,2)*myOffset(2) & - + tMat(3,3)*myOffset(3) + donorOffset(1) = trMat(1,1)*myOffset(1) & + + trMat(1,2)*myOffset(2) & + + trMat(1,3)*myOffset(3) + donorOffset(2) = trMat(2,1)*myOffset(1) & + + trMat(2,2)*myOffset(2) & + + trMat(2,3)*myOffset(3) + donorOffset(3) = trMat(3,1)*myOffset(1) & + + trMat(3,2)*myOffset(2) & + + trMat(3,3)*myOffset(3) ! ! First treat the nodes on the subface. ! @@ -1052,11 +1052,11 @@ subroutine determineFaceHalos(level) kk = k - myNodeRange(3,1) iD = donorOffset(1) + dinBeg(mm) & - + tMat(1,1)*ii + tMat(1,2)*jj + tMat(1,3)*kk + + trMat(1,1)*ii + trMat(1,2)*jj + trMat(1,3)*kk jD = donorOffset(2) + djnBeg(mm) & - + tMat(2,1)*ii + tMat(2,2)*jj + tMat(2,3)*kk + + trMat(2,1)*ii + trMat(2,2)*jj + trMat(2,3)*kk kD = donorOffset(3) + dknBeg(mm) & - + tMat(3,1)*ii + tMat(3,2)*jj + tMat(3,3)*kk + + trMat(3,1)*ii + trMat(3,2)*jj + trMat(3,3)*kk ! Determine the indices of my nodal halo node. @@ -1194,11 +1194,11 @@ subroutine determineFaceHalos(level) kk = k - myCellRange(3,1) iD = donorCellRange(1,1) & - + tMat(1,1)*ii + tMat(1,2)*jj + tMat(1,3)*kk + + trMat(1,1)*ii + trMat(1,2)*jj + trMat(1,3)*kk jD = donorCellRange(2,1) & - + tMat(2,1)*ii + tMat(2,2)*jj + tMat(2,3)*kk + + trMat(2,1)*ii + trMat(2,2)*jj + trMat(2,3)*kk kD = donorCellRange(3,1) & - + tMat(3,1)*ii + tMat(3,2)*jj + tMat(3,3)*kk + + trMat(3,1)*ii + trMat(3,2)*jj + trMat(3,3)*kk ! Update the counter iicell1st and store its value a ! bit easier in ii and set entryList accordingly. @@ -2875,7 +2875,7 @@ subroutine fillSendBuf(sendBuf, proc, entityHalo, transform, & integer(kind=intType) :: i, ii, jj, m integer(kind=intType) :: l1, l2, l3 - integer(kind=intType), dimension(3,3) :: tMat + integer(kind=intType), dimension(3,3) :: trMat ! Initialize m to 0. @@ -2899,17 +2899,17 @@ subroutine fillSendBuf(sendBuf, proc, entityHalo, transform, & l2 = transform(jj,2) l3 = transform(jj,3) - tMat(1,1) = sign(1_intType,l1) * delta(l1,1_intType) - tMat(2,1) = sign(1_intType,l1) * delta(l1,2_intType) - tMat(3,1) = sign(1_intType,l1) * delta(l1,3_intType) + trMat(1,1) = sign(1_intType,l1) * delta(l1,1_intType) + trMat(2,1) = sign(1_intType,l1) * delta(l1,2_intType) + trMat(3,1) = sign(1_intType,l1) * delta(l1,3_intType) - tMat(1,2) = sign(1_intType,l2) * delta(l2,1_intType) - tMat(2,2) = sign(1_intType,l2) * delta(l2,2_intType) - tMat(3,2) = sign(1_intType,l2) * delta(l2,3_intType) + trMat(1,2) = sign(1_intType,l2) * delta(l2,1_intType) + trMat(2,2) = sign(1_intType,l2) * delta(l2,2_intType) + trMat(3,2) = sign(1_intType,l2) * delta(l2,3_intType) - tMat(1,3) = sign(1_intType,l3) * delta(l3,1_intType) - tMat(2,3) = sign(1_intType,l3) * delta(l3,2_intType) - tMat(3,3) = sign(1_intType,l3) * delta(l3,3_intType) + trMat(1,3) = sign(1_intType,l3) * delta(l3,1_intType) + trMat(2,3) = sign(1_intType,l3) * delta(l3,2_intType) + trMat(3,3) = sign(1_intType,l3) * delta(l3,3_intType) ! Store the direction from the direct to the indirect ! halo in l1, l2 and l3 @@ -2929,9 +2929,9 @@ subroutine fillSendBuf(sendBuf, proc, entityHalo, transform, & m = m+1; sendBuf(m) = entityHalo(jj)%dJ m = m+1; sendBuf(m) = entityHalo(jj)%dK - m = m+1; sendBuf(m) = tMat(1,1)*l1 + tMat(1,2)*l2 + tMat(1,3)*l3 - m = m+1; sendBuf(m) = tMat(2,1)*l1 + tMat(2,2)*l2 + tMat(2,3)*l3 - m = m+1; sendBuf(m) = tMat(3,1)*l1 + tMat(3,2)*l2 + tMat(3,3)*l3 + m = m+1; sendBuf(m) = trMat(1,1)*l1 + trMat(1,2)*l2 + trMat(1,3)*l3 + m = m+1; sendBuf(m) = trMat(2,1)*l1 + trMat(2,2)*l2 + trMat(2,3)*l3 + m = m+1; sendBuf(m) = trMat(3,1)*l1 + trMat(3,2)*l2 + trMat(3,3)*l3 enddo diff --git a/src/preprocessing/preprocessingAPI.F90 b/src/preprocessing/preprocessingAPI.F90 index fbfe618c9..1fbd08b1b 100644 --- a/src/preprocessing/preprocessingAPI.F90 +++ b/src/preprocessing/preprocessingAPI.F90 @@ -1697,7 +1697,7 @@ subroutine createNodeScatterForFamilies(famList, exch, sps, localIndices) ! 3. Node-based output for tecplot files. use constants use communication, only : adflow_comm_world, myid, nProc - use surfaceFamilies, only : familyExchange, IS1, IS2, PETSC_COPY_VALUES, PETSC_DETERMINE + use surfaceFamilies, only : familyExchange, IS1, IS2!, PETSC_COPY_VALUES, PETSC_DETERMINE use utils, only : pointReduce, eChk use surfaceUtils implicit none @@ -3965,16 +3965,9 @@ subroutine preprocessingADjoint use ADjointPETSc, only: w_like1, w_like2, PETScIerr, & psi_like1, psi_like2, x_like, psi_like3 use utils, only : setPointers, EChk -#include -#if PETSC_VERSION_GE(3,8,0) #include - use petsc - implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#endif + use petsc + implicit none ! Local variables. ! diff --git a/src/solver/agmg.F90 b/src/solver/agmg.F90 index 1c852e7f3..5cc68a255 100644 --- a/src/solver/agmg.F90 +++ b/src/solver/agmg.F90 @@ -2,18 +2,9 @@ module agmg use constants use utils, only : EChk - ! MPI comes from constants, so we need to avoid MPIF_H in PETSc -#include -#if PETSC_VERSION_GE(3,8,0) #include use petsc implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#include "petsc/finclude/petscvec.h90" -#endif ! Structure used for storing the interpolation indices type arr1int4 @@ -314,7 +305,7 @@ subroutine setupAGMG(inputMat, nCell, blockSize) call EChk(ierr,__FILE__,__LINE__) ! Create the scatter - call VecScatterCreate(indexVec, IS1, recvVec, PETSC_NULL_OBJECT, scat, ierr) + call VecScatterCreate(indexVec, IS1, recvVec, PETSC_NULL_IS, scat, ierr) call EChk(ierr,__FILE__,__LINE__) ! Do the actual scatter diff --git a/src/utils/haloExchange.F90 b/src/utils/haloExchange.F90 index 9f3b2284c..0c0a0cede 100644 --- a/src/utils/haloExchange.F90 +++ b/src/utils/haloExchange.F90 @@ -3109,18 +3109,9 @@ subroutine flowIntegrationZipperComm(isInflow, vars, sps) use surfaceFamilies, only : familyExchange, BCFamExchange use utils, only : setPointers, setBCPointers, EChk -#include -#if PETSC_VERSION_GE(3,8,0) #include - use petsc - implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petscsys.h" -#include "petsc/finclude/petscvec.h" -#include "petsc/finclude/petscvec.h90" -#endif + use petsc + implicit none ! Input variables logical, intent(in) :: isInflow @@ -3236,18 +3227,9 @@ subroutine flowIntegrationZipperComm_d(isInflow, vars, varsd, sps) use oversetData, only : zipperMeshes, zipperMesh use surfaceFamilies, only : familyExchange, BCFamExchange use utils, only : setPointers_d, setBCPointers_d, EChk -#include -#if PETSC_VERSION_GE(3,8,0) #include - use petsc - implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petscsys.h" -#include "petsc/finclude/petscvec.h" -#include "petsc/finclude/petscvec.h90" -#endif + use petsc + implicit none ! Input variables logical, intent(in) :: isInflow real(kind=realType), dimension(:, :) :: vars, varsd @@ -3364,18 +3346,9 @@ subroutine flowIntegrationZipperComm_b(isInflow, vars, varsd, sps) use oversetData, only : zipperMeshes, zipperMesh use surfaceFamilies, only : familyExchange, BCFamExchange use utils, only : setPointers_b, setBCPointers_d, EChk -#include -#if PETSC_VERSION_GE(3,8,0) #include - use petsc - implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petscsys.h" -#include "petsc/finclude/petscvec.h" -#include "petsc/finclude/petscvec.h90" -#endif + use petsc + implicit none ! Input variables logical, intent(in) :: isInflow @@ -3514,18 +3487,9 @@ subroutine wallIntegrationZipperComm(vars, sps) use oversetData, only : zipperMeshes, zipperMesh use surfaceFamilies, only : familyExchange, BCFamExchange use utils, only : setPointers, setBCPointers, EChk, isWallType -#include -#if PETSC_VERSION_GE(3,8,0) #include - use petsc - implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petscsys.h" -#include "petsc/finclude/petscvec.h" -#include "petsc/finclude/petscvec.h90" -#endif + use petsc + implicit none ! Input variables real(kind=realType), dimension(:, :) :: vars integer(kind=intType) :: sps @@ -3613,18 +3577,9 @@ subroutine wallIntegrationZipperComm_d(vars, varsd, sps) use oversetData, only : zipperMeshes, zipperMesh use surfaceFamilies, only : familyExchange, BCFamExchange use utils, only : setPointers_d, setBCPointers_d, EChk, isWallType -#include -#if PETSC_VERSION_GE(3,8,0) #include - use petsc - implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petscsys.h" -#include "petsc/finclude/petscvec.h" -#include "petsc/finclude/petscvec.h90" -#endif + use petsc + implicit none ! Input variables real(kind=realType), dimension(:, :):: vars, varsd @@ -3716,18 +3671,9 @@ subroutine wallIntegrationZipperComm_b(vars, varsd, sps) use oversetData, only : zipperMeshes, zipperMesh use surfaceFamilies, only : familyExchange, BCFamExchange use utils, only : setPointers_b, setBCPointers_d, EChk, isWallType -#include -#if PETSC_VERSION_GE(3,8,0) #include - use petsc - implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petscsys.h" -#include "petsc/finclude/petscvec.h" -#include "petsc/finclude/petscvec.h90" -#endif + use petsc + implicit none ! Input variables real(kind=realType), dimension(:, :) :: vars, varsd diff --git a/src/utils/surfaceUtils.F90 b/src/utils/surfaceUtils.F90 index b9d002531..fc43cb047 100644 --- a/src/utils/surfaceUtils.F90 +++ b/src/utils/surfaceUtils.F90 @@ -378,17 +378,9 @@ subroutine getSurfacePoints(points, npts, sps_in, famList, nFamList, includeZipp use oversetData, only : zipperMeshes, zipperMesh, oversetPresent use sorting, only : famInList use utils, only : setPointers, EChk, setBCPointers -#include -#if PETSC_VERSION_GE(3,8,0) #include - use petsc - implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#include "petsc/finclude/petscvec.h90" -#endif + use petsc + implicit none ! ! Local variables. diff --git a/src/utils/utils.F90 b/src/utils/utils.F90 index a01ec4d8e..249d71b97 100644 --- a/src/utils/utils.F90 +++ b/src/utils/utils.F90 @@ -5690,7 +5690,7 @@ subroutine returnFail(routineName, errorMessage) end subroutine returnFail - subroutine EChk(ierr, file, line) + subroutine EChk(errorcode, file, line) ! Check if ierr that resulted from a petsc or MPI call is in fact an ! error. @@ -5698,26 +5698,27 @@ subroutine EChk(ierr, file, line) use communication, only : adflow_comm_world, myid implicit none - integer(kind=intType),intent(in) :: ierr + integer(kind=intType),intent(in) :: errorcode character*(*),intent(in) :: file integer(kind=intType),intent(in) :: line + integer::ierr - if (ierr == 0) then + if (errorcode == 0) then return ! No error, return immediately else #ifndef USE_TAPENADE #ifndef USE_COMPLEX print *,'---------------------------------------------------------------------------' - write(*,900) "PETSc or MPI Error. Error Code ",ierr,". Detected on Proc ",myid + write(*,900) "PETSc or MPI Error. Error Code ",errorcode,". Detected on Proc ",myid write(*,901) "Error at line: ",line," in file: ",file print *,'---------------------------------------------------------------------------' #else print *,'-----------------------------------------------------------------' - write(*,900) "PETSc or MPI Error. Error Code ",ierr,". Detected on Proc ",myid + write(*,900) "PETSc or MPI Error. Error Code ",errorcode,". Detected on Proc ",myid write(*,901) "Error at line: ",line," in file: ",file print *,'-----------------------------------------------------------------' #endif - call MPI_Abort(adflow_comm_world,ierr) + call MPI_Abort(adflow_comm_world,errorcode,ierr) stop ! Just in case #else stop diff --git a/src/warping/getForces.F90 b/src/warping/getForces.F90 index 6885bbc72..b84cb3393 100644 --- a/src/warping/getForces.F90 +++ b/src/warping/getForces.F90 @@ -9,17 +9,9 @@ subroutine getForces(forces, npts, sps) use surfaceFamilies, only : fullfamList use oversetData, only : zipperMeshes, zipperMesh, oversetPresent use surfaceFamilies, only : familyExchange, BCFamExchange -#include -#if PETSC_VERSION_GE(3,8,0) #include use petsc implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#include "petsc/finclude/petscvec.h90" -#endif integer(kind=intType), intent(in) :: npts, sps real(kind=realType), intent(inout) :: forces(3,npts) @@ -143,17 +135,9 @@ subroutine getForces_d(forces, forcesd, npts, sps) use utils, only : setPointers, setPointers_d, EChk, terminate use oversetData, only : zipperMeshes, zipperMesh, oversetPresent use surfaceFamilies, only : familyExchange, BCFamExchange -#include -#if PETSC_VERSION_GE(3,8,0) #include use petsc implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#include "petsc/finclude/petscvec.h90" -#endif integer(kind=intType), intent(in) :: npts, sps real(kind=realType), intent(out), dimension(3, npts) :: forces, forcesd integer(kind=intType) :: mm, nn, i, j, ii, jj, iDim, ierr @@ -265,17 +249,9 @@ subroutine getForces_b(forcesd, npts, sps) use utils, only : EChk, setPointers, setPointers_d use oversetData, only : zipperMeshes, zipperMesh, oversetPresent use surfaceFamilies, only : familyExchange, BCFamExchange -#include -#if PETSC_VERSION_GE(3,8,0) #include use petsc implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#include "petsc/finclude/petscvec.h90" -#endif integer(kind=intType), intent(in) :: npts, sps real(kind=realType), intent(inout) :: forcesd(3, npts) integer(kind=intType) :: mm, nn, i, j, ii, iDim, ierr @@ -387,17 +363,9 @@ subroutine surfaceCellCenterToNode(exch) use surfaceFamilies, only : familyExchange use utils, only : setPointers, EChk use sorting, only : famInList -#include -#if PETSC_VERSION_GE(3,8,0) #include use petsc implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#include "petsc/finclude/petscvec.h90" -#endif type(familyExchange) :: exch integer(kind=intType) :: sps @@ -507,17 +475,9 @@ subroutine computeWeighting(exch) use surfaceFamilies, only : familyExchange use utils, only : setPointers, EChk use sorting, only : famInList -#include -#if PETSC_VERSION_GE(3,8,0) #include use petsc implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#include "petsc/finclude/petscvec.h90" -#endif type(familyExchange) :: exch integer(kind=intType) :: sps integer(kind=intType) :: mm, nn, i, j, ii, jj, iDim, ierr @@ -661,17 +621,9 @@ subroutine computeNodalTractions_d(sps) use inputPhysics, only : forcesAsTractions use surfaceFamilies, only: BCFamExchange, familyExchange use utils, only : setPointers, setPointers_d, EChk -#include -#if PETSC_VERSION_GE(3,8,0) #include use petsc implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#include "petsc/finclude/petscvec.h90" -#endif integer(kind=intType), intent(in) :: sps integer(kind=intType) :: mm, nn, i, j, ii, jj, iDim, ierr integer(kind=intType) :: iBeg, iEnd, jBeg, jEnd, ind(4), ni, nj @@ -948,17 +900,9 @@ subroutine computeNodalTractions_b(sps) use surfaceFamilies, only: BCFamExchange, familyExchange use communication use utils, only : EChk, setPointers, setPointers_d -#include -#if PETSC_VERSION_GE(3,8,0) #include use petsc implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petsc.h" -#include "petsc/finclude/petscvec.h90" -#endif integer(kind=intType), intent(in) :: sps integer(kind=intType) :: mm, nn, i, j, ii, jj, iDim, ierr diff --git a/src/warping/warping.F90 b/src/warping/warping.F90 index bf40c27f0..c422133ec 100644 --- a/src/warping/warping.F90 +++ b/src/warping/warping.F90 @@ -272,18 +272,9 @@ subroutine getSurfacePerturbation(xRand, nRand, randSurface, nRandSurface, famLi use sorting, only : famInList use oversetData, only : zipperMeshes, zipperMesh, oversetPresent use surfaceFamilies, only : BCFamGroups, familyExchange, BCFamExchange -#include -#if PETSC_VERSION_GE(3,8,0) #include - use petsc - implicit none -#else - implicit none -#define PETSC_AVOID_MPIF_H -#include "petsc/finclude/petscsys.h" -#include "petsc/finclude/petscvec.h" -#include "petsc/finclude/petscvec.h90" -#endif + use petsc + implicit none ! Input Parameters real(kind=realType), intent(in), dimension(nRand) :: xRand diff --git a/src_cs/modules/precision.F90 b/src_cs/modules/precision.F90 index 5a0fe8415..964b280a6 100644 --- a/src_cs/modules/precision.F90 +++ b/src_cs/modules/precision.F90 @@ -16,9 +16,10 @@ module precision ! use complexify + use mpi implicit none save -#include "mpif.h" + ! ! Definition of the integer type used in the entire code. There ! might be a more elegant solution to do this, but be sure that @@ -100,9 +101,6 @@ module precision ! integer(kind=1), private :: adtDummyElementInt - ! Definition of the cgns periodic type. - ! - real(kind=4), private :: dummyCGNSPer ! ! Definition of the kind parameters for the integer and real ! types. @@ -112,7 +110,6 @@ module precision integer, parameter :: realType = kind(dummyReal) integer, parameter :: adtElementType = kind(adtDummyElementInt) integer, parameter :: cgnsRealType = kind(dummyCGNSReal) - integer, parameter :: cgnsPerType = kind(dummyCGNSPer) integer, parameter :: alwaysRealType = kind(dummyReal) integer, parameter :: singleType = kind(dummySingle) integer, parameter :: doubleType = kind(dummyDouble)