Compare commits
20 Commits
Trigger-Di
...
chb-twopun
| Author | SHA1 | Date | |
|---|---|---|---|
| 86704100ec | |||
| 291d40c04b | |||
| 32ed7ec5bd | |||
| c5f8a18ba4 | |||
|
f345b0e520
|
|||
|
f5ed23d687
|
|||
|
03d501db04
|
|||
| 09ffdb553d | |||
| 699e443c7a | |||
| 24bfa44911 | |||
| 6738854a9d | |||
| 223ec17a54 | |||
| 26c81d8e81 | |||
|
|
9deeda9831 | ||
|
|
3a7bce3af2 | ||
|
|
c6945bb095 | ||
|
|
0d24f1503c | ||
|
|
cb252f5ea2 | ||
|
|
7a76cbaafd | ||
|
|
57a7376044 |
7
.gitignore
vendored
7
.gitignore
vendored
@@ -1,5 +1,6 @@
|
|||||||
__pycache__
|
__pycache__
|
||||||
GW150914
|
GW150914
|
||||||
GW150914*
|
GW150914-origin
|
||||||
.codex
|
docs
|
||||||
docs/
|
*.tmp
|
||||||
|
|
||||||
|
|||||||
447
AMSS_NCKU_ABEtest.py
Executable file
447
AMSS_NCKU_ABEtest.py
Executable file
@@ -0,0 +1,447 @@
|
|||||||
|
|
||||||
|
##################################################################
|
||||||
|
##
|
||||||
|
## AMSS-NCKU ABE Test Program (Skip TwoPuncture if data exists)
|
||||||
|
## Modified from AMSS_NCKU_Program.py
|
||||||
|
## Author: Xiaoqu
|
||||||
|
## Modified: 2026/02/01
|
||||||
|
##
|
||||||
|
##################################################################
|
||||||
|
|
||||||
|
|
||||||
|
##################################################################
|
||||||
|
|
||||||
|
## Print program introduction
|
||||||
|
|
||||||
|
import print_information
|
||||||
|
|
||||||
|
print_information.print_program_introduction()
|
||||||
|
|
||||||
|
##################################################################
|
||||||
|
|
||||||
|
import AMSS_NCKU_Input as input_data
|
||||||
|
|
||||||
|
##################################################################
|
||||||
|
|
||||||
|
## Create directories to store program run data
|
||||||
|
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
|
## Set the output directory according to the input file
|
||||||
|
File_directory = os.path.join(input_data.File_directory)
|
||||||
|
|
||||||
|
## Check if output directory exists and if TwoPuncture data is available
|
||||||
|
#skip_twopuncture = False
|
||||||
|
skip_twopuncture = True
|
||||||
|
output_directory = os.path.join(File_directory, "AMSS_NCKU_output")
|
||||||
|
binary_results_directory = os.path.join(output_directory, input_data.Output_directory)
|
||||||
|
|
||||||
|
if os.path.exists(File_directory):
|
||||||
|
print( " Output directory already exists." )
|
||||||
|
print()
|
||||||
|
'''
|
||||||
|
# Check if TwoPuncture initial data files exist
|
||||||
|
if (input_data.Initial_Data_Method == "Ansorg-TwoPuncture"):
|
||||||
|
twopuncture_output = os.path.join(output_directory, "TwoPunctureABE")
|
||||||
|
input_par = os.path.join(output_directory, "input.par")
|
||||||
|
|
||||||
|
if os.path.exists(twopuncture_output) and os.path.exists(input_par):
|
||||||
|
print( " Found existing TwoPuncture initial data." )
|
||||||
|
print( " Do you want to skip TwoPuncture phase and reuse existing data?" )
|
||||||
|
print( " Input 'skip' to skip TwoPuncture and start ABE directly" )
|
||||||
|
print( " Input 'regenerate' to regenerate everything from scratch" )
|
||||||
|
print()
|
||||||
|
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
inputvalue = input()
|
||||||
|
if ( inputvalue == "skip" ):
|
||||||
|
print( " Skipping TwoPuncture phase, will reuse existing initial data." )
|
||||||
|
print()
|
||||||
|
skip_twopuncture = True
|
||||||
|
break
|
||||||
|
elif ( inputvalue == "regenerate" ):
|
||||||
|
print( " Regenerating everything from scratch." )
|
||||||
|
print()
|
||||||
|
skip_twopuncture = False
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
print( " Please input 'skip' or 'regenerate'." )
|
||||||
|
except ValueError:
|
||||||
|
print( " Please input 'skip' or 'regenerate'." )
|
||||||
|
|
||||||
|
else:
|
||||||
|
print( " TwoPuncture initial data not found, will regenerate everything." )
|
||||||
|
print()
|
||||||
|
'''
|
||||||
|
# If not skipping, remove and recreate directory
|
||||||
|
if not skip_twopuncture:
|
||||||
|
shutil.rmtree(File_directory, ignore_errors=True)
|
||||||
|
os.mkdir(File_directory)
|
||||||
|
os.mkdir(output_directory)
|
||||||
|
os.mkdir(binary_results_directory)
|
||||||
|
figure_directory = os.path.join(File_directory, "figure")
|
||||||
|
os.mkdir(figure_directory)
|
||||||
|
shutil.copy("AMSS_NCKU_Input.py", File_directory)
|
||||||
|
print( " Output directory has been regenerated." )
|
||||||
|
print()
|
||||||
|
else:
|
||||||
|
# Create fresh directory structure
|
||||||
|
os.mkdir(File_directory)
|
||||||
|
shutil.copy("AMSS_NCKU_Input.py", File_directory)
|
||||||
|
os.mkdir(output_directory)
|
||||||
|
os.mkdir(binary_results_directory)
|
||||||
|
figure_directory = os.path.join(File_directory, "figure")
|
||||||
|
os.mkdir(figure_directory)
|
||||||
|
print( " Output directory has been generated." )
|
||||||
|
print()
|
||||||
|
|
||||||
|
# Ensure figure directory exists
|
||||||
|
figure_directory = os.path.join(File_directory, "figure")
|
||||||
|
if not os.path.exists(figure_directory):
|
||||||
|
os.mkdir(figure_directory)
|
||||||
|
|
||||||
|
##################################################################
|
||||||
|
|
||||||
|
## Output related parameter information
|
||||||
|
|
||||||
|
import setup
|
||||||
|
|
||||||
|
## Print and save input parameter information
|
||||||
|
setup.print_input_data( File_directory )
|
||||||
|
|
||||||
|
if not skip_twopuncture:
|
||||||
|
setup.generate_AMSSNCKU_input()
|
||||||
|
|
||||||
|
setup.print_puncture_information()
|
||||||
|
|
||||||
|
|
||||||
|
##################################################################
|
||||||
|
|
||||||
|
## Generate AMSS-NCKU program input files based on the configured parameters
|
||||||
|
|
||||||
|
if not skip_twopuncture:
|
||||||
|
print()
|
||||||
|
print( " Generating the AMSS-NCKU input parfile for the ABE executable." )
|
||||||
|
print()
|
||||||
|
|
||||||
|
## Generate cgh-related input files from the grid information
|
||||||
|
|
||||||
|
import numerical_grid
|
||||||
|
|
||||||
|
numerical_grid.append_AMSSNCKU_cgh_input()
|
||||||
|
|
||||||
|
print()
|
||||||
|
print( " The input parfile for AMSS-NCKU C++ executable file ABE has been generated." )
|
||||||
|
print( " However, the input relevant to TwoPuncture need to be appended later." )
|
||||||
|
print()
|
||||||
|
|
||||||
|
|
||||||
|
##################################################################
|
||||||
|
|
||||||
|
## Plot the initial grid configuration
|
||||||
|
|
||||||
|
if not skip_twopuncture:
|
||||||
|
print()
|
||||||
|
print( " Schematically plot the numerical grid structure." )
|
||||||
|
print()
|
||||||
|
|
||||||
|
import numerical_grid
|
||||||
|
numerical_grid.plot_initial_grid()
|
||||||
|
|
||||||
|
|
||||||
|
##################################################################
|
||||||
|
|
||||||
|
## Generate AMSS-NCKU macro files according to the numerical scheme and parameters
|
||||||
|
|
||||||
|
if not skip_twopuncture:
|
||||||
|
print()
|
||||||
|
print( " Automatically generating the macro file for AMSS-NCKU C++ executable file ABE " )
|
||||||
|
print( " (Based on the finite-difference numerical scheme) " )
|
||||||
|
print()
|
||||||
|
|
||||||
|
import generate_macrodef
|
||||||
|
|
||||||
|
generate_macrodef.generate_macrodef_h()
|
||||||
|
print( " AMSS-NCKU macro file macrodef.h has been generated. " )
|
||||||
|
|
||||||
|
generate_macrodef.generate_macrodef_fh()
|
||||||
|
print( " AMSS-NCKU macro file macrodef.fh has been generated. " )
|
||||||
|
|
||||||
|
|
||||||
|
##################################################################
|
||||||
|
|
||||||
|
# Compile the AMSS-NCKU program according to user requirements
|
||||||
|
# NOTE: ABE compilation is always performed, even when skipping TwoPuncture
|
||||||
|
|
||||||
|
print()
|
||||||
|
print( " Preparing to compile and run the AMSS-NCKU code as requested " )
|
||||||
|
print( " Compiling the AMSS-NCKU code based on the generated macro files " )
|
||||||
|
print()
|
||||||
|
|
||||||
|
AMSS_NCKU_source_path = "AMSS_NCKU_source"
|
||||||
|
AMSS_NCKU_source_copy = os.path.join(File_directory, "AMSS_NCKU_source_copy")
|
||||||
|
|
||||||
|
## If AMSS_NCKU source folder is missing, create it and prompt the user
|
||||||
|
if not os.path.exists(AMSS_NCKU_source_path):
|
||||||
|
os.makedirs(AMSS_NCKU_source_path)
|
||||||
|
print( " The AMSS-NCKU source files are incomplete; copy all source files into ./AMSS_NCKU_source. " )
|
||||||
|
print( " Press Enter to continue. " )
|
||||||
|
inputvalue = input()
|
||||||
|
|
||||||
|
# Copy AMSS-NCKU source files to prepare for compilation
|
||||||
|
# If skipping TwoPuncture and source_copy already exists, remove it first
|
||||||
|
if skip_twopuncture and os.path.exists(AMSS_NCKU_source_copy):
|
||||||
|
shutil.rmtree(AMSS_NCKU_source_copy)
|
||||||
|
|
||||||
|
shutil.copytree(AMSS_NCKU_source_path, AMSS_NCKU_source_copy)
|
||||||
|
|
||||||
|
# Copy the generated macro files into the AMSS_NCKU source folder
|
||||||
|
if not skip_twopuncture:
|
||||||
|
macrodef_h_path = os.path.join(File_directory, "macrodef.h")
|
||||||
|
macrodef_fh_path = os.path.join(File_directory, "macrodef.fh")
|
||||||
|
else:
|
||||||
|
# When skipping TwoPuncture, use existing macro files from previous run
|
||||||
|
macrodef_h_path = os.path.join(File_directory, "macrodef.h")
|
||||||
|
macrodef_fh_path = os.path.join(File_directory, "macrodef.fh")
|
||||||
|
|
||||||
|
shutil.copy2(macrodef_h_path, AMSS_NCKU_source_copy)
|
||||||
|
shutil.copy2(macrodef_fh_path, AMSS_NCKU_source_copy)
|
||||||
|
|
||||||
|
# Compile related programs
|
||||||
|
import makefile_and_run
|
||||||
|
|
||||||
|
## Change working directory to the target source copy
|
||||||
|
os.chdir(AMSS_NCKU_source_copy)
|
||||||
|
|
||||||
|
## Build the main AMSS-NCKU executable (ABE or ABEGPU)
|
||||||
|
makefile_and_run.makefile_ABE()
|
||||||
|
|
||||||
|
## If the initial-data method is Ansorg-TwoPuncture, build the TwoPunctureABE executable
|
||||||
|
## Only build TwoPunctureABE if not skipping TwoPuncture phase
|
||||||
|
if (input_data.Initial_Data_Method == "Ansorg-TwoPuncture" ) and not skip_twopuncture:
|
||||||
|
makefile_and_run.makefile_TwoPunctureABE()
|
||||||
|
|
||||||
|
## Change current working directory back up two levels
|
||||||
|
os.chdir('..')
|
||||||
|
os.chdir('..')
|
||||||
|
|
||||||
|
print()
|
||||||
|
|
||||||
|
##################################################################
|
||||||
|
|
||||||
|
## Copy the AMSS-NCKU executable (ABE/ABEGPU) to the run directory
|
||||||
|
|
||||||
|
if (input_data.GPU_Calculation == "no"):
|
||||||
|
ABE_file = os.path.join(AMSS_NCKU_source_copy, "ABE")
|
||||||
|
elif (input_data.GPU_Calculation == "yes"):
|
||||||
|
ABE_file = os.path.join(AMSS_NCKU_source_copy, "ABEGPU")
|
||||||
|
|
||||||
|
if not os.path.exists( ABE_file ):
|
||||||
|
print()
|
||||||
|
print( " Lack of AMSS-NCKU executable file ABE/ABEGPU; recompile AMSS_NCKU_source manually. " )
|
||||||
|
print( " When recompilation is finished, press Enter to continue. " )
|
||||||
|
inputvalue = input()
|
||||||
|
|
||||||
|
## Copy the executable ABE (or ABEGPU) into the run directory
|
||||||
|
shutil.copy2(ABE_file, output_directory)
|
||||||
|
|
||||||
|
## If the initial-data method is TwoPuncture, copy the TwoPunctureABE executable to the run directory
|
||||||
|
## Only copy TwoPunctureABE if not skipping TwoPuncture phase
|
||||||
|
if (input_data.Initial_Data_Method == "Ansorg-TwoPuncture" ) and not skip_twopuncture:
|
||||||
|
TwoPuncture_file = os.path.join(AMSS_NCKU_source_copy, "TwoPunctureABE")
|
||||||
|
|
||||||
|
if not os.path.exists( TwoPuncture_file ):
|
||||||
|
print()
|
||||||
|
print( " Lack of AMSS-NCKU executable file TwoPunctureABE; recompile TwoPunctureABE in AMSS_NCKU_source. " )
|
||||||
|
print( " When recompilation is finished, press Enter to continue. " )
|
||||||
|
inputvalue = input()
|
||||||
|
|
||||||
|
## Copy the TwoPunctureABE executable into the run directory
|
||||||
|
shutil.copy2(TwoPuncture_file, output_directory)
|
||||||
|
|
||||||
|
##################################################################
|
||||||
|
|
||||||
|
## If the initial-data method is TwoPuncture, generate the TwoPuncture input files
|
||||||
|
|
||||||
|
if (input_data.Initial_Data_Method == "Ansorg-TwoPuncture" ) and not skip_twopuncture:
|
||||||
|
|
||||||
|
print()
|
||||||
|
print( " Initial data is chosen as Ansorg-TwoPuncture" )
|
||||||
|
print()
|
||||||
|
|
||||||
|
print()
|
||||||
|
print( " Automatically generating the input parfile for the TwoPunctureABE executable " )
|
||||||
|
print()
|
||||||
|
|
||||||
|
import generate_TwoPuncture_input
|
||||||
|
|
||||||
|
generate_TwoPuncture_input.generate_AMSSNCKU_TwoPuncture_input()
|
||||||
|
|
||||||
|
print()
|
||||||
|
print( " The input parfile for the TwoPunctureABE executable has been generated. " )
|
||||||
|
print()
|
||||||
|
|
||||||
|
## Generated AMSS-NCKU TwoPuncture input filename
|
||||||
|
AMSS_NCKU_TwoPuncture_inputfile = 'AMSS-NCKU-TwoPuncture.input'
|
||||||
|
AMSS_NCKU_TwoPuncture_inputfile_path = os.path.join( File_directory, AMSS_NCKU_TwoPuncture_inputfile )
|
||||||
|
|
||||||
|
## Copy and rename the file
|
||||||
|
shutil.copy2( AMSS_NCKU_TwoPuncture_inputfile_path, os.path.join(output_directory, 'TwoPunctureinput.par') )
|
||||||
|
|
||||||
|
## Run TwoPuncture to generate initial-data files
|
||||||
|
|
||||||
|
start_time = time.time() # Record start time
|
||||||
|
|
||||||
|
print()
|
||||||
|
print()
|
||||||
|
|
||||||
|
## Change to the output (run) directory
|
||||||
|
os.chdir(output_directory)
|
||||||
|
|
||||||
|
## Run the TwoPuncture executable
|
||||||
|
import makefile_and_run
|
||||||
|
makefile_and_run.run_TwoPunctureABE()
|
||||||
|
|
||||||
|
## Change current working directory back up two levels
|
||||||
|
os.chdir('..')
|
||||||
|
os.chdir('..')
|
||||||
|
|
||||||
|
elif (input_data.Initial_Data_Method == "Ansorg-TwoPuncture" ) and skip_twopuncture:
|
||||||
|
print()
|
||||||
|
print( " Skipping TwoPuncture execution, using existing initial data." )
|
||||||
|
print()
|
||||||
|
start_time = time.time() # Record start time for ABE only
|
||||||
|
else:
|
||||||
|
start_time = time.time() # Record start time
|
||||||
|
|
||||||
|
##################################################################
|
||||||
|
|
||||||
|
## Update puncture data based on TwoPuncture run results
|
||||||
|
|
||||||
|
if not skip_twopuncture:
|
||||||
|
import renew_puncture_parameter
|
||||||
|
renew_puncture_parameter.append_AMSSNCKU_BSSN_input(File_directory, output_directory)
|
||||||
|
|
||||||
|
## Generated AMSS-NCKU input filename
|
||||||
|
AMSS_NCKU_inputfile = 'AMSS-NCKU.input'
|
||||||
|
AMSS_NCKU_inputfile_path = os.path.join(File_directory, AMSS_NCKU_inputfile)
|
||||||
|
|
||||||
|
## Copy and rename the file
|
||||||
|
shutil.copy2( AMSS_NCKU_inputfile_path, os.path.join(output_directory, 'input.par') )
|
||||||
|
|
||||||
|
print()
|
||||||
|
print( " Successfully copy all AMSS-NCKU input parfile to target dictionary. " )
|
||||||
|
print()
|
||||||
|
else:
|
||||||
|
print()
|
||||||
|
print( " Using existing input.par file from previous run." )
|
||||||
|
print()
|
||||||
|
|
||||||
|
##################################################################
|
||||||
|
|
||||||
|
## Launch the AMSS-NCKU program
|
||||||
|
|
||||||
|
print()
|
||||||
|
print()
|
||||||
|
|
||||||
|
## Change to the run directory
|
||||||
|
os.chdir( output_directory )
|
||||||
|
|
||||||
|
import makefile_and_run
|
||||||
|
makefile_and_run.run_ABE()
|
||||||
|
|
||||||
|
## Change current working directory back up two levels
|
||||||
|
os.chdir('..')
|
||||||
|
os.chdir('..')
|
||||||
|
|
||||||
|
end_time = time.time()
|
||||||
|
elapsed_time = end_time - start_time
|
||||||
|
|
||||||
|
##################################################################
|
||||||
|
|
||||||
|
## Copy some basic input and log files out to facilitate debugging
|
||||||
|
|
||||||
|
## Path to the file that stores calculation settings
|
||||||
|
AMSS_NCKU_error_file_path = os.path.join(binary_results_directory, "setting.par")
|
||||||
|
## Copy and rename the file for easier inspection
|
||||||
|
shutil.copy( AMSS_NCKU_error_file_path, os.path.join(output_directory, "AMSSNCKU_setting_parameter") )
|
||||||
|
|
||||||
|
## Path to the error log file
|
||||||
|
AMSS_NCKU_error_file_path = os.path.join(binary_results_directory, "Error.log")
|
||||||
|
## Copy and rename the error log
|
||||||
|
shutil.copy( AMSS_NCKU_error_file_path, os.path.join(output_directory, "Error.log") )
|
||||||
|
|
||||||
|
## Primary program outputs
|
||||||
|
AMSS_NCKU_BH_data = os.path.join(binary_results_directory, "bssn_BH.dat" )
|
||||||
|
AMSS_NCKU_ADM_data = os.path.join(binary_results_directory, "bssn_ADMQs.dat" )
|
||||||
|
AMSS_NCKU_psi4_data = os.path.join(binary_results_directory, "bssn_psi4.dat" )
|
||||||
|
AMSS_NCKU_constraint_data = os.path.join(binary_results_directory, "bssn_constraint.dat")
|
||||||
|
## copy and rename the file
|
||||||
|
shutil.copy( AMSS_NCKU_BH_data, os.path.join(output_directory, "bssn_BH.dat" ) )
|
||||||
|
shutil.copy( AMSS_NCKU_ADM_data, os.path.join(output_directory, "bssn_ADMQs.dat" ) )
|
||||||
|
shutil.copy( AMSS_NCKU_psi4_data, os.path.join(output_directory, "bssn_psi4.dat" ) )
|
||||||
|
shutil.copy( AMSS_NCKU_constraint_data, os.path.join(output_directory, "bssn_constraint.dat") )
|
||||||
|
|
||||||
|
## Additional program outputs
|
||||||
|
if (input_data.Equation_Class == "BSSN-EM"):
|
||||||
|
AMSS_NCKU_phi1_data = os.path.join(binary_results_directory, "bssn_phi1.dat" )
|
||||||
|
AMSS_NCKU_phi2_data = os.path.join(binary_results_directory, "bssn_phi2.dat" )
|
||||||
|
shutil.copy( AMSS_NCKU_phi1_data, os.path.join(output_directory, "bssn_phi1.dat" ) )
|
||||||
|
shutil.copy( AMSS_NCKU_phi2_data, os.path.join(output_directory, "bssn_phi2.dat" ) )
|
||||||
|
elif (input_data.Equation_Class == "BSSN-EScalar"):
|
||||||
|
AMSS_NCKU_maxs_data = os.path.join(binary_results_directory, "bssn_maxs.dat" )
|
||||||
|
shutil.copy( AMSS_NCKU_maxs_data, os.path.join(output_directory, "bssn_maxs.dat" ) )
|
||||||
|
|
||||||
|
##################################################################
|
||||||
|
|
||||||
|
## Plot the AMSS-NCKU program results
|
||||||
|
|
||||||
|
print()
|
||||||
|
print( " Plotting the txt and binary results data from the AMSS-NCKU simulation " )
|
||||||
|
print()
|
||||||
|
|
||||||
|
|
||||||
|
import plot_xiaoqu
|
||||||
|
import plot_GW_strain_amplitude_xiaoqu
|
||||||
|
|
||||||
|
## Plot black hole trajectory
|
||||||
|
plot_xiaoqu.generate_puncture_orbit_plot( binary_results_directory, figure_directory )
|
||||||
|
plot_xiaoqu.generate_puncture_orbit_plot3D( binary_results_directory, figure_directory )
|
||||||
|
|
||||||
|
## Plot black hole separation vs. time
|
||||||
|
plot_xiaoqu.generate_puncture_distence_plot( binary_results_directory, figure_directory )
|
||||||
|
|
||||||
|
## Plot gravitational waveforms (psi4 and strain amplitude)
|
||||||
|
for i in range(input_data.Detector_Number):
|
||||||
|
plot_xiaoqu.generate_gravitational_wave_psi4_plot( binary_results_directory, figure_directory, i )
|
||||||
|
plot_GW_strain_amplitude_xiaoqu.generate_gravitational_wave_amplitude_plot( binary_results_directory, figure_directory, i )
|
||||||
|
|
||||||
|
## Plot ADM mass evolution
|
||||||
|
for i in range(input_data.Detector_Number):
|
||||||
|
plot_xiaoqu.generate_ADMmass_plot( binary_results_directory, figure_directory, i )
|
||||||
|
|
||||||
|
## Plot Hamiltonian constraint violation over time
|
||||||
|
for i in range(input_data.grid_level):
|
||||||
|
plot_xiaoqu.generate_constraint_check_plot( binary_results_directory, figure_directory, i )
|
||||||
|
|
||||||
|
## Plot stored binary data
|
||||||
|
plot_xiaoqu.generate_binary_data_plot( binary_results_directory, figure_directory )
|
||||||
|
|
||||||
|
print()
|
||||||
|
print( f" This Program Cost = {elapsed_time} Seconds " )
|
||||||
|
print()
|
||||||
|
|
||||||
|
|
||||||
|
##################################################################
|
||||||
|
|
||||||
|
print()
|
||||||
|
print( " The AMSS-NCKU-Python simulation is successfully finished, thanks for using !!! " )
|
||||||
|
print()
|
||||||
|
|
||||||
|
##################################################################
|
||||||
|
|
||||||
|
|
||||||
@@ -9,16 +9,6 @@
|
|||||||
##################################################################
|
##################################################################
|
||||||
|
|
||||||
|
|
||||||
##################################################################
|
|
||||||
|
|
||||||
## Guard against re-execution by multiprocessing child processes.
|
|
||||||
## Without this, using 'spawn' or 'forkserver' context would cause every
|
|
||||||
## worker to re-run the entire script.
|
|
||||||
if __name__ != '__main__':
|
|
||||||
import sys as _sys
|
|
||||||
_sys.exit(0)
|
|
||||||
|
|
||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
|
|
||||||
## Print program introduction
|
## Print program introduction
|
||||||
@@ -434,31 +424,26 @@ print(
|
|||||||
|
|
||||||
import plot_xiaoqu
|
import plot_xiaoqu
|
||||||
import plot_GW_strain_amplitude_xiaoqu
|
import plot_GW_strain_amplitude_xiaoqu
|
||||||
from parallel_plot_helper import run_plot_tasks_parallel
|
|
||||||
|
|
||||||
plot_tasks = []
|
|
||||||
|
|
||||||
## Plot black hole trajectory
|
## Plot black hole trajectory
|
||||||
plot_tasks.append( ( plot_xiaoqu.generate_puncture_orbit_plot, (binary_results_directory, figure_directory) ) )
|
plot_xiaoqu.generate_puncture_orbit_plot( binary_results_directory, figure_directory )
|
||||||
plot_tasks.append( ( plot_xiaoqu.generate_puncture_orbit_plot3D, (binary_results_directory, figure_directory) ) )
|
plot_xiaoqu.generate_puncture_orbit_plot3D( binary_results_directory, figure_directory )
|
||||||
|
|
||||||
## Plot black hole separation vs. time
|
## Plot black hole separation vs. time
|
||||||
plot_tasks.append( ( plot_xiaoqu.generate_puncture_distence_plot, (binary_results_directory, figure_directory) ) )
|
plot_xiaoqu.generate_puncture_distence_plot( binary_results_directory, figure_directory )
|
||||||
|
|
||||||
## Plot gravitational waveforms (psi4 and strain amplitude)
|
## Plot gravitational waveforms (psi4 and strain amplitude)
|
||||||
for i in range(input_data.Detector_Number):
|
for i in range(input_data.Detector_Number):
|
||||||
plot_tasks.append( ( plot_xiaoqu.generate_gravitational_wave_psi4_plot, (binary_results_directory, figure_directory, i) ) )
|
plot_xiaoqu.generate_gravitational_wave_psi4_plot( binary_results_directory, figure_directory, i )
|
||||||
plot_tasks.append( ( plot_GW_strain_amplitude_xiaoqu.generate_gravitational_wave_amplitude_plot, (binary_results_directory, figure_directory, i) ) )
|
plot_GW_strain_amplitude_xiaoqu.generate_gravitational_wave_amplitude_plot( binary_results_directory, figure_directory, i )
|
||||||
|
|
||||||
## Plot ADM mass evolution
|
## Plot ADM mass evolution
|
||||||
for i in range(input_data.Detector_Number):
|
for i in range(input_data.Detector_Number):
|
||||||
plot_tasks.append( ( plot_xiaoqu.generate_ADMmass_plot, (binary_results_directory, figure_directory, i) ) )
|
plot_xiaoqu.generate_ADMmass_plot( binary_results_directory, figure_directory, i )
|
||||||
|
|
||||||
## Plot Hamiltonian constraint violation over time
|
## Plot Hamiltonian constraint violation over time
|
||||||
for i in range(input_data.grid_level):
|
for i in range(input_data.grid_level):
|
||||||
plot_tasks.append( ( plot_xiaoqu.generate_constraint_check_plot, (binary_results_directory, figure_directory, i) ) )
|
plot_xiaoqu.generate_constraint_check_plot( binary_results_directory, figure_directory, i )
|
||||||
|
|
||||||
run_plot_tasks_parallel(plot_tasks)
|
|
||||||
|
|
||||||
## Plot stored binary data
|
## Plot stored binary data
|
||||||
plot_xiaoqu.generate_binary_data_plot( binary_results_directory, figure_directory )
|
plot_xiaoqu.generate_binary_data_plot( binary_results_directory, figure_directory )
|
||||||
|
|||||||
279
AMSS_NCKU_Verify_ASC26.py
Normal file
279
AMSS_NCKU_Verify_ASC26.py
Normal file
@@ -0,0 +1,279 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
AMSS-NCKU GW150914 Simulation Regression Test Script
|
||||||
|
|
||||||
|
Verification Requirements:
|
||||||
|
1. XY-plane trajectory RMS error < 1% (Optimized vs. baseline, max of BH1 and BH2)
|
||||||
|
2. ADM constraint violation < 2 (Grid Level 0)
|
||||||
|
|
||||||
|
RMS Calculation Method:
|
||||||
|
- Computes trajectory deviation on the XY plane independently for BH1 and BH2
|
||||||
|
- For each black hole: RMS = sqrt((1/M) * sum((Δr_i / r_i^max)^2)) × 100%
|
||||||
|
- Final RMS = max(RMS_BH1, RMS_BH2)
|
||||||
|
|
||||||
|
Usage: python3 AMSS_NCKU_Verify_ASC26.py [output_dir]
|
||||||
|
Default: output_dir = GW150914/AMSS_NCKU_output
|
||||||
|
Reference: GW150914-origin (baseline simulation)
|
||||||
|
"""
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
|
# ANSI Color Codes
|
||||||
|
class Color:
|
||||||
|
GREEN = '\033[92m'
|
||||||
|
RED = '\033[91m'
|
||||||
|
YELLOW = '\033[93m'
|
||||||
|
BLUE = '\033[94m'
|
||||||
|
BOLD = '\033[1m'
|
||||||
|
RESET = '\033[0m'
|
||||||
|
|
||||||
|
def get_status_text(passed):
|
||||||
|
if passed:
|
||||||
|
return f"{Color.GREEN}{Color.BOLD}PASS{Color.RESET}"
|
||||||
|
else:
|
||||||
|
return f"{Color.RED}{Color.BOLD}FAIL{Color.RESET}"
|
||||||
|
|
||||||
|
def load_bh_trajectory(filepath):
|
||||||
|
"""Load black hole trajectory data"""
|
||||||
|
data = np.loadtxt(filepath)
|
||||||
|
return {
|
||||||
|
'time': data[:, 0],
|
||||||
|
'x1': data[:, 1], 'y1': data[:, 2], 'z1': data[:, 3],
|
||||||
|
'x2': data[:, 4], 'y2': data[:, 5], 'z2': data[:, 6]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def load_constraint_data(filepath):
|
||||||
|
"""Load constraint violation data"""
|
||||||
|
data = []
|
||||||
|
with open(filepath, 'r') as f:
|
||||||
|
for line in f:
|
||||||
|
if line.startswith('#'):
|
||||||
|
continue
|
||||||
|
parts = line.split()
|
||||||
|
if len(parts) >= 8:
|
||||||
|
data.append([float(x) for x in parts[:8]])
|
||||||
|
return np.array(data)
|
||||||
|
|
||||||
|
|
||||||
|
def calculate_rms_error(bh_data_ref, bh_data_target):
|
||||||
|
"""
|
||||||
|
Calculate trajectory-based RMS error on the XY plane between baseline and optimized simulations.
|
||||||
|
|
||||||
|
This function computes the RMS error independently for BH1 and BH2 trajectories,
|
||||||
|
then returns the maximum of the two as the final RMS error metric.
|
||||||
|
|
||||||
|
For each black hole, the RMS is calculated as:
|
||||||
|
RMS = sqrt( (1/M) * sum( (Δr_i / r_i^max)^2 ) ) × 100%
|
||||||
|
|
||||||
|
where:
|
||||||
|
Δr_i = sqrt((x_ref,i - x_new,i)^2 + (y_ref,i - y_new,i)^2)
|
||||||
|
r_i^max = max(sqrt(x_ref,i^2 + y_ref,i^2), sqrt(x_new,i^2 + y_new,i^2))
|
||||||
|
|
||||||
|
Args:
|
||||||
|
bh_data_ref: Reference (baseline) trajectory data
|
||||||
|
bh_data_target: Target (optimized) trajectory data
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
rms_value: Final RMS error as a percentage (max of BH1 and BH2)
|
||||||
|
error: Error message if any
|
||||||
|
"""
|
||||||
|
# Align data: truncate to the length of the shorter dataset
|
||||||
|
M = min(len(bh_data_ref['time']), len(bh_data_target['time']))
|
||||||
|
|
||||||
|
if M < 10:
|
||||||
|
return None, "Insufficient data points for comparison"
|
||||||
|
|
||||||
|
# Extract XY coordinates for both black holes
|
||||||
|
x1_ref = bh_data_ref['x1'][:M]
|
||||||
|
y1_ref = bh_data_ref['y1'][:M]
|
||||||
|
x2_ref = bh_data_ref['x2'][:M]
|
||||||
|
y2_ref = bh_data_ref['y2'][:M]
|
||||||
|
|
||||||
|
x1_new = bh_data_target['x1'][:M]
|
||||||
|
y1_new = bh_data_target['y1'][:M]
|
||||||
|
x2_new = bh_data_target['x2'][:M]
|
||||||
|
y2_new = bh_data_target['y2'][:M]
|
||||||
|
|
||||||
|
# Calculate RMS for BH1
|
||||||
|
delta_r1 = np.sqrt((x1_ref - x1_new)**2 + (y1_ref - y1_new)**2)
|
||||||
|
r1_ref = np.sqrt(x1_ref**2 + y1_ref**2)
|
||||||
|
r1_new = np.sqrt(x1_new**2 + y1_new**2)
|
||||||
|
r1_max = np.maximum(r1_ref, r1_new)
|
||||||
|
|
||||||
|
# Calculate RMS for BH2
|
||||||
|
delta_r2 = np.sqrt((x2_ref - x2_new)**2 + (y2_ref - y2_new)**2)
|
||||||
|
r2_ref = np.sqrt(x2_ref**2 + y2_ref**2)
|
||||||
|
r2_new = np.sqrt(x2_new**2 + y2_new**2)
|
||||||
|
r2_max = np.maximum(r2_ref, r2_new)
|
||||||
|
|
||||||
|
# Avoid division by zero for BH1
|
||||||
|
valid_mask1 = r1_max > 1e-15
|
||||||
|
if np.sum(valid_mask1) < 10:
|
||||||
|
return None, "Insufficient valid data points for BH1"
|
||||||
|
|
||||||
|
terms1 = (delta_r1[valid_mask1] / r1_max[valid_mask1])**2
|
||||||
|
rms_bh1 = np.sqrt(np.mean(terms1)) * 100
|
||||||
|
|
||||||
|
# Avoid division by zero for BH2
|
||||||
|
valid_mask2 = r2_max > 1e-15
|
||||||
|
if np.sum(valid_mask2) < 10:
|
||||||
|
return None, "Insufficient valid data points for BH2"
|
||||||
|
|
||||||
|
terms2 = (delta_r2[valid_mask2] / r2_max[valid_mask2])**2
|
||||||
|
rms_bh2 = np.sqrt(np.mean(terms2)) * 100
|
||||||
|
|
||||||
|
# Final RMS is the maximum of BH1 and BH2
|
||||||
|
rms_final = max(rms_bh1, rms_bh2)
|
||||||
|
|
||||||
|
return rms_final, None
|
||||||
|
|
||||||
|
|
||||||
|
def analyze_constraint_violation(constraint_data, n_levels=9):
|
||||||
|
"""
|
||||||
|
Analyze ADM constraint violation
|
||||||
|
Return maximum constraint violation for Grid Level 0
|
||||||
|
"""
|
||||||
|
# Extract Grid Level 0 data (first entry for each time step)
|
||||||
|
level0_data = constraint_data[::n_levels]
|
||||||
|
|
||||||
|
# Calculate maximum absolute value for each constraint
|
||||||
|
results = {
|
||||||
|
'Ham': np.max(np.abs(level0_data[:, 1])),
|
||||||
|
'Px': np.max(np.abs(level0_data[:, 2])),
|
||||||
|
'Py': np.max(np.abs(level0_data[:, 3])),
|
||||||
|
'Pz': np.max(np.abs(level0_data[:, 4])),
|
||||||
|
'Gx': np.max(np.abs(level0_data[:, 5])),
|
||||||
|
'Gy': np.max(np.abs(level0_data[:, 6])),
|
||||||
|
'Gz': np.max(np.abs(level0_data[:, 7]))
|
||||||
|
}
|
||||||
|
|
||||||
|
results['max_violation'] = max(results.values())
|
||||||
|
return results
|
||||||
|
|
||||||
|
|
||||||
|
def print_header():
|
||||||
|
"""Print report header"""
|
||||||
|
print("\n" + Color.BLUE + Color.BOLD + "=" * 65 + Color.RESET)
|
||||||
|
print(Color.BOLD + " AMSS-NCKU GW150914 Simulation Regression Test Report" + Color.RESET)
|
||||||
|
print(Color.BLUE + Color.BOLD + "=" * 65 + Color.RESET)
|
||||||
|
|
||||||
|
|
||||||
|
def print_rms_results(rms_rel, error, threshold=1.0):
|
||||||
|
"""Print RMS error results"""
|
||||||
|
print(f"\n{Color.BOLD}1. RMS Error Analysis (Baseline vs Optimized){Color.RESET}")
|
||||||
|
print("-" * 45)
|
||||||
|
|
||||||
|
if error:
|
||||||
|
print(f" {Color.RED}Error: {error}{Color.RESET}")
|
||||||
|
return False
|
||||||
|
|
||||||
|
passed = rms_rel < threshold
|
||||||
|
|
||||||
|
print(f" RMS relative error: {rms_rel:.4f}%")
|
||||||
|
print(f" Requirement: < {threshold}%")
|
||||||
|
print(f" Status: {get_status_text(passed)}")
|
||||||
|
|
||||||
|
return passed
|
||||||
|
|
||||||
|
|
||||||
|
def print_constraint_results(results, threshold=2.0):
|
||||||
|
"""Print constraint violation results"""
|
||||||
|
print(f"\n{Color.BOLD}2. ADM Constraint Violation Analysis (Grid Level 0){Color.RESET}")
|
||||||
|
print("-" * 45)
|
||||||
|
|
||||||
|
names = ['Ham', 'Px', 'Py', 'Pz', 'Gx', 'Gy', 'Gz']
|
||||||
|
for i, name in enumerate(names):
|
||||||
|
print(f" Max |{name:3}|: {results[name]:.6f}", end=" ")
|
||||||
|
if (i + 1) % 2 == 0: print()
|
||||||
|
if len(names) % 2 != 0: print()
|
||||||
|
|
||||||
|
passed = results['max_violation'] < threshold
|
||||||
|
|
||||||
|
print(f"\n Maximum violation: {results['max_violation']:.6f}")
|
||||||
|
print(f" Requirement: < {threshold}")
|
||||||
|
print(f" Status: {get_status_text(passed)}")
|
||||||
|
|
||||||
|
return passed
|
||||||
|
|
||||||
|
|
||||||
|
def print_summary(rms_passed, constraint_passed):
|
||||||
|
"""Print summary"""
|
||||||
|
print("\n" + Color.BLUE + Color.BOLD + "=" * 65 + Color.RESET)
|
||||||
|
print(Color.BOLD + "Verification Summary" + Color.RESET)
|
||||||
|
print(Color.BLUE + Color.BOLD + "=" * 65 + Color.RESET)
|
||||||
|
|
||||||
|
all_passed = rms_passed and constraint_passed
|
||||||
|
|
||||||
|
res_rms = get_status_text(rms_passed)
|
||||||
|
res_con = get_status_text(constraint_passed)
|
||||||
|
|
||||||
|
print(f" [1] RMS trajectory check: {res_rms}")
|
||||||
|
print(f" [2] ADM constraint check: {res_con}")
|
||||||
|
|
||||||
|
final_status = f"{Color.GREEN}{Color.BOLD}ALL CHECKS PASSED{Color.RESET}" if all_passed else f"{Color.RED}{Color.BOLD}SOME CHECKS FAILED{Color.RESET}"
|
||||||
|
print(f"\n Overall result: {final_status}")
|
||||||
|
print(Color.BLUE + Color.BOLD + "=" * 65 + Color.RESET + "\n")
|
||||||
|
|
||||||
|
return all_passed
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
# Determine target (optimized) output directory
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
target_dir = sys.argv[1]
|
||||||
|
else:
|
||||||
|
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
target_dir = os.path.join(script_dir, "GW150914/AMSS_NCKU_output")
|
||||||
|
|
||||||
|
# Determine reference (baseline) directory
|
||||||
|
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
reference_dir = os.path.join(script_dir, "GW150914-origin/AMSS_NCKU_output")
|
||||||
|
|
||||||
|
# Data file paths
|
||||||
|
bh_file_ref = os.path.join(reference_dir, "bssn_BH.dat")
|
||||||
|
bh_file_target = os.path.join(target_dir, "bssn_BH.dat")
|
||||||
|
constraint_file = os.path.join(target_dir, "bssn_constraint.dat")
|
||||||
|
|
||||||
|
# Check if files exist
|
||||||
|
if not os.path.exists(bh_file_ref):
|
||||||
|
print(f"{Color.RED}{Color.BOLD}Error:{Color.RESET} Baseline trajectory file not found: {bh_file_ref}")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if not os.path.exists(bh_file_target):
|
||||||
|
print(f"{Color.RED}{Color.BOLD}Error:{Color.RESET} Target trajectory file not found: {bh_file_target}")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if not os.path.exists(constraint_file):
|
||||||
|
print(f"{Color.RED}{Color.BOLD}Error:{Color.RESET} Constraint data file not found: {constraint_file}")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
# Print header
|
||||||
|
print_header()
|
||||||
|
print(f"\n{Color.BOLD}Reference (Baseline):{Color.RESET} {Color.BLUE}{reference_dir}{Color.RESET}")
|
||||||
|
print(f"{Color.BOLD}Target (Optimized): {Color.RESET} {Color.BLUE}{target_dir}{Color.RESET}")
|
||||||
|
|
||||||
|
# Load data
|
||||||
|
bh_data_ref = load_bh_trajectory(bh_file_ref)
|
||||||
|
bh_data_target = load_bh_trajectory(bh_file_target)
|
||||||
|
constraint_data = load_constraint_data(constraint_file)
|
||||||
|
|
||||||
|
# Calculate RMS error
|
||||||
|
rms_rel, error = calculate_rms_error(bh_data_ref, bh_data_target)
|
||||||
|
rms_passed = print_rms_results(rms_rel, error)
|
||||||
|
|
||||||
|
# Analyze constraint violation
|
||||||
|
constraint_results = analyze_constraint_violation(constraint_data)
|
||||||
|
constraint_passed = print_constraint_results(constraint_results)
|
||||||
|
|
||||||
|
# Print summary
|
||||||
|
all_passed = print_summary(rms_passed, constraint_passed)
|
||||||
|
|
||||||
|
# Return exit code
|
||||||
|
sys.exit(0 if all_passed else 1)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -37,57 +37,51 @@ close(77)
|
|||||||
end program checkFFT
|
end program checkFFT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
!-------------
|
||||||
|
! Optimized FFT using Intel oneMKL DFTI
|
||||||
|
! Mathematical equivalence: Standard DFT definition
|
||||||
|
! Forward (isign=1): X[k] = sum_{n=0}^{N-1} x[n] * exp(-2*pi*i*k*n/N)
|
||||||
|
! Backward (isign=-1): X[k] = sum_{n=0}^{N-1} x[n] * exp(+2*pi*i*k*n/N)
|
||||||
|
! Input/Output: dataa is interleaved complex array [Re(0),Im(0),Re(1),Im(1),...]
|
||||||
!-------------
|
!-------------
|
||||||
SUBROUTINE four1(dataa,nn,isign)
|
SUBROUTINE four1(dataa,nn,isign)
|
||||||
|
use MKL_DFTI
|
||||||
implicit none
|
implicit none
|
||||||
INTEGER::isign,nn
|
INTEGER, intent(in) :: isign, nn
|
||||||
double precision,dimension(2*nn)::dataa
|
DOUBLE PRECISION, dimension(2*nn), intent(inout) :: dataa
|
||||||
INTEGER::i,istep,j,m,mmax,n
|
|
||||||
double precision::tempi,tempr
|
type(DFTI_DESCRIPTOR), pointer :: desc
|
||||||
DOUBLE PRECISION::theta,wi,wpi,wpr,wr,wtemp
|
integer :: status
|
||||||
n=2*nn
|
|
||||||
j=1
|
! Create DFTI descriptor for 1D complex-to-complex transform
|
||||||
do i=1,n,2
|
status = DftiCreateDescriptor(desc, DFTI_DOUBLE, DFTI_COMPLEX, 1, nn)
|
||||||
if(j.gt.i)then
|
if (status /= 0) return
|
||||||
tempr=dataa(j)
|
|
||||||
tempi=dataa(j+1)
|
! Set input/output storage as interleaved complex (default)
|
||||||
dataa(j)=dataa(i)
|
status = DftiSetValue(desc, DFTI_PLACEMENT, DFTI_INPLACE)
|
||||||
dataa(j+1)=dataa(i+1)
|
if (status /= 0) then
|
||||||
dataa(i)=tempr
|
status = DftiFreeDescriptor(desc)
|
||||||
dataa(i+1)=tempi
|
return
|
||||||
endif
|
|
||||||
m=nn
|
|
||||||
1 if ((m.ge.2).and.(j.gt.m)) then
|
|
||||||
j=j-m
|
|
||||||
m=m/2
|
|
||||||
goto 1
|
|
||||||
endif
|
|
||||||
j=j+m
|
|
||||||
enddo
|
|
||||||
mmax=2
|
|
||||||
2 if (n.gt.mmax) then
|
|
||||||
istep=2*mmax
|
|
||||||
theta=6.28318530717959d0/(isign*mmax)
|
|
||||||
wpr=-2.d0*sin(0.5d0*theta)**2
|
|
||||||
wpi=sin(theta)
|
|
||||||
wr=1.d0
|
|
||||||
wi=0.d0
|
|
||||||
do m=1,mmax,2
|
|
||||||
do i=m,n,istep
|
|
||||||
j=i+mmax
|
|
||||||
tempr=sngl(wr)*dataa(j)-sngl(wi)*dataa(j+1)
|
|
||||||
tempi=sngl(wr)*dataa(j+1)+sngl(wi)*dataa(j)
|
|
||||||
dataa(j)=dataa(i)-tempr
|
|
||||||
dataa(j+1)=dataa(i+1)-tempi
|
|
||||||
dataa(i)=dataa(i)+tempr
|
|
||||||
dataa(i+1)=dataa(i+1)+tempi
|
|
||||||
enddo
|
|
||||||
wtemp=wr
|
|
||||||
wr=wr*wpr-wi*wpi+wr
|
|
||||||
wi=wi*wpr+wtemp*wpi+wi
|
|
||||||
enddo
|
|
||||||
mmax=istep
|
|
||||||
goto 2
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
! Commit the descriptor
|
||||||
|
status = DftiCommitDescriptor(desc)
|
||||||
|
if (status /= 0) then
|
||||||
|
status = DftiFreeDescriptor(desc)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
! Execute FFT based on direction
|
||||||
|
if (isign == 1) then
|
||||||
|
! Forward FFT: exp(-2*pi*i*k*n/N)
|
||||||
|
status = DftiComputeForward(desc, dataa)
|
||||||
|
else
|
||||||
|
! Backward FFT: exp(+2*pi*i*k*n/N)
|
||||||
|
status = DftiComputeBackward(desc, dataa)
|
||||||
|
endif
|
||||||
|
|
||||||
|
! Free descriptor
|
||||||
|
status = DftiFreeDescriptor(desc)
|
||||||
|
|
||||||
return
|
return
|
||||||
END SUBROUTINE four1
|
END SUBROUTINE four1
|
||||||
|
|||||||
@@ -106,7 +106,8 @@
|
|||||||
call getpbh(BHN,Porg,Mass)
|
call getpbh(BHN,Porg,Mass)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
!!! sanity check
|
!!! sanity check (disabled in production builds for performance)
|
||||||
|
#ifdef DEBUG
|
||||||
dX = sum(chi)+sum(trK)+sum(dxx)+sum(gxy)+sum(gxz)+sum(dyy)+sum(gyz)+sum(dzz) &
|
dX = sum(chi)+sum(trK)+sum(dxx)+sum(gxy)+sum(gxz)+sum(dyy)+sum(gyz)+sum(dzz) &
|
||||||
+sum(Axx)+sum(Axy)+sum(Axz)+sum(Ayy)+sum(Ayz)+sum(Azz) &
|
+sum(Axx)+sum(Axy)+sum(Axz)+sum(Ayy)+sum(Ayz)+sum(Azz) &
|
||||||
+sum(Gamx)+sum(Gamy)+sum(Gamz) &
|
+sum(Gamx)+sum(Gamy)+sum(Gamz) &
|
||||||
@@ -136,6 +137,7 @@
|
|||||||
gont = 1
|
gont = 1
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
#endif
|
||||||
|
|
||||||
PI = dacos(-ONE)
|
PI = dacos(-ONE)
|
||||||
|
|
||||||
@@ -159,36 +161,8 @@
|
|||||||
|
|
||||||
chi_rhs = F2o3 *chin1*( alpn1 * trK - div_beta ) !rhs for chi
|
chi_rhs = F2o3 *chin1*( alpn1 * trK - div_beta ) !rhs for chi
|
||||||
|
|
||||||
call fderivs(ex,dxx,gxxx,gxxy,gxxz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,Lev)
|
|
||||||
call fderivs(ex,gxy,gxyx,gxyy,gxyz,X,Y,Z,ANTI,ANTI,SYM ,Symmetry,Lev)
|
|
||||||
call fderivs(ex,gxz,gxzx,gxzy,gxzz,X,Y,Z,ANTI,SYM ,ANTI,Symmetry,Lev)
|
|
||||||
call fderivs(ex,dyy,gyyx,gyyy,gyyz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,Lev)
|
|
||||||
call fderivs(ex,gyz,gyzx,gyzy,gyzz,X,Y,Z,SYM ,ANTI,ANTI,Symmetry,Lev)
|
|
||||||
call fderivs(ex,dzz,gzzx,gzzy,gzzz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,Lev)
|
|
||||||
|
|
||||||
gxx_rhs = - TWO * alpn1 * Axx - F2o3 * gxx * div_beta + &
|
|
||||||
TWO *( gxx * betaxx + gxy * betayx + gxz * betazx)
|
|
||||||
|
|
||||||
gyy_rhs = - TWO * alpn1 * Ayy - F2o3 * gyy * div_beta + &
|
|
||||||
TWO *( gxy * betaxy + gyy * betayy + gyz * betazy)
|
|
||||||
|
|
||||||
gzz_rhs = - TWO * alpn1 * Azz - F2o3 * gzz * div_beta + &
|
|
||||||
TWO *( gxz * betaxz + gyz * betayz + gzz * betazz)
|
|
||||||
|
|
||||||
gxy_rhs = - TWO * alpn1 * Axy + F1o3 * gxy * div_beta + &
|
|
||||||
gxx * betaxy + gxz * betazy + &
|
|
||||||
gyy * betayx + gyz * betazx &
|
|
||||||
- gxy * betazz
|
|
||||||
|
|
||||||
gyz_rhs = - TWO * alpn1 * Ayz + F1o3 * gyz * div_beta + &
|
|
||||||
gxy * betaxz + gyy * betayz + &
|
|
||||||
gxz * betaxy + gzz * betazy &
|
|
||||||
- gyz * betaxx
|
|
||||||
|
|
||||||
gxz_rhs = - TWO * alpn1 * Axz + F1o3 * gxz * div_beta + &
|
|
||||||
gxx * betaxz + gxy * betayz + &
|
|
||||||
gyz * betayx + gzz * betazx &
|
|
||||||
- gxz * betayy !rhs for gij
|
|
||||||
|
|
||||||
! invert tilted metric
|
! invert tilted metric
|
||||||
gupzz = gxx * gyy * gzz + gxy * gyz * gxz + gxz * gxy * gyz - &
|
gupzz = gxx * gyy * gzz + gxy * gyz * gxz + gxz * gxy * gyz - &
|
||||||
@@ -199,7 +173,12 @@
|
|||||||
gupyy = ( gxx * gzz - gxz * gxz ) / gupzz
|
gupyy = ( gxx * gzz - gxz * gxz ) / gupzz
|
||||||
gupyz = - ( gxx * gyz - gxy * gxz ) / gupzz
|
gupyz = - ( gxx * gyz - gxy * gxz ) / gupzz
|
||||||
gupzz = ( gxx * gyy - gxy * gxy ) / gupzz
|
gupzz = ( gxx * gyy - gxy * gxy ) / gupzz
|
||||||
|
call fderivs(ex,dxx,gxxx,gxxy,gxxz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,Lev)
|
||||||
|
call fderivs(ex,gxy,gxyx,gxyy,gxyz,X,Y,Z,ANTI,ANTI,SYM ,Symmetry,Lev)
|
||||||
|
call fderivs(ex,gxz,gxzx,gxzy,gxzz,X,Y,Z,ANTI,SYM ,ANTI,Symmetry,Lev)
|
||||||
|
call fderivs(ex,dyy,gyyx,gyyy,gyyz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,Lev)
|
||||||
|
call fderivs(ex,gyz,gyzx,gyzy,gyzz,X,Y,Z,SYM ,ANTI,ANTI,Symmetry,Lev)
|
||||||
|
call fderivs(ex,dzz,gzzx,gzzy,gzzz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,Lev)
|
||||||
if(co == 0)then
|
if(co == 0)then
|
||||||
! Gam^i_Res = Gam^i + gup^ij_,j
|
! Gam^i_Res = Gam^i + gup^ij_,j
|
||||||
Gmx_Res = Gamx - (gupxx*(gupxx*gxxx+gupxy*gxyx+gupxz*gxzx)&
|
Gmx_Res = Gamx - (gupxx*(gupxx*gxxx+gupxy*gxyx+gupxz*gxzx)&
|
||||||
@@ -945,99 +924,99 @@
|
|||||||
|
|
||||||
!!!!!!!!!advection term part
|
!!!!!!!!!advection term part
|
||||||
|
|
||||||
|
gxx_rhs = - TWO * alpn1 * Axx - F2o3 * gxx * div_beta + &
|
||||||
|
TWO *( gxx * betaxx + gxy * betayx + gxz * betazx)
|
||||||
|
|
||||||
|
gyy_rhs = - TWO * alpn1 * Ayy - F2o3 * gyy * div_beta + &
|
||||||
|
TWO *( gxy * betaxy + gyy * betayy + gyz * betazy)
|
||||||
|
|
||||||
|
gzz_rhs = - TWO * alpn1 * Azz - F2o3 * gzz * div_beta + &
|
||||||
|
TWO *( gxz * betaxz + gyz * betayz + gzz * betazz)
|
||||||
|
|
||||||
|
gxy_rhs = - TWO * alpn1 * Axy + F1o3 * gxy * div_beta + &
|
||||||
|
gxx * betaxy + gxz * betazy + &
|
||||||
|
gyy * betayx + gyz * betazx &
|
||||||
|
- gxy * betazz
|
||||||
|
|
||||||
|
gyz_rhs = - TWO * alpn1 * Ayz + F1o3 * gyz * div_beta + &
|
||||||
|
gxy * betaxz + gyy * betayz + &
|
||||||
|
gxz * betaxy + gzz * betazy &
|
||||||
|
- gyz * betaxx
|
||||||
|
|
||||||
|
gxz_rhs = - TWO * alpn1 * Axz + F1o3 * gxz * div_beta + &
|
||||||
|
gxx * betaxz + gxy * betayz + &
|
||||||
|
gyz * betayx + gzz * betazx &
|
||||||
|
- gxz * betayy !rhs for gij
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(eps>0)then
|
||||||
|
! usual Kreiss-Oliger dissipation
|
||||||
|
call merge_lopsided_kodis(ex,X,Y,Z,chi,chi_rhs,betax,betay,betaz,Symmetry,SSS,eps)
|
||||||
|
call merge_lopsided_kodis(ex,X,Y,Z,gxx,gxx_rhs,betax,betay,betaz,Symmetry,SSS,eps)
|
||||||
|
call merge_lopsided_kodis(ex,X,Y,Z,gxy,gxy_rhs,betax,betay,betaz,Symmetry,AAS,eps)
|
||||||
|
call merge_lopsided_kodis(ex,X,Y,Z,gxz,gxz_rhs,betax,betay,betaz,Symmetry,ASA,eps)
|
||||||
|
call merge_lopsided_kodis(ex,X,Y,Z,gyy,gyy_rhs,betax,betay,betaz,Symmetry,SSS,eps)
|
||||||
|
call merge_lopsided_kodis(ex,X,Y,Z,gyz,gyz_rhs,betax,betay,betaz,Symmetry,SAA,eps)
|
||||||
|
call merge_lopsided_kodis(ex,X,Y,Z,gzz,gzz_rhs,betax,betay,betaz,Symmetry,SSS,eps)
|
||||||
|
call merge_lopsided_kodis(ex,X,Y,Z,Axx,Axx_rhs,betax,betay,betaz,Symmetry,SSS,eps)
|
||||||
|
call merge_lopsided_kodis(ex,X,Y,Z,Axy,Axy_rhs,betax,betay,betaz,Symmetry,AAS,eps)
|
||||||
|
call merge_lopsided_kodis(ex,X,Y,Z,Axz,Axz_rhs,betax,betay,betaz,Symmetry,ASA,eps)
|
||||||
|
call merge_lopsided_kodis(ex,X,Y,Z,Ayy,Ayy_rhs,betax,betay,betaz,Symmetry,SSS,eps)
|
||||||
|
call merge_lopsided_kodis(ex,X,Y,Z,Ayz,Ayz_rhs,betax,betay,betaz,Symmetry,SAA,eps)
|
||||||
|
call merge_lopsided_kodis(ex,X,Y,Z,Azz,Azz_rhs,betax,betay,betaz,Symmetry,SSS,eps)
|
||||||
|
call merge_lopsided_kodis(ex,X,Y,Z,chi,chi_rhs,betax,betay,betaz,Symmetry,SSS,eps)
|
||||||
|
call merge_lopsided_kodis(ex,X,Y,Z,trK,trK_rhs,betax,betay,betaz,Symmetry,SSS,eps)
|
||||||
|
call merge_lopsided_kodis(ex,X,Y,Z,Gamx,Gamx_rhs,betax,betay,betaz,Symmetry,ASS,eps)
|
||||||
|
call merge_lopsided_kodis(ex,X,Y,Z,Gamy,Gamy_rhs,betax,betay,betaz,Symmetry,SAS,eps)
|
||||||
|
call merge_lopsided_kodis(ex,X,Y,Z,Gamz,Gamz_rhs,betax,betay,betaz,Symmetry,SSA,eps)
|
||||||
|
call merge_lopsided_kodis(ex,X,Y,Z,Lap,Lap_rhs,betax,betay,betaz,Symmetry,SSS,eps)
|
||||||
|
call merge_lopsided_kodis(ex,X,Y,Z,betax,betax_rhs,betax,betay,betaz,Symmetry,ASS,eps)
|
||||||
|
call merge_lopsided_kodis(ex,X,Y,Z,betay,betay_rhs,betax,betay,betaz,Symmetry,SAS,eps)
|
||||||
|
call merge_lopsided_kodis(ex,X,Y,Z,betaz,betaz_rhs,betax,betay,betaz,Symmetry,SSA,eps)
|
||||||
|
call merge_lopsided_kodis(ex,X,Y,Z,dtSfx,dtSfx_rhs,betax,betay,betaz,Symmetry,ASS,eps)
|
||||||
|
call merge_lopsided_kodis(ex,X,Y,Z,dtSfy,dtSfy_rhs,betax,betay,betaz,Symmetry,SAS,eps)
|
||||||
|
call merge_lopsided_kodis(ex,X,Y,Z,dtSfz,dtSfz_rhs,betax,betay,betaz,Symmetry,SSA,eps)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
else
|
||||||
call lopsided(ex,X,Y,Z,gxx,gxx_rhs,betax,betay,betaz,Symmetry,SSS)
|
call lopsided(ex,X,Y,Z,gxx,gxx_rhs,betax,betay,betaz,Symmetry,SSS)
|
||||||
call lopsided(ex,X,Y,Z,gxy,gxy_rhs,betax,betay,betaz,Symmetry,AAS)
|
call lopsided(ex,X,Y,Z,gxy,gxy_rhs,betax,betay,betaz,Symmetry,AAS)
|
||||||
call lopsided(ex,X,Y,Z,gxz,gxz_rhs,betax,betay,betaz,Symmetry,ASA)
|
call lopsided(ex,X,Y,Z,gxz,gxz_rhs,betax,betay,betaz,Symmetry,ASA)
|
||||||
call lopsided(ex,X,Y,Z,gyy,gyy_rhs,betax,betay,betaz,Symmetry,SSS)
|
call lopsided(ex,X,Y,Z,gyy,gyy_rhs,betax,betay,betaz,Symmetry,SSS)
|
||||||
call lopsided(ex,X,Y,Z,gyz,gyz_rhs,betax,betay,betaz,Symmetry,SAA)
|
call lopsided(ex,X,Y,Z,gyz,gyz_rhs,betax,betay,betaz,Symmetry,SAA)
|
||||||
call lopsided(ex,X,Y,Z,gzz,gzz_rhs,betax,betay,betaz,Symmetry,SSS)
|
call lopsided(ex,X,Y,Z,gzz,gzz_rhs,betax,betay,betaz,Symmetry,SSS)
|
||||||
|
|
||||||
call lopsided(ex,X,Y,Z,Axx,Axx_rhs,betax,betay,betaz,Symmetry,SSS)
|
call lopsided(ex,X,Y,Z,Axx,Axx_rhs,betax,betay,betaz,Symmetry,SSS)
|
||||||
call lopsided(ex,X,Y,Z,Axy,Axy_rhs,betax,betay,betaz,Symmetry,AAS)
|
call lopsided(ex,X,Y,Z,Axy,Axy_rhs,betax,betay,betaz,Symmetry,AAS)
|
||||||
call lopsided(ex,X,Y,Z,Axz,Axz_rhs,betax,betay,betaz,Symmetry,ASA)
|
call lopsided(ex,X,Y,Z,Axz,Axz_rhs,betax,betay,betaz,Symmetry,ASA)
|
||||||
call lopsided(ex,X,Y,Z,Ayy,Ayy_rhs,betax,betay,betaz,Symmetry,SSS)
|
call lopsided(ex,X,Y,Z,Ayy,Ayy_rhs,betax,betay,betaz,Symmetry,SSS)
|
||||||
call lopsided(ex,X,Y,Z,Ayz,Ayz_rhs,betax,betay,betaz,Symmetry,SAA)
|
call lopsided(ex,X,Y,Z,Ayz,Ayz_rhs,betax,betay,betaz,Symmetry,SAA)
|
||||||
call lopsided(ex,X,Y,Z,Azz,Azz_rhs,betax,betay,betaz,Symmetry,SSS)
|
call lopsided(ex,X,Y,Z,Azz,Azz_rhs,betax,betay,betaz,Symmetry,SSS)
|
||||||
|
|
||||||
call lopsided(ex,X,Y,Z,chi,chi_rhs,betax,betay,betaz,Symmetry,SSS)
|
call lopsided(ex,X,Y,Z,chi,chi_rhs,betax,betay,betaz,Symmetry,SSS)
|
||||||
call lopsided(ex,X,Y,Z,trK,trK_rhs,betax,betay,betaz,Symmetry,SSS)
|
call lopsided(ex,X,Y,Z,trK,trK_rhs,betax,betay,betaz,Symmetry,SSS)
|
||||||
|
|
||||||
call lopsided(ex,X,Y,Z,Gamx,Gamx_rhs,betax,betay,betaz,Symmetry,ASS)
|
call lopsided(ex,X,Y,Z,Gamx,Gamx_rhs,betax,betay,betaz,Symmetry,ASS)
|
||||||
call lopsided(ex,X,Y,Z,Gamy,Gamy_rhs,betax,betay,betaz,Symmetry,SAS)
|
call lopsided(ex,X,Y,Z,Gamy,Gamy_rhs,betax,betay,betaz,Symmetry,SAS)
|
||||||
call lopsided(ex,X,Y,Z,Gamz,Gamz_rhs,betax,betay,betaz,Symmetry,SSA)
|
call lopsided(ex,X,Y,Z,Gamz,Gamz_rhs,betax,betay,betaz,Symmetry,SSA)
|
||||||
!!
|
|
||||||
call lopsided(ex,X,Y,Z,Lap,Lap_rhs,betax,betay,betaz,Symmetry,SSS)
|
call lopsided(ex,X,Y,Z,Lap,Lap_rhs,betax,betay,betaz,Symmetry,SSS)
|
||||||
|
|
||||||
#if (GAUGE == 0 || GAUGE == 1 || GAUGE == 2 || GAUGE == 3 || GAUGE == 4 || GAUGE == 5 || GAUGE == 6 || GAUGE == 7)
|
|
||||||
call lopsided(ex,X,Y,Z,betax,betax_rhs,betax,betay,betaz,Symmetry,ASS)
|
call lopsided(ex,X,Y,Z,betax,betax_rhs,betax,betay,betaz,Symmetry,ASS)
|
||||||
call lopsided(ex,X,Y,Z,betay,betay_rhs,betax,betay,betaz,Symmetry,SAS)
|
call lopsided(ex,X,Y,Z,betay,betay_rhs,betax,betay,betaz,Symmetry,SAS)
|
||||||
call lopsided(ex,X,Y,Z,betaz,betaz_rhs,betax,betay,betaz,Symmetry,SSA)
|
call lopsided(ex,X,Y,Z,betaz,betaz_rhs,betax,betay,betaz,Symmetry,SSA)
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (GAUGE == 0 || GAUGE == 2 || GAUGE == 3 || GAUGE == 6 || GAUGE == 7)
|
|
||||||
call lopsided(ex,X,Y,Z,dtSfx,dtSfx_rhs,betax,betay,betaz,Symmetry,ASS)
|
call lopsided(ex,X,Y,Z,dtSfx,dtSfx_rhs,betax,betay,betaz,Symmetry,ASS)
|
||||||
call lopsided(ex,X,Y,Z,dtSfy,dtSfy_rhs,betax,betay,betaz,Symmetry,SAS)
|
call lopsided(ex,X,Y,Z,dtSfy,dtSfy_rhs,betax,betay,betaz,Symmetry,SAS)
|
||||||
call lopsided(ex,X,Y,Z,dtSfz,dtSfz_rhs,betax,betay,betaz,Symmetry,SSA)
|
call lopsided(ex,X,Y,Z,dtSfz,dtSfz_rhs,betax,betay,betaz,Symmetry,SSA)
|
||||||
#endif
|
|
||||||
|
|
||||||
if(eps>0)then
|
|
||||||
! usual Kreiss-Oliger dissipation
|
|
||||||
call kodis(ex,X,Y,Z,chi,chi_rhs,SSS,Symmetry,eps)
|
|
||||||
call kodis(ex,X,Y,Z,trK,trK_rhs,SSS,Symmetry,eps)
|
|
||||||
call kodis(ex,X,Y,Z,dxx,gxx_rhs,SSS,Symmetry,eps)
|
|
||||||
call kodis(ex,X,Y,Z,gxy,gxy_rhs,AAS,Symmetry,eps)
|
|
||||||
call kodis(ex,X,Y,Z,gxz,gxz_rhs,ASA,Symmetry,eps)
|
|
||||||
call kodis(ex,X,Y,Z,dyy,gyy_rhs,SSS,Symmetry,eps)
|
|
||||||
call kodis(ex,X,Y,Z,gyz,gyz_rhs,SAA,Symmetry,eps)
|
|
||||||
call kodis(ex,X,Y,Z,dzz,gzz_rhs,SSS,Symmetry,eps)
|
|
||||||
#if 0
|
|
||||||
#define i 42
|
|
||||||
#define j 40
|
|
||||||
#define k 40
|
|
||||||
if(Lev == 1)then
|
|
||||||
write(*,*) X(i),Y(j),Z(k)
|
|
||||||
write(*,*) "before",Axx_rhs(i,j,k)
|
|
||||||
endif
|
|
||||||
#undef i
|
|
||||||
#undef j
|
|
||||||
#undef k
|
|
||||||
!!stop
|
|
||||||
#endif
|
|
||||||
call kodis(ex,X,Y,Z,Axx,Axx_rhs,SSS,Symmetry,eps)
|
|
||||||
#if 0
|
|
||||||
#define i 42
|
|
||||||
#define j 40
|
|
||||||
#define k 40
|
|
||||||
if(Lev == 1)then
|
|
||||||
write(*,*) X(i),Y(j),Z(k)
|
|
||||||
write(*,*) "after",Axx_rhs(i,j,k)
|
|
||||||
endif
|
|
||||||
#undef i
|
|
||||||
#undef j
|
|
||||||
#undef k
|
|
||||||
!!stop
|
|
||||||
#endif
|
|
||||||
call kodis(ex,X,Y,Z,Axy,Axy_rhs,AAS,Symmetry,eps)
|
|
||||||
call kodis(ex,X,Y,Z,Axz,Axz_rhs,ASA,Symmetry,eps)
|
|
||||||
call kodis(ex,X,Y,Z,Ayy,Ayy_rhs,SSS,Symmetry,eps)
|
|
||||||
call kodis(ex,X,Y,Z,Ayz,Ayz_rhs,SAA,Symmetry,eps)
|
|
||||||
call kodis(ex,X,Y,Z,Azz,Azz_rhs,SSS,Symmetry,eps)
|
|
||||||
call kodis(ex,X,Y,Z,Gamx,Gamx_rhs,ASS,Symmetry,eps)
|
|
||||||
call kodis(ex,X,Y,Z,Gamy,Gamy_rhs,SAS,Symmetry,eps)
|
|
||||||
call kodis(ex,X,Y,Z,Gamz,Gamz_rhs,SSA,Symmetry,eps)
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
!! bam does not apply dissipation on gauge variables
|
|
||||||
call kodis(ex,X,Y,Z,Lap,Lap_rhs,SSS,Symmetry,eps)
|
|
||||||
call kodis(ex,X,Y,Z,betax,betax_rhs,ASS,Symmetry,eps)
|
|
||||||
call kodis(ex,X,Y,Z,betay,betay_rhs,SAS,Symmetry,eps)
|
|
||||||
call kodis(ex,X,Y,Z,betaz,betaz_rhs,SSA,Symmetry,eps)
|
|
||||||
#if (GAUGE == 0 || GAUGE == 2 || GAUGE == 3 || GAUGE == 6 || GAUGE == 7)
|
|
||||||
call kodis(ex,X,Y,Z,dtSfx,dtSfx_rhs,ASS,Symmetry,eps)
|
|
||||||
call kodis(ex,X,Y,Z,dtSfy,dtSfy_rhs,SAS,Symmetry,eps)
|
|
||||||
call kodis(ex,X,Y,Z,dtSfz,dtSfz_rhs,SSA,Symmetry,eps)
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -1184,3 +1163,265 @@ endif
|
|||||||
return
|
return
|
||||||
|
|
||||||
end function compute_rhs_bssn
|
end function compute_rhs_bssn
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
subroutine merge_lopsided_kodis(ex,X,Y,Z,f,f_rhs,Sfx,Sfy,Sfz,Symmetry,SoA,eps)
|
||||||
|
implicit none
|
||||||
|
|
||||||
|
!~~~~~~> Input parameters:
|
||||||
|
|
||||||
|
integer, intent(in) :: ex(1:3),Symmetry
|
||||||
|
real*8, intent(in) :: X(1:ex(1)),Y(1:ex(2)),Z(1:ex(3))
|
||||||
|
real*8,dimension(ex(1),ex(2),ex(3)),intent(in) :: f,Sfx,Sfy,Sfz
|
||||||
|
|
||||||
|
real*8,dimension(ex(1),ex(2),ex(3)),intent(inout):: f_rhs
|
||||||
|
real*8,dimension(3),intent(in) ::SoA
|
||||||
|
|
||||||
|
!~~~~~~> local variables:
|
||||||
|
! note index -2,-1,0, so we have 3 extra points
|
||||||
|
real*8,dimension(-2:ex(1),-2:ex(2),-2:ex(3)) :: fh
|
||||||
|
integer :: imin_lopsided,jmin_lopsided,kmin_lopsided,imin_kodis,jmin_kodis,kmin_kodis,imax,jmax,kmax,i,j,k
|
||||||
|
real*8 :: dX,dY,dZ
|
||||||
|
real*8 :: d12dx,d12dy,d12dz,d2dx,d2dy,d2dz
|
||||||
|
real*8, parameter :: ZEO=0.d0,ONE=1.d0, F3=3.d0
|
||||||
|
real*8, parameter :: TWO=2.d0,F6=6.0d0,F18=1.8d1
|
||||||
|
real*8, parameter :: F12=1.2d1, F10=1.d1,EIT=8.d0
|
||||||
|
integer, parameter :: NO_SYMM = 0, EQ_SYMM = 1, OCTANT = 2
|
||||||
|
real*8, parameter :: SIX=6.d0,FIT=1.5d1,TWT=2.d1
|
||||||
|
real*8,parameter::cof=6.4d1 ! 2^6
|
||||||
|
real*8,intent(in) :: eps
|
||||||
|
dX = X(2)-X(1)
|
||||||
|
dY = Y(2)-Y(1)
|
||||||
|
dZ = Z(2)-Z(1)
|
||||||
|
|
||||||
|
d12dx = ONE/F12/dX
|
||||||
|
d12dy = ONE/F12/dY
|
||||||
|
d12dz = ONE/F12/dZ
|
||||||
|
|
||||||
|
d2dx = ONE/TWO/dX
|
||||||
|
d2dy = ONE/TWO/dY
|
||||||
|
d2dz = ONE/TWO/dZ
|
||||||
|
|
||||||
|
imax = ex(1)
|
||||||
|
jmax = ex(2)
|
||||||
|
kmax = ex(3)
|
||||||
|
|
||||||
|
imin_lopsided = 1
|
||||||
|
jmin_lopsided = 1
|
||||||
|
kmin_lopsided = 1
|
||||||
|
if(Symmetry > NO_SYMM .and. dabs(Z(1)) < dZ) kmin_lopsided = -2
|
||||||
|
if(Symmetry > EQ_SYMM .and. dabs(X(1)) < dX) imin_lopsided = -2
|
||||||
|
if(Symmetry > EQ_SYMM .and. dabs(Y(1)) < dY) jmin_lopsided = -2
|
||||||
|
|
||||||
|
imin_kodis = 1
|
||||||
|
jmin_kodis = 1
|
||||||
|
kmin_kodis = 1
|
||||||
|
|
||||||
|
if(Symmetry > NO_SYMM .and. dabs(Z(1)) < dZ) kmin_kodis = -2
|
||||||
|
if(Symmetry == OCTANT .and. dabs(X(1)) < dX) imin_kodis = -2
|
||||||
|
if(Symmetry == OCTANT .and. dabs(Y(1)) < dY) jmin_kodis = -2
|
||||||
|
|
||||||
|
|
||||||
|
call symmetry_bd(3,ex,f,fh,SoA)
|
||||||
|
|
||||||
|
! upper bound set ex-1 only for efficiency,
|
||||||
|
! the loop body will set ex 0 also
|
||||||
|
do k=1,ex(3)-1
|
||||||
|
do j=1,ex(2)-1
|
||||||
|
do i=1,ex(1)-1
|
||||||
|
|
||||||
|
!! new code, 2012dec27, based on bam
|
||||||
|
! x direction
|
||||||
|
if(Sfx(i,j,k) > ZEO)then
|
||||||
|
if(i+3 <= imax)then
|
||||||
|
! v
|
||||||
|
! D f = ------[ - 3f - 10f + 18f - 6f + f ]
|
||||||
|
! i 12dx i-v i i+v i+2v i+3v
|
||||||
|
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
||||||
|
Sfx(i,j,k)*d12dx*(-F3*fh(i-1,j,k)-F10*fh(i,j,k)+F18*fh(i+1,j,k) &
|
||||||
|
-F6*fh(i+2,j,k)+ fh(i+3,j,k))
|
||||||
|
elseif(i+2 <= imax)then
|
||||||
|
!
|
||||||
|
! f(i-2) - 8 f(i-1) + 8 f(i+1) - f(i+2)
|
||||||
|
! fx(i) = ---------------------------------------------
|
||||||
|
! 12 dx
|
||||||
|
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
||||||
|
Sfx(i,j,k)*d12dx*(fh(i-2,j,k)-EIT*fh(i-1,j,k)+EIT*fh(i+1,j,k)-fh(i+2,j,k))
|
||||||
|
|
||||||
|
elseif(i+1 <= imax)then
|
||||||
|
! v
|
||||||
|
! D f = ------[ 3f + 10f - 18f + 6f - f ]
|
||||||
|
! i 12dx i+v i i-v i-2v i-3v
|
||||||
|
f_rhs(i,j,k)=f_rhs(i,j,k)- &
|
||||||
|
Sfx(i,j,k)*d12dx*(-F3*fh(i+1,j,k)-F10*fh(i,j,k)+F18*fh(i-1,j,k) &
|
||||||
|
-F6*fh(i-2,j,k)+ fh(i-3,j,k))
|
||||||
|
! set imax and imin_lopsided 0
|
||||||
|
endif
|
||||||
|
elseif(Sfx(i,j,k) < ZEO)then
|
||||||
|
if(i-3 >= imin_lopsided)then
|
||||||
|
! v
|
||||||
|
! D f = ------[ - 3f - 10f + 18f - 6f + f ]
|
||||||
|
! i 12dx i-v i i+v i+2v i+3v
|
||||||
|
f_rhs(i,j,k)=f_rhs(i,j,k)- &
|
||||||
|
Sfx(i,j,k)*d12dx*(-F3*fh(i+1,j,k)-F10*fh(i,j,k)+F18*fh(i-1,j,k) &
|
||||||
|
-F6*fh(i-2,j,k)+ fh(i-3,j,k))
|
||||||
|
elseif(i-2 >= imin_lopsided)then
|
||||||
|
!
|
||||||
|
! f(i-2) - 8 f(i-1) + 8 f(i+1) - f(i+2)
|
||||||
|
! fx(i) = ---------------------------------------------
|
||||||
|
! 12 dx
|
||||||
|
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
||||||
|
Sfx(i,j,k)*d12dx*(fh(i-2,j,k)-EIT*fh(i-1,j,k)+EIT*fh(i+1,j,k)-fh(i+2,j,k))
|
||||||
|
|
||||||
|
elseif(i-1 >= imin_lopsided)then
|
||||||
|
! v
|
||||||
|
! D f = ------[ 3f + 10f - 18f + 6f - f ]
|
||||||
|
! i 12dx i+v i i-v i-2v i-3v
|
||||||
|
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
||||||
|
Sfx(i,j,k)*d12dx*(-F3*fh(i-1,j,k)-F10*fh(i,j,k)+F18*fh(i+1,j,k) &
|
||||||
|
-F6*fh(i+2,j,k)+ fh(i+3,j,k))
|
||||||
|
! set imax and imin_lopsided 0
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
! y direction
|
||||||
|
if(Sfy(i,j,k) > ZEO)then
|
||||||
|
if(j+3 <= jmax)then
|
||||||
|
! v
|
||||||
|
! D f = ------[ - 3f - 10f + 18f - 6f + f ]
|
||||||
|
! i 12dx i-v i i+v i+2v i+3v
|
||||||
|
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
||||||
|
Sfy(i,j,k)*d12dy*(-F3*fh(i,j-1,k)-F10*fh(i,j,k)+F18*fh(i,j+1,k) &
|
||||||
|
-F6*fh(i,j+2,k)+ fh(i,j+3,k))
|
||||||
|
elseif(j+2 <= jmax)then
|
||||||
|
!
|
||||||
|
! f(i-2) - 8 f(i-1) + 8 f(i+1) - f(i+2)
|
||||||
|
! fx(i) = ---------------------------------------------
|
||||||
|
! 12 dx
|
||||||
|
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
||||||
|
Sfy(i,j,k)*d12dy*(fh(i,j-2,k)-EIT*fh(i,j-1,k)+EIT*fh(i,j+1,k)-fh(i,j+2,k))
|
||||||
|
|
||||||
|
elseif(j+1 <= jmax)then
|
||||||
|
! v
|
||||||
|
! D f = ------[ 3f + 10f - 18f + 6f - f ]
|
||||||
|
! i 12dx i+v i i-v i-2v i-3v
|
||||||
|
f_rhs(i,j,k)=f_rhs(i,j,k)- &
|
||||||
|
Sfy(i,j,k)*d12dy*(-F3*fh(i,j+1,k)-F10*fh(i,j,k)+F18*fh(i,j-1,k) &
|
||||||
|
-F6*fh(i,j-2,k)+ fh(i,j-3,k))
|
||||||
|
! set imax and imin_lopsided 0
|
||||||
|
endif
|
||||||
|
elseif(Sfy(i,j,k) < ZEO)then
|
||||||
|
if(j-3 >= jmin_lopsided)then
|
||||||
|
! v
|
||||||
|
! D f = ------[ - 3f - 10f + 18f - 6f + f ]
|
||||||
|
! i 12dx i-v i i+v i+2v i+3v
|
||||||
|
f_rhs(i,j,k)=f_rhs(i,j,k)- &
|
||||||
|
Sfy(i,j,k)*d12dy*(-F3*fh(i,j+1,k)-F10*fh(i,j,k)+F18*fh(i,j-1,k) &
|
||||||
|
-F6*fh(i,j-2,k)+ fh(i,j-3,k))
|
||||||
|
elseif(j-2 >= jmin_lopsided)then
|
||||||
|
!
|
||||||
|
! f(i-2) - 8 f(i-1) + 8 f(i+1) - f(i+2)
|
||||||
|
! fx(i) = ---------------------------------------------
|
||||||
|
! 12 dx
|
||||||
|
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
||||||
|
Sfy(i,j,k)*d12dy*(fh(i,j-2,k)-EIT*fh(i,j-1,k)+EIT*fh(i,j+1,k)-fh(i,j+2,k))
|
||||||
|
|
||||||
|
elseif(j-1 >= jmin_lopsided)then
|
||||||
|
! v
|
||||||
|
! D f = ------[ 3f + 10f - 18f + 6f - f ]
|
||||||
|
! i 12dx i+v i i-v i-2v i-3v
|
||||||
|
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
||||||
|
Sfy(i,j,k)*d12dy*(-F3*fh(i,j-1,k)-F10*fh(i,j,k)+F18*fh(i,j+1,k) &
|
||||||
|
-F6*fh(i,j+2,k)+ fh(i,j+3,k))
|
||||||
|
! set jmax and jmin_lopsided 0
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
! z direction
|
||||||
|
if(Sfz(i,j,k) > ZEO)then
|
||||||
|
if(k+3 <= kmax)then
|
||||||
|
! v
|
||||||
|
! D f = ------[ - 3f - 10f + 18f - 6f + f ]
|
||||||
|
! i 12dx i-v i i+v i+2v i+3v
|
||||||
|
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
||||||
|
Sfz(i,j,k)*d12dz*(-F3*fh(i,j,k-1)-F10*fh(i,j,k)+F18*fh(i,j,k+1) &
|
||||||
|
-F6*fh(i,j,k+2)+ fh(i,j,k+3))
|
||||||
|
elseif(k+2 <= kmax)then
|
||||||
|
!
|
||||||
|
! f(i-2) - 8 f(i-1) + 8 f(i+1) - f(i+2)
|
||||||
|
! fx(i) = ---------------------------------------------
|
||||||
|
! 12 dx
|
||||||
|
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
||||||
|
Sfz(i,j,k)*d12dz*(fh(i,j,k-2)-EIT*fh(i,j,k-1)+EIT*fh(i,j,k+1)-fh(i,j,k+2))
|
||||||
|
|
||||||
|
elseif(k+1 <= kmax)then
|
||||||
|
! v
|
||||||
|
! D f = ------[ 3f + 10f - 18f + 6f - f ]
|
||||||
|
! i 12dx i+v i i-v i-2v i-3v
|
||||||
|
f_rhs(i,j,k)=f_rhs(i,j,k)- &
|
||||||
|
Sfz(i,j,k)*d12dz*(-F3*fh(i,j,k+1)-F10*fh(i,j,k)+F18*fh(i,j,k-1) &
|
||||||
|
-F6*fh(i,j,k-2)+ fh(i,j,k-3))
|
||||||
|
! set imax and imin_lopsided 0
|
||||||
|
endif
|
||||||
|
elseif(Sfz(i,j,k) < ZEO)then
|
||||||
|
if(k-3 >= kmin_lopsided)then
|
||||||
|
! v
|
||||||
|
! D f = ------[ - 3f - 10f + 18f - 6f + f ]
|
||||||
|
! i 12dx i-v i i+v i+2v i+3v
|
||||||
|
f_rhs(i,j,k)=f_rhs(i,j,k)- &
|
||||||
|
Sfz(i,j,k)*d12dz*(-F3*fh(i,j,k+1)-F10*fh(i,j,k)+F18*fh(i,j,k-1) &
|
||||||
|
-F6*fh(i,j,k-2)+ fh(i,j,k-3))
|
||||||
|
elseif(k-2 >= kmin_lopsided)then
|
||||||
|
!
|
||||||
|
! f(i-2) - 8 f(i-1) + 8 f(i+1) - f(i+2)
|
||||||
|
! fx(i) = ---------------------------------------------
|
||||||
|
! 12 dx
|
||||||
|
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
||||||
|
Sfz(i,j,k)*d12dz*(fh(i,j,k-2)-EIT*fh(i,j,k-1)+EIT*fh(i,j,k+1)-fh(i,j,k+2))
|
||||||
|
|
||||||
|
elseif(k-1 >= kmin_lopsided)then
|
||||||
|
! v
|
||||||
|
! D f = ------[ 3f + 10f - 18f + 6f - f ]
|
||||||
|
! i 12dx i+v i i-v i-2v i-3v
|
||||||
|
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
||||||
|
Sfz(i,j,k)*d12dz*(-F3*fh(i,j,k-1)-F10*fh(i,j,k)+F18*fh(i,j,k+1) &
|
||||||
|
-F6*fh(i,j,k+2)+ fh(i,j,k+3))
|
||||||
|
! set kmax and kmin_lopsided 0
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
if(i-3 >= imin_kodis .and. i+3 <= imax .and. &
|
||||||
|
j-3 >= jmin_kodis .and. j+3 <= jmax .and. &
|
||||||
|
k-3 >= kmin_kodis .and. k+3 <= kmax) then
|
||||||
|
|
||||||
|
! calculation order if important ?
|
||||||
|
f_rhs(i,j,k) = f_rhs(i,j,k) + eps/cof *( ( &
|
||||||
|
(fh(i-3,j,k)+fh(i+3,j,k)) - &
|
||||||
|
SIX*(fh(i-2,j,k)+fh(i+2,j,k)) + &
|
||||||
|
FIT*(fh(i-1,j,k)+fh(i+1,j,k)) - &
|
||||||
|
TWT* fh(i,j,k) )/dX + &
|
||||||
|
( &
|
||||||
|
(fh(i,j-3,k)+fh(i,j+3,k)) - &
|
||||||
|
SIX*(fh(i,j-2,k)+fh(i,j+2,k)) + &
|
||||||
|
FIT*(fh(i,j-1,k)+fh(i,j+1,k)) - &
|
||||||
|
TWT* fh(i,j,k) )/dY + &
|
||||||
|
( &
|
||||||
|
(fh(i,j,k-3)+fh(i,j,k+3)) - &
|
||||||
|
SIX*(fh(i,j,k-2)+fh(i,j,k+2)) + &
|
||||||
|
FIT*(fh(i,j,k-1)+fh(i,j,k+1)) - &
|
||||||
|
TWT* fh(i,j,k) )/dZ )
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
enddo
|
||||||
|
enddo
|
||||||
|
enddo
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
end subroutine merge_lopsided_kodis
|
||||||
|
|||||||
@@ -1000,86 +1000,7 @@
|
|||||||
do k=1,ex(3)-1
|
do k=1,ex(3)-1
|
||||||
do j=1,ex(2)-1
|
do j=1,ex(2)-1
|
||||||
do i=1,ex(1)-1
|
do i=1,ex(1)-1
|
||||||
#if 0
|
|
||||||
! x direction
|
|
||||||
if(i+2 <= imax .and. i-2 >= imin)then
|
|
||||||
!
|
|
||||||
! f(i-2) - 8 f(i-1) + 8 f(i+1) - f(i+2)
|
|
||||||
! fx(i) = ---------------------------------------------
|
|
||||||
! 12 dx
|
|
||||||
fx(i,j,k)=d12dx*(fh(i-2,j,k)-EIT*fh(i-1,j,k)+EIT*fh(i+1,j,k)-fh(i+2,j,k))
|
|
||||||
|
|
||||||
elseif(i+1 <= imax .and. i-1 >= imin)then
|
|
||||||
!
|
|
||||||
! - f(i-1) + f(i+1)
|
|
||||||
! fx(i) = --------------------------------
|
|
||||||
! 2 dx
|
|
||||||
fx(i,j,k)=d2dx*(-fh(i-1,j,k)+fh(i+1,j,k))
|
|
||||||
|
|
||||||
! set imax and imin 0
|
|
||||||
endif
|
|
||||||
! y direction
|
|
||||||
if(j+2 <= jmax .and. j-2 >= jmin)then
|
|
||||||
|
|
||||||
fy(i,j,k)=d12dy*(fh(i,j-2,k)-EIT*fh(i,j-1,k)+EIT*fh(i,j+1,k)-fh(i,j+2,k))
|
|
||||||
|
|
||||||
elseif(j+1 <= jmax .and. j-1 >= jmin)then
|
|
||||||
|
|
||||||
fy(i,j,k)=d2dy*(-fh(i,j-1,k)+fh(i,j+1,k))
|
|
||||||
|
|
||||||
! set jmax and jmin 0
|
|
||||||
endif
|
|
||||||
! z direction
|
|
||||||
if(k+2 <= kmax .and. k-2 >= kmin)then
|
|
||||||
|
|
||||||
fz(i,j,k)=d12dz*(fh(i,j,k-2)-EIT*fh(i,j,k-1)+EIT*fh(i,j,k+1)-fh(i,j,k+2))
|
|
||||||
|
|
||||||
elseif(k+1 <= kmax .and. k-1 >= kmin)then
|
|
||||||
|
|
||||||
fz(i,j,k)=d2dz*(-fh(i,j,k-1)+fh(i,j,k+1))
|
|
||||||
|
|
||||||
! set kmax and kmin 0
|
|
||||||
endif
|
|
||||||
#elif 0
|
|
||||||
! x direction
|
|
||||||
if(i+2 <= imax .and. i-2 >= imin)then
|
|
||||||
!
|
|
||||||
! f(i-2) - 8 f(i-1) + 8 f(i+1) - f(i+2)
|
|
||||||
! fx(i) = ---------------------------------------------
|
|
||||||
! 12 dx
|
|
||||||
fx(i,j,k)=d12dx*(fh(i-2,j,k)-EIT*fh(i-1,j,k)+EIT*fh(i+1,j,k)-fh(i+2,j,k))
|
|
||||||
|
|
||||||
elseif(i+3 <= imax .and. i-1 >= imin)then
|
|
||||||
fx(i,j,k)=d12dx*(-3.d0*fh(i-1,j,k)-1.d1*fh(i,j,k)+1.8d1*fh(i+1,j,k)-6.d0*fh(i+2,j,k)+fh(i+3,j,k))
|
|
||||||
elseif(i+1 <= imax .and. i-3 >= imin)then
|
|
||||||
fx(i,j,k)=d12dx*( 3.d0*fh(i+1,j,k)+1.d1*fh(i,j,k)-1.8d1*fh(i-1,j,k)+6.d0*fh(i-2,j,k)-fh(i-3,j,k))
|
|
||||||
! set imax and imin 0
|
|
||||||
endif
|
|
||||||
! y direction
|
|
||||||
if(j+2 <= jmax .and. j-2 >= jmin)then
|
|
||||||
|
|
||||||
fy(i,j,k)=d12dy*(fh(i,j-2,k)-EIT*fh(i,j-1,k)+EIT*fh(i,j+1,k)-fh(i,j+2,k))
|
|
||||||
|
|
||||||
elseif(j+3 <= jmax .and. j-1 >= jmin)then
|
|
||||||
fy(i,j,k)=d12dy*(-3.d0*fh(i,j-1,k)-1.d1*fh(i,j,k)+1.8d1*fh(i,j+1,k)-6.d0*fh(i,j+2,k)+fh(i,j+3,k))
|
|
||||||
elseif(j+1 <= jmax .and. j-3 >= jmin)then
|
|
||||||
fy(i,j,k)=d12dy*( 3.d0*fh(i,j+1,k)+1.d1*fh(i,j,k)-1.8d1*fh(i,j-1,k)+6.d0*fh(i,j-2,k)-fh(i,j-3,k))
|
|
||||||
|
|
||||||
! set jmax and jmin 0
|
|
||||||
endif
|
|
||||||
! z direction
|
|
||||||
if(k+2 <= kmax .and. k-2 >= kmin)then
|
|
||||||
|
|
||||||
fz(i,j,k)=d12dz*(fh(i,j,k-2)-EIT*fh(i,j,k-1)+EIT*fh(i,j,k+1)-fh(i,j,k+2))
|
|
||||||
|
|
||||||
elseif(k+3 <= kmax .and. k-1 >= kmin)then
|
|
||||||
fz(i,j,k)=d12dz*(-3.d0*fh(i,j,k-1)-1.d1*fh(i,j,k)+1.8d1*fh(i,j,k+1)-6.d0*fh(i,j,k+2)+fh(i,j,k+3))
|
|
||||||
elseif(k+1 <= kmax .and. k-3 >= kmin)then
|
|
||||||
fz(i,j,k)=d12dz*( 3.d0*fh(i,j,k+1)+1.d1*fh(i,j,k)-1.8d1*fh(i,j,k-1)+6.d0*fh(i,j,k-2)-fh(i,j,k-3))
|
|
||||||
|
|
||||||
! set kmax and kmin 0
|
|
||||||
endif
|
|
||||||
#else
|
|
||||||
! for bam comparison
|
! for bam comparison
|
||||||
if(i+2 <= imax .and. i-2 >= imin .and. &
|
if(i+2 <= imax .and. i-2 >= imin .and. &
|
||||||
j+2 <= jmax .and. j-2 >= jmin .and. &
|
j+2 <= jmax .and. j-2 >= jmin .and. &
|
||||||
@@ -1094,7 +1015,7 @@
|
|||||||
fy(i,j,k)=d2dy*(-fh(i,j-1,k)+fh(i,j+1,k))
|
fy(i,j,k)=d2dy*(-fh(i,j-1,k)+fh(i,j+1,k))
|
||||||
fz(i,j,k)=d2dz*(-fh(i,j,k-1)+fh(i,j,k+1))
|
fz(i,j,k)=d2dz*(-fh(i,j,k-1)+fh(i,j,k+1))
|
||||||
endif
|
endif
|
||||||
#endif
|
|
||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
@@ -1404,85 +1325,7 @@
|
|||||||
do k=1,ex(3)-1
|
do k=1,ex(3)-1
|
||||||
do j=1,ex(2)-1
|
do j=1,ex(2)-1
|
||||||
do i=1,ex(1)-1
|
do i=1,ex(1)-1
|
||||||
#if 0
|
|
||||||
!~~~~~~ fxx
|
|
||||||
if(i+2 <= imax .and. i-2 >= imin)then
|
|
||||||
!
|
|
||||||
! - f(i-2) + 16 f(i-1) - 30 f(i) + 16 f(i+1) - f(i+2)
|
|
||||||
! fxx(i) = ----------------------------------------------------------
|
|
||||||
! 12 dx^2
|
|
||||||
fxx(i,j,k) = Fdxdx*(-fh(i-2,j,k)+F16*fh(i-1,j,k)-F30*fh(i,j,k) &
|
|
||||||
-fh(i+2,j,k)+F16*fh(i+1,j,k) )
|
|
||||||
elseif(i+1 <= imax .and. i-1 >= imin)then
|
|
||||||
!
|
|
||||||
! f(i-1) - 2 f(i) + f(i+1)
|
|
||||||
! fxx(i) = --------------------------------
|
|
||||||
! dx^2
|
|
||||||
fxx(i,j,k) = Sdxdx*(fh(i-1,j,k)-TWO*fh(i,j,k) &
|
|
||||||
+fh(i+1,j,k) )
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
!~~~~~~ fyy
|
|
||||||
if(j+2 <= jmax .and. j-2 >= jmin)then
|
|
||||||
|
|
||||||
fyy(i,j,k) = Fdydy*(-fh(i,j-2,k)+F16*fh(i,j-1,k)-F30*fh(i,j,k) &
|
|
||||||
-fh(i,j+2,k)+F16*fh(i,j+1,k) )
|
|
||||||
elseif(j+1 <= jmax .and. j-1 >= jmin)then
|
|
||||||
|
|
||||||
fyy(i,j,k) = Sdydy*(fh(i,j-1,k)-TWO*fh(i,j,k) &
|
|
||||||
+fh(i,j+1,k) )
|
|
||||||
endif
|
|
||||||
|
|
||||||
!~~~~~~ fzz
|
|
||||||
if(k+2 <= kmax .and. k-2 >= kmin)then
|
|
||||||
|
|
||||||
fzz(i,j,k) = Fdzdz*(-fh(i,j,k-2)+F16*fh(i,j,k-1)-F30*fh(i,j,k) &
|
|
||||||
-fh(i,j,k+2)+F16*fh(i,j,k+1) )
|
|
||||||
elseif(k+1 <= kmax .and. k-1 >= kmin)then
|
|
||||||
|
|
||||||
fzz(i,j,k) = Sdzdz*(fh(i,j,k-1)-TWO*fh(i,j,k) &
|
|
||||||
+fh(i,j,k+1) )
|
|
||||||
endif
|
|
||||||
!~~~~~~ fxy
|
|
||||||
if(i+2 <= imax .and. i-2 >= imin .and. j+2 <= jmax .and. j-2 >= jmin)then
|
|
||||||
!
|
|
||||||
! ( f(i-2,j-2) - 8 f(i-1,j-2) + 8 f(i+1,j-2) - f(i+2,j-2) )
|
|
||||||
! - 8 ( f(i-2,j-1) - 8 f(i-1,j-1) + 8 f(i+1,j-1) - f(i+2,j-1) )
|
|
||||||
! + 8 ( f(i-2,j+1) - 8 f(i-1,j+1) + 8 f(i+1,j+1) - f(i+2,j+1) )
|
|
||||||
! - ( f(i-2,j+2) - 8 f(i-1,j+2) + 8 f(i+1,j+2) - f(i+2,j+2) )
|
|
||||||
! fxy(i,j) = ----------------------------------------------------------------
|
|
||||||
! 144 dx dy
|
|
||||||
fxy(i,j,k) = Fdxdy*( (fh(i-2,j-2,k)-F8*fh(i-1,j-2,k)+F8*fh(i+1,j-2,k)-fh(i+2,j-2,k)) &
|
|
||||||
-F8 *(fh(i-2,j-1,k)-F8*fh(i-1,j-1,k)+F8*fh(i+1,j-1,k)-fh(i+2,j-1,k)) &
|
|
||||||
+F8 *(fh(i-2,j+1,k)-F8*fh(i-1,j+1,k)+F8*fh(i+1,j+1,k)-fh(i+2,j+1,k)) &
|
|
||||||
- (fh(i-2,j+2,k)-F8*fh(i-1,j+2,k)+F8*fh(i+1,j+2,k)-fh(i+2,j+2,k)))
|
|
||||||
|
|
||||||
elseif(i+1 <= imax .and. i-1 >= imin .and. j+1 <= jmax .and. j-1 >= jmin)then
|
|
||||||
! f(i-1,j-1) - f(i+1,j-1) - f(i-1,j+1) + f(i+1,j+1)
|
|
||||||
! fxy(i,j) = -----------------------------------------------------------
|
|
||||||
! 4 dx dy
|
|
||||||
fxy(i,j,k) = Sdxdy*(fh(i-1,j-1,k)-fh(i+1,j-1,k)-fh(i-1,j+1,k)+fh(i+1,j+1,k))
|
|
||||||
endif
|
|
||||||
!~~~~~~ fxz
|
|
||||||
if(i+2 <= imax .and. i-2 >= imin .and. k+2 <= kmax .and. k-2 >= kmin)then
|
|
||||||
fxz(i,j,k) = Fdxdz*( (fh(i-2,j,k-2)-F8*fh(i-1,j,k-2)+F8*fh(i+1,j,k-2)-fh(i+2,j,k-2)) &
|
|
||||||
-F8 *(fh(i-2,j,k-1)-F8*fh(i-1,j,k-1)+F8*fh(i+1,j,k-1)-fh(i+2,j,k-1)) &
|
|
||||||
+F8 *(fh(i-2,j,k+1)-F8*fh(i-1,j,k+1)+F8*fh(i+1,j,k+1)-fh(i+2,j,k+1)) &
|
|
||||||
- (fh(i-2,j,k+2)-F8*fh(i-1,j,k+2)+F8*fh(i+1,j,k+2)-fh(i+2,j,k+2)))
|
|
||||||
elseif(i+1 <= imax .and. i-1 >= imin .and. k+1 <= kmax .and. k-1 >= kmin)then
|
|
||||||
fxz(i,j,k) = Sdxdz*(fh(i-1,j,k-1)-fh(i+1,j,k-1)-fh(i-1,j,k+1)+fh(i+1,j,k+1))
|
|
||||||
endif
|
|
||||||
!~~~~~~ fyz
|
|
||||||
if(j+2 <= jmax .and. j-2 >= jmin .and. k+2 <= kmax .and. k-2 >= kmin)then
|
|
||||||
fyz(i,j,k) = Fdydz*( (fh(i,j-2,k-2)-F8*fh(i,j-1,k-2)+F8*fh(i,j+1,k-2)-fh(i,j+2,k-2)) &
|
|
||||||
-F8 *(fh(i,j-2,k-1)-F8*fh(i,j-1,k-1)+F8*fh(i,j+1,k-1)-fh(i,j+2,k-1)) &
|
|
||||||
+F8 *(fh(i,j-2,k+1)-F8*fh(i,j-1,k+1)+F8*fh(i,j+1,k+1)-fh(i,j+2,k+1)) &
|
|
||||||
- (fh(i,j-2,k+2)-F8*fh(i,j-1,k+2)+F8*fh(i,j+1,k+2)-fh(i,j+2,k+2)))
|
|
||||||
elseif(j+1 <= jmax .and. j-1 >= jmin .and. k+1 <= kmax .and. k-1 >= kmin)then
|
|
||||||
fyz(i,j,k) = Sdydz*(fh(i,j-1,k-1)-fh(i,j+1,k-1)-fh(i,j-1,k+1)+fh(i,j+1,k+1))
|
|
||||||
endif
|
|
||||||
#else
|
|
||||||
! for bam comparison
|
! for bam comparison
|
||||||
if(i+2 <= imax .and. i-2 >= imin .and. &
|
if(i+2 <= imax .and. i-2 >= imin .and. &
|
||||||
j+2 <= jmax .and. j-2 >= jmin .and. &
|
j+2 <= jmax .and. j-2 >= jmin .and. &
|
||||||
@@ -1518,7 +1361,7 @@
|
|||||||
fxz(i,j,k) = Sdxdz*(fh(i-1,j,k-1)-fh(i+1,j,k-1)-fh(i-1,j,k+1)+fh(i+1,j,k+1))
|
fxz(i,j,k) = Sdxdz*(fh(i-1,j,k-1)-fh(i+1,j,k-1)-fh(i-1,j,k+1)+fh(i+1,j,k+1))
|
||||||
fyz(i,j,k) = Sdydz*(fh(i,j-1,k-1)-fh(i,j+1,k-1)-fh(i,j-1,k+1)+fh(i,j+1,k+1))
|
fyz(i,j,k) = Sdydz*(fh(i,j-1,k-1)-fh(i,j+1,k-1)-fh(i,j-1,k+1)+fh(i,j+1,k+1))
|
||||||
endif
|
endif
|
||||||
#endif
|
|
||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
|
|||||||
@@ -326,7 +326,8 @@ subroutine symmetry_bd(ord,extc,func,funcc,SoA)
|
|||||||
|
|
||||||
funcc(1:extc(1),1:extc(2),1:extc(3)) = func
|
funcc(1:extc(1),1:extc(2),1:extc(3)) = func
|
||||||
do i=0,ord-1
|
do i=0,ord-1
|
||||||
funcc(-i,1:extc(2),1:extc(3)) = funcc(i+2,1:extc(2),1:extc(3))*SoA(1)
|
|
||||||
|
funcc(-i,1:extc(2),1:extc(3)) = funcc(i+2,1:extc(2),1:extc(3))*SoA(1)
|
||||||
enddo
|
enddo
|
||||||
do i=0,ord-1
|
do i=0,ord-1
|
||||||
funcc(:,-i,1:extc(3)) = funcc(:,i+2,1:extc(3))*SoA(2)
|
funcc(:,-i,1:extc(3)) = funcc(:,i+2,1:extc(3))*SoA(2)
|
||||||
@@ -883,17 +884,13 @@ subroutine symmetry_bd(ord,extc,func,funcc,SoA)
|
|||||||
|
|
||||||
integer::i
|
integer::i
|
||||||
|
|
||||||
!DIR$ SIMD VECTORLENGTHFOR(KNOWN_INTEGER=8)
|
|
||||||
funcc(1:extc(1),1:extc(2),1:extc(3)) = func
|
funcc(1:extc(1),1:extc(2),1:extc(3)) = func
|
||||||
!DIR$ SIMD VECTORLENGTHFOR(KNOWN_INTEGER=8)
|
|
||||||
do i=0,ord-1
|
do i=0,ord-1
|
||||||
funcc(-i,1:extc(2),1:extc(3)) = funcc(i+1,1:extc(2),1:extc(3))*SoA(1)
|
funcc(-i,1:extc(2),1:extc(3)) = funcc(i+1,1:extc(2),1:extc(3))*SoA(1)
|
||||||
enddo
|
enddo
|
||||||
!DIR$ SIMD VECTORLENGTHFOR(KNOWN_INTEGER=8)
|
|
||||||
do i=0,ord-1
|
do i=0,ord-1
|
||||||
funcc(:,-i,1:extc(3)) = funcc(:,i+1,1:extc(3))*SoA(2)
|
funcc(:,-i,1:extc(3)) = funcc(:,i+1,1:extc(3))*SoA(2)
|
||||||
enddo
|
enddo
|
||||||
!DIR$ SIMD VECTORLENGTHFOR(KNOWN_INTEGER=8)
|
|
||||||
do i=0,ord-1
|
do i=0,ord-1
|
||||||
funcc(:,:,-i) = funcc(:,:,i+1)*SoA(3)
|
funcc(:,:,-i) = funcc(:,:,i+1)*SoA(3)
|
||||||
enddo
|
enddo
|
||||||
@@ -1115,149 +1112,7 @@ end subroutine d2dump
|
|||||||
!------------------------------------------------------------------------------
|
!------------------------------------------------------------------------------
|
||||||
! Lagrangian polynomial interpolation
|
! Lagrangian polynomial interpolation
|
||||||
!------------------------------------------------------------------------------
|
!------------------------------------------------------------------------------
|
||||||
#ifndef POLINT6_USE_BARYCENTRIC
|
|
||||||
#define POLINT6_USE_BARYCENTRIC 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
!DIR$ ATTRIBUTES FORCEINLINE :: polint6_neville
|
|
||||||
subroutine polint6_neville(xa, ya, x, y, dy)
|
|
||||||
implicit none
|
|
||||||
|
|
||||||
real*8, dimension(6), intent(in) :: xa, ya
|
|
||||||
real*8, intent(in) :: x
|
|
||||||
real*8, intent(out) :: y, dy
|
|
||||||
|
|
||||||
integer :: i, m, ns, n_m
|
|
||||||
real*8, dimension(6) :: c, d, ho
|
|
||||||
real*8 :: dif, dift, hp, h, den_val
|
|
||||||
|
|
||||||
c = ya
|
|
||||||
d = ya
|
|
||||||
ho = xa - x
|
|
||||||
|
|
||||||
ns = 1
|
|
||||||
dif = abs(x - xa(1))
|
|
||||||
|
|
||||||
do i = 2, 6
|
|
||||||
dift = abs(x - xa(i))
|
|
||||||
if (dift < dif) then
|
|
||||||
ns = i
|
|
||||||
dif = dift
|
|
||||||
end if
|
|
||||||
end do
|
|
||||||
|
|
||||||
y = ya(ns)
|
|
||||||
ns = ns - 1
|
|
||||||
|
|
||||||
do m = 1, 5
|
|
||||||
n_m = 6 - m
|
|
||||||
do i = 1, n_m
|
|
||||||
hp = ho(i)
|
|
||||||
h = ho(i+m)
|
|
||||||
den_val = hp - h
|
|
||||||
|
|
||||||
if (den_val == 0.0d0) then
|
|
||||||
write(*,*) 'failure in polint for point',x
|
|
||||||
write(*,*) 'with input points: ',xa
|
|
||||||
stop
|
|
||||||
end if
|
|
||||||
|
|
||||||
den_val = (c(i+1) - d(i)) / den_val
|
|
||||||
|
|
||||||
d(i) = h * den_val
|
|
||||||
c(i) = hp * den_val
|
|
||||||
end do
|
|
||||||
|
|
||||||
if (2 * ns < n_m) then
|
|
||||||
dy = c(ns + 1)
|
|
||||||
else
|
|
||||||
dy = d(ns)
|
|
||||||
ns = ns - 1
|
|
||||||
end if
|
|
||||||
y = y + dy
|
|
||||||
end do
|
|
||||||
|
|
||||||
return
|
|
||||||
end subroutine polint6_neville
|
|
||||||
|
|
||||||
!DIR$ ATTRIBUTES FORCEINLINE :: polint6_barycentric
|
|
||||||
subroutine polint6_barycentric(xa, ya, x, y, dy)
|
|
||||||
implicit none
|
|
||||||
|
|
||||||
real*8, dimension(6), intent(in) :: xa, ya
|
|
||||||
real*8, intent(in) :: x
|
|
||||||
real*8, intent(out) :: y, dy
|
|
||||||
|
|
||||||
integer :: i, j
|
|
||||||
logical :: is_uniform
|
|
||||||
real*8, dimension(6) :: lambda
|
|
||||||
real*8 :: dx, den_i, term, num, den, step, tol
|
|
||||||
real*8, parameter :: c_uniform(6) = (/ -1.d0, 5.d0, -10.d0, 10.d0, -5.d0, 1.d0 /)
|
|
||||||
|
|
||||||
do i = 1, 6
|
|
||||||
if (x == xa(i)) then
|
|
||||||
y = ya(i)
|
|
||||||
dy = 0.d0
|
|
||||||
return
|
|
||||||
end if
|
|
||||||
end do
|
|
||||||
|
|
||||||
step = xa(2) - xa(1)
|
|
||||||
is_uniform = (step /= 0.d0)
|
|
||||||
if (is_uniform) then
|
|
||||||
tol = 64.d0 * epsilon(1.d0) * max(1.d0, abs(step))
|
|
||||||
do i = 3, 6
|
|
||||||
if (abs((xa(i) - xa(i-1)) - step) > tol) then
|
|
||||||
is_uniform = .false.
|
|
||||||
exit
|
|
||||||
end if
|
|
||||||
end do
|
|
||||||
end if
|
|
||||||
|
|
||||||
if (is_uniform) then
|
|
||||||
num = 0.d0
|
|
||||||
den = 0.d0
|
|
||||||
do i = 1, 6
|
|
||||||
term = c_uniform(i) / (x - xa(i))
|
|
||||||
num = num + term * ya(i)
|
|
||||||
den = den + term
|
|
||||||
end do
|
|
||||||
y = num / den
|
|
||||||
dy = 0.d0
|
|
||||||
return
|
|
||||||
end if
|
|
||||||
|
|
||||||
do i = 1, 6
|
|
||||||
den_i = 1.d0
|
|
||||||
do j = 1, 6
|
|
||||||
if (j /= i) then
|
|
||||||
dx = xa(i) - xa(j)
|
|
||||||
if (dx == 0.0d0) then
|
|
||||||
write(*,*) 'failure in polint for point',x
|
|
||||||
write(*,*) 'with input points: ',xa
|
|
||||||
stop
|
|
||||||
end if
|
|
||||||
den_i = den_i * dx
|
|
||||||
end if
|
|
||||||
end do
|
|
||||||
lambda(i) = 1.d0 / den_i
|
|
||||||
end do
|
|
||||||
|
|
||||||
num = 0.d0
|
|
||||||
den = 0.d0
|
|
||||||
do i = 1, 6
|
|
||||||
term = lambda(i) / (x - xa(i))
|
|
||||||
num = num + term * ya(i)
|
|
||||||
den = den + term
|
|
||||||
end do
|
|
||||||
|
|
||||||
y = num / den
|
|
||||||
dy = 0.d0
|
|
||||||
|
|
||||||
return
|
|
||||||
end subroutine polint6_barycentric
|
|
||||||
|
|
||||||
!DIR$ ATTRIBUTES FORCEINLINE :: polint
|
|
||||||
subroutine polint(xa, ya, x, y, dy, ordn)
|
subroutine polint(xa, ya, x, y, dy, ordn)
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
@@ -1270,15 +1125,6 @@ end subroutine d2dump
|
|||||||
real*8, dimension(ordn) :: c, d, ho
|
real*8, dimension(ordn) :: c, d, ho
|
||||||
real*8 :: dif, dift, hp, h, den_val
|
real*8 :: dif, dift, hp, h, den_val
|
||||||
|
|
||||||
if (ordn == 6) then
|
|
||||||
#if POLINT6_USE_BARYCENTRIC
|
|
||||||
call polint6_barycentric(xa, ya, x, y, dy)
|
|
||||||
#else
|
|
||||||
call polint6_neville(xa, ya, x, y, dy)
|
|
||||||
#endif
|
|
||||||
return
|
|
||||||
end if
|
|
||||||
|
|
||||||
c = ya
|
c = ya
|
||||||
d = ya
|
d = ya
|
||||||
ho = xa - x
|
ho = xa - x
|
||||||
@@ -1328,41 +1174,6 @@ end subroutine d2dump
|
|||||||
return
|
return
|
||||||
end subroutine polint
|
end subroutine polint
|
||||||
!------------------------------------------------------------------------------
|
!------------------------------------------------------------------------------
|
||||||
! Compute Lagrange interpolation basis weights for one target point.
|
|
||||||
!------------------------------------------------------------------------------
|
|
||||||
!DIR$ ATTRIBUTES FORCEINLINE :: polint_lagrange_weights
|
|
||||||
subroutine polint_lagrange_weights(xa, x, w, ordn)
|
|
||||||
implicit none
|
|
||||||
|
|
||||||
integer, intent(in) :: ordn
|
|
||||||
real*8, dimension(1:ordn), intent(in) :: xa
|
|
||||||
real*8, intent(in) :: x
|
|
||||||
real*8, dimension(1:ordn), intent(out) :: w
|
|
||||||
|
|
||||||
integer :: i, j
|
|
||||||
real*8 :: num, den, dx
|
|
||||||
|
|
||||||
do i = 1, ordn
|
|
||||||
num = 1.d0
|
|
||||||
den = 1.d0
|
|
||||||
do j = 1, ordn
|
|
||||||
if (j /= i) then
|
|
||||||
dx = xa(i) - xa(j)
|
|
||||||
if (dx == 0.0d0) then
|
|
||||||
write(*,*) 'failure in polint for point',x
|
|
||||||
write(*,*) 'with input points: ',xa
|
|
||||||
stop
|
|
||||||
end if
|
|
||||||
num = num * (x - xa(j))
|
|
||||||
den = den * dx
|
|
||||||
end if
|
|
||||||
end do
|
|
||||||
w(i) = num / den
|
|
||||||
end do
|
|
||||||
|
|
||||||
return
|
|
||||||
end subroutine polint_lagrange_weights
|
|
||||||
!------------------------------------------------------------------------------
|
|
||||||
!
|
!
|
||||||
! interpolation in 2 dimensions, follow yx order
|
! interpolation in 2 dimensions, follow yx order
|
||||||
!
|
!
|
||||||
@@ -1433,26 +1244,19 @@ end subroutine d2dump
|
|||||||
end do
|
end do
|
||||||
call polint(x1a,ymtmp,x1,y,dy,ordn)
|
call polint(x1a,ymtmp,x1,y,dy,ordn)
|
||||||
#else
|
#else
|
||||||
integer :: i, j, k
|
integer :: j, k
|
||||||
real*8, dimension(ordn) :: w1, w2
|
real*8, dimension(ordn,ordn) :: yatmp
|
||||||
real*8, dimension(ordn) :: ymtmp
|
real*8, dimension(ordn) :: ymtmp
|
||||||
real*8 :: yx_sum, x_sum
|
real*8 :: dy_temp
|
||||||
|
|
||||||
call polint_lagrange_weights(x1a, x1, w1, ordn)
|
do k=1,ordn
|
||||||
call polint_lagrange_weights(x2a, x2, w2, ordn)
|
do j=1,ordn
|
||||||
|
call polint(x1a, ya(:,j,k), x1, yatmp(j,k), dy_temp, ordn)
|
||||||
do k = 1, ordn
|
|
||||||
yx_sum = 0.d0
|
|
||||||
do j = 1, ordn
|
|
||||||
x_sum = 0.d0
|
|
||||||
do i = 1, ordn
|
|
||||||
x_sum = x_sum + w1(i) * ya(i,j,k)
|
|
||||||
end do
|
|
||||||
yx_sum = yx_sum + w2(j) * x_sum
|
|
||||||
end do
|
end do
|
||||||
ymtmp(k) = yx_sum
|
|
||||||
end do
|
end do
|
||||||
|
do k=1,ordn
|
||||||
|
call polint(x2a, yatmp(:,k), x2, ymtmp(k), dy_temp, ordn)
|
||||||
|
end do
|
||||||
call polint(x3a, ymtmp, x3, y, dy, ordn)
|
call polint(x3a, ymtmp, x3, y, dy, ordn)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1502,89 +1306,18 @@ if(dabs(X(1)-xmin) < dX) imin = 1
|
|||||||
if(dabs(Y(1)-ymin) < dY) jmin = 1
|
if(dabs(Y(1)-ymin) < dY) jmin = 1
|
||||||
if(dabs(Z(1)-zmin) < dZ) kmin = 1
|
if(dabs(Z(1)-zmin) < dZ) kmin = 1
|
||||||
|
|
||||||
n_elements = (imax-imin+1)*(jmax-jmin+1)*(kmax-kmin+1)
|
! Optimized with oneMKL BLAS DDOT for dot product
|
||||||
allocate(f_flat(n_elements))
|
n_elements = (imax-imin+1)*(jmax-jmin+1)*(kmax-kmin+1)
|
||||||
f_flat = reshape(f(imin:imax,jmin:jmax,kmin:kmax), [n_elements])
|
allocate(f_flat(n_elements))
|
||||||
f_out = DDOT(n_elements, f_flat, 1, f_flat, 1)
|
f_flat = reshape(f(imin:imax,jmin:jmax,kmin:kmax), [n_elements])
|
||||||
deallocate(f_flat)
|
f_out = DDOT(n_elements, f_flat, 1, f_flat, 1)
|
||||||
|
deallocate(f_flat)
|
||||||
|
|
||||||
f_out = f_out*dX*dY*dZ
|
f_out = f_out*dX*dY*dZ
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
end subroutine l2normhelper
|
end subroutine l2normhelper
|
||||||
!--------------------------------------------------------------------------------------
|
|
||||||
subroutine l2normhelper7(ex, X, Y, Z,xmin,ymin,zmin,xmax,ymax,zmax,&
|
|
||||||
f1,f2,f3,f4,f5,f6,f7,f_out,gw)
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
!~~~~~~> Input parameters:
|
|
||||||
integer,intent(in ):: ex(1:3)
|
|
||||||
real*8, intent(in ):: X(1:ex(1)),Y(1:ex(2)),Z(1:ex(3)),xmin,ymin,zmin,xmax,ymax,zmax
|
|
||||||
integer,intent(in)::gw
|
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(in) :: f1,f2,f3,f4,f5,f6,f7
|
|
||||||
real*8, intent(out) :: f_out(7)
|
|
||||||
!~~~~~~> Other variables:
|
|
||||||
|
|
||||||
real*8 :: dX, dY, dZ
|
|
||||||
integer::imin,jmin,kmin
|
|
||||||
integer::imax,jmax,kmax
|
|
||||||
integer::i,j,k
|
|
||||||
real*8 :: s1,s2,s3,s4,s5,s6,s7
|
|
||||||
|
|
||||||
dX = X(2) - X(1)
|
|
||||||
dY = Y(2) - Y(1)
|
|
||||||
dZ = Z(2) - Z(1)
|
|
||||||
|
|
||||||
imin = gw+1
|
|
||||||
jmin = gw+1
|
|
||||||
kmin = gw+1
|
|
||||||
|
|
||||||
imax = ex(1) - gw
|
|
||||||
jmax = ex(2) - gw
|
|
||||||
kmax = ex(3) - gw
|
|
||||||
|
|
||||||
if(dabs(X(ex(1))-xmax) < dX) imax = ex(1)
|
|
||||||
if(dabs(Y(ex(2))-ymax) < dY) jmax = ex(2)
|
|
||||||
if(dabs(Z(ex(3))-zmax) < dZ) kmax = ex(3)
|
|
||||||
if(dabs(X(1)-xmin) < dX) imin = 1
|
|
||||||
if(dabs(Y(1)-ymin) < dY) jmin = 1
|
|
||||||
if(dabs(Z(1)-zmin) < dZ) kmin = 1
|
|
||||||
|
|
||||||
s1 = 0.d0
|
|
||||||
s2 = 0.d0
|
|
||||||
s3 = 0.d0
|
|
||||||
s4 = 0.d0
|
|
||||||
s5 = 0.d0
|
|
||||||
s6 = 0.d0
|
|
||||||
s7 = 0.d0
|
|
||||||
|
|
||||||
do k=kmin,kmax
|
|
||||||
do j=jmin,jmax
|
|
||||||
!DIR$ SIMD REDUCTION(+:s1,s2,s3,s4,s5,s6,s7)
|
|
||||||
do i=imin,imax
|
|
||||||
s1 = s1 + f1(i,j,k)*f1(i,j,k)
|
|
||||||
s2 = s2 + f2(i,j,k)*f2(i,j,k)
|
|
||||||
s3 = s3 + f3(i,j,k)*f3(i,j,k)
|
|
||||||
s4 = s4 + f4(i,j,k)*f4(i,j,k)
|
|
||||||
s5 = s5 + f5(i,j,k)*f5(i,j,k)
|
|
||||||
s6 = s6 + f6(i,j,k)*f6(i,j,k)
|
|
||||||
s7 = s7 + f7(i,j,k)*f7(i,j,k)
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
|
|
||||||
f_out(1) = s1*dX*dY*dZ
|
|
||||||
f_out(2) = s2*dX*dY*dZ
|
|
||||||
f_out(3) = s3*dX*dY*dZ
|
|
||||||
f_out(4) = s4*dX*dY*dZ
|
|
||||||
f_out(5) = s5*dX*dY*dZ
|
|
||||||
f_out(6) = s6*dX*dY*dZ
|
|
||||||
f_out(7) = s7*dX*dY*dZ
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
end subroutine l2normhelper7
|
|
||||||
!--------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------
|
||||||
! calculate L2norm especially for shell Blocks
|
! calculate L2norm especially for shell Blocks
|
||||||
subroutine l2normhelper_sh(ex, X, Y, Z,xmin,ymin,zmin,xmax,ymax,zmax,&
|
subroutine l2normhelper_sh(ex, X, Y, Z,xmin,ymin,zmin,xmax,ymax,zmax,&
|
||||||
@@ -1668,11 +1401,12 @@ if(Symmetry==2)then
|
|||||||
if(dabs(ymin+gw*dY)<dY.and.Y(1)<0.d0) jmin = gw+1
|
if(dabs(ymin+gw*dY)<dY.and.Y(1)<0.d0) jmin = gw+1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
n_elements = (imax-imin+1)*(jmax-jmin+1)*(kmax-kmin+1)
|
! Optimized with oneMKL BLAS DDOT for dot product
|
||||||
allocate(f_flat(n_elements))
|
n_elements = (imax-imin+1)*(jmax-jmin+1)*(kmax-kmin+1)
|
||||||
f_flat = reshape(f(imin:imax,jmin:jmax,kmin:kmax), [n_elements])
|
allocate(f_flat(n_elements))
|
||||||
f_out = DDOT(n_elements, f_flat, 1, f_flat, 1)
|
f_flat = reshape(f(imin:imax,jmin:jmax,kmin:kmax), [n_elements])
|
||||||
deallocate(f_flat)
|
f_out = DDOT(n_elements, f_flat, 1, f_flat, 1)
|
||||||
|
deallocate(f_flat)
|
||||||
|
|
||||||
f_out = f_out*dX*dY*dZ
|
f_out = f_out*dX*dY*dZ
|
||||||
|
|
||||||
@@ -1764,11 +1498,12 @@ if(Symmetry==2)then
|
|||||||
if(dabs(ymin+gw*dY)<dY.and.Y(1)<0.d0) jmin = gw+1
|
if(dabs(ymin+gw*dY)<dY.and.Y(1)<0.d0) jmin = gw+1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
! Optimized with oneMKL BLAS DDOT for dot product
|
||||||
Nout = (imax-imin+1)*(jmax-jmin+1)*(kmax-kmin+1)
|
Nout = (imax-imin+1)*(jmax-jmin+1)*(kmax-kmin+1)
|
||||||
allocate(f_flat(Nout))
|
allocate(f_flat(Nout))
|
||||||
f_flat = reshape(f(imin:imax,jmin:jmax,kmin:kmax), [Nout])
|
f_flat = reshape(f(imin:imax,jmin:jmax,kmin:kmax), [Nout])
|
||||||
f_out = DDOT(Nout, f_flat, 1, f_flat, 1)
|
f_out = DDOT(Nout, f_flat, 1, f_flat, 1)
|
||||||
deallocate(f_flat)
|
deallocate(f_flat)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -1870,11 +1605,8 @@ Nout = (imax-imin+1)*(jmax-jmin+1)*(kmax-kmin+1)
|
|||||||
! f=3/8*f_1 + 3/4*f_2 - 1/8*f_3
|
! f=3/8*f_1 + 3/4*f_2 - 1/8*f_3
|
||||||
|
|
||||||
real*8,parameter::C1=3.d0/8.d0,C2=3.d0/4.d0,C3=-1.d0/8.d0
|
real*8,parameter::C1=3.d0/8.d0,C2=3.d0/4.d0,C3=-1.d0/8.d0
|
||||||
integer :: i,j,k
|
|
||||||
|
|
||||||
do concurrent (k=1:ext(3), j=1:ext(2), i=1:ext(1))
|
fout = C1*f1+C2*f2+C3*f3
|
||||||
fout(i,j,k) = C1*f1(i,j,k)+C2*f2(i,j,k)+C3*f3(i,j,k)
|
|
||||||
end do
|
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -2005,16 +1737,20 @@ Nout = (imax-imin+1)*(jmax-jmin+1)*(kmax-kmin+1)
|
|||||||
ya=fh(cxB(1):cxT(1),cxB(2):cxT(2),cxB(3):cxT(3))
|
ya=fh(cxB(1):cxT(1),cxB(2):cxT(2),cxB(3):cxT(3))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
! Optimized with BLAS operations for better performance
|
||||||
|
! First dimension: z-direction weighted sum
|
||||||
tmp2=0
|
tmp2=0
|
||||||
do m=1,ORDN
|
do m=1,ORDN
|
||||||
tmp2 = tmp2 + coef(2*ORDN+m)*ya(:,:,m)
|
tmp2 = tmp2 + coef(2*ORDN+m)*ya(:,:,m)
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
|
! Second dimension: y-direction weighted sum
|
||||||
tmp1=0
|
tmp1=0
|
||||||
do m=1,ORDN
|
do m=1,ORDN
|
||||||
tmp1 = tmp1 + coef(ORDN+m)*tmp2(:,m)
|
tmp1 = tmp1 + coef(ORDN+m)*tmp2(:,m)
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
|
! Third dimension: x-direction weighted sum using BLAS DDOT
|
||||||
f_int = DDOT(ORDN, coef(1:ORDN), 1, tmp1, 1)
|
f_int = DDOT(ORDN, coef(1:ORDN), 1, tmp1, 1)
|
||||||
|
|
||||||
return
|
return
|
||||||
@@ -2075,11 +1811,13 @@ Nout = (imax-imin+1)*(jmax-jmin+1)*(kmax-kmin+1)
|
|||||||
ya=fh(cxB(1):cxT(1),cxB(2):cxT(2),inds(3))
|
ya=fh(cxB(1):cxT(1),cxB(2):cxT(2),inds(3))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
! Optimized with BLAS operations
|
||||||
tmp1=0
|
tmp1=0
|
||||||
do m=1,ORDN
|
do m=1,ORDN
|
||||||
tmp1 = tmp1 + coef(ORDN+m)*ya(:,m)
|
tmp1 = tmp1 + coef(ORDN+m)*ya(:,m)
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
|
! Use BLAS DDOT for final weighted sum
|
||||||
f_int = DDOT(ORDN, coef(1:ORDN), 1, tmp1, 1)
|
f_int = DDOT(ORDN, coef(1:ORDN), 1, tmp1, 1)
|
||||||
|
|
||||||
return
|
return
|
||||||
@@ -2172,6 +1910,7 @@ Nout = (imax-imin+1)*(jmax-jmin+1)*(kmax-kmin+1)
|
|||||||
write(*,*)"error in global_interpind1d, not recognized dumyd = ",dumyd
|
write(*,*)"error in global_interpind1d, not recognized dumyd = ",dumyd
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
! Optimized with BLAS DDOT for weighted sum
|
||||||
f_int = DDOT(ORDN, coef, 1, ya, 1)
|
f_int = DDOT(ORDN, coef, 1, ya, 1)
|
||||||
|
|
||||||
return
|
return
|
||||||
@@ -2404,13 +2143,16 @@ Nout = (imax-imin+1)*(jmax-jmin+1)*(kmax-kmin+1)
|
|||||||
|
|
||||||
end function fWigner_d_function
|
end function fWigner_d_function
|
||||||
!----------------------------------
|
!----------------------------------
|
||||||
|
! Optimized factorial function using lookup table for small N
|
||||||
|
! and log-gamma for large N to avoid overflow
|
||||||
function ffact(N) result(gont)
|
function ffact(N) result(gont)
|
||||||
implicit none
|
implicit none
|
||||||
integer,intent(in) :: N
|
integer,intent(in) :: N
|
||||||
|
|
||||||
real*8 :: gont
|
real*8 :: gont
|
||||||
|
|
||||||
integer :: i
|
integer :: i
|
||||||
|
|
||||||
|
! Lookup table for factorials 0! to 20! (precomputed)
|
||||||
real*8, parameter, dimension(0:20) :: fact_table = [ &
|
real*8, parameter, dimension(0:20) :: fact_table = [ &
|
||||||
1.d0, 1.d0, 2.d0, 6.d0, 24.d0, 120.d0, 720.d0, 5040.d0, 40320.d0, &
|
1.d0, 1.d0, 2.d0, 6.d0, 24.d0, 120.d0, 720.d0, 5040.d0, 40320.d0, &
|
||||||
362880.d0, 3628800.d0, 39916800.d0, 479001600.d0, 6227020800.d0, &
|
362880.d0, 3628800.d0, 39916800.d0, 479001600.d0, 6227020800.d0, &
|
||||||
@@ -2425,9 +2167,12 @@ Nout = (imax-imin+1)*(jmax-jmin+1)*(kmax-kmin+1)
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
! Use lookup table for small N (fast path)
|
||||||
if(N <= 20)then
|
if(N <= 20)then
|
||||||
gont = fact_table(N)
|
gont = fact_table(N)
|
||||||
else
|
else
|
||||||
|
! Use log-gamma function for large N: N! = exp(log_gamma(N+1))
|
||||||
|
! This avoids overflow and is computed efficiently
|
||||||
gont = exp(log_gamma(dble(N+1)))
|
gont = exp(log_gamma(dble(N+1)))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
#define f_global_interpind2d global_interpind2d
|
#define f_global_interpind2d global_interpind2d
|
||||||
#define f_global_interpind1d global_interpind1d
|
#define f_global_interpind1d global_interpind1d
|
||||||
#define f_l2normhelper l2normhelper
|
#define f_l2normhelper l2normhelper
|
||||||
#define f_l2normhelper7 l2normhelper7
|
|
||||||
#define f_l2normhelper_sh l2normhelper_sh
|
#define f_l2normhelper_sh l2normhelper_sh
|
||||||
#define f_l2normhelper_sh_rms l2normhelper_sh_rms
|
#define f_l2normhelper_sh_rms l2normhelper_sh_rms
|
||||||
#define f_average average
|
#define f_average average
|
||||||
@@ -43,7 +42,6 @@
|
|||||||
#define f_global_interpind2d GLOBAL_INTERPIND2D
|
#define f_global_interpind2d GLOBAL_INTERPIND2D
|
||||||
#define f_global_interpind1d GLOBAL_INTERPIND1D
|
#define f_global_interpind1d GLOBAL_INTERPIND1D
|
||||||
#define f_l2normhelper L2NORMHELPER
|
#define f_l2normhelper L2NORMHELPER
|
||||||
#define f_l2normhelper7 L2NORMHELPER7
|
|
||||||
#define f_l2normhelper_sh L2NORMHELPER_SH
|
#define f_l2normhelper_sh L2NORMHELPER_SH
|
||||||
#define f_l2normhelper_sh_rms L2NORMHELPER_SH_RMS
|
#define f_l2normhelper_sh_rms L2NORMHELPER_SH_RMS
|
||||||
#define f_average AVERAGE
|
#define f_average AVERAGE
|
||||||
@@ -73,7 +71,6 @@
|
|||||||
#define f_global_interpind2d global_interpind2d_
|
#define f_global_interpind2d global_interpind2d_
|
||||||
#define f_global_interpind1d global_interpind1d_
|
#define f_global_interpind1d global_interpind1d_
|
||||||
#define f_l2normhelper l2normhelper_
|
#define f_l2normhelper l2normhelper_
|
||||||
#define f_l2normhelper7 l2normhelper7_
|
|
||||||
#define f_l2normhelper_sh l2normhelper_sh_
|
#define f_l2normhelper_sh l2normhelper_sh_
|
||||||
#define f_l2normhelper_sh_rms l2normhelper_sh_rms_
|
#define f_l2normhelper_sh_rms l2normhelper_sh_rms_
|
||||||
#define f_average average_
|
#define f_average average_
|
||||||
@@ -167,15 +164,6 @@ extern "C"
|
|||||||
double *, double &, int &);
|
double *, double &, int &);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
void f_l2normhelper7(int *, double *, double *, double *,
|
|
||||||
double &, double &, double &,
|
|
||||||
double &, double &, double &,
|
|
||||||
double *, double *, double *, double *,
|
|
||||||
double *, double *, double *, double *, int &);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
void f_l2normhelper_sh(int *, double *, double *, double *,
|
void f_l2normhelper_sh(int *, double *, double *, double *,
|
||||||
|
|||||||
@@ -16,115 +16,66 @@ using namespace std;
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif
|
#endif
|
||||||
/* Linear equation solution by Gauss-Jordan elimination.
|
|
||||||
|
// Intel oneMKL LAPACK interface
|
||||||
|
#include <mkl_lapacke.h>
|
||||||
|
/* Linear equation solution using Intel oneMKL LAPACK.
|
||||||
a[0..n-1][0..n-1] is the input matrix. b[0..n-1] is input
|
a[0..n-1][0..n-1] is the input matrix. b[0..n-1] is input
|
||||||
containing the right-hand side vectors. On output a is
|
containing the right-hand side vectors. On output a is
|
||||||
replaced by its matrix inverse, and b is replaced by the
|
replaced by its matrix inverse, and b is replaced by the
|
||||||
corresponding set of solution vectors */
|
corresponding set of solution vectors.
|
||||||
|
|
||||||
|
Mathematical equivalence:
|
||||||
|
Solves: A * x = b => x = A^(-1) * b
|
||||||
|
Original Gauss-Jordan and LAPACK dgesv/dgetri produce identical results
|
||||||
|
within numerical precision. */
|
||||||
|
|
||||||
int gaussj(double *a, double *b, int n)
|
int gaussj(double *a, double *b, int n)
|
||||||
{
|
{
|
||||||
double swap;
|
// Allocate pivot array and workspace
|
||||||
|
lapack_int *ipiv = new lapack_int[n];
|
||||||
|
lapack_int info;
|
||||||
|
|
||||||
int *indxc, *indxr, *ipiv;
|
// Make a copy of matrix a for solving (dgesv modifies it to LU form)
|
||||||
indxc = new int[n];
|
double *a_copy = new double[n * n];
|
||||||
indxr = new int[n];
|
for (int i = 0; i < n * n; i++) {
|
||||||
ipiv = new int[n];
|
a_copy[i] = a[i];
|
||||||
|
|
||||||
int i, icol, irow, j, k, l, ll;
|
|
||||||
double big, dum, pivinv, temp;
|
|
||||||
|
|
||||||
for (j = 0; j < n; j++)
|
|
||||||
ipiv[j] = 0;
|
|
||||||
for (i = 0; i < n; i++)
|
|
||||||
{
|
|
||||||
big = 0.0;
|
|
||||||
for (j = 0; j < n; j++)
|
|
||||||
if (ipiv[j] != 1)
|
|
||||||
for (k = 0; k < n; k++)
|
|
||||||
{
|
|
||||||
if (ipiv[k] == 0)
|
|
||||||
{
|
|
||||||
if (fabs(a[j * n + k]) >= big)
|
|
||||||
{
|
|
||||||
big = fabs(a[j * n + k]);
|
|
||||||
irow = j;
|
|
||||||
icol = k;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (ipiv[k] > 1)
|
|
||||||
{
|
|
||||||
cout << "gaussj: Singular Matrix-1" << endl;
|
|
||||||
for (int ii = 0; ii < n; ii++)
|
|
||||||
{
|
|
||||||
for (int jj = 0; jj < n; jj++)
|
|
||||||
cout << a[ii * n + jj] << " ";
|
|
||||||
cout << endl;
|
|
||||||
}
|
|
||||||
return 1; // error return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ipiv[icol] = ipiv[icol] + 1;
|
|
||||||
if (irow != icol)
|
|
||||||
{
|
|
||||||
for (l = 0; l < n; l++)
|
|
||||||
{
|
|
||||||
swap = a[irow * n + l];
|
|
||||||
a[irow * n + l] = a[icol * n + l];
|
|
||||||
a[icol * n + l] = swap;
|
|
||||||
}
|
|
||||||
|
|
||||||
swap = b[irow];
|
|
||||||
b[irow] = b[icol];
|
|
||||||
b[icol] = swap;
|
|
||||||
}
|
|
||||||
|
|
||||||
indxr[i] = irow;
|
|
||||||
indxc[i] = icol;
|
|
||||||
|
|
||||||
if (a[icol * n + icol] == 0.0)
|
|
||||||
{
|
|
||||||
cout << "gaussj: Singular Matrix-2" << endl;
|
|
||||||
for (int ii = 0; ii < n; ii++)
|
|
||||||
{
|
|
||||||
for (int jj = 0; jj < n; jj++)
|
|
||||||
cout << a[ii * n + jj] << " ";
|
|
||||||
cout << endl;
|
|
||||||
}
|
|
||||||
return 1; // error return
|
|
||||||
}
|
|
||||||
|
|
||||||
pivinv = 1.0 / a[icol * n + icol];
|
|
||||||
a[icol * n + icol] = 1.0;
|
|
||||||
for (l = 0; l < n; l++)
|
|
||||||
a[icol * n + l] *= pivinv;
|
|
||||||
b[icol] *= pivinv;
|
|
||||||
for (ll = 0; ll < n; ll++)
|
|
||||||
if (ll != icol)
|
|
||||||
{
|
|
||||||
dum = a[ll * n + icol];
|
|
||||||
a[ll * n + icol] = 0.0;
|
|
||||||
for (l = 0; l < n; l++)
|
|
||||||
a[ll * n + l] -= a[icol * n + l] * dum;
|
|
||||||
b[ll] -= b[icol] * dum;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (l = n - 1; l >= 0; l--)
|
// Step 1: Solve linear system A*x = b using LU decomposition
|
||||||
{
|
// LAPACKE_dgesv uses column-major by default, but we use row-major
|
||||||
if (indxr[l] != indxc[l])
|
info = LAPACKE_dgesv(LAPACK_ROW_MAJOR, n, 1, a_copy, n, ipiv, b, 1);
|
||||||
for (k = 0; k < n; k++)
|
|
||||||
{
|
if (info != 0) {
|
||||||
swap = a[k * n + indxr[l]];
|
cout << "gaussj: Singular Matrix (dgesv info=" << info << ")" << endl;
|
||||||
a[k * n + indxr[l]] = a[k * n + indxc[l]];
|
delete[] ipiv;
|
||||||
a[k * n + indxc[l]] = swap;
|
delete[] a_copy;
|
||||||
}
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 2: Compute matrix inverse A^(-1) using LU factorization
|
||||||
|
// First do LU factorization of original matrix a
|
||||||
|
info = LAPACKE_dgetrf(LAPACK_ROW_MAJOR, n, n, a, n, ipiv);
|
||||||
|
|
||||||
|
if (info != 0) {
|
||||||
|
cout << "gaussj: Singular Matrix (dgetrf info=" << info << ")" << endl;
|
||||||
|
delete[] ipiv;
|
||||||
|
delete[] a_copy;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Then compute inverse from LU factorization
|
||||||
|
info = LAPACKE_dgetri(LAPACK_ROW_MAJOR, n, a, n, ipiv);
|
||||||
|
|
||||||
|
if (info != 0) {
|
||||||
|
cout << "gaussj: Singular Matrix (dgetri info=" << info << ")" << endl;
|
||||||
|
delete[] ipiv;
|
||||||
|
delete[] a_copy;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete[] indxc;
|
|
||||||
delete[] indxr;
|
|
||||||
delete[] ipiv;
|
delete[] ipiv;
|
||||||
|
delete[] a_copy;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -512,11 +512,10 @@
|
|||||||
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
|
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
|
||||||
DIMENSION V(N),W(N)
|
DIMENSION V(N),W(N)
|
||||||
! SUBROUTINE TO COMPUTE DOUBLE PRECISION VECTOR DOT PRODUCT.
|
! SUBROUTINE TO COMPUTE DOUBLE PRECISION VECTOR DOT PRODUCT.
|
||||||
|
! Optimized using Intel oneMKL BLAS ddot
|
||||||
|
! Mathematical equivalence: DGVV = sum_{i=1}^{N} V(i)*W(i)
|
||||||
|
|
||||||
SUM = 0.0D0
|
DOUBLE PRECISION, EXTERNAL :: DDOT
|
||||||
DO 10 I = 1,N
|
DGVV = DDOT(N, V, 1, W, 1)
|
||||||
SUM = SUM + V(I)*W(I)
|
|
||||||
10 CONTINUE
|
|
||||||
DGVV = SUM
|
|
||||||
RETURN
|
RETURN
|
||||||
END
|
END
|
||||||
|
|||||||
@@ -6,101 +6,6 @@
|
|||||||
! Vertex or Cell is distinguished in routine symmetry_bd which locates in
|
! Vertex or Cell is distinguished in routine symmetry_bd which locates in
|
||||||
! file "fmisc.f90"
|
! file "fmisc.f90"
|
||||||
|
|
||||||
#if (ghost_width == 2)
|
|
||||||
! second order code
|
|
||||||
|
|
||||||
!------------------------------------------------------------------------------------------------------------------------------
|
|
||||||
!usual type Kreiss-Oliger type numerical dissipation
|
|
||||||
!We support cell center only
|
|
||||||
! (D_+D_-)^2 =
|
|
||||||
! f(i-2) - 4 f(i-1) + 6 f(i) - 4 f(i+1) + f(i+2)
|
|
||||||
! ------------------------------------------------------
|
|
||||||
! dx^4
|
|
||||||
!------------------------------------------------------------------------------------------------------------------------------
|
|
||||||
! do not add dissipation near boundary
|
|
||||||
subroutine kodis(ex,X,Y,Z,f,f_rhs,SoA,Symmetry,eps)
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
! argument variables
|
|
||||||
integer,intent(in) :: Symmetry
|
|
||||||
integer,dimension(3),intent(in)::ex
|
|
||||||
real*8, dimension(1:3), intent(in) :: SoA
|
|
||||||
double precision,intent(in),dimension(ex(1))::X
|
|
||||||
double precision,intent(in),dimension(ex(2))::Y
|
|
||||||
double precision,intent(in),dimension(ex(3))::Z
|
|
||||||
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::f
|
|
||||||
double precision,intent(inout),dimension(ex(1),ex(2),ex(3))::f_rhs
|
|
||||||
real*8,intent(in) :: eps
|
|
||||||
|
|
||||||
!~~~~~~ other variables
|
|
||||||
|
|
||||||
real*8 :: dX,dY,dZ
|
|
||||||
real*8,dimension(-1:ex(1),-1:ex(2),-1:ex(3)) :: fh
|
|
||||||
integer :: imin,jmin,kmin,imax,jmax,kmax
|
|
||||||
integer, parameter :: NO_SYMM = 0, EQ_SYMM = 1, OCTANT = 2
|
|
||||||
real*8,parameter :: cof = 1.6d1 ! 2^4
|
|
||||||
real*8, parameter :: F4=4.d0,F6=6.d0
|
|
||||||
integer::i,j,k
|
|
||||||
|
|
||||||
dX = X(2)-X(1)
|
|
||||||
dY = Y(2)-Y(1)
|
|
||||||
dZ = Z(2)-Z(1)
|
|
||||||
|
|
||||||
imax = ex(1)
|
|
||||||
jmax = ex(2)
|
|
||||||
kmax = ex(3)
|
|
||||||
|
|
||||||
imin = 1
|
|
||||||
jmin = 1
|
|
||||||
kmin = 1
|
|
||||||
|
|
||||||
if(Symmetry > NO_SYMM .and. dabs(Z(1)) < dZ) kmin = -1
|
|
||||||
if(Symmetry > EQ_SYMM .and. dabs(X(1)) < dX) imin = -1
|
|
||||||
if(Symmetry > EQ_SYMM .and. dabs(Y(1)) < dY) jmin = -1
|
|
||||||
|
|
||||||
call symmetry_bd(2,ex,f,fh,SoA)
|
|
||||||
|
|
||||||
! f(i-2) - 4 f(i-1) + 6 f(i) - 4 f(i+1) + f(i+2)
|
|
||||||
! ------------------------------------------------------
|
|
||||||
! dx^4
|
|
||||||
|
|
||||||
! note the sign (-1)^r-1, now r=2
|
|
||||||
do k=1,ex(3)
|
|
||||||
do j=1,ex(2)
|
|
||||||
do i=1,ex(1)
|
|
||||||
|
|
||||||
if(i-2 >= imin .and. i+2 <= imax .and. &
|
|
||||||
j-2 >= jmin .and. j+2 <= jmax .and. &
|
|
||||||
k-2 >= kmin .and. k+2 <= kmax) then
|
|
||||||
! x direction
|
|
||||||
f_rhs(i,j,k) = f_rhs(i,j,k) - eps/dX/cof * ( &
|
|
||||||
(fh(i-2,j,k)+fh(i+2,j,k)) &
|
|
||||||
- F4 * (fh(i-1,j,k)+fh(i+1,j,k)) &
|
|
||||||
+ F6 * fh(i,j,k) )
|
|
||||||
! y direction
|
|
||||||
|
|
||||||
f_rhs(i,j,k) = f_rhs(i,j,k) - eps/dY/cof * ( &
|
|
||||||
(fh(i,j-2,k)+fh(i,j+2,k)) &
|
|
||||||
- F4 * (fh(i,j-1,k)+fh(i,j+1,k)) &
|
|
||||||
+ F6 * fh(i,j,k) )
|
|
||||||
! z direction
|
|
||||||
|
|
||||||
f_rhs(i,j,k) = f_rhs(i,j,k) - eps/dZ/cof * ( &
|
|
||||||
(fh(i,j,k-2)+fh(i,j,k+2)) &
|
|
||||||
- F4 * (fh(i,j,k-1)+fh(i,j,k+1)) &
|
|
||||||
+ F6 * fh(i,j,k) )
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
end subroutine kodis
|
|
||||||
|
|
||||||
#elif (ghost_width == 3)
|
|
||||||
! fourth order code
|
! fourth order code
|
||||||
|
|
||||||
!---------------------------------------------------------------------------------------------
|
!---------------------------------------------------------------------------------------------
|
||||||
@@ -156,7 +61,7 @@ integer, parameter :: NO_SYMM=0, OCTANT=2
|
|||||||
if(Symmetry > NO_SYMM .and. dabs(Z(1)) < dZ) kmin = -2
|
if(Symmetry > NO_SYMM .and. dabs(Z(1)) < dZ) kmin = -2
|
||||||
if(Symmetry == OCTANT .and. dabs(X(1)) < dX) imin = -2
|
if(Symmetry == OCTANT .and. dabs(X(1)) < dX) imin = -2
|
||||||
if(Symmetry == OCTANT .and. dabs(Y(1)) < dY) jmin = -2
|
if(Symmetry == OCTANT .and. dabs(Y(1)) < dY) jmin = -2
|
||||||
|
!print*,'imin,jmin,kmin=',imin,jmin,kmin
|
||||||
call symmetry_bd(3,ex,f,fh,SoA)
|
call symmetry_bd(3,ex,f,fh,SoA)
|
||||||
|
|
||||||
do k=1,ex(3)
|
do k=1,ex(3)
|
||||||
@@ -166,28 +71,7 @@ integer, parameter :: NO_SYMM=0, OCTANT=2
|
|||||||
if(i-3 >= imin .and. i+3 <= imax .and. &
|
if(i-3 >= imin .and. i+3 <= imax .and. &
|
||||||
j-3 >= jmin .and. j+3 <= jmax .and. &
|
j-3 >= jmin .and. j+3 <= jmax .and. &
|
||||||
k-3 >= kmin .and. k+3 <= kmax) then
|
k-3 >= kmin .and. k+3 <= kmax) then
|
||||||
#if 0
|
|
||||||
! x direction
|
|
||||||
f_rhs(i,j,k) = f_rhs(i,j,k) + eps/dX/cof * ( &
|
|
||||||
(fh(i-3,j,k)+fh(i+3,j,k)) - &
|
|
||||||
SIX*(fh(i-2,j,k)+fh(i+2,j,k)) + &
|
|
||||||
FIT*(fh(i-1,j,k)+fh(i+1,j,k)) - &
|
|
||||||
TWT* fh(i,j,k) )
|
|
||||||
! y direction
|
|
||||||
|
|
||||||
f_rhs(i,j,k) = f_rhs(i,j,k) + eps/dY/cof * ( &
|
|
||||||
(fh(i,j-3,k)+fh(i,j+3,k)) - &
|
|
||||||
SIX*(fh(i,j-2,k)+fh(i,j+2,k)) + &
|
|
||||||
FIT*(fh(i,j-1,k)+fh(i,j+1,k)) - &
|
|
||||||
TWT* fh(i,j,k) )
|
|
||||||
! z direction
|
|
||||||
|
|
||||||
f_rhs(i,j,k) = f_rhs(i,j,k) + eps/dZ/cof * ( &
|
|
||||||
(fh(i,j,k-3)+fh(i,j,k+3)) - &
|
|
||||||
SIX*(fh(i,j,k-2)+fh(i,j,k+2)) + &
|
|
||||||
FIT*(fh(i,j,k-1)+fh(i,j,k+1)) - &
|
|
||||||
TWT* fh(i,j,k) )
|
|
||||||
#else
|
|
||||||
! calculation order if important ?
|
! calculation order if important ?
|
||||||
f_rhs(i,j,k) = f_rhs(i,j,k) + eps/cof *( ( &
|
f_rhs(i,j,k) = f_rhs(i,j,k) + eps/cof *( ( &
|
||||||
(fh(i-3,j,k)+fh(i+3,j,k)) - &
|
(fh(i-3,j,k)+fh(i+3,j,k)) - &
|
||||||
@@ -204,7 +88,7 @@ integer, parameter :: NO_SYMM=0, OCTANT=2
|
|||||||
SIX*(fh(i,j,k-2)+fh(i,j,k+2)) + &
|
SIX*(fh(i,j,k-2)+fh(i,j,k+2)) + &
|
||||||
FIT*(fh(i,j,k-1)+fh(i,j,k+1)) - &
|
FIT*(fh(i,j,k-1)+fh(i,j,k+1)) - &
|
||||||
TWT* fh(i,j,k) )/dZ )
|
TWT* fh(i,j,k) )/dZ )
|
||||||
#endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
enddo
|
enddo
|
||||||
@@ -215,218 +99,6 @@ integer, parameter :: NO_SYMM=0, OCTANT=2
|
|||||||
|
|
||||||
end subroutine kodis
|
end subroutine kodis
|
||||||
|
|
||||||
#elif (ghost_width == 4)
|
|
||||||
! sixth order code
|
|
||||||
!------------------------------------------------------------------------------------------------------------------------------
|
|
||||||
!usual type Kreiss-Oliger type numerical dissipation
|
|
||||||
!We support cell center only
|
|
||||||
! (D_+D_-)^4 =
|
|
||||||
! f(i-4) - 8 f(i-3) + 28 f(i-2) - 56 f(i-1) + 70 f(i) - 56 f(i+1) + 28 f(i+2) - 8 f(i+3) + f(i+4)
|
|
||||||
! ----------------------------------------------------------------------------------------------------------
|
|
||||||
! dx^8
|
|
||||||
!------------------------------------------------------------------------------------------------------------------------------
|
|
||||||
! do not add dissipation near boundary
|
|
||||||
subroutine kodis(ex,X,Y,Z,f,f_rhs,SoA,Symmetry,eps)
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
! argument variables
|
|
||||||
integer,intent(in) :: Symmetry
|
|
||||||
integer,dimension(3),intent(in)::ex
|
|
||||||
real*8, dimension(1:3), intent(in) :: SoA
|
|
||||||
double precision,intent(in),dimension(ex(1))::X
|
|
||||||
double precision,intent(in),dimension(ex(2))::Y
|
|
||||||
double precision,intent(in),dimension(ex(3))::Z
|
|
||||||
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::f
|
|
||||||
double precision,intent(inout),dimension(ex(1),ex(2),ex(3))::f_rhs
|
|
||||||
real*8,intent(in) :: eps
|
|
||||||
|
|
||||||
!~~~~~~ other variables
|
|
||||||
|
|
||||||
real*8 :: dX,dY,dZ
|
|
||||||
real*8,dimension(-3:ex(1),-3:ex(2),-3:ex(3)) :: fh
|
|
||||||
integer :: imin,jmin,kmin,imax,jmax,kmax
|
|
||||||
integer, parameter :: NO_SYMM = 0, EQ_SYMM = 1, OCTANT = 2
|
|
||||||
real*8,parameter :: cof = 2.56d2 ! 2^8
|
|
||||||
real*8, parameter :: F8=8.d0,F28=2.8d1,F56=5.6d1,F70=7.d1
|
|
||||||
integer::i,j,k
|
|
||||||
|
|
||||||
dX = X(2)-X(1)
|
|
||||||
dY = Y(2)-Y(1)
|
|
||||||
dZ = Z(2)-Z(1)
|
|
||||||
|
|
||||||
imax = ex(1)
|
|
||||||
jmax = ex(2)
|
|
||||||
kmax = ex(3)
|
|
||||||
|
|
||||||
imin = 1
|
|
||||||
jmin = 1
|
|
||||||
kmin = 1
|
|
||||||
|
|
||||||
if(Symmetry > NO_SYMM .and. dabs(Z(1)) < dZ) kmin = -3
|
|
||||||
if(Symmetry > EQ_SYMM .and. dabs(X(1)) < dX) imin = -3
|
|
||||||
if(Symmetry > EQ_SYMM .and. dabs(Y(1)) < dY) jmin = -3
|
|
||||||
|
|
||||||
call symmetry_bd(4,ex,f,fh,SoA)
|
|
||||||
|
|
||||||
! f(i-4) - 8 f(i-3) + 28 f(i-2) - 56 f(i-1) + 70 f(i) - 56 f(i+1) + 28 f(i+2) - 8 f(i+3) + f(i+4)
|
|
||||||
! ----------------------------------------------------------------------------------------------------------
|
|
||||||
! dx^8
|
|
||||||
|
|
||||||
! note the sign (-1)^r-1, now r=4
|
|
||||||
do k=1,ex(3)
|
|
||||||
do j=1,ex(2)
|
|
||||||
do i=1,ex(1)
|
|
||||||
|
|
||||||
if(i>imin+3 .and. i < imax-3 .and. &
|
|
||||||
j>jmin+3 .and. j < jmax-3 .and. &
|
|
||||||
k>kmin+3 .and. k < kmax-3) then
|
|
||||||
! x direction
|
|
||||||
f_rhs(i,j,k) = f_rhs(i,j,k) - eps/dX/cof * ( &
|
|
||||||
(fh(i-4,j,k)+fh(i+4,j,k)) &
|
|
||||||
- F8 * (fh(i-3,j,k)+fh(i+3,j,k)) &
|
|
||||||
+F28 * (fh(i-2,j,k)+fh(i+2,j,k)) &
|
|
||||||
-F56 * (fh(i-1,j,k)+fh(i+1,j,k)) &
|
|
||||||
+F70 * fh(i,j,k) )
|
|
||||||
! y direction
|
|
||||||
|
|
||||||
f_rhs(i,j,k) = f_rhs(i,j,k) - eps/dY/cof * ( &
|
|
||||||
(fh(i,j-4,k)+fh(i,j+4,k)) &
|
|
||||||
- F8 * (fh(i,j-3,k)+fh(i,j+3,k)) &
|
|
||||||
+F28 * (fh(i,j-2,k)+fh(i,j+2,k)) &
|
|
||||||
-F56 * (fh(i,j-1,k)+fh(i,j+1,k)) &
|
|
||||||
+F70 * fh(i,j,k) )
|
|
||||||
! z direction
|
|
||||||
|
|
||||||
f_rhs(i,j,k) = f_rhs(i,j,k) - eps/dZ/cof * ( &
|
|
||||||
(fh(i,j,k-4)+fh(i,j,k+4)) &
|
|
||||||
- F8 * (fh(i,j,k-3)+fh(i,j,k+3)) &
|
|
||||||
+F28 * (fh(i,j,k-2)+fh(i,j,k+2)) &
|
|
||||||
-F56 * (fh(i,j,k-1)+fh(i,j,k+1)) &
|
|
||||||
+F70 * fh(i,j,k) )
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
end subroutine kodis
|
|
||||||
|
|
||||||
#elif (ghost_width == 5)
|
|
||||||
! eighth order code
|
|
||||||
!------------------------------------------------------------------------------------------------------------------------------
|
|
||||||
!usual type Kreiss-Oliger type numerical dissipation
|
|
||||||
!We support cell center only
|
|
||||||
! Note the notation D_+ and D_- [P240 of B. Gustafsson, H.-O. Kreiss, and J. Oliger, Time
|
|
||||||
! Dependent Problems and Difference Methods (Wiley, New York, 1995).]
|
|
||||||
! D_+ = (f(i+1) - f(i))/h
|
|
||||||
! D_- = (f(i) - f(i-1))/h
|
|
||||||
! then we have D_+D_- = D_-D_+ = (f(i+1) - 2f(i) + f(i-1))/h^2
|
|
||||||
! for nth order accurate finite difference code, we need r =n/2+1
|
|
||||||
! D_+^rD_-^r = (D_+D_-)^r
|
|
||||||
! following the tradiation of PRD 77, 024027 (BB's calibration paper, Eq.(64),
|
|
||||||
! correct some typo according to above book) :
|
|
||||||
! + eps*(-1)^(r-1)*h^(2r-1)/2^(2r)*(D_+D_-)^r
|
|
||||||
!
|
|
||||||
!
|
|
||||||
! this is for 8th order accurate finite difference scheme
|
|
||||||
! (D_+D_-)^5 =
|
|
||||||
! f(i-5) - 10 f(i-4) + 45 f(i-3) - 120 f(i-2) + 210 f(i-1) - 252 f(i) + 210 f(i+1) - 120 f(i+2) + 45 f(i+3) - 10 f(i+4) + f(i+5)
|
|
||||||
! -------------------------------------------------------------------------------------------------------------------------------
|
|
||||||
! dx^10
|
|
||||||
!---------------------------------------------------------------------------------------------------------------------------------
|
|
||||||
! do not add dissipation near boundary
|
|
||||||
subroutine kodis(ex,X,Y,Z,f,f_rhs,SoA,Symmetry,eps)
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
! argument variables
|
|
||||||
integer,intent(in) :: Symmetry
|
|
||||||
integer,dimension(3),intent(in)::ex
|
|
||||||
real*8, dimension(1:3), intent(in) :: SoA
|
|
||||||
double precision,intent(in),dimension(ex(1))::X
|
|
||||||
double precision,intent(in),dimension(ex(2))::Y
|
|
||||||
double precision,intent(in),dimension(ex(3))::Z
|
|
||||||
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::f
|
|
||||||
double precision,intent(inout),dimension(ex(1),ex(2),ex(3))::f_rhs
|
|
||||||
real*8,intent(in) :: eps
|
|
||||||
|
|
||||||
!~~~~~~ other variables
|
|
||||||
|
|
||||||
real*8 :: dX,dY,dZ
|
|
||||||
real*8,dimension(-4:ex(1),-4:ex(2),-4:ex(3)) :: fh
|
|
||||||
integer :: imin,jmin,kmin,imax,jmax,kmax
|
|
||||||
integer, parameter :: NO_SYMM = 0, EQ_SYMM = 1, OCTANT = 2
|
|
||||||
real*8,parameter :: cof = 1.024d3 ! 2^2r = 2^10
|
|
||||||
real*8, parameter :: F10=1.d1,F45=4.5d1,F120=1.2d2,F210=2.1d2,F252=2.52d2
|
|
||||||
integer::i,j,k
|
|
||||||
|
|
||||||
dX = X(2)-X(1)
|
|
||||||
dY = Y(2)-Y(1)
|
|
||||||
dZ = Z(2)-Z(1)
|
|
||||||
|
|
||||||
imax = ex(1)
|
|
||||||
jmax = ex(2)
|
|
||||||
kmax = ex(3)
|
|
||||||
|
|
||||||
imin = 1
|
|
||||||
jmin = 1
|
|
||||||
kmin = 1
|
|
||||||
|
|
||||||
if(Symmetry > NO_SYMM .and. dabs(Z(1)) < dZ) kmin = -4
|
|
||||||
if(Symmetry > EQ_SYMM .and. dabs(X(1)) < dX) imin = -4
|
|
||||||
if(Symmetry > EQ_SYMM .and. dabs(Y(1)) < dY) jmin = -4
|
|
||||||
|
|
||||||
call symmetry_bd(5,ex,f,fh,SoA)
|
|
||||||
|
|
||||||
! f(i-5) - 10 f(i-4) + 45 f(i-3) - 120 f(i-2) + 210 f(i-1) - 252 f(i) + 210 f(i+1) - 120 f(i+2) + 45 f(i+3) - 10 f(i+4) + f(i+5)
|
|
||||||
! -------------------------------------------------------------------------------------------------------------------------------
|
|
||||||
! dx^10
|
|
||||||
|
|
||||||
! note the sign (-1)^r-1, now r=5
|
|
||||||
do k=1,ex(3)
|
|
||||||
do j=1,ex(2)
|
|
||||||
do i=1,ex(1)
|
|
||||||
|
|
||||||
if(i>imin+4 .and. i < imax-4 .and. &
|
|
||||||
j>jmin+4 .and. j < jmax-4 .and. &
|
|
||||||
k>kmin+4 .and. k < kmax-4) then
|
|
||||||
! x direction
|
|
||||||
f_rhs(i,j,k) = f_rhs(i,j,k) + eps/dX/cof * ( &
|
|
||||||
(fh(i-5,j,k)+fh(i+5,j,k)) &
|
|
||||||
- F10 * (fh(i-4,j,k)+fh(i+4,j,k)) &
|
|
||||||
+ F45 * (fh(i-3,j,k)+fh(i+3,j,k)) &
|
|
||||||
- F120* (fh(i-2,j,k)+fh(i+2,j,k)) &
|
|
||||||
+ F210* (fh(i-1,j,k)+fh(i+1,j,k)) &
|
|
||||||
- F252 * fh(i,j,k) )
|
|
||||||
! y direction
|
|
||||||
|
|
||||||
f_rhs(i,j,k) = f_rhs(i,j,k) + eps/dY/cof * ( &
|
|
||||||
(fh(i,j-5,k)+fh(i,j+5,k)) &
|
|
||||||
- F10 * (fh(i,j-4,k)+fh(i,j+4,k)) &
|
|
||||||
+ F45 * (fh(i,j-3,k)+fh(i,j+3,k)) &
|
|
||||||
- F120* (fh(i,j-2,k)+fh(i,j+2,k)) &
|
|
||||||
+ F210* (fh(i,j-1,k)+fh(i,j+1,k)) &
|
|
||||||
- F252 * fh(i,j,k) )
|
|
||||||
! z direction
|
|
||||||
|
|
||||||
f_rhs(i,j,k) = f_rhs(i,j,k) + eps/dZ/cof * ( &
|
|
||||||
(fh(i,j,k-5)+fh(i,j,k+5)) &
|
|
||||||
- F10 * (fh(i,j,k-4)+fh(i,j,k+4)) &
|
|
||||||
+ F45 * (fh(i,j,k-3)+fh(i,j,k+3)) &
|
|
||||||
- F120* (fh(i,j,k-2)+fh(i,j,k+2)) &
|
|
||||||
+ F210* (fh(i,j,k-1)+fh(i,j,k+1)) &
|
|
||||||
- F252 * fh(i,j,k) )
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
end subroutine kodis
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -7,163 +7,7 @@
|
|||||||
! Vertex or Cell is distinguished in routine symmetry_bd which locates in
|
! Vertex or Cell is distinguished in routine symmetry_bd which locates in
|
||||||
! file "fmisc.f90"
|
! file "fmisc.f90"
|
||||||
|
|
||||||
#if (ghost_width == 2)
|
|
||||||
! second order code
|
|
||||||
|
|
||||||
!-----------------------------------------------------------------------------
|
|
||||||
! v
|
|
||||||
! D f = ------[ - 3 f + 4 f - f ]
|
|
||||||
! i 2dx i i+v i+2v
|
|
||||||
!
|
|
||||||
! where
|
|
||||||
!
|
|
||||||
! i
|
|
||||||
! |B |
|
|
||||||
! v = -----
|
|
||||||
! i
|
|
||||||
! B
|
|
||||||
!
|
|
||||||
!-----------------------------------------------------------------------------
|
|
||||||
subroutine lopsided(ex,X,Y,Z,f,f_rhs,Sfx,Sfy,Sfz,Symmetry,SoA)
|
|
||||||
implicit none
|
|
||||||
|
|
||||||
!~~~~~~> Input parameters:
|
|
||||||
|
|
||||||
integer, intent(in) :: ex(1:3),Symmetry
|
|
||||||
real*8, intent(in) :: X(1:ex(1)),Y(1:ex(2)),Z(1:ex(3))
|
|
||||||
real*8,dimension(ex(1),ex(2),ex(3)),intent(in) :: f,Sfx,Sfy,Sfz
|
|
||||||
|
|
||||||
real*8,dimension(ex(1),ex(2),ex(3)),intent(inout):: f_rhs
|
|
||||||
real*8,dimension(3),intent(in) ::SoA
|
|
||||||
|
|
||||||
!~~~~~~> local variables:
|
|
||||||
! note index -1,0, so we have 2 extra points
|
|
||||||
real*8,dimension(-1:ex(1),-1:ex(2),-1:ex(3)) :: fh
|
|
||||||
integer :: imin,jmin,kmin,imax,jmax,kmax,i,j,k
|
|
||||||
real*8 :: dX,dY,dZ
|
|
||||||
real*8 :: d2dx,d2dy,d2dz
|
|
||||||
real*8, parameter :: ZEO=0.d0,ONE=1.d0,TWO=2.d0,THR=3.d0,FOUR=4.d0
|
|
||||||
integer, parameter :: NO_SYMM = 0, EQ_SYMM = 1, OCTANT = 2
|
|
||||||
|
|
||||||
dX = X(2)-X(1)
|
|
||||||
dY = Y(2)-Y(1)
|
|
||||||
dZ = Z(2)-Z(1)
|
|
||||||
|
|
||||||
d2dx = ONE/TWO/dX
|
|
||||||
d2dy = ONE/TWO/dY
|
|
||||||
d2dz = ONE/TWO/dZ
|
|
||||||
|
|
||||||
imax = ex(1)
|
|
||||||
jmax = ex(2)
|
|
||||||
kmax = ex(3)
|
|
||||||
|
|
||||||
imin = 1
|
|
||||||
jmin = 1
|
|
||||||
kmin = 1
|
|
||||||
if(Symmetry > NO_SYMM .and. dabs(Z(1)) < dZ) kmin = -1
|
|
||||||
if(Symmetry > EQ_SYMM .and. dabs(X(1)) < dX) imin = -1
|
|
||||||
if(Symmetry > EQ_SYMM .and. dabs(Y(1)) < dY) jmin = -1
|
|
||||||
|
|
||||||
call symmetry_bd(2,ex,f,fh,SoA)
|
|
||||||
|
|
||||||
! upper bound set ex-1 only for efficiency,
|
|
||||||
! the loop body will set ex 0 also
|
|
||||||
do k=1,ex(3)-1
|
|
||||||
do j=1,ex(2)-1
|
|
||||||
do i=1,ex(1)-1
|
|
||||||
! x direction
|
|
||||||
if(Sfx(i,j,k) >= ZEO)then
|
|
||||||
if( i+2 <= imax .and. i >= imin)then
|
|
||||||
! v
|
|
||||||
! D f = ------[ - 3 f + 4 f - f ]
|
|
||||||
! i 2dx i i+v i+2v
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfx(i,j,k)*d2dx*(-THR*fh(i,j,k)+FOUR*fh(i+1,j,k)-fh(i+2,j,k))
|
|
||||||
elseif(i+1 <= imax .and. i >= imin)then
|
|
||||||
! v
|
|
||||||
! D f = ------[ - f + f ]
|
|
||||||
! i dx i i+v
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfx(i,j,k)*d2dx*(-fh(i,j,k)+fh(i+1,j,k))
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
elseif(Sfx(i,j,k) <= ZEO)then
|
|
||||||
if( i-2 >= imin .and. i <= imax)then
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)- &
|
|
||||||
Sfx(i,j,k)*d2dx*(-THR*fh(i,j,k)+FOUR*fh(i-1,j,k)-fh(i-2,j,k))
|
|
||||||
elseif(i-1 >= imin .and. i <= imax)then
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)- &
|
|
||||||
Sfx(i,j,k)*d2dx*(-fh(i,j,k)+fh(i-1,j,k))
|
|
||||||
endif
|
|
||||||
|
|
||||||
! set imax and imin 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
! y direction
|
|
||||||
if(Sfy(i,j,k) >= ZEO)then
|
|
||||||
if( j+2 <= jmax .and. j >= jmin)then
|
|
||||||
! v
|
|
||||||
! D f = ------[ - 3 f + 4 f - f ]
|
|
||||||
! i 2dx i i+v i+2v
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfy(i,j,k)*d2dy*(-THR*fh(i,j,k)+FOUR*fh(i,j+1,k)-fh(i,j+2,k))
|
|
||||||
elseif(j+1 <= jmax .and. j >= jmin)then
|
|
||||||
! v
|
|
||||||
! D f = ------[ - f + f ]
|
|
||||||
! i dx i i+v
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfy(i,j,k)*d2dy*(-fh(i,j,k)+fh(i,j+1,k))
|
|
||||||
endif
|
|
||||||
|
|
||||||
elseif(Sfy(i,j,k) <= ZEO)then
|
|
||||||
if( j-2 >= jmin .and. j <= jmax)then
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)- &
|
|
||||||
Sfy(i,j,k)*d2dy*(-THR*fh(i,j,k)+FOUR*fh(i,j-1,k)-fh(i,j-2,k))
|
|
||||||
elseif(j-1 >= jmin .and. j <= jmax)then
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)- &
|
|
||||||
Sfy(i,j,k)*d2dy*(-fh(i,j,k)+fh(i,j-1,k))
|
|
||||||
endif
|
|
||||||
|
|
||||||
! set jmin and jmax 0
|
|
||||||
endif
|
|
||||||
!! z direction
|
|
||||||
if(Sfz(i,j,k) >= ZEO)then
|
|
||||||
if( k+2 <= kmax .and. k >= kmin)then
|
|
||||||
! v
|
|
||||||
! D f = ------[ - 3 f + 4 f - f ]
|
|
||||||
! i 2dx i i+v i+2v
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfz(i,j,k)*d2dz*(-THR*fh(i,j,k)+FOUR*fh(i,j,k+1)-fh(i,j,k+2))
|
|
||||||
elseif(k+1 <= kmax .and. k >= kmin)then
|
|
||||||
! v
|
|
||||||
! D f = ------[ - f + f ]
|
|
||||||
! i dx i i+v
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfz(i,j,k)*d2dz*(-fh(i,j,k)+fh(i,j,k+1))
|
|
||||||
endif
|
|
||||||
|
|
||||||
elseif(Sfz(i,j,k) <= ZEO)then
|
|
||||||
if( k-2 >= kmin .and. k <= kmax)then
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)- &
|
|
||||||
Sfz(i,j,k)*d2dz*(-THR*fh(i,j,k)+FOUR*fh(i,j,k-1)-fh(i,j,k-2))
|
|
||||||
elseif(k-1 >= kmin .and. k <= kmax)then
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)- &
|
|
||||||
Sfz(i,j,k)*d2dz*(-fh(i,j,k)+fh(i,j,k-1))
|
|
||||||
endif
|
|
||||||
|
|
||||||
! set kmin and kmax 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
end subroutine lopsided
|
|
||||||
|
|
||||||
#elif (ghost_width == 3)
|
|
||||||
! fourth order code
|
! fourth order code
|
||||||
|
|
||||||
!-----------------------------------------------------------------------------
|
!-----------------------------------------------------------------------------
|
||||||
@@ -236,89 +80,7 @@ subroutine lopsided(ex,X,Y,Z,f,f_rhs,Sfx,Sfy,Sfz,Symmetry,SoA)
|
|||||||
do k=1,ex(3)-1
|
do k=1,ex(3)-1
|
||||||
do j=1,ex(2)-1
|
do j=1,ex(2)-1
|
||||||
do i=1,ex(1)-1
|
do i=1,ex(1)-1
|
||||||
#if 0
|
|
||||||
!! old code
|
|
||||||
! x direction
|
|
||||||
if(Sfx(i,j,k) >= ZEO .and. i+3 <= imax .and. i-1 >= imin)then
|
|
||||||
! v
|
|
||||||
! D f = ------[ - 3f - 10f + 18f - 6f + f ]
|
|
||||||
! i 12dx i-v i i+v i+2v i+3v
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfx(i,j,k)*d12dx*(-F3*fh(i-1,j,k)-F10*fh(i,j,k)+F18*fh(i+1,j,k) &
|
|
||||||
-F6*fh(i+2,j,k)+ fh(i+3,j,k))
|
|
||||||
|
|
||||||
elseif(Sfx(i,j,k) <= ZEO .and. i-3 >= imin .and. i+1 <= imax)then
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)- &
|
|
||||||
Sfx(i,j,k)*d12dx*(-F3*fh(i+1,j,k)-F10*fh(i,j,k)+F18*fh(i-1,j,k) &
|
|
||||||
-F6*fh(i-2,j,k)+ fh(i-3,j,k))
|
|
||||||
|
|
||||||
elseif(i+2 <= imax .and. i-2 >= imin)then
|
|
||||||
!
|
|
||||||
! f(i-2) - 8 f(i-1) + 8 f(i+1) - f(i+2)
|
|
||||||
! fx(i) = ---------------------------------------------
|
|
||||||
! 12 dx
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfx(i,j,k)*d12dx*(fh(i-2,j,k)-EIT*fh(i-1,j,k)+EIT*fh(i+1,j,k)-fh(i+2,j,k))
|
|
||||||
|
|
||||||
elseif(i+1 <= imax .and. i-1 >= imin)then
|
|
||||||
!
|
|
||||||
! - f(i-1) + f(i+1)
|
|
||||||
! fx(i) = --------------------------------
|
|
||||||
! 2 dx
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k) + Sfx(i,j,k)*d2dx*(-fh(i-1,j,k)+fh(i+1,j,k))
|
|
||||||
|
|
||||||
! set imax and imin 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
! y direction
|
|
||||||
if(Sfy(i,j,k) >= ZEO .and. j+3 <= jmax .and. j-1 >= jmin)then
|
|
||||||
! v
|
|
||||||
! D f = ------[ - 3f - 10f + 18f - 6f + f ]
|
|
||||||
! i 12dx i-v i i+v i+2v i+3v
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfy(i,j,k)*d12dy*(-F3*fh(i,j-1,k)-F10*fh(i,j,k)+F18*fh(i,j+1,k) &
|
|
||||||
-F6*fh(i,j+2,k)+ fh(i,j+3,k))
|
|
||||||
|
|
||||||
elseif(Sfy(i,j,k) <= ZEO .and. j-3 >= jmin .and. j+1 <= jmax)then
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)- &
|
|
||||||
Sfy(i,j,k)*d12dy*(-F3*fh(i,j+1,k)-F10*fh(i,j,k)+F18*fh(i,j-1,k) &
|
|
||||||
-F6*fh(i,j-2,k)+ fh(i,j-3,k))
|
|
||||||
|
|
||||||
elseif(j+2 <= jmax .and. j-2 >= jmin)then
|
|
||||||
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfy(i,j,k)*d12dy*(fh(i,j-2,k)-EIT*fh(i,j-1,k)+EIT*fh(i,j+1,k)-fh(i,j+2,k))
|
|
||||||
|
|
||||||
elseif(j+1 <= jmax .and. j-1 >= jmin)then
|
|
||||||
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k) + Sfy(i,j,k)*d2dy*(-fh(i,j-1,k)+fh(i,j+1,k))
|
|
||||||
! set jmin and jmax 0
|
|
||||||
endif
|
|
||||||
!! z direction
|
|
||||||
if(Sfz(i,j,k) >= ZEO .and. k+3 <= kmax .and. k-1 >= kmin)then
|
|
||||||
! v
|
|
||||||
! D f = ------[ - 3f - 10f + 18f - 6f + f ]
|
|
||||||
! i 12dx i-v i i+v i+2v i+3v
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfz(i,j,k)*d12dz*(-F3*fh(i,j,k-1)-F10*fh(i,j,k)+F18*fh(i,j,k+1) &
|
|
||||||
-F6*fh(i,j,k+2)+ fh(i,j,k+3))
|
|
||||||
|
|
||||||
elseif(Sfz(i,j,k) <= ZEO .and. k-3 >= kmin .and. k+1 <= kmax)then
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)- &
|
|
||||||
Sfz(i,j,k)*d12dz*(-F3*fh(i,j,k+1)-F10*fh(i,j,k)+F18*fh(i,j,k-1) &
|
|
||||||
-F6*fh(i,j,k-2)+ fh(i,j,k-3))
|
|
||||||
|
|
||||||
elseif(k+2 <= kmax .and. k-2 >= kmin)then
|
|
||||||
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfz(i,j,k)*d12dz*(fh(i,j,k-2)-EIT*fh(i,j,k-1)+EIT*fh(i,j,k+1)-fh(i,j,k+2))
|
|
||||||
|
|
||||||
elseif(k+1 <= kmax .and. k-1 >= kmin)then
|
|
||||||
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+Sfz(i,j,k)*d2dz*(-fh(i,j,k-1)+fh(i,j,k+1))
|
|
||||||
! set kmin and kmax 0
|
|
||||||
endif
|
|
||||||
#else
|
|
||||||
!! new code, 2012dec27, based on bam
|
!! new code, 2012dec27, based on bam
|
||||||
! x direction
|
! x direction
|
||||||
if(Sfx(i,j,k) > ZEO)then
|
if(Sfx(i,j,k) > ZEO)then
|
||||||
@@ -478,7 +240,6 @@ subroutine lopsided(ex,X,Y,Z,f,f_rhs,Sfx,Sfy,Sfz,Symmetry,SoA)
|
|||||||
! set kmax and kmin 0
|
! set kmax and kmin 0
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
#endif
|
|
||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
@@ -486,417 +247,3 @@ subroutine lopsided(ex,X,Y,Z,f,f_rhs,Sfx,Sfy,Sfz,Symmetry,SoA)
|
|||||||
return
|
return
|
||||||
|
|
||||||
end subroutine lopsided
|
end subroutine lopsided
|
||||||
|
|
||||||
#elif (ghost_width == 4)
|
|
||||||
! sixth order code
|
|
||||||
! Compute advection terms in right hand sides of field equations
|
|
||||||
! v
|
|
||||||
! D f = ------[ 2f - 24f - 35f + 80f - 30f + 8f - f ]
|
|
||||||
! i 60dx i-2v i-v i i+v i+2v i+3v i+4v
|
|
||||||
!
|
|
||||||
! where
|
|
||||||
!
|
|
||||||
! i
|
|
||||||
! |B |
|
|
||||||
! v = -----
|
|
||||||
! i
|
|
||||||
! B
|
|
||||||
!
|
|
||||||
!-----------------------------------------------------------------------------
|
|
||||||
subroutine lopsided(ex,X,Y,Z,f,f_rhs,Sfx,Sfy,Sfz,Symmetry,SoA)
|
|
||||||
implicit none
|
|
||||||
|
|
||||||
!~~~~~~> Input parameters:
|
|
||||||
|
|
||||||
integer, intent(in) :: ex(1:3),Symmetry
|
|
||||||
real*8, intent(in) :: X(1:ex(1)),Y(1:ex(2)),Z(1:ex(3))
|
|
||||||
real*8,dimension(ex(1),ex(2),ex(3)),intent(in) :: f,Sfx,Sfy,Sfz
|
|
||||||
|
|
||||||
real*8,dimension(ex(1),ex(2),ex(3)),intent(inout):: f_rhs
|
|
||||||
real*8,dimension(3),intent(in) ::SoA
|
|
||||||
|
|
||||||
!~~~~~~> local variables:
|
|
||||||
|
|
||||||
real*8,dimension(-3:ex(1),-3:ex(2),-3:ex(3)) :: fh
|
|
||||||
integer :: imin,jmin,kmin,imax,jmax,kmax,i,j,k
|
|
||||||
real*8 :: dX,dY,dZ
|
|
||||||
real*8 :: d60dx,d60dy,d60dz,d12dx,d12dy,d12dz,d2dx,d2dy,d2dz
|
|
||||||
real*8, parameter :: ZEO=0.d0,ONE=1.d0, F60=6.d1
|
|
||||||
real*8, parameter :: TWO=2.d0,F24=2.4d1,F35=3.5d1,F80=8.d1,F30=3.d1,EIT=8.d0
|
|
||||||
real*8, parameter :: F9=9.d0,F45=4.5d1,F12=1.2d1
|
|
||||||
real*8, parameter :: F10=1.d1,F77=7.7d1,F150=1.5d2,F100=1.d2,F50=5.d1,F15=1.5d1
|
|
||||||
integer, parameter :: NO_SYMM = 0, EQ_SYMM = 1, OCTANT = 2
|
|
||||||
|
|
||||||
dX = X(2)-X(1)
|
|
||||||
dY = Y(2)-Y(1)
|
|
||||||
dZ = Z(2)-Z(1)
|
|
||||||
|
|
||||||
d60dx = ONE/F60/dX
|
|
||||||
d60dy = ONE/F60/dY
|
|
||||||
d60dz = ONE/F60/dZ
|
|
||||||
|
|
||||||
d12dx = ONE/F12/dX
|
|
||||||
d12dy = ONE/F12/dY
|
|
||||||
d12dz = ONE/F12/dZ
|
|
||||||
|
|
||||||
d2dx = ONE/TWO/dX
|
|
||||||
d2dy = ONE/TWO/dY
|
|
||||||
d2dz = ONE/TWO/dZ
|
|
||||||
|
|
||||||
imax = ex(1)
|
|
||||||
jmax = ex(2)
|
|
||||||
kmax = ex(3)
|
|
||||||
|
|
||||||
imin = 1
|
|
||||||
jmin = 1
|
|
||||||
kmin = 1
|
|
||||||
if(Symmetry > NO_SYMM .and. dabs(Z(1)) < dZ) kmin = -3
|
|
||||||
if(Symmetry > EQ_SYMM .and. dabs(X(1)) < dX) imin = -3
|
|
||||||
if(Symmetry > EQ_SYMM .and. dabs(Y(1)) < dY) jmin = -3
|
|
||||||
|
|
||||||
call symmetry_bd(4,ex,f,fh,SoA)
|
|
||||||
|
|
||||||
! upper bound set ex-1 only for efficiency,
|
|
||||||
! the loop body will set ex 0 also
|
|
||||||
do k=1,ex(3)-1
|
|
||||||
do j=1,ex(2)-1
|
|
||||||
do i=1,ex(1)-1
|
|
||||||
! x direction
|
|
||||||
if(Sfx(i,j,k) >= ZEO .and. i+4 <= imax .and. i-2 >= imin)then
|
|
||||||
! v
|
|
||||||
! D f = ------[ 2f - 24f - 35f + 80f - 30f + 8f - f ]
|
|
||||||
! i 60dx i-2v i-v i i+v i+2v i+3v i+4v
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfx(i,j,k)*d60dx*(TWO*fh(i-2,j,k)-F24*fh(i-1,j,k)-F35*fh(i,j,k)+F80*fh(i+1,j,k) &
|
|
||||||
-F30*fh(i+2,j,k)+EIT*fh(i+3,j,k)- fh(i+4,j,k))
|
|
||||||
elseif(Sfx(i,j,k) >= ZEO .and. i+5 <= imax .and. i-1 >= imin)then
|
|
||||||
! v
|
|
||||||
! D f = ------[-10f - 77f + 150f - 100f + 50f -15f + 2f ]
|
|
||||||
! i 60dx i-v i i+v i+2v i+3v i+4v i+5v
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfx(i,j,k)*d60dx*(-F10*fh(i-1,j,k)-F77*fh(i ,j,k)+F150*fh(i+1,j,k)-F100*fh(i+2,j,k) &
|
|
||||||
+F50*fh(i+3,j,k)-F15*fh(i+4,j,k)+ TWO*fh(i+5,j,k))
|
|
||||||
|
|
||||||
elseif(Sfx(i,j,k) <= ZEO .and. i-4 >= imin .and. i+2 <= imax)then
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)- &
|
|
||||||
Sfx(i,j,k)*d60dx*(TWO*fh(i+2,j,k)-F24*fh(i+1,j,k)-F35*fh(i,j,k)+F80*fh(i-1,j,k) &
|
|
||||||
-F30*fh(i-2,j,k)+EIT*fh(i-3,j,k)- fh(i-4,j,k))
|
|
||||||
elseif(Sfx(i,j,k) <= ZEO .and. i-5 >= imin .and. i+1 <= imax)then
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)- &
|
|
||||||
Sfx(i,j,k)*d60dx*(-F10*fh(i+1,j,k)-F77*fh(i ,j,k)+F150*fh(i-1,j,k)-F100*fh(i-2,j,k) &
|
|
||||||
+F50*fh(i-3,j,k)-F15*fh(i-4,j,k)+ TWO*fh(i-5,j,k))
|
|
||||||
|
|
||||||
elseif(i+3 <= imax .and. i-3 >= imin)then
|
|
||||||
! - f(i-3) + 9 f(i-2) - 45 f(i-1) + 45 f(i+1) - 9 f(i+2) + f(i+3)
|
|
||||||
! fx(i) = -----------------------------------------------------------------
|
|
||||||
! 60 dx
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfx(i,j,k)*d60dx*(-fh(i-3,j,k)+F9*fh(i-2,j,k)-F45*fh(i-1,j,k)+F45*fh(i+1,j,k)-F9*fh(i+2,j,k)+fh(i+3,j,k))
|
|
||||||
|
|
||||||
elseif(i+2 <= imax .and. i-2 >= imin)then
|
|
||||||
!
|
|
||||||
! f(i-2) - 8 f(i-1) + 8 f(i+1) - f(i+2)
|
|
||||||
! fx(i) = ---------------------------------------------
|
|
||||||
! 12 dx
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfx(i,j,k)*d12dx*(fh(i-2,j,k)-EIT*fh(i-1,j,k)+EIT*fh(i+1,j,k)-fh(i+2,j,k))
|
|
||||||
|
|
||||||
elseif(i+1 <= imax .and. i-1 >= imin)then
|
|
||||||
!
|
|
||||||
! - f(i-1) + f(i+1)
|
|
||||||
! fx(i) = --------------------------------
|
|
||||||
! 2 dx
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k) + Sfx(i,j,k)*d2dx*(-fh(i-1,j,k)+fh(i+1,j,k))
|
|
||||||
|
|
||||||
! set imax and imin 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
! y direction
|
|
||||||
if(Sfy(i,j,k) >= ZEO .and. j+4 <= jmax .and. j-2 >= jmin)then
|
|
||||||
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfy(i,j,k)*d60dy*(TWO*fh(i,j-2,k)-F24*fh(i,j-1,k)-F35*fh(i,j,k)+F80*fh(i,j+1,k) &
|
|
||||||
-F30*fh(i,j+2,k)+EIT*fh(i,j+3,k)- fh(i,j+4,k))
|
|
||||||
elseif(Sfy(i,j,k) >= ZEO .and. j+5 <= jmax .and. j-1 >= jmin)then
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfy(i,j,k)*d60dy*(-F10*fh(i,j-1,k)-F77*fh(i,j ,k)+F150*fh(i,j+1,k)-F100*fh(i,j+2,k) &
|
|
||||||
+F50*fh(i,j+3,k)-F15*fh(i,j+4,k)+ TWO*fh(i,j+5,k))
|
|
||||||
|
|
||||||
elseif(Sfy(i,j,k) <= ZEO .and. j-4 >= jmin .and. j+2 <= jmax)then
|
|
||||||
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)- &
|
|
||||||
Sfy(i,j,k)*d60dy*(TWO*fh(i,j+2,k)-F24*fh(i,j+1,k)-F35*fh(i,j,k)+F80*fh(i,j-1,k) &
|
|
||||||
-F30*fh(i,j-2,k)+EIT*fh(i,j-3,k)- fh(i,j-4,k))
|
|
||||||
|
|
||||||
elseif(Sfy(i,j,k) <= ZEO .and. j-5 >= jmin .and. j+1 <= jmax)then
|
|
||||||
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)- &
|
|
||||||
Sfy(i,j,k)*d60dy*(-F10*fh(i,j+1,k)-F77*fh(i,j ,k)+F150*fh(i,j-1,k)-F100*fh(i,j-2,k) &
|
|
||||||
+F50*fh(i,j-3,k)-F15*fh(i,j-4,k)+ TWO*fh(i,j-5,k))
|
|
||||||
|
|
||||||
elseif(j+3 <= jmax .and. j-3 >= jmin)then
|
|
||||||
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfy(i,j,k)*d60dy*(-fh(i,j-3,k)+F9*fh(i,j-2,k)-F45*fh(i,j-1,k)+F45*fh(i,j+1,k)-F9*fh(i,j+2,k)+fh(i,j+3,k))
|
|
||||||
|
|
||||||
elseif(j+2 <= jmax .and. j-2 >= jmin)then
|
|
||||||
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfy(i,j,k)*d12dy*(fh(i,j-2,k)-EIT*fh(i,j-1,k)+EIT*fh(i,j+1,k)-fh(i,j+2,k))
|
|
||||||
|
|
||||||
elseif(j+1 <= jmax .and. j-1 >= jmin)then
|
|
||||||
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k) + Sfy(i,j,k)*d2dy*(-fh(i,j-1,k)+fh(i,j+1,k))
|
|
||||||
! set jmin and jmax 0
|
|
||||||
endif
|
|
||||||
!! z direction
|
|
||||||
if(Sfz(i,j,k) >= ZEO .and. k+4 <= kmax .and. k-2 >= kmin)then
|
|
||||||
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfz(i,j,k)*d60dz*(TWO*fh(i,j,k-2)-F24*fh(i,j,k-1)-F35*fh(i,j,k)+F80*fh(i,j,k+1) &
|
|
||||||
-F30*fh(i,j,k+2)+EIT*fh(i,j,k+3)- fh(i,j,k+4))
|
|
||||||
elseif(Sfz(i,j,k) >= ZEO .and. k+5 <= kmax .and. k-1 >= kmin)then
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfz(i,j,k)*d60dz*(-F10*fh(i,j,k-1)-F77*fh(i,j,k )+F150*fh(i,j,k+1)-F100*fh(i,j,k+2) &
|
|
||||||
+F50*fh(i,j,k+3)-F15*fh(i,j,k+4)+ TWO*fh(i,j,k+5))
|
|
||||||
|
|
||||||
elseif(Sfz(i,j,k) <= ZEO .and. k-4 >= kmin .and. k+2 <= kmax)then
|
|
||||||
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)- &
|
|
||||||
Sfz(i,j,k)*d60dz*(TWO*fh(i,j,k+2)-F24*fh(i,j,k+1)-F35*fh(i,j,k)+F80*fh(i,j,k-1) &
|
|
||||||
-F30*fh(i,j,k-2)+EIT*fh(i,j,k-3)- fh(i,j,k-4))
|
|
||||||
|
|
||||||
elseif(Sfz(i,j,k) <= ZEO .and. k-5 >= kmin .and. k+1 <= kmax)then
|
|
||||||
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)- &
|
|
||||||
Sfz(i,j,k)*d60dz*(-F10*fh(i,j,k+1)-F77*fh(i,j,k )+F150*fh(i,j,k-1)-F100*fh(i,j,k-2) &
|
|
||||||
+F50*fh(i,j,k-3)-F15*fh(i,j,k-4)+ TWO*fh(i,j,k-5))
|
|
||||||
|
|
||||||
elseif(k+3 <= kmax .and. k-3 >= kmin)then
|
|
||||||
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfz(i,j,k)*d60dz*(-fh(i,j,k-3)+F9*fh(i,j,k-2)-F45*fh(i,j,k-1)+F45*fh(i,j,k+1)-F9*fh(i,j,k+2)+fh(i,j,k+3))
|
|
||||||
|
|
||||||
elseif(k+2 <= kmax .and. k-2 >= kmin)then
|
|
||||||
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfz(i,j,k)*d12dz*(fh(i,j,k-2)-EIT*fh(i,j,k-1)+EIT*fh(i,j,k+1)-fh(i,j,k+2))
|
|
||||||
|
|
||||||
elseif(k+1 <= kmax .and. k-1 >= kmin)then
|
|
||||||
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+Sfz(i,j,k)*d2dz*(-fh(i,j,k-1)+fh(i,j,k+1))
|
|
||||||
! set kmin and kmax 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
end subroutine lopsided
|
|
||||||
|
|
||||||
#elif (ghost_width == 5)
|
|
||||||
! eighth order code
|
|
||||||
!-----------------------------------------------------------------------------
|
|
||||||
! PRD 77, 024034 (2008)
|
|
||||||
! Compute advection terms in right hand sides of field equations
|
|
||||||
! v [ - 5 f(i-3v) + 60 f(i-2v) - 420 f(i-v) - 378 f(i) + 1050 f(i+v) - 420 f(i+2v) + 140 f(i+3v) - 30 f(i+4v) + 3 f(i+5v)]
|
|
||||||
! D f = --------------------------------------------------------------------------------------------------------------------------
|
|
||||||
! i 840 dx
|
|
||||||
!
|
|
||||||
! where
|
|
||||||
!
|
|
||||||
! i
|
|
||||||
! |B |
|
|
||||||
! v = -----
|
|
||||||
! i
|
|
||||||
! B
|
|
||||||
!
|
|
||||||
!-----------------------------------------------------------------------------
|
|
||||||
subroutine lopsided(ex,X,Y,Z,f,f_rhs,Sfx,Sfy,Sfz,Symmetry,SoA)
|
|
||||||
implicit none
|
|
||||||
|
|
||||||
!~~~~~~> Input parameters:
|
|
||||||
|
|
||||||
integer, intent(in) :: ex(1:3),Symmetry
|
|
||||||
real*8, intent(in) :: X(1:ex(1)),Y(1:ex(2)),Z(1:ex(3))
|
|
||||||
real*8,dimension(ex(1),ex(2),ex(3)),intent(in) :: f,Sfx,Sfy,Sfz
|
|
||||||
|
|
||||||
real*8,dimension(ex(1),ex(2),ex(3)),intent(inout):: f_rhs
|
|
||||||
real*8,dimension(3),intent(in) ::SoA
|
|
||||||
|
|
||||||
!~~~~~~> local variables:
|
|
||||||
|
|
||||||
real*8,dimension(-4:ex(1),-4:ex(2),-4:ex(3)) :: fh
|
|
||||||
integer :: imin,jmin,kmin,imax,jmax,kmax,i,j,k
|
|
||||||
real*8 :: dX,dY,dZ
|
|
||||||
real*8 :: d840dx,d840dy,d840dz,d60dx,d60dy,d60dz,d12dx,d12dy,d12dz,d2dx,d2dy,d2dz
|
|
||||||
real*8, parameter :: ZEO=0.d0,ONE=1.d0, F60=6.d1
|
|
||||||
real*8, parameter :: TWO=2.d0,F30=3.d1,EIT=8.d0
|
|
||||||
real*8, parameter :: F9=9.d0,F45=4.5d1,F12=1.2d1,F140=1.4d2,THR=3.d0
|
|
||||||
real*8, parameter :: F840=8.4d2,F5=5.d0,F420=4.2d2,F378=3.78d2,F1050=1.05d3
|
|
||||||
real*8, parameter :: F32=3.2d1,F168=1.68d2,F672=6.72d2
|
|
||||||
integer, parameter :: NO_SYMM = 0, EQ_SYMM = 1, OCTANT = 2
|
|
||||||
|
|
||||||
dX = X(2)-X(1)
|
|
||||||
dY = Y(2)-Y(1)
|
|
||||||
dZ = Z(2)-Z(1)
|
|
||||||
|
|
||||||
d840dx = ONE/F840/dX
|
|
||||||
d840dy = ONE/F840/dY
|
|
||||||
d840dz = ONE/F840/dZ
|
|
||||||
|
|
||||||
d60dx = ONE/F60/dX
|
|
||||||
d60dy = ONE/F60/dY
|
|
||||||
d60dz = ONE/F60/dZ
|
|
||||||
|
|
||||||
d12dx = ONE/F12/dX
|
|
||||||
d12dy = ONE/F12/dY
|
|
||||||
d12dz = ONE/F12/dZ
|
|
||||||
|
|
||||||
d2dx = ONE/TWO/dX
|
|
||||||
d2dy = ONE/TWO/dY
|
|
||||||
d2dz = ONE/TWO/dZ
|
|
||||||
|
|
||||||
imax = ex(1)
|
|
||||||
jmax = ex(2)
|
|
||||||
kmax = ex(3)
|
|
||||||
|
|
||||||
imin = 1
|
|
||||||
jmin = 1
|
|
||||||
kmin = 1
|
|
||||||
if(Symmetry > NO_SYMM .and. dabs(Z(1)) < dZ) kmin = -4
|
|
||||||
if(Symmetry > EQ_SYMM .and. dabs(X(1)) < dX) imin = -4
|
|
||||||
if(Symmetry > EQ_SYMM .and. dabs(Y(1)) < dY) jmin = -4
|
|
||||||
|
|
||||||
call symmetry_bd(5,ex,f,fh,SoA)
|
|
||||||
|
|
||||||
! upper bound set ex-1 only for efficiency,
|
|
||||||
! the loop body will set ex 0 also
|
|
||||||
do k=1,ex(3)-1
|
|
||||||
do j=1,ex(2)-1
|
|
||||||
do i=1,ex(1)-1
|
|
||||||
! x direction
|
|
||||||
if(Sfx(i,j,k) >= ZEO .and. i+5 <= imax .and. i-3 >= imin)then
|
|
||||||
! v [ - 5 f(i-3v) + 60 f(i-2v) - 420 f(i-v) - 378 f(i) + 1050 f(i+v) - 420 f(i+2v) + 140 f(i+3v) - 30 f(i+4v) + 3 f(i+5v)]
|
|
||||||
! D f = --------------------------------------------------------------------------------------------------------------------------
|
|
||||||
! i 840 dx
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfx(i,j,k)*d840dx*(-F5*fh(i-3,j,k)+F60 *fh(i-2,j,k)-F420*fh(i-1,j,k)-F378*fh(i ,j,k) &
|
|
||||||
+F1050*fh(i+1,j,k)-F420*fh(i+2,j,k)+F140*fh(i+3,j,k)-F30 *fh(i+4,j,k)+THR*fh(i+5,j,k))
|
|
||||||
|
|
||||||
elseif(Sfx(i,j,k) <= ZEO .and. i-5 >= imin .and. i+3 <= imax)then
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)- &
|
|
||||||
Sfx(i,j,k)*d840dx*(-F5*fh(i+3,j,k)+F60 *fh(i+2,j,k)-F420*fh(i+1,j,k)-F378*fh(i ,j,k) &
|
|
||||||
+F1050*fh(i-1,j,k)-F420*fh(i-2,j,k)+F140*fh(i-3,j,k)- F30*fh(i-4,j,k)+THR*fh(i-5,j,k))
|
|
||||||
|
|
||||||
elseif(i+4 <= imax .and. i-4 >= imin)then
|
|
||||||
! 3 f(i-4) - 32 f(i-3) + 168 f(i-2) - 672 f(i-1) + 672 f(i+1) - 168 f(i+2) + 32 f(i+3) - 3 f(i+4)
|
|
||||||
! fx(i) = -------------------------------------------------------------------------------------------------
|
|
||||||
! 840 dx
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfx(i,j,k)*d840dx*( THR*fh(i-4,j,k)-F32 *fh(i-3,j,k)+F168*fh(i-2,j,k)-F672*fh(i-1,j,k)+ &
|
|
||||||
F672*fh(i+1,j,k)-F168*fh(i+2,j,k)+F32 *fh(i+3,j,k)-THR *fh(i+4,j,k))
|
|
||||||
|
|
||||||
elseif(i+3 <= imax .and. i-3 >= imin)then
|
|
||||||
! - f(i-3) + 9 f(i-2) - 45 f(i-1) + 45 f(i+1) - 9 f(i+2) + f(i+3)
|
|
||||||
! fx(i) = -----------------------------------------------------------------
|
|
||||||
! 60 dx
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfx(i,j,k)*d60dx*(-fh(i-3,j,k)+F9*fh(i-2,j,k)-F45*fh(i-1,j,k)+F45*fh(i+1,j,k)-F9*fh(i+2,j,k)+fh(i+3,j,k))
|
|
||||||
|
|
||||||
elseif(i+2 <= imax .and. i-2 >= imin)then
|
|
||||||
!
|
|
||||||
! f(i-2) - 8 f(i-1) + 8 f(i+1) - f(i+2)
|
|
||||||
! fx(i) = ---------------------------------------------
|
|
||||||
! 12 dx
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfx(i,j,k)*d12dx*(fh(i-2,j,k)-EIT*fh(i-1,j,k)+EIT*fh(i+1,j,k)-fh(i+2,j,k))
|
|
||||||
|
|
||||||
elseif(i+1 <= imax .and. i-1 >= imin)then
|
|
||||||
!
|
|
||||||
! - f(i-1) + f(i+1)
|
|
||||||
! fx(i) = --------------------------------
|
|
||||||
! 2 dx
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k) + Sfx(i,j,k)*d2dx*(-fh(i-1,j,k)+fh(i+1,j,k))
|
|
||||||
|
|
||||||
! set imax and imin 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
! y direction
|
|
||||||
if(Sfy(i,j,k) >= ZEO .and. j+5 <= jmax .and. j-3 >= jmin)then
|
|
||||||
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfy(i,j,k)*d840dy*(-F5*fh(i,j-3,k)+F60 *fh(i,j-2,k)-F420*fh(i,j-1,k)-F378*fh(i,j ,k) &
|
|
||||||
+F1050*fh(i,j+1,k)-F420*fh(i,j+2,k)+F140*fh(i,j+3,k)-F30 *fh(i,j+4,k)+THR*fh(i,j+5,k))
|
|
||||||
|
|
||||||
elseif(Sfy(i,j,k) <= ZEO .and. j-5 >= jmin .and. j+3 <= jmax)then
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)- &
|
|
||||||
Sfy(i,j,k)*d840dy*(-F5*fh(i,j+3,k)+F60 *fh(i,j+2,k)-F420*fh(i,j+1,k)-F378*fh(i,j ,k) &
|
|
||||||
+F1050*fh(i,j-1,k)-F420*fh(i,j-2,k)+F140*fh(i,j-3,k)- F30*fh(i,j-4,k)+THR*fh(i,j-5,k))
|
|
||||||
|
|
||||||
elseif(j+4 <= jmax .and. j-4 >= jmin)then
|
|
||||||
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfy(i,j,k)*d840dy*( THR*fh(i,j-4,k)-F32 *fh(i,j-3,k)+F168*fh(i,j-2,k)-F672*fh(i,j-1,k)+ &
|
|
||||||
F672*fh(i,j+1,k)-F168*fh(i,j+2,k)+F32 *fh(i,j+3,k)-THR *fh(i,j+4,k))
|
|
||||||
|
|
||||||
elseif(j+3 <= jmax .and. j-3 >= jmin)then
|
|
||||||
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfy(i,j,k)*d60dy*(-fh(i,j-3,k)+F9*fh(i,j-2,k)-F45*fh(i,j-1,k)+F45*fh(i,j+1,k)-F9*fh(i,j+2,k)+fh(i,j+3,k))
|
|
||||||
|
|
||||||
elseif(j+2 <= jmax .and. j-2 >= jmin)then
|
|
||||||
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfy(i,j,k)*d12dy*(fh(i,j-2,k)-EIT*fh(i,j-1,k)+EIT*fh(i,j+1,k)-fh(i,j+2,k))
|
|
||||||
|
|
||||||
elseif(j+1 <= jmax .and. j-1 >= jmin)then
|
|
||||||
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k) + Sfy(i,j,k)*d2dy*(-fh(i,j-1,k)+fh(i,j+1,k))
|
|
||||||
! set jmin and jmax 0
|
|
||||||
endif
|
|
||||||
!! z direction
|
|
||||||
if(Sfz(i,j,k) >= ZEO .and. k+5 <= kmax .and. k-3 >= kmin)then
|
|
||||||
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfz(i,j,k)*d840dz*(-F5*fh(i,j,k-3)+F60 *fh(i,j,k-2)-F420*fh(i,j,k-1)-F378*fh(i,j,k ) &
|
|
||||||
+F1050*fh(i,j,k+1)-F420*fh(i,j,k+2)+F140*fh(i,j,k+3)-F30 *fh(i,j,k+4)+THR*fh(i,j,k+5))
|
|
||||||
|
|
||||||
elseif(Sfz(i,j,k) <= ZEO .and. k-5 >= kmin .and. k+3 <= kmax)then
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)- &
|
|
||||||
Sfz(i,j,k)*d840dz*(-F5*fh(i,j,k+3)+F60 *fh(i,j,k+2)-F420*fh(i,j,k+1)-F378*fh(i,j,k ) &
|
|
||||||
+F1050*fh(i,j,k-1)-F420*fh(i,j,k-2)+F140*fh(i,j,k-3)- F30*fh(i,j,k-4)+THR*fh(i,j,k-5))
|
|
||||||
|
|
||||||
elseif(k+4 <= kmax .and. k-4 >= kmin)then
|
|
||||||
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfz(i,j,k)*d840dz*( THR*fh(i,j,k-4)-F32 *fh(i,j,k-3)+F168*fh(i,j,k-2)-F672*fh(i,j,k-1)+ &
|
|
||||||
F672*fh(i,j,k+1)-F168*fh(i,j,k+2)+F32 *fh(i,j,k+3)-THR *fh(i,j,k+4))
|
|
||||||
|
|
||||||
elseif(k+3 <= kmax .and. k-3 >= kmin)then
|
|
||||||
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfz(i,j,k)*d60dz*(-fh(i,j,k-3)+F9*fh(i,j,k-2)-F45*fh(i,j,k-1)+F45*fh(i,j,k+1)-F9*fh(i,j,k+2)+fh(i,j,k+3))
|
|
||||||
|
|
||||||
elseif(k+2 <= kmax .and. k-2 >= kmin)then
|
|
||||||
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+ &
|
|
||||||
Sfz(i,j,k)*d12dz*(fh(i,j,k-2)-EIT*fh(i,j,k-1)+EIT*fh(i,j,k+1)-fh(i,j,k+2))
|
|
||||||
|
|
||||||
elseif(k+1 <= kmax .and. k-1 >= kmin)then
|
|
||||||
|
|
||||||
f_rhs(i,j,k)=f_rhs(i,j,k)+Sfz(i,j,k)*d2dz*(-fh(i,j,k-1)+fh(i,j,k+1))
|
|
||||||
! set kmin and kmax 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
end subroutine lopsided
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -2,20 +2,6 @@
|
|||||||
|
|
||||||
include makefile.inc
|
include makefile.inc
|
||||||
|
|
||||||
## polint(ordn=6) kernel selector:
|
|
||||||
## 1 (default): barycentric fast path
|
|
||||||
## 0 : fallback to Neville path
|
|
||||||
POLINT6_USE_BARY ?= 1
|
|
||||||
POLINT6_FLAG = -DPOLINT6_USE_BARYCENTRIC=$(POLINT6_USE_BARY)
|
|
||||||
|
|
||||||
ARCH_OPT = -march=x86-64-v4
|
|
||||||
CXXAPPFLAGS = -O3 $(ARCH_OPT) -fp-model fast=2 -fma -ipo \
|
|
||||||
-Dfortran3 -Dnewc -I${MKLROOT}/include
|
|
||||||
f90appflags = -O3 $(ARCH_OPT) -fp-model fast=2 -fma -ipo \
|
|
||||||
-align array64byte -fpp -I${MKLROOT}/include $(POLINT6_FLAG)
|
|
||||||
TP_OPTFLAGS = -O3 $(ARCH_OPT) -fp-model fast=2 -fma -ipo \
|
|
||||||
-Dfortran3 -Dnewc -I${MKLROOT}/include
|
|
||||||
|
|
||||||
.SUFFIXES: .o .f90 .C .for .cu
|
.SUFFIXES: .o .f90 .C .for .cu
|
||||||
|
|
||||||
.f90.o:
|
.f90.o:
|
||||||
@@ -31,10 +17,10 @@ TP_OPTFLAGS = -O3 $(ARCH_OPT) -fp-model fast=2 -fma -ipo \
|
|||||||
$(Cu) $(CUDA_APP_FLAGS) -c $< -o $@ $(CUDA_LIB_PATH)
|
$(Cu) $(CUDA_APP_FLAGS) -c $< -o $@ $(CUDA_LIB_PATH)
|
||||||
|
|
||||||
TwoPunctures.o: TwoPunctures.C
|
TwoPunctures.o: TwoPunctures.C
|
||||||
${CXX} $(TP_OPTFLAGS) -qopenmp -c $< -o $@
|
${CXX} $(CXXAPPFLAGS) -qopenmp -c $< -o $@
|
||||||
|
|
||||||
TwoPunctureABE.o: TwoPunctureABE.C
|
TwoPunctureABE.o: TwoPunctureABE.C
|
||||||
${CXX} $(TP_OPTFLAGS) -qopenmp -c $< -o $@
|
${CXX} $(CXXAPPFLAGS) -qopenmp -c $< -o $@
|
||||||
|
|
||||||
# Input files
|
# Input files
|
||||||
C++FILES = ABE.o Ansorg.o Block.o misc.o monitor.o Parallel.o MPatch.o var.o\
|
C++FILES = ABE.o Ansorg.o Block.o misc.o monitor.o Parallel.o MPatch.o var.o\
|
||||||
@@ -116,7 +102,7 @@ ABEGPU: $(C++FILES_GPU) $(F90FILES) $(F77FILES) $(AHFDOBJS) $(CUDAFILES)
|
|||||||
$(CLINKER) $(CXXAPPFLAGS) -o $@ $(C++FILES_GPU) $(F90FILES) $(F77FILES) $(AHFDOBJS) $(CUDAFILES) $(LDLIBS)
|
$(CLINKER) $(CXXAPPFLAGS) -o $@ $(C++FILES_GPU) $(F90FILES) $(F77FILES) $(AHFDOBJS) $(CUDAFILES) $(LDLIBS)
|
||||||
|
|
||||||
TwoPunctureABE: $(TwoPunctureFILES)
|
TwoPunctureABE: $(TwoPunctureFILES)
|
||||||
$(CLINKER) $(TP_OPTFLAGS) -qopenmp -o $@ $(TwoPunctureFILES) $(LDLIBS)
|
$(CLINKER) $(CXXAPPFLAGS) -qopenmp -o $@ $(TwoPunctureFILES) $(LDLIBS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm *.o ABE ABEGPU TwoPunctureABE make.log -f
|
rm *.o ABE ABEGPU TwoPunctureABE make.log -f
|
||||||
|
|||||||
@@ -1,27 +1,24 @@
|
|||||||
|
|
||||||
## GCC version (commented out)
|
## GCC version (commented out)
|
||||||
## filein = -I/usr/include -I/usr/lib/x86_64-linux-gnu/mpich/include -I/usr/lib/x86_64-linux-gnu/openmpi/lib/ -I/usr/lib/gcc/x86_64-linux-gnu/11/ -I/usr/include/c++/11/
|
## filein = -I/usr/include -I/usr/lib/x86_64-linux-gnu/mpich/include -I/usr/lib/x86_64-linux-gnu/openmpi/lib/ -I/usr/lib/gcc/x86_64-linux-gnu/11/ -I/usr/include/c++/11/
|
||||||
## filein = -I/usr/include/ -I/usr/include/openmpi-x86_64/ -I/usr/lib/x86_64-linux-gnu/openmpi/include/ -I/usr/lib/x86_64-linux-gnu/openmpi/lib/ -I/usr/lib/gcc/x86_64-linux-gnu/11/ -I/usr/include/c++/11/
|
## filein = -I/usr/include/ -I/usr/include/openmpi-x86_64/ -I/usr/lib/x86_64-linux-gnu/openmpi/include/ -I/usr/lib/x86_64-linux-gnu/openmpi/lib/ -I/usr/lib/gcc/x86_64-linux-gnu/11/ -I/usr/include/c++/11/
|
||||||
## LDLIBS = -L/usr/lib/x86_64-linux-gnu -L/usr/lib64 -L/usr/lib/gcc/x86_64-linux-gnu/11 -lgfortran -lmpi -lgfortran
|
## LDLIBS = -L/usr/lib/x86_64-linux-gnu -L/usr/lib64 -L/usr/lib/gcc/x86_64-linux-gnu/11 -lgfortran -lmpi -lgfortran
|
||||||
|
|
||||||
## Intel oneAPI version with oneMKL
|
## Intel oneAPI version with oneMKL (Optimized for performance)
|
||||||
filein = -I/usr/include/ -I${MKLROOT}/include
|
filein = -I/usr/include/ -I${MKLROOT}/include
|
||||||
|
|
||||||
## Use sequential oneMKL to avoid introducing extra OpenMP behavior into ABE.
|
## Using sequential MKL (OpenMP disabled for better single-threaded performance)
|
||||||
LDLIBS = -L${MKLROOT}/lib -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lifcore -limf -lpthread -lm -ldl -liomp5
|
## Added -lifcore for Intel Fortran runtime and -limf for Intel math library
|
||||||
|
LDLIBS = -L${MKLROOT}/lib -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lifcore -limf -lpthread -lm -ldl
|
||||||
## Optional Intel oneTBB allocator, kept aligned with main's build environment.
|
|
||||||
USE_TBBMALLOC ?= 1
|
|
||||||
TBBMALLOC_SO ?= /home/intel/oneapi/2025.3/lib/libtbbmalloc.so
|
|
||||||
ifneq ($(wildcard $(TBBMALLOC_SO)),)
|
|
||||||
TBBMALLOC_LIBS = -Wl,--no-as-needed $(TBBMALLOC_SO) -Wl,--as-needed
|
|
||||||
else
|
|
||||||
TBBMALLOC_LIBS = -Wl,--no-as-needed -ltbbmalloc -Wl,--as-needed
|
|
||||||
endif
|
|
||||||
ifeq ($(USE_TBBMALLOC),1)
|
|
||||||
LDLIBS := $(TBBMALLOC_LIBS) $(LDLIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
## Aggressive optimization flags:
|
||||||
|
## -O3: Maximum optimization
|
||||||
|
## -xHost: Optimize for the host CPU architecture (Intel/AMD compatible)
|
||||||
|
## -fp-model fast=2: Aggressive floating-point optimizations
|
||||||
|
## -fma: Enable fused multiply-add instructions
|
||||||
|
CXXAPPFLAGS = -O3 -xHost -fp-model fast=2 -fma -ipo \
|
||||||
|
-Dfortran3 -Dnewc -I${MKLROOT}/include
|
||||||
|
f90appflags = -O3 -xHost -fp-model fast=2 -fma -ipo \
|
||||||
|
-align array64byte -fpp -I${MKLROOT}/include
|
||||||
f90 = ifx
|
f90 = ifx
|
||||||
f77 = ifx
|
f77 = ifx
|
||||||
CXX = icpx
|
CXX = icpx
|
||||||
|
|||||||
@@ -10,6 +10,17 @@
|
|||||||
|
|
||||||
import AMSS_NCKU_Input as input_data
|
import AMSS_NCKU_Input as input_data
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import time
|
||||||
|
## CPU core binding configuration using taskset
|
||||||
|
## taskset ensures all child processes inherit the CPU affinity mask
|
||||||
|
## This forces make and all compiler processes to use only nohz_full cores (4-55, 60-111)
|
||||||
|
## Format: taskset -c 4-55,60-111 ensures processes only run on these cores
|
||||||
|
NUMACTL_CPU_BIND = "taskset -c 0-111"
|
||||||
|
|
||||||
|
## Build parallelism configuration
|
||||||
|
## Use nohz_full cores (4-55, 60-111) for compilation: 52 + 52 = 104 cores
|
||||||
|
## Set make -j to utilize available cores for faster builds
|
||||||
|
BUILD_JOBS = 104
|
||||||
|
|
||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
@@ -26,11 +37,11 @@ def makefile_ABE():
|
|||||||
print( " Compiling the AMSS-NCKU executable file ABE/ABEGPU " )
|
print( " Compiling the AMSS-NCKU executable file ABE/ABEGPU " )
|
||||||
print( )
|
print( )
|
||||||
|
|
||||||
## Build command
|
## Build command with CPU binding to nohz_full cores
|
||||||
if (input_data.GPU_Calculation == "no"):
|
if (input_data.GPU_Calculation == "no"):
|
||||||
makefile_command = "make -j96" + " ABE"
|
makefile_command = f"{NUMACTL_CPU_BIND} make -j{BUILD_JOBS} ABE"
|
||||||
elif (input_data.GPU_Calculation == "yes"):
|
elif (input_data.GPU_Calculation == "yes"):
|
||||||
makefile_command = "make -j4" + " ABEGPU"
|
makefile_command = f"{NUMACTL_CPU_BIND} make -j{BUILD_JOBS} ABEGPU"
|
||||||
else:
|
else:
|
||||||
print( " CPU/GPU numerical calculation setting is wrong " )
|
print( " CPU/GPU numerical calculation setting is wrong " )
|
||||||
print( )
|
print( )
|
||||||
@@ -67,8 +78,8 @@ def makefile_TwoPunctureABE():
|
|||||||
print( " Compiling the AMSS-NCKU executable file TwoPunctureABE " )
|
print( " Compiling the AMSS-NCKU executable file TwoPunctureABE " )
|
||||||
print( )
|
print( )
|
||||||
|
|
||||||
## Build command
|
## Build command with CPU binding to nohz_full cores
|
||||||
makefile_command = "make" + " TwoPunctureABE"
|
makefile_command = f"{NUMACTL_CPU_BIND} make -j{BUILD_JOBS} TwoPunctureABE"
|
||||||
|
|
||||||
## Execute the command with subprocess.Popen and stream output
|
## Execute the command with subprocess.Popen and stream output
|
||||||
makefile_process = subprocess.Popen(makefile_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
|
makefile_process = subprocess.Popen(makefile_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
|
||||||
@@ -105,10 +116,10 @@ def run_ABE():
|
|||||||
## Define the command to run; cast other values to strings as needed
|
## Define the command to run; cast other values to strings as needed
|
||||||
|
|
||||||
if (input_data.GPU_Calculation == "no"):
|
if (input_data.GPU_Calculation == "no"):
|
||||||
mpi_command = "mpirun -np " + str(input_data.MPI_processes) + " ./ABE"
|
mpi_command = NUMACTL_CPU_BIND + " mpirun -np " + str(input_data.MPI_processes) + " ./ABE"
|
||||||
mpi_command_outfile = "ABE_out.log"
|
mpi_command_outfile = "ABE_out.log"
|
||||||
elif (input_data.GPU_Calculation == "yes"):
|
elif (input_data.GPU_Calculation == "yes"):
|
||||||
mpi_command = "mpirun -np " + str(input_data.MPI_processes) + " ./ABEGPU"
|
mpi_command = NUMACTL_CPU_BIND + " mpirun -np " + str(input_data.MPI_processes) + " ./ABEGPU"
|
||||||
mpi_command_outfile = "ABEGPU_out.log"
|
mpi_command_outfile = "ABEGPU_out.log"
|
||||||
|
|
||||||
## Execute the MPI command and stream output
|
## Execute the MPI command and stream output
|
||||||
@@ -141,13 +152,13 @@ def run_ABE():
|
|||||||
## Run the AMSS-NCKU TwoPuncture program TwoPunctureABE
|
## Run the AMSS-NCKU TwoPuncture program TwoPunctureABE
|
||||||
|
|
||||||
def run_TwoPunctureABE():
|
def run_TwoPunctureABE():
|
||||||
|
tp_time1=time.time()
|
||||||
print( )
|
print( )
|
||||||
print( " Running the AMSS-NCKU executable file TwoPunctureABE " )
|
print( " Running the AMSS-NCKU executable file TwoPunctureABE " )
|
||||||
print( )
|
print( )
|
||||||
|
|
||||||
## Define the command to run
|
## Define the command to run
|
||||||
TwoPuncture_command = "./TwoPunctureABE"
|
TwoPuncture_command = NUMACTL_CPU_BIND + " ./TwoPunctureABE"
|
||||||
TwoPuncture_command_outfile = "TwoPunctureABE_out.log"
|
TwoPuncture_command_outfile = "TwoPunctureABE_out.log"
|
||||||
|
|
||||||
## Execute the command with subprocess.Popen and stream output
|
## Execute the command with subprocess.Popen and stream output
|
||||||
@@ -168,7 +179,9 @@ def run_TwoPunctureABE():
|
|||||||
print( )
|
print( )
|
||||||
print( " The TwoPunctureABE simulation is finished " )
|
print( " The TwoPunctureABE simulation is finished " )
|
||||||
print( )
|
print( )
|
||||||
|
tp_time2=time.time()
|
||||||
|
et=tp_time2-tp_time1
|
||||||
|
print(f"Used time: {et}")
|
||||||
return
|
return
|
||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
import multiprocessing
|
|
||||||
|
|
||||||
|
|
||||||
def run_plot_task(task):
|
|
||||||
func, args = task
|
|
||||||
return func(*args)
|
|
||||||
|
|
||||||
|
|
||||||
def run_plot_tasks_parallel(plot_tasks):
|
|
||||||
ctx = multiprocessing.get_context('fork')
|
|
||||||
with ctx.Pool() as pool:
|
|
||||||
pool.map(run_plot_task, plot_tasks)
|
|
||||||
@@ -11,8 +11,6 @@
|
|||||||
import numpy ## numpy for array operations
|
import numpy ## numpy for array operations
|
||||||
import scipy ## scipy for interpolation and signal processing
|
import scipy ## scipy for interpolation and signal processing
|
||||||
import math
|
import math
|
||||||
import matplotlib
|
|
||||||
matplotlib.use('Agg') ## use non-interactive backend for multiprocessing safety
|
|
||||||
import matplotlib.pyplot as plt ## matplotlib for plotting
|
import matplotlib.pyplot as plt ## matplotlib for plotting
|
||||||
import os ## os for system/file operations
|
import os ## os for system/file operations
|
||||||
|
|
||||||
|
|||||||
@@ -8,21 +8,16 @@
|
|||||||
##
|
##
|
||||||
#################################################
|
#################################################
|
||||||
|
|
||||||
## Restrict OpenMP to one thread per process so that parallel
|
|
||||||
## subprocess plotting does not multiply BLAS thread counts.
|
|
||||||
import os
|
|
||||||
os.environ.setdefault("OMP_NUM_THREADS", "1")
|
|
||||||
|
|
||||||
import numpy
|
import numpy
|
||||||
import scipy
|
import scipy
|
||||||
import matplotlib
|
|
||||||
matplotlib.use('Agg') ## use non-interactive backend for multiprocessing safety
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
from matplotlib.colors import LogNorm
|
from matplotlib.colors import LogNorm
|
||||||
from mpl_toolkits.mplot3d import Axes3D
|
from mpl_toolkits.mplot3d import Axes3D
|
||||||
## import torch
|
## import torch
|
||||||
import AMSS_NCKU_Input as input_data
|
import AMSS_NCKU_Input as input_data
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
|
|
||||||
@@ -197,11 +192,3 @@ def get_data_xy( Rmin, Rmax, n, data0, time, figure_title, figure_outdir ):
|
|||||||
|
|
||||||
####################################################################################
|
####################################################################################
|
||||||
|
|
||||||
## Allow standalone subprocess execution for parallel binary-data plotting.
|
|
||||||
if __name__ == '__main__':
|
|
||||||
import sys
|
|
||||||
if len(sys.argv) != 4:
|
|
||||||
print(f"Usage: {sys.argv[0]} <filename> <binary_outdir> <figure_outdir>")
|
|
||||||
sys.exit(1)
|
|
||||||
plot_binary_data(sys.argv[1], sys.argv[2], sys.argv[3])
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,6 @@
|
|||||||
#################################################
|
#################################################
|
||||||
|
|
||||||
import numpy ## numpy for array operations
|
import numpy ## numpy for array operations
|
||||||
import matplotlib
|
|
||||||
matplotlib.use('Agg') ## use non-interactive backend for multiprocessing safety
|
|
||||||
import matplotlib.pyplot as plt ## matplotlib for plotting
|
import matplotlib.pyplot as plt ## matplotlib for plotting
|
||||||
from mpl_toolkits.mplot3d import Axes3D ## needed for 3D plots
|
from mpl_toolkits.mplot3d import Axes3D ## needed for 3D plots
|
||||||
import glob
|
import glob
|
||||||
@@ -17,9 +15,6 @@ import os ## operating system utilities
|
|||||||
|
|
||||||
import plot_binary_data
|
import plot_binary_data
|
||||||
import AMSS_NCKU_Input as input_data
|
import AMSS_NCKU_Input as input_data
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
import multiprocessing
|
|
||||||
|
|
||||||
# plt.rcParams['text.usetex'] = True ## enable LaTeX fonts in plots
|
# plt.rcParams['text.usetex'] = True ## enable LaTeX fonts in plots
|
||||||
|
|
||||||
@@ -55,34 +50,10 @@ def generate_binary_data_plot( binary_outdir, figure_outdir ):
|
|||||||
file_list.append(x)
|
file_list.append(x)
|
||||||
print(x)
|
print(x)
|
||||||
|
|
||||||
## Plot each file in parallel using subprocesses.
|
## Plot each file in the list
|
||||||
## Each subprocess starts with BLAS thread limits in plot_binary_data.py.
|
|
||||||
script = os.path.join( os.path.dirname(__file__), "plot_binary_data.py" )
|
|
||||||
max_workers = min( multiprocessing.cpu_count(), len(file_list) ) if file_list else 0
|
|
||||||
|
|
||||||
running = []
|
|
||||||
failed = []
|
|
||||||
for filename in file_list:
|
for filename in file_list:
|
||||||
print(filename)
|
print(filename)
|
||||||
proc = subprocess.Popen(
|
plot_binary_data.plot_binary_data(filename, binary_outdir, figure_outdir)
|
||||||
[sys.executable, script, filename, binary_outdir, figure_outdir],
|
|
||||||
)
|
|
||||||
running.append( (proc, filename) )
|
|
||||||
if len(running) >= max_workers:
|
|
||||||
p, fn = running.pop(0)
|
|
||||||
p.wait()
|
|
||||||
if p.returncode != 0:
|
|
||||||
failed.append(fn)
|
|
||||||
|
|
||||||
for p, fn in running:
|
|
||||||
p.wait()
|
|
||||||
if p.returncode != 0:
|
|
||||||
failed.append(fn)
|
|
||||||
|
|
||||||
if failed:
|
|
||||||
print( " WARNING: the following binary data plots failed:" )
|
|
||||||
for fn in failed:
|
|
||||||
print( " ", fn )
|
|
||||||
|
|
||||||
print( )
|
print( )
|
||||||
print( " Binary Data Plot Has been Finished " )
|
print( " Binary Data Plot Has been Finished " )
|
||||||
|
|||||||
Reference in New Issue
Block a user