Compare commits

..

4 Commits

218 changed files with 190586 additions and 192364 deletions

6
.idea/vcs.xml generated
View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@@ -13,14 +13,17 @@ import numpy
## Setting MPI processes and the output file directory
File_directory = "GW150914" ## output file directory
Output_directory = "binary_output" ## binary data file directory
## The file directory name should not be too long
MPI_processes = 64 ## number of mpi processes used in the simulation
GPU_Calculation = "no" ## Use GPU or not
## (prefer "no" in the current version, because the GPU part may have bugs when integrated in this Python interface)
CPU_Part = 1.0
File_directory = "GW150914" ## output file directory
Output_directory = "binary_output" ## binary data file directory
## The file directory name should not be too long
MPI_processes = 64 ## number of mpi processes used in the simulation
OMP_Threads = 3 ## number of OpenMP threads used by each MPI process
MPI_hosts = ["localhost", "192.168.20.102"] ## MPI hosts for multi-node runs
MPI_processes_per_node = 32 ## MPI ranks launched on each node in MPI_hosts
GPU_Calculation = "no" ## Use GPU or not
## (prefer "no" in the current version, because the GPU part may have bugs when integrated in this Python interface)
CPU_Part = 1.0
GPU_Part = 0.0
#################################################
@@ -50,7 +53,7 @@ Check_Time = 100.0
Dump_Time = 100.0 ## time inteval dT for dumping binary data
D2_Dump_Time = 100.0 ## dump the ascii data for 2d surface after dT'
Analysis_Time = 0.1 ## dump the puncture position and GW psi4 after dT"
Evolution_Step_Number = 10000000 ## stop the calculation after the maximal step number
Evolution_Step_Number = 10000000 ## stop the calculation after the maximal step number
Courant_Factor = 0.5 ## Courant Factor
Dissipation = 0.15 ## Kreiss-Oliger Dissipation Strength

View File

@@ -126,7 +126,12 @@ setup.generate_AMSSNCKU_input()
#inputvalue = input() ## Wait for user input (press Enter) to proceed
#print()
## Generate AMSS-NCKU program input files based on the configured parameters
setup.print_puncture_information()
##################################################################
## Generate AMSS-NCKU program input files based on the configured parameters
print( )
print( " Generating the AMSS-NCKU input parfile for the ABE executable. " )
@@ -307,7 +312,7 @@ if (input_data.Initial_Data_Method == "Ansorg-TwoPuncture" ):
import generate_TwoPuncture_input
generate_TwoPuncture_input.generate_AMSSNCKU_TwoPuncture_input(numerical_grid.puncture_data)
generate_TwoPuncture_input.generate_AMSSNCKU_TwoPuncture_input()
print( )
print( " The input parfile for the TwoPunctureABE executable has been generated. " )
@@ -349,7 +354,7 @@ if (input_data.Initial_Data_Method == "Ansorg-TwoPuncture" ):
import renew_puncture_parameter
renew_puncture_parameter.append_AMSSNCKU_BSSN_input(File_directory, output_directory, numerical_grid.puncture_data)
renew_puncture_parameter.append_AMSSNCKU_BSSN_input(File_directory, output_directory)
## Generated AMSS-NCKU input filename

View File

@@ -2,18 +2,13 @@
"""
AMSS-NCKU GW150914 Simulation Regression Test Script (Comprehensive Version)
Verification Requirements:
1. RMS errors < 1% for:
- 3D Vector Total RMS
- X Component RMS
- Y Component RMS
- Z Component RMS
2. ADM constraint violation < 2 (Grid Level 0)
3. The following figure PDFs must match GW150914-origin exactly after rasterization:
- ADM_Constraint_Grid_Level_0.pdf
- BH_Trajectory_21_XY.pdf
- BH_Trajectory_XY.pdf
The script also reports the percentage of differing pixels for each figure.
Verification Requirements:
1. RMS errors < 1% for:
- 3D Vector Total RMS
- X Component RMS
- Y Component RMS
- Z Component RMS
2. ADM constraint violation < 2 (Grid Level 0)
RMS Calculation Method:
- Computes trajectory deviation on the XY plane independently for BH1 and BH2
@@ -25,13 +20,9 @@ Default: output_dir = GW150914/AMSS_NCKU_output
Reference: GW150914-origin (baseline simulation)
"""
import numpy as np
import sys
import os
import shutil
import subprocess
import tempfile
from PIL import Image
import numpy as np
import sys
import os
# ANSI Color Codes
class Color:
@@ -58,143 +49,17 @@ def load_bh_trajectory(filepath):
}
def load_constraint_data(filepath):
"""Load constraint violation data"""
data = []
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 resolve_figure_dir(path):
"""Resolve the sibling figure directory from an output or figure path."""
normalized = os.path.normpath(path)
if os.path.basename(normalized) == "figure":
return normalized
return os.path.join(os.path.dirname(normalized), "figure")
def render_pdf_to_images(pdf_path, dpi=150):
"""Render a PDF to RGB images using Ghostscript."""
gs_path = shutil.which("gs")
if gs_path is None:
raise RuntimeError("Ghostscript executable 'gs' was not found in PATH")
with tempfile.TemporaryDirectory(prefix="amss_verify_pdf_") as temp_dir:
output_pattern = os.path.join(temp_dir, "page-%03d.ppm")
cmd = [
gs_path,
"-q",
"-dSAFER",
"-dBATCH",
"-dNOPAUSE",
"-sDEVICE=ppmraw",
f"-r{dpi}",
f"-o{output_pattern}",
pdf_path
]
try:
subprocess.run(cmd, check=True, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE, text=True)
except subprocess.CalledProcessError as exc:
message = exc.stderr.strip() or str(exc)
raise RuntimeError(f"Failed to render PDF '{pdf_path}': {message}") from exc
ppm_files = sorted(
os.path.join(temp_dir, filename)
for filename in os.listdir(temp_dir)
if filename.endswith(".ppm")
)
if not ppm_files:
raise RuntimeError(f"No rendered pages were produced for '{pdf_path}'")
images = []
for ppm_file in ppm_files:
with Image.open(ppm_file) as img:
images.append(np.array(img.convert("RGB"), dtype=np.uint8))
return images
def compare_rendered_pages(ref_img, target_img):
"""Return (different_pixels, total_pixels) for two rendered RGB pages."""
ref_h, ref_w = ref_img.shape[:2]
tgt_h, tgt_w = target_img.shape[:2]
total_pixels = max(ref_h, tgt_h) * max(ref_w, tgt_w)
if ref_h == tgt_h and ref_w == tgt_w:
different_pixels = int(np.count_nonzero(np.any(ref_img != target_img, axis=2)))
return different_pixels, total_pixels
diff_mask = np.ones((max(ref_h, tgt_h), max(ref_w, tgt_w)), dtype=bool)
overlap_h = min(ref_h, tgt_h)
overlap_w = min(ref_w, tgt_w)
overlap_diff = np.any(ref_img[:overlap_h, :overlap_w] != target_img[:overlap_h, :overlap_w], axis=2)
diff_mask[:overlap_h, :overlap_w] = overlap_diff
different_pixels = int(np.count_nonzero(diff_mask))
return different_pixels, total_pixels
def compare_pdf_images(ref_pdf, target_pdf, dpi=150, threshold_percent=0.001):
"""Compare two PDFs by rasterizing them and counting differing pixels."""
ref_pages = render_pdf_to_images(ref_pdf, dpi=dpi)
target_pages = render_pdf_to_images(target_pdf, dpi=dpi)
total_pixels = 0
different_pixels = 0
max_pages = max(len(ref_pages), len(target_pages))
for page_idx in range(max_pages):
if page_idx < len(ref_pages) and page_idx < len(target_pages):
page_diff, page_total = compare_rendered_pages(ref_pages[page_idx], target_pages[page_idx])
else:
existing_page = ref_pages[page_idx] if page_idx < len(ref_pages) else target_pages[page_idx]
page_total = existing_page.shape[0] * existing_page.shape[1]
page_diff = page_total
total_pixels += page_total
different_pixels += page_diff
diff_percent = (different_pixels / total_pixels * 100.0) if total_pixels else 0.0
return {
"different_pixels": different_pixels,
"total_pixels": total_pixels,
"diff_percent": diff_percent,
"pages_ref": len(ref_pages),
"pages_target": len(target_pages),
"passed": diff_percent < threshold_percent
}
def compare_required_figures(reference_figure_dir, target_figure_dir):
"""Compare the required GW150914 figure PDFs."""
figure_names = [
"ADM_Constraint_Grid_Level_0.pdf",
"BH_Trajectory_21_XY.pdf",
"BH_Trajectory_XY.pdf"
]
results = []
for figure_name in figure_names:
ref_pdf = os.path.join(reference_figure_dir, figure_name)
target_pdf = os.path.join(target_figure_dir, figure_name)
if not os.path.exists(ref_pdf):
raise FileNotFoundError(f"Reference figure not found: {ref_pdf}")
if not os.path.exists(target_pdf):
raise FileNotFoundError(f"Target figure not found: {target_pdf}")
comparison = compare_pdf_images(ref_pdf, target_pdf)
comparison["name"] = figure_name
results.append(comparison)
return results
data.append([float(x) for x in parts[:8]])
return np.array(data)
def calculate_all_rms_errors(bh_data_ref, bh_data_target):
"""
@@ -300,7 +165,7 @@ def print_rms_results(rms_dict, error, threshold=1.0):
return all_passed
def print_constraint_results(results, threshold=2.0):
def print_constraint_results(results, threshold=2.0):
print(f"\n{Color.BOLD}2. ADM Constraint Violation Analysis (Grid Level 0){Color.RESET}")
print("-" * 65)
@@ -315,49 +180,22 @@ def print_constraint_results(results, threshold=2.0):
print(f"\n Maximum violation: {results['max_violation']:.6f}")
print(f" Requirement: < {threshold}")
print(f" Status: {get_status_text(passed)}")
return passed
def print_figure_results(results, threshold_percent=0.001):
print(f"\n{Color.BOLD}3. Figure Pixel Comparison (PDF Rasterization){Color.RESET}")
print("-" * 65)
print(f" Requirement: < {threshold_percent:.3f}% differing pixels\n")
all_passed = True
for result in results:
passed = result["passed"]
all_passed = all_passed and passed
status = get_status_text(passed)
print(f" {result['name']:32}: {result['diff_percent']:10.6f}% | Status: {status}")
if result["pages_ref"] != result["pages_target"]:
print(f" {'':32} pages(ref/target): {result['pages_ref']}/{result['pages_target']}")
return all_passed
def print_figure_error(error_message):
print(f"\n{Color.BOLD}3. Figure Pixel Comparison (PDF Rasterization){Color.RESET}")
print("-" * 65)
print(f" {Color.RED}Error: {error_message}{Color.RESET}")
return False
def print_summary(rms_passed, constraint_passed, figure_passed):
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 and figure_passed
res_rms = get_status_text(rms_passed)
res_con = get_status_text(constraint_passed)
res_fig = get_status_text(figure_passed)
print(f" [1] Comprehensive RMS check: {res_rms}")
print(f" [2] ADM constraint check: {res_con}")
print(f" [3] Figure pixel comparison: {res_fig}")
return passed
def print_summary(rms_passed, constraint_passed):
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] Comprehensive RMS 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}")
@@ -372,14 +210,12 @@ def main():
script_dir = os.path.dirname(os.path.abspath(__file__))
target_dir = os.path.join(script_dir, "GW150914/AMSS_NCKU_output")
script_dir = os.path.dirname(os.path.abspath(__file__))
reference_dir = os.path.join(script_dir, "GW150914-origin/AMSS_NCKU_output")
target_figure_dir = resolve_figure_dir(target_dir)
reference_figure_dir = os.path.join(script_dir, "GW150914-origin/figure")
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")
script_dir = os.path.dirname(os.path.abspath(__file__))
reference_dir = os.path.join(script_dir, "GW150914-origin/AMSS_NCKU_output")
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")
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}")
@@ -391,11 +227,9 @@ def main():
print(f"{Color.RED}{Color.BOLD}Error:{Color.RESET} Constraint data file not found: {constraint_file}")
sys.exit(1)
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}")
print(f"{Color.BOLD}Reference Figures: {Color.RESET} {Color.BLUE}{reference_figure_dir}{Color.RESET}")
print(f"{Color.BOLD}Target Figures: {Color.RESET} {Color.BLUE}{target_figure_dir}{Color.RESET}")
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}")
bh_data_ref = load_bh_trajectory(bh_file_ref)
bh_data_target = load_bh_trajectory(bh_file_target)
@@ -405,18 +239,12 @@ def main():
rms_dict, error = calculate_all_rms_errors(bh_data_ref, bh_data_target)
rms_passed = print_rms_results(rms_dict, error)
# Output constraint results
constraint_results = analyze_constraint_violation(constraint_data)
constraint_passed = print_constraint_results(constraint_results)
try:
figure_results = compare_required_figures(reference_figure_dir, target_figure_dir)
figure_passed = print_figure_results(figure_results)
except (FileNotFoundError, RuntimeError) as exc:
figure_passed = print_figure_error(str(exc))
all_passed = print_summary(rms_passed, constraint_passed, figure_passed)
sys.exit(0 if all_passed else 1)
# Output constraint results
constraint_results = analyze_constraint_violation(constraint_data)
constraint_passed = print_constraint_results(constraint_results)
all_passed = print_summary(rms_passed, constraint_passed)
sys.exit(0 if all_passed else 1)
if __name__ == "__main__":
main()

View File

@@ -1,53 +1,53 @@
#ifndef Ansorg_H
#define Ansorg_H
#ifdef newc
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cmath>
using namespace std;
#else
#include <iostream.h>
#include <iomanip.h>
#include <fstream.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#endif
#include <mpi.h>
#define PI M_PI
class Ansorg
{
protected:
int n1, n2, n3, ntotal;
int order;
double *coordA, *coordB, *coordphi;
int ps_rxx, ps_rxy, ps_ryx, ps_ryy;
double ps_b, ps_dx;
double PIh;
double *pu_ps;
int myrank;
public:
Ansorg(char *filename, int orderi);
~Ansorg();
double ps_u_at_xyz(double x, double y, double z);
void set_ABp();
void xyz_to_ABp(double x, double y, double z,
double *A, double *B, double *phi);
double interpolate_tri_bar(double x, double y, double z,
int n1, int n2, int n3,
double *x1, double *x2, double *x3, double *yp);
int find_point_bisection(double x, int n, double *xp, int o);
void barycentric_omega(int n, int s, double *x, double *omega);
double barycentric(double x0, int n, int s, double *x, double *y,
double *omega);
};
#endif /* Ansorg_H */
#ifndef Ansorg_H
#define Ansorg_H
#ifdef newc
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cmath>
using namespace std;
#else
#include <iostream.h>
#include <iomanip.h>
#include <fstream.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#endif
#include <mpi.h>
#define PI M_PI
class Ansorg
{
protected:
int n1, n2, n3, ntotal;
int order;
double *coordA, *coordB, *coordphi;
int ps_rxx, ps_rxy, ps_ryx, ps_ryy;
double ps_b, ps_dx;
double PIh;
double *pu_ps;
int myrank;
public:
Ansorg(char *filename, int orderi);
~Ansorg();
double ps_u_at_xyz(double x, double y, double z);
void set_ABp();
void xyz_to_ABp(double x, double y, double z,
double *A, double *B, double *phi);
double interpolate_tri_bar(double x, double y, double z,
int n1, int n2, int n3,
double *x1, double *x2, double *x3, double *yp);
int find_point_bisection(double x, int n, double *xp, int o);
void barycentric_omega(int n, int s, double *x, double *omega);
double barycentric(double x0, int n, int s, double *x, double *y,
double *omega);
};
#endif /* Ansorg_H */

View File

@@ -1,101 +1,101 @@
#ifndef BH_DIAGNOSTICS_H
#define BH_DIAGNOSTICS_H
namespace AHFinderDirect
{
struct BH_diagnostics
{
public:
// mean x,y,z
fp centroid_x, centroid_y, centroid_z;
// these are quadrupole moments about the centroid, i.e.
// mean(xi*xj) - centroid_i*centroid_j
fp quadrupole_xx, quadrupole_xy, quadrupole_xz,
quadrupole_yy, quadrupole_yz,
quadrupole_zz;
// min,max,mean surface radius about local coordinate origin
fp min_radius, max_radius, mean_radius;
// xyz bounding box
fp min_x, max_x,
min_y, max_y,
min_z, max_z;
// proper circumference
// (computed using induced metric along these local-coordinate planes)
fp circumference_xy,
circumference_xz,
circumference_yz;
// surface area (computed using induced metric)
// and quantities derived from it
fp area, irreducible_mass, areal_radius;
double Px, Py, Pz, Sx, Sy, Sz;
public:
// position of diagnostics in buffer and number of diagnostics
enum
{
posn__centroid_x = 0,
posn__centroid_y,
posn__centroid_z,
posn__quadrupole_xx,
posn__quadrupole_xy,
posn__quadrupole_xz,
posn__quadrupole_yy,
posn__quadrupole_yz,
posn__quadrupole_zz,
posn__min_radius,
posn__max_radius,
posn__mean_radius,
posn__min_x,
posn__max_x,
posn__min_y,
posn__max_y,
posn__min_z,
posn__max_z,
posn__circumference_xy,
posn__circumference_xz,
posn__circumference_yz,
posn__area,
posn__irreducible_mass,
posn__areal_radius,
N_buffer // no comma // size of buffer
};
// copy diagnostics to/from buffer
void copy_to_buffer(double buffer[N_buffer]) const;
void copy_from_buffer(const double buffer[N_buffer]);
public:
void compute(patch_system &ps);
void compute_signature(patch_system &ps, const double dT);
FILE *setup_output_file(int N_horizons, int hn)
const;
void output(FILE *fileptr, double time)
const;
BH_diagnostics();
private:
static double surface_integral(const patch_system &ps,
int src_gfn, bool src_gfn_is_even_across_xy_plane,
bool src_gfn_is_even_across_xz_plane,
bool src_gfn_is_even_across_yz_plane,
enum patch::integration_method method);
};
//******************************************************************************
} // namespace AHFinderDirect
#endif /* BH_DIAGNOSTICS_H */
#ifndef BH_DIAGNOSTICS_H
#define BH_DIAGNOSTICS_H
namespace AHFinderDirect
{
struct BH_diagnostics
{
public:
// mean x,y,z
fp centroid_x, centroid_y, centroid_z;
// these are quadrupole moments about the centroid, i.e.
// mean(xi*xj) - centroid_i*centroid_j
fp quadrupole_xx, quadrupole_xy, quadrupole_xz,
quadrupole_yy, quadrupole_yz,
quadrupole_zz;
// min,max,mean surface radius about local coordinate origin
fp min_radius, max_radius, mean_radius;
// xyz bounding box
fp min_x, max_x,
min_y, max_y,
min_z, max_z;
// proper circumference
// (computed using induced metric along these local-coordinate planes)
fp circumference_xy,
circumference_xz,
circumference_yz;
// surface area (computed using induced metric)
// and quantities derived from it
fp area, irreducible_mass, areal_radius;
double Px, Py, Pz, Sx, Sy, Sz;
public:
// position of diagnostics in buffer and number of diagnostics
enum
{
posn__centroid_x = 0,
posn__centroid_y,
posn__centroid_z,
posn__quadrupole_xx,
posn__quadrupole_xy,
posn__quadrupole_xz,
posn__quadrupole_yy,
posn__quadrupole_yz,
posn__quadrupole_zz,
posn__min_radius,
posn__max_radius,
posn__mean_radius,
posn__min_x,
posn__max_x,
posn__min_y,
posn__max_y,
posn__min_z,
posn__max_z,
posn__circumference_xy,
posn__circumference_xz,
posn__circumference_yz,
posn__area,
posn__irreducible_mass,
posn__areal_radius,
N_buffer // no comma // size of buffer
};
// copy diagnostics to/from buffer
void copy_to_buffer(double buffer[N_buffer]) const;
void copy_from_buffer(const double buffer[N_buffer]);
public:
void compute(patch_system &ps);
void compute_signature(patch_system &ps, const double dT);
FILE *setup_output_file(int N_horizons, int hn)
const;
void output(FILE *fileptr, double time)
const;
BH_diagnostics();
private:
static double surface_integral(const patch_system &ps,
int src_gfn, bool src_gfn_is_even_across_xy_plane,
bool src_gfn_is_even_across_xz_plane,
bool src_gfn_is_even_across_yz_plane,
enum patch::integration_method method);
};
//******************************************************************************
} // namespace AHFinderDirect
#endif /* BH_DIAGNOSTICS_H */

View File

@@ -1,199 +1,199 @@
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cmath>
#include <new>
using namespace std;
#include "Block.h"
#include "misc.h"
Block::Block(int DIM, int *shapei, double *bboxi, int ranki, int ingfsi, int fngfsi, int levi, const int cgpui) : rank(ranki), ingfs(ingfsi), fngfs(fngfsi), lev(levi), cgpu(cgpui)
{
for (int i = 0; i < dim; i++)
X[i] = 0;
if (DIM != dim)
{
cout << "dimension is not consistent in Block construction" << endl;
MPI_Abort(MPI_COMM_WORLD, 1);
}
bool flag = false;
for (int i = 0; i < dim; i++)
{
shape[i] = shapei[i];
if (shape[i] <= 0)
flag = true;
bbox[i] = bboxi[i];
bbox[dim + i] = bboxi[dim + i];
}
int myrank;
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
if (flag)
{
cout << "myrank: " << myrank << ", on rank: " << rank << endl;
cout << "error shape in Block construction: (" << shape[0] << "," << shape[1] << "," << shape[2] << ")" << endl;
cout << "box boundary: (" << bbox[0] << ":" << bbox[3] << "," << bbox[1] << ":" << bbox[4] << "," << bbox[2] << ":" << bbox[5] << ")" << endl;
cout << "belong to level " << lev << endl;
MPI_Abort(MPI_COMM_WORLD, 1);
}
#ifndef FAKECHECK
if (myrank == rank)
{
for (int i = 0; i < dim; i++)
{
X[i] = new double[shape[i]];
#ifdef Vertex
#ifdef Cell
#error Both Cell and Vertex are defined
#endif
double h = (bbox[dim + i] - bbox[i]) / (shape[i] - 1);
for (int j = 0; j < shape[i]; j++)
X[i][j] = bbox[i] + j * h;
#else
#ifdef Cell
double h = (bbox[dim + i] - bbox[i]) / shape[i];
for (int j = 0; j < shape[i]; j++)
X[i][j] = bbox[i] + (j + 0.5) * h;
#else
#error Not define Vertex nor Cell
#endif
#endif
}
int nn = shape[0] * shape[1] * shape[2];
fgfs = new double *[fngfs];
for (int i = 0; i < fngfs; i++)
{
fgfs[i] = (double *)malloc(sizeof(double) * nn);
if (!(fgfs[i]))
{
cout << "on node#" << rank << ", out of memory when constructing Block." << endl;
MPI_Abort(MPI_COMM_WORLD, 1);
}
memset(fgfs[i], 0, sizeof(double) * nn);
}
igfs = new int *[ingfs];
for (int i = 0; i < ingfs; i++)
{
igfs[i] = (int *)malloc(sizeof(int) * nn);
if (!(igfs[i]))
{
cout << "on node#" << rank << ", out of memory when constructing Block." << endl;
MPI_Abort(MPI_COMM_WORLD, 1);
}
memset(igfs[i], 0, sizeof(int) * nn);
}
}
#endif
}
Block::~Block()
{
int myrank;
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
if (myrank == rank)
{
for (int i = 0; i < dim; i++)
delete[] X[i];
for (int i = 0; i < ingfs; i++)
free(igfs[i]);
delete[] igfs;
for (int i = 0; i < fngfs; i++)
free(fgfs[i]);
delete[] fgfs;
X[0] = X[1] = X[2] = 0;
igfs = 0;
fgfs = 0;
}
}
void Block::checkBlock()
{
int myrank;
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
if (myrank == 0)
{
cout << "belong to level " << lev << endl;
cout << "shape: [";
for (int i = 0; i < dim; i++)
{
cout << shape[i];
if (i < dim - 1)
cout << ",";
else
cout << "]";
}
cout << " resolution: [";
for (int i = 0; i < dim; i++)
{
cout << getdX(i);
if (i < dim - 1)
cout << ",";
else
cout << "]" << endl;
}
cout << "locate on node " << rank << ", at (includes ghost zone):" << endl;
cout << "(";
for (int i = 0; i < dim; i++)
{
cout << bbox[i] << ":" << bbox[dim + i];
if (i < dim - 1)
cout << ",";
else
cout << ")" << endl;
}
cout << "has " << ingfs << " int type grids functions," << fngfs << " double type grids functions" << endl;
}
}
double Block::getdX(int dir)
{
if (dir < 0 || dir >= dim)
{
cout << "Block::getdX: error input dir = " << dir << ", this Block has direction (0," << dim - 1 << ")" << endl;
MPI_Abort(MPI_COMM_WORLD, 1);
}
double h;
#ifdef Vertex
#ifdef Cell
#error Both Cell and Vertex are defined
#endif
if (shape[dir] == 1)
{
cout << "Block::getdX: for direction " << dir << ", this Block has only one point. Can not determine dX for vertex center grid." << endl;
MPI_Abort(MPI_COMM_WORLD, 1);
}
h = (bbox[dim + dir] - bbox[dir]) / (shape[dir] - 1);
#else
#ifdef Cell
h = (bbox[dim + dir] - bbox[dir]) / shape[dir];
#else
#error Not define Vertex nor Cell
#endif
#endif
return h;
}
void Block::swapList(MyList<var> *VarList1, MyList<var> *VarList2, int myrank)
{
if (rank == myrank)
{
MyList<var> *varl1 = VarList1, *varl2 = VarList2;
while (varl1 && varl2)
{
misc::swap<double *>(fgfs[varl1->data->sgfn], fgfs[varl2->data->sgfn]);
varl1 = varl1->next;
varl2 = varl2->next;
}
if (varl1 || varl2)
{
cout << "error in Block::swaplist, var lists does not match." << endl;
MPI_Abort(MPI_COMM_WORLD, 1);
}
}
}
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cmath>
#include <new>
using namespace std;
#include "Block.h"
#include "misc.h"
Block::Block(int DIM, int *shapei, double *bboxi, int ranki, int ingfsi, int fngfsi, int levi, const int cgpui) : rank(ranki), ingfs(ingfsi), fngfs(fngfsi), lev(levi), cgpu(cgpui)
{
for (int i = 0; i < dim; i++)
X[i] = 0;
if (DIM != dim)
{
cout << "dimension is not consistent in Block construction" << endl;
MPI_Abort(MPI_COMM_WORLD, 1);
}
bool flag = false;
for (int i = 0; i < dim; i++)
{
shape[i] = shapei[i];
if (shape[i] <= 0)
flag = true;
bbox[i] = bboxi[i];
bbox[dim + i] = bboxi[dim + i];
}
int myrank;
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
if (flag)
{
cout << "myrank: " << myrank << ", on rank: " << rank << endl;
cout << "error shape in Block construction: (" << shape[0] << "," << shape[1] << "," << shape[2] << ")" << endl;
cout << "box boundary: (" << bbox[0] << ":" << bbox[3] << "," << bbox[1] << ":" << bbox[4] << "," << bbox[2] << ":" << bbox[5] << ")" << endl;
cout << "belong to level " << lev << endl;
MPI_Abort(MPI_COMM_WORLD, 1);
}
#ifndef FAKECHECK
if (myrank == rank)
{
for (int i = 0; i < dim; i++)
{
X[i] = new double[shape[i]];
#ifdef Vertex
#ifdef Cell
#error Both Cell and Vertex are defined
#endif
double h = (bbox[dim + i] - bbox[i]) / (shape[i] - 1);
for (int j = 0; j < shape[i]; j++)
X[i][j] = bbox[i] + j * h;
#else
#ifdef Cell
double h = (bbox[dim + i] - bbox[i]) / shape[i];
for (int j = 0; j < shape[i]; j++)
X[i][j] = bbox[i] + (j + 0.5) * h;
#else
#error Not define Vertex nor Cell
#endif
#endif
}
int nn = shape[0] * shape[1] * shape[2];
fgfs = new double *[fngfs];
for (int i = 0; i < fngfs; i++)
{
fgfs[i] = (double *)malloc(sizeof(double) * nn);
if (!(fgfs[i]))
{
cout << "on node#" << rank << ", out of memory when constructing Block." << endl;
MPI_Abort(MPI_COMM_WORLD, 1);
}
memset(fgfs[i], 0, sizeof(double) * nn);
}
igfs = new int *[ingfs];
for (int i = 0; i < ingfs; i++)
{
igfs[i] = (int *)malloc(sizeof(int) * nn);
if (!(igfs[i]))
{
cout << "on node#" << rank << ", out of memory when constructing Block." << endl;
MPI_Abort(MPI_COMM_WORLD, 1);
}
memset(igfs[i], 0, sizeof(int) * nn);
}
}
#endif
}
Block::~Block()
{
int myrank;
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
if (myrank == rank)
{
for (int i = 0; i < dim; i++)
delete[] X[i];
for (int i = 0; i < ingfs; i++)
free(igfs[i]);
delete[] igfs;
for (int i = 0; i < fngfs; i++)
free(fgfs[i]);
delete[] fgfs;
X[0] = X[1] = X[2] = 0;
igfs = 0;
fgfs = 0;
}
}
void Block::checkBlock()
{
int myrank;
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
if (myrank == 0)
{
cout << "belong to level " << lev << endl;
cout << "shape: [";
for (int i = 0; i < dim; i++)
{
cout << shape[i];
if (i < dim - 1)
cout << ",";
else
cout << "]";
}
cout << " resolution: [";
for (int i = 0; i < dim; i++)
{
cout << getdX(i);
if (i < dim - 1)
cout << ",";
else
cout << "]" << endl;
}
cout << "locate on node " << rank << ", at (includes ghost zone):" << endl;
cout << "(";
for (int i = 0; i < dim; i++)
{
cout << bbox[i] << ":" << bbox[dim + i];
if (i < dim - 1)
cout << ",";
else
cout << ")" << endl;
}
cout << "has " << ingfs << " int type grids functions," << fngfs << " double type grids functions" << endl;
}
}
double Block::getdX(int dir)
{
if (dir < 0 || dir >= dim)
{
cout << "Block::getdX: error input dir = " << dir << ", this Block has direction (0," << dim - 1 << ")" << endl;
MPI_Abort(MPI_COMM_WORLD, 1);
}
double h;
#ifdef Vertex
#ifdef Cell
#error Both Cell and Vertex are defined
#endif
if (shape[dir] == 1)
{
cout << "Block::getdX: for direction " << dir << ", this Block has only one point. Can not determine dX for vertex center grid." << endl;
MPI_Abort(MPI_COMM_WORLD, 1);
}
h = (bbox[dim + dir] - bbox[dir]) / (shape[dir] - 1);
#else
#ifdef Cell
h = (bbox[dim + dir] - bbox[dir]) / shape[dir];
#else
#error Not define Vertex nor Cell
#endif
#endif
return h;
}
void Block::swapList(MyList<var> *VarList1, MyList<var> *VarList2, int myrank)
{
if (rank == myrank)
{
MyList<var> *varl1 = VarList1, *varl2 = VarList2;
while (varl1 && varl2)
{
misc::swap<double *>(fgfs[varl1->data->sgfn], fgfs[varl2->data->sgfn]);
varl1 = varl1->next;
varl2 = varl2->next;
}
if (varl1 || varl2)
{
cout << "error in Block::swaplist, var lists does not match." << endl;
MPI_Abort(MPI_COMM_WORLD, 1);
}
}
}

View File

@@ -1,34 +1,34 @@
#ifndef BLOCK_H
#define BLOCK_H
#include <mpi.h>
#include "macrodef.h" //need dim here; Vertex or Cell
#include "var.h"
#include "MyList.h"
class Block
{
public:
int shape[dim];
double bbox[2 * dim];
double *X[dim];
int rank; // where the real data locate in
int lev, cgpu;
int ingfs, fngfs;
int *(*igfs);
double *(*fgfs);
public:
Block() {};
Block(int DIM, int *shapei, double *bboxi, int ranki, int ingfsi, int fngfs, int levi, const int cgpui = 0);
~Block();
void checkBlock();
double getdX(int dir);
void swapList(MyList<var> *VarList1, MyList<var> *VarList2, int myrank);
};
#endif /* BLOCK_H */
#ifndef BLOCK_H
#define BLOCK_H
#include <mpi.h>
#include "macrodef.h" //need dim here; Vertex or Cell
#include "var.h"
#include "MyList.h"
class Block
{
public:
int shape[dim];
double bbox[2 * dim];
double *X[dim];
int rank; // where the real data locate in
int lev, cgpu;
int ingfs, fngfs;
int *(*igfs);
double *(*fgfs);
public:
Block() {};
Block(int DIM, int *shapei, double *bboxi, int ranki, int ingfsi, int fngfs, int levi, const int cgpui = 0);
~Block();
void checkBlock();
double getdX(int dir);
void swapList(MyList<var> *VarList1, MyList<var> *VarList2, int myrank);
};
#endif /* BLOCK_H */

View File

@@ -1,283 +1,283 @@
//-----------------------------------------------------------------------
// Read binary files and do fancy things with them...
//-----------------------------------------------------------------------
#ifdef newc
#include <cmath>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <fstream>
using namespace std;
#else
#include <math.h>
#include <iostream.h>
#include <iomanip.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fstream.h>
#endif
#include "microdef.fh"
int main(int argc, char *argv[])
{
//
// USE: DataCT flag file1 [ file2 ]
//
// where: - flag can be XY,XZ,YZ
//
void set_fname(char *fname);
if (argc < 3)
{
cout << "\aUsage: DataCT flag binaryfile1 [ binaryfile2 ] \n "
<< " where: - flag can be XY,XZ,YZ"
<< endl;
exit(1);
}
ifstream infile1;
infile1.open(argv[2]);
if (!infile1)
{
cerr << "\a Can't open " << argv[2] << " for input." << endl;
exit(1);
}
/* read properties of the binary file */
double time;
int nx, ny, nz;
double xmin, xmax, ymin, ymax, zmin, zmax;
infile1.seekg(0, ios::beg);
infile1.read((char *)&time, sizeof(double));
infile1.read((char *)&nx, sizeof(int));
infile1.read((char *)&ny, sizeof(int));
infile1.read((char *)&nz, sizeof(int));
infile1.read((char *)&xmin, sizeof(double));
infile1.read((char *)&xmax, sizeof(double));
infile1.read((char *)&ymin, sizeof(double));
infile1.read((char *)&ymax, sizeof(double));
infile1.read((char *)&zmin, sizeof(double));
infile1.read((char *)&zmax, sizeof(double));
/* get rid of any 4 character suffix */
set_fname(argv[2]);
/* sanity check */
if (nx != ny || nx != nz)
{
cout << "\n"
<< endl;
cout << " nx, ny and nz do not agree! Using a symmetry?... ";
cout << "\n"
<< endl;
}
cout << "\n Reading file : " << argv[2] << endl;
cout << "\n Time : " << time << endl;
cout << " Dimensions : " << setw(16) << nx << setw(16) << ny << setw(16) << nz << endl;
cout << " xmin, xmax : " << setw(16) << xmin << setw(16) << xmax << endl;
cout << " ymin, ymax : " << setw(16) << ymin << setw(16) << ymax << endl;
cout << " zmin, zmax : " << setw(16) << zmin << setw(16) << zmax << endl;
cout << "\n";
double *data;
data = new double[nx * ny * nz];
int i = 0, j = 0, k = 0;
infile1.read((char *)data, nx * ny * nz * sizeof(double));
infile1.close();
//
//
// if second file given, open second file and subtract from first one!
//
//
if (argc == 4)
{
infile1.open(argv[3]);
if (!infile1)
{
cerr << "\a Can't open " << argv[3] << " for input." << endl;
exit(1);
}
double *indata;
indata = new double[nx * ny * nz];
// read in header
infile1.seekg(0, ios::beg);
int nxin, nyin, nzin;
infile1.read((char *)&time, sizeof(double));
infile1.read((char *)&nxin, sizeof(int));
infile1.read((char *)&nyin, sizeof(int));
infile1.read((char *)&nzin, sizeof(int));
infile1.read((char *)&xmin, sizeof(double));
infile1.read((char *)&xmax, sizeof(double));
infile1.read((char *)&ymin, sizeof(double));
infile1.read((char *)&ymax, sizeof(double));
infile1.read((char *)&zmin, sizeof(double));
infile1.read((char *)&zmax, sizeof(double));
if (nxin != nx || nyin != ny || nzin != nz)
{
cerr << "\a Number of indices do not agree! " << endl;
exit(1);
}
cout << " Comparing with data at time " << time << "\n"
<< endl;
infile1.read((char *)indata, nx * ny * nz * sizeof(double));
infile1.close();
for (i = 0; i < nx * ny * nz; i++)
data[i] -= indata[i];
}
double *X, *Y, *Z;
X = new double[nx];
Y = new double[ny];
Z = new double[nz];
double dd;
#ifdef Vertex
#ifdef Cell
#error Both Cell and Vertex are defined
#endif
dd = (xmax - xmin) / (nx - 1);
for (i = 0; i < nx; i++)
X[i] = xmin + i * dd;
dd = (ymax - ymin) / (ny - 1);
for (j = 0; j < ny; j++)
Y[j] = ymin + j * dd;
dd = (zmax - zmin) / (nz - 1);
for (k = 0; k < nz; k++)
Z[k] = zmin + k * dd;
#else
#ifdef Cell
dd = (xmax - xmin) / nx;
for (i = 0; i < nx; i++)
X[i] = xmin + (i + 0.5) * dd;
dd = (ymax - ymin) / ny;
for (j = 0; j < ny; j++)
Y[j] = ymin + (j + 0.5) * dd;
dd = (zmax - zmin) / nz;
for (k = 0; k < nz; k++)
Z[k] = zmin + (k + 0.5) * dd;
#else
#error Not define Vertex nor Cell
#endif
#endif
int ext[3];
ext[0] = nx;
ext[1] = ny;
ext[2] = nz;
void writefile(int *ext, double *XX, double *YY, double *ZZ, double *datain,
char *filename, const char *flag);
writefile(ext, X, Y, Z, data, argv[2], argv[1]);
delete[] data;
delete[] X;
delete[] Y;
delete[] Z;
}
/*-----------------------------------*/
/* get rid of any 4 character suffix */
/*-----------------------------------*/
void set_fname(char *fname)
{
int len = strlen(fname) - 4;
char *n_fname;
n_fname = new char[len];
for (int i = 0; i < len; ++i)
{
n_fname[i] = fname[i];
// cout << n_fname[i] << " " << i << endl;
}
n_fname[len] = '\0';
// cout << "n_fname: " << n_fname << " fname: " << fname << ", "
// << len << endl;
strcpy(fname, n_fname); /* Send back the old pointer */
delete n_fname;
}
//|----------------------------------------------------------------------------
// writefile
//|----------------------------------------------------------------------------
void writefile(int *ext, double *XX, double *YY, double *ZZ, double *datain,
char *filename, const char *flag)
{
int nx = ext[0], ny = ext[1], nz = ext[2];
int i, j, k;
char filename_h[50];
//|--->open out put file
ofstream outfile;
if (!strcmp(flag, "YZ"))
{
for (i = 0; i < nx; i++)
{
sprintf(filename_h, "%s_%d.dat", filename, i);
outfile.open(filename_h);
outfile << "# CT along X at " << i << endl;
for (k = 0; k < nz; k++)
{
for (j = 0; j < ny; j++)
{
outfile << setw(10) << setprecision(10) << YY[j] << " "
<< setw(10) << setprecision(10) << ZZ[k] << " "
<< datain[i + j * nx + k * nx * ny] << " "
<< endl;
}
outfile << "\n"; /* blanck line for gnuplot */
}
outfile.close();
}
}
else if (!strcmp(flag, "XZ"))
{
for (j = 0; j < ny; j++)
{
sprintf(filename_h, "%s_%d.dat", filename, j);
outfile.open(filename_h);
outfile << "# CT along Y at " << j << endl;
for (k = 0; k < nz; k++)
{
for (i = 0; i < nx; i++)
{
outfile << setw(10) << setprecision(10) << XX[i] << " "
<< setw(10) << setprecision(10) << ZZ[k] << " "
<< datain[i + j * nx + k * nx * ny] << " "
<< endl;
}
outfile << "\n"; /* blanck line for gnuplot */
}
outfile.close();
}
}
else if (!strcmp(flag, "XY"))
{
for (k = 0; k < nz; k++)
{
sprintf(filename_h, "%s_%d.dat", filename, k);
outfile.open(filename_h);
outfile << "# CT along Z at " << k << endl;
for (j = 0; j < ny; j++)
{
for (i = 0; i < nx; i++)
{
outfile << setw(10) << setprecision(10) << XX[i] << " "
<< setw(10) << setprecision(10) << YY[j] << " "
<< datain[i + j * nx + k * nx * ny] << " "
<< endl;
}
outfile << "\n"; /* blanck line for gnuplot */
}
outfile.close();
}
}
else
{
cout << "In output_data: not recognized flag-->" << flag << endl;
exit(0);
}
}
//-----------------------------------------------------------------------
// Read binary files and do fancy things with them...
//-----------------------------------------------------------------------
#ifdef newc
#include <cmath>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <fstream>
using namespace std;
#else
#include <math.h>
#include <iostream.h>
#include <iomanip.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fstream.h>
#endif
#include "microdef.fh"
int main(int argc, char *argv[])
{
//
// USE: DataCT flag file1 [ file2 ]
//
// where: - flag can be XY,XZ,YZ
//
void set_fname(char *fname);
if (argc < 3)
{
cout << "\aUsage: DataCT flag binaryfile1 [ binaryfile2 ] \n "
<< " where: - flag can be XY,XZ,YZ"
<< endl;
exit(1);
}
ifstream infile1;
infile1.open(argv[2]);
if (!infile1)
{
cerr << "\a Can't open " << argv[2] << " for input." << endl;
exit(1);
}
/* read properties of the binary file */
double time;
int nx, ny, nz;
double xmin, xmax, ymin, ymax, zmin, zmax;
infile1.seekg(0, ios::beg);
infile1.read((char *)&time, sizeof(double));
infile1.read((char *)&nx, sizeof(int));
infile1.read((char *)&ny, sizeof(int));
infile1.read((char *)&nz, sizeof(int));
infile1.read((char *)&xmin, sizeof(double));
infile1.read((char *)&xmax, sizeof(double));
infile1.read((char *)&ymin, sizeof(double));
infile1.read((char *)&ymax, sizeof(double));
infile1.read((char *)&zmin, sizeof(double));
infile1.read((char *)&zmax, sizeof(double));
/* get rid of any 4 character suffix */
set_fname(argv[2]);
/* sanity check */
if (nx != ny || nx != nz)
{
cout << "\n"
<< endl;
cout << " nx, ny and nz do not agree! Using a symmetry?... ";
cout << "\n"
<< endl;
}
cout << "\n Reading file : " << argv[2] << endl;
cout << "\n Time : " << time << endl;
cout << " Dimensions : " << setw(16) << nx << setw(16) << ny << setw(16) << nz << endl;
cout << " xmin, xmax : " << setw(16) << xmin << setw(16) << xmax << endl;
cout << " ymin, ymax : " << setw(16) << ymin << setw(16) << ymax << endl;
cout << " zmin, zmax : " << setw(16) << zmin << setw(16) << zmax << endl;
cout << "\n";
double *data;
data = new double[nx * ny * nz];
int i = 0, j = 0, k = 0;
infile1.read((char *)data, nx * ny * nz * sizeof(double));
infile1.close();
//
//
// if second file given, open second file and subtract from first one!
//
//
if (argc == 4)
{
infile1.open(argv[3]);
if (!infile1)
{
cerr << "\a Can't open " << argv[3] << " for input." << endl;
exit(1);
}
double *indata;
indata = new double[nx * ny * nz];
// read in header
infile1.seekg(0, ios::beg);
int nxin, nyin, nzin;
infile1.read((char *)&time, sizeof(double));
infile1.read((char *)&nxin, sizeof(int));
infile1.read((char *)&nyin, sizeof(int));
infile1.read((char *)&nzin, sizeof(int));
infile1.read((char *)&xmin, sizeof(double));
infile1.read((char *)&xmax, sizeof(double));
infile1.read((char *)&ymin, sizeof(double));
infile1.read((char *)&ymax, sizeof(double));
infile1.read((char *)&zmin, sizeof(double));
infile1.read((char *)&zmax, sizeof(double));
if (nxin != nx || nyin != ny || nzin != nz)
{
cerr << "\a Number of indices do not agree! " << endl;
exit(1);
}
cout << " Comparing with data at time " << time << "\n"
<< endl;
infile1.read((char *)indata, nx * ny * nz * sizeof(double));
infile1.close();
for (i = 0; i < nx * ny * nz; i++)
data[i] -= indata[i];
}
double *X, *Y, *Z;
X = new double[nx];
Y = new double[ny];
Z = new double[nz];
double dd;
#ifdef Vertex
#ifdef Cell
#error Both Cell and Vertex are defined
#endif
dd = (xmax - xmin) / (nx - 1);
for (i = 0; i < nx; i++)
X[i] = xmin + i * dd;
dd = (ymax - ymin) / (ny - 1);
for (j = 0; j < ny; j++)
Y[j] = ymin + j * dd;
dd = (zmax - zmin) / (nz - 1);
for (k = 0; k < nz; k++)
Z[k] = zmin + k * dd;
#else
#ifdef Cell
dd = (xmax - xmin) / nx;
for (i = 0; i < nx; i++)
X[i] = xmin + (i + 0.5) * dd;
dd = (ymax - ymin) / ny;
for (j = 0; j < ny; j++)
Y[j] = ymin + (j + 0.5) * dd;
dd = (zmax - zmin) / nz;
for (k = 0; k < nz; k++)
Z[k] = zmin + (k + 0.5) * dd;
#else
#error Not define Vertex nor Cell
#endif
#endif
int ext[3];
ext[0] = nx;
ext[1] = ny;
ext[2] = nz;
void writefile(int *ext, double *XX, double *YY, double *ZZ, double *datain,
char *filename, const char *flag);
writefile(ext, X, Y, Z, data, argv[2], argv[1]);
delete[] data;
delete[] X;
delete[] Y;
delete[] Z;
}
/*-----------------------------------*/
/* get rid of any 4 character suffix */
/*-----------------------------------*/
void set_fname(char *fname)
{
int len = strlen(fname) - 4;
char *n_fname;
n_fname = new char[len];
for (int i = 0; i < len; ++i)
{
n_fname[i] = fname[i];
// cout << n_fname[i] << " " << i << endl;
}
n_fname[len] = '\0';
// cout << "n_fname: " << n_fname << " fname: " << fname << ", "
// << len << endl;
strcpy(fname, n_fname); /* Send back the old pointer */
delete n_fname;
}
//|----------------------------------------------------------------------------
// writefile
//|----------------------------------------------------------------------------
void writefile(int *ext, double *XX, double *YY, double *ZZ, double *datain,
char *filename, const char *flag)
{
int nx = ext[0], ny = ext[1], nz = ext[2];
int i, j, k;
char filename_h[50];
//|--->open out put file
ofstream outfile;
if (!strcmp(flag, "YZ"))
{
for (i = 0; i < nx; i++)
{
sprintf(filename_h, "%s_%d.dat", filename, i);
outfile.open(filename_h);
outfile << "# CT along X at " << i << endl;
for (k = 0; k < nz; k++)
{
for (j = 0; j < ny; j++)
{
outfile << setw(10) << setprecision(10) << YY[j] << " "
<< setw(10) << setprecision(10) << ZZ[k] << " "
<< datain[i + j * nx + k * nx * ny] << " "
<< endl;
}
outfile << "\n"; /* blanck line for gnuplot */
}
outfile.close();
}
}
else if (!strcmp(flag, "XZ"))
{
for (j = 0; j < ny; j++)
{
sprintf(filename_h, "%s_%d.dat", filename, j);
outfile.open(filename_h);
outfile << "# CT along Y at " << j << endl;
for (k = 0; k < nz; k++)
{
for (i = 0; i < nx; i++)
{
outfile << setw(10) << setprecision(10) << XX[i] << " "
<< setw(10) << setprecision(10) << ZZ[k] << " "
<< datain[i + j * nx + k * nx * ny] << " "
<< endl;
}
outfile << "\n"; /* blanck line for gnuplot */
}
outfile.close();
}
}
else if (!strcmp(flag, "XY"))
{
for (k = 0; k < nz; k++)
{
sprintf(filename_h, "%s_%d.dat", filename, k);
outfile.open(filename_h);
outfile << "# CT along Z at " << k << endl;
for (j = 0; j < ny; j++)
{
for (i = 0; i < nx; i++)
{
outfile << setw(10) << setprecision(10) << XX[i] << " "
<< setw(10) << setprecision(10) << YY[j] << " "
<< datain[i + j * nx + k * nx * ny] << " "
<< endl;
}
outfile << "\n"; /* blanck line for gnuplot */
}
outfile.close();
}
}
else
{
cout << "In output_data: not recognized flag-->" << flag << endl;
exit(0);
}
}

View File

@@ -1,87 +1,87 @@
#if 0
program checkFFT
use dfport
implicit none
double precision::x
integer,parameter::N=256
double precision,dimension(N*2)::p
double precision,dimension(N/2)::s
integer::ncount,j,idum
character(len=8)::tt
tt=clock()
idum=iachar(tt(8:8))-48
p=0.0
open(77,file='prime.dat',status='unknown')
loop1:do ncount=1,N
x=ran(idum)
p(2*ncount-1)=x
write(77,'(f15.3)')x
enddo loop1
close(77)
call four1(p,N,1)
do j=1,N/2
s(j)=p(2*j)*p(2*j)+p(2*j-1)*p(2*j-1)
enddo
x=0.0
do j=1,N/2
x=x+s(j)
enddo
s=s/x
open(77,file='power.dat',status='unknown')
do j=1,N/2
write(77,'(2(1x,f15.3))')dble(j-1)/dble(N),s(j)
enddo
close(77)
end program checkFFT
#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)
use MKL_DFTI
implicit none
INTEGER, intent(in) :: isign, nn
DOUBLE PRECISION, dimension(2*nn), intent(inout) :: dataa
type(DFTI_DESCRIPTOR), pointer :: desc
integer :: status
! Create DFTI descriptor for 1D complex-to-complex transform
status = DftiCreateDescriptor(desc, DFTI_DOUBLE, DFTI_COMPLEX, 1, nn)
if (status /= 0) return
! Set input/output storage as interleaved complex (default)
status = DftiSetValue(desc, DFTI_PLACEMENT, DFTI_INPLACE)
if (status /= 0) then
status = DftiFreeDescriptor(desc)
return
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
END SUBROUTINE four1
#if 0
program checkFFT
use dfport
implicit none
double precision::x
integer,parameter::N=256
double precision,dimension(N*2)::p
double precision,dimension(N/2)::s
integer::ncount,j,idum
character(len=8)::tt
tt=clock()
idum=iachar(tt(8:8))-48
p=0.0
open(77,file='prime.dat',status='unknown')
loop1:do ncount=1,N
x=ran(idum)
p(2*ncount-1)=x
write(77,'(f15.3)')x
enddo loop1
close(77)
call four1(p,N,1)
do j=1,N/2
s(j)=p(2*j)*p(2*j)+p(2*j-1)*p(2*j-1)
enddo
x=0.0
do j=1,N/2
x=x+s(j)
enddo
s=s/x
open(77,file='power.dat',status='unknown')
do j=1,N/2
write(77,'(2(1x,f15.3))')dble(j-1)/dble(N),s(j)
enddo
close(77)
end program checkFFT
#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)
use MKL_DFTI
implicit none
INTEGER, intent(in) :: isign, nn
DOUBLE PRECISION, dimension(2*nn), intent(inout) :: dataa
type(DFTI_DESCRIPTOR), pointer :: desc
integer :: status
! Create DFTI descriptor for 1D complex-to-complex transform
status = DftiCreateDescriptor(desc, DFTI_DOUBLE, DFTI_COMPLEX, 1, nn)
if (status /= 0) return
! Set input/output storage as interleaved complex (default)
status = DftiSetValue(desc, DFTI_PLACEMENT, DFTI_INPLACE)
if (status /= 0) then
status = DftiFreeDescriptor(desc)
return
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
END SUBROUTINE four1

View File

@@ -1,97 +1,97 @@
//$Id: IntPnts.C,v 1.1 2012/04/03 10:49:42 zjcao Exp $
#include "macrodef.h"
#ifdef With_AHF
#include <math.h>
#include <stdio.h>
#include <iostream>
using namespace std;
#include "myglobal.h"
namespace AHFinderDirect
{
extern struct state state;
int globalInterpGFL(double *X, double *Y, double *Z, int Ns,
double *Data)
{
if (Ns == 0)
return 0;
int n;
double *pox[3];
for (int i = 0; i < 3; i++)
pox[i] = new double[Ns];
for (n = 0; n < Ns; n++)
{
pox[0][n] = X[n];
pox[1][n] = Y[n];
pox[2][n] = Z[n];
}
const int InList = 35;
double *datap;
datap = new double[Ns * InList];
if (!(state.ADM->AH_Interp_Points(state.AHList, Ns, pox, datap, state.Symmetry)))
return 0;
// reform data
for (int pnt = 0; pnt < Ns; pnt++)
for (int ii = 0; ii < InList; ii++)
{
if (ii == 0 || ii == 12 || ii == 20)
Data[pnt + ii * Ns] = datap[ii + pnt * InList] + 1;
else if (ii == 24) // from chi-1 to psi
Data[pnt + ii * Ns] = pow(datap[ii + pnt * InList] + 1, -0.25);
else if (ii == 25 || ii == 26 || ii == 27) // from chi,i to psi,i
Data[pnt + ii * Ns] = -pow(datap[24 + pnt * InList] + 1, -1.25) / 4 * datap[ii + pnt * InList];
else
Data[pnt + ii * Ns] = datap[ii + pnt * InList];
}
delete[] datap;
delete[] pox[0];
delete[] pox[1];
delete[] pox[2];
return 1;
}
// inerpolate lapse and shift
int globalInterpGFLlash(double *X, double *Y, double *Z, int Ns,
double *Data)
{
if (Ns == 0)
return 0;
int n;
double *pox[3];
for (int i = 0; i < 3; i++)
pox[i] = new double[Ns];
for (n = 0; n < Ns; n++)
{
pox[0][n] = X[n];
pox[1][n] = Y[n];
pox[2][n] = Z[n];
}
double SYM = 1.0, ANT = -1.0;
const int InList = 4;
double *datap;
datap = new double[Ns * InList];
state.ADM->AH_Interp_Points(state.GaugeList, Ns, pox, datap, state.Symmetry);
// reform data
for (int pnt = 0; pnt < Ns; pnt++)
for (int ii = 0; ii < InList; ii++)
Data[pnt + ii * Ns] = datap[ii + pnt * InList];
delete[] datap;
delete[] pox[0];
delete[] pox[1];
delete[] pox[2];
return 1;
}
} // namespace AHFinderDirect
#endif
//$Id: IntPnts.C,v 1.1 2012/04/03 10:49:42 zjcao Exp $
#include "macrodef.h"
#ifdef With_AHF
#include <math.h>
#include <stdio.h>
#include <iostream>
using namespace std;
#include "myglobal.h"
namespace AHFinderDirect
{
extern struct state state;
int globalInterpGFL(double *X, double *Y, double *Z, int Ns,
double *Data)
{
if (Ns == 0)
return 0;
int n;
double *pox[3];
for (int i = 0; i < 3; i++)
pox[i] = new double[Ns];
for (n = 0; n < Ns; n++)
{
pox[0][n] = X[n];
pox[1][n] = Y[n];
pox[2][n] = Z[n];
}
const int InList = 35;
double *datap;
datap = new double[Ns * InList];
if (!(state.ADM->AH_Interp_Points(state.AHList, Ns, pox, datap, state.Symmetry)))
return 0;
// reform data
for (int pnt = 0; pnt < Ns; pnt++)
for (int ii = 0; ii < InList; ii++)
{
if (ii == 0 || ii == 12 || ii == 20)
Data[pnt + ii * Ns] = datap[ii + pnt * InList] + 1;
else if (ii == 24) // from chi-1 to psi
Data[pnt + ii * Ns] = pow(datap[ii + pnt * InList] + 1, -0.25);
else if (ii == 25 || ii == 26 || ii == 27) // from chi,i to psi,i
Data[pnt + ii * Ns] = -pow(datap[24 + pnt * InList] + 1, -1.25) / 4 * datap[ii + pnt * InList];
else
Data[pnt + ii * Ns] = datap[ii + pnt * InList];
}
delete[] datap;
delete[] pox[0];
delete[] pox[1];
delete[] pox[2];
return 1;
}
// inerpolate lapse and shift
int globalInterpGFLlash(double *X, double *Y, double *Z, int Ns,
double *Data)
{
if (Ns == 0)
return 0;
int n;
double *pox[3];
for (int i = 0; i < 3; i++)
pox[i] = new double[Ns];
for (n = 0; n < Ns; n++)
{
pox[0][n] = X[n];
pox[1][n] = Y[n];
pox[2][n] = Z[n];
}
double SYM = 1.0, ANT = -1.0;
const int InList = 4;
double *datap;
datap = new double[Ns * InList];
state.ADM->AH_Interp_Points(state.GaugeList, Ns, pox, datap, state.Symmetry);
// reform data
for (int pnt = 0; pnt < Ns; pnt++)
for (int ii = 0; ii < InList; ii++)
Data[pnt + ii * Ns] = datap[ii + pnt * InList];
delete[] datap;
delete[] pox[0];
delete[] pox[1];
delete[] pox[2];
return 1;
}
} // namespace AHFinderDirect
#endif

View File

@@ -1,43 +1,43 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <mpi.h>
#include "myglobal.h"
int CCTK_VInfo(const char *thorn, const char *format, ...)
{
int myrank;
MPI_Comm_rank(MPI_COMM_WORLD,&myrank);
if (myrank !=0) return 0;
va_list ap;
va_start (ap, format);
fprintf (stdout, "INFO (%s): ", thorn);
vfprintf (stdout, format, ap);
fprintf (stdout, "\n");
va_end (ap);
return 0;
}
int CCTK_VWarn (int level,
int line,
const char *file,
const char *thorn,
const char *format,
...)
{
int myrank;
MPI_Comm_rank(MPI_COMM_WORLD,&myrank);
if (myrank !=0) return 0;
va_list ap;
va_start (ap, format);
fprintf (stdout, "WARN (%s): ", thorn);
vfprintf (stdout, format, ap);
fprintf (stdout, "\n");
va_end (ap);
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <mpi.h>
#include "myglobal.h"
int CCTK_VInfo(const char *thorn, const char *format, ...)
{
int myrank;
MPI_Comm_rank(MPI_COMM_WORLD,&myrank);
if (myrank !=0) return 0;
va_list ap;
va_start (ap, format);
fprintf (stdout, "INFO (%s): ", thorn);
vfprintf (stdout, format, ap);
fprintf (stdout, "\n");
va_end (ap);
return 0;
}
int CCTK_VWarn (int level,
int line,
const char *file,
const char *thorn,
const char *format,
...)
{
int myrank;
MPI_Comm_rank(MPI_COMM_WORLD,&myrank);
if (myrank !=0) return 0;
va_list ap;
va_start (ap, format);
fprintf (stdout, "WARN (%s): ", thorn);
vfprintf (stdout, format, ap);
fprintf (stdout, "\n");
va_end (ap);
return 0;
}

View File

@@ -1,270 +1,270 @@
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <math.h>
#include <string.h>
#include "util_Table.h"
#include "cctk.h"
#include "config.h"
#include "stdc.h"
#include "util.h"
#include "array.h"
#include "cpm_map.h"
#include "linear_map.h"
#include "coords.h"
#include "tgrid.h"
#include "fd_grid.h"
#include "patch.h"
#include "patch_edge.h"
#include "patch_interp.h"
#include "ghost_zone.h"
#include "patch_system.h"
#include "Jacobian.h"
#include "ilucg.h"
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
// this represents a single element stored in the matrix for
// sort_row_into_column_order() and sort_row_into_column_order__cmp()
struct matrix_element
{
int JA;
fp A;
};
Jacobian::Jacobian(patch_system &ps)
: ps_(ps),
N_rows_(ps.N_grid_points()),
N_nonzeros_(0), current_N_rows_(0), N_nonzeros_allocated_(0),
IA_(new integer[N_rows_ + 1]), JA_(NULL), A_(NULL),
itemp_(NULL), rtemp_(NULL)
{
IO_ = 1;
zero_matrix();
}
Jacobian::~Jacobian()
{
if (A_)
delete[] A_;
if (JA_)
delete[] JA_;
if (IA_)
delete[] IA_;
if (rtemp_)
delete[] rtemp_;
if (itemp_)
delete[] itemp_;
}
double Jacobian::element(int II, int JJ)
const
{
const int posn = find_element(II, JJ);
return (posn >= 0) ? A_[posn] : 0.0;
}
void Jacobian::zero_matrix()
{
N_nonzeros_ = 0;
current_N_rows_ = 0;
IA_[0] = IO_;
}
void Jacobian::set_element(int II, int JJ, fp value)
{
const int posn = find_element(II, JJ);
if (posn >= 0)
then A_[posn] = value;
else
insert_element(II, JJ, value);
}
void Jacobian::sum_into_element(int II, int JJ, fp value)
{
const int posn = find_element(II, JJ);
if (posn >= 0)
then A_[posn] += value;
else
insert_element(II, JJ, value);
}
int Jacobian::find_element(int II, int JJ)
const
{
if (II >= current_N_rows_)
then return -1; // this row not defined yet
const int start = IA_[II] - IO_;
const int stop = IA_[II + 1] - IO_;
for (int posn = start; posn < stop; ++posn)
{
if (JA_[posn] - IO_ == JJ)
then return posn; // found
}
return -1; // not found
}
int Jacobian::insert_element(int II, int JJ, double value)
{
if (!((II == current_N_rows_ - 1) || (II == current_N_rows_)))
{
printf(
"***** row_sparse_Jacobian::insert_element(II=%d, JJ=%d, value=%g):\n"
" attempt to insert element elsewhere than {last row, last row+1}!\n"
" N_rows_=%d current_N_rows_=%d IO_=%d\n"
" N_nonzeros_=%d N_nonzeros_allocated_=%d\n",
II, JJ, double(value),
N_rows_, current_N_rows_, IO_,
N_nonzeros_, N_nonzeros_allocated_);
abort();
}
// start a new row if necessary
if (II == current_N_rows_)
then
{
assert(current_N_rows_ < N_rows_);
IA_[current_N_rows_ + 1] = IA_[current_N_rows_];
++current_N_rows_;
}
// insert into current row
assert(II == current_N_rows_ - 1);
if (IA_[II + 1] - IO_ >= N_nonzeros_allocated_)
then grow_arrays();
const int posn = IA_[II + 1] - IO_;
assert(posn < N_nonzeros_allocated_);
JA_[posn] = JJ + IO_;
A_[posn] = value;
++IA_[II + 1];
++N_nonzeros_;
return posn;
}
void Jacobian::grow_arrays()
{
N_nonzeros_allocated_ += base_growth_amount + (N_nonzeros_allocated_ >> 1);
int *const new_JA = new int[N_nonzeros_allocated_];
double *const new_A = new double[N_nonzeros_allocated_];
for (int posn = 0; posn < N_nonzeros_; ++posn)
{
new_JA[posn] = JA_[posn];
new_A[posn] = A_[posn];
}
delete[] A_;
delete[] JA_;
JA_ = new_JA;
A_ = new_A;
}
int compare_matrix_elements(const void *x, const void *y)
{
const struct matrix_element *const px = static_cast<const struct matrix_element *>(x);
const struct matrix_element *const py = static_cast<const struct matrix_element *>(y);
return px->JA - py->JA;
}
void Jacobian::sort_each_row_into_column_order()
{
// buffer must be big enough to hold the largest row
int max_N_in_row = 0;
{
for (int II = 0; II < N_rows_; ++II)
{
max_N_in_row = max(max_N_in_row, IA_[II + 1] - IA_[II]);
}
}
// contiguous buffer for sorting
struct matrix_element *const buffer = new struct matrix_element[max_N_in_row];
{
for (int II = 0; II < N_rows_; ++II)
{
const int N_in_row = IA_[II + 1] - IA_[II];
// copy this row's JA_[] and A_[] values to the buffer
const int start = IA_[II] - IO_;
for (int p = 0; p < N_in_row; ++p)
{
const int posn = start + p;
buffer[p].JA = JA_[posn];
buffer[p].A = A_[posn];
}
// sort the buffer
qsort(static_cast<void *>(buffer), N_in_row, sizeof(buffer[0]),
&compare_matrix_elements);
// copy the buffer values back to this row's JA_[] and A_[]
for (int p = 0; p < N_in_row; ++p)
{
const int posn = start + p;
JA_[posn] = buffer[p].JA;
A_[posn] = buffer[p].A;
}
}
}
delete[] buffer;
}
double Jacobian::solve_linear_system(int rhs_gfn, int x_gfn, bool print_msg_flag)
{
assert(IO_ == Fortran_index_origin);
assert(current_N_rows_ == N_rows_);
if (itemp_ == NULL)
then
{
itemp_ = new int[3 * N_rows_ + 3 * N_nonzeros_ + 2];
rtemp_ = new double[4 * N_rows_ + N_nonzeros_];
}
// initial guess = all zeros
double *x = ps_.gridfn_data(x_gfn);
for (int II = 0; II < N_rows_; ++II)
{
x[II] = 0.0;
}
const int N = N_rows_;
const double *rhs = ps_.gridfn_data(rhs_gfn);
const double eps = 1e-10;
const int max_iterations = N_rows_;
int istatus;
// the actual linear solution
f_ilucg(N,
IA_, JA_, A_,
rhs, x,
itemp_, rtemp_,
eps, max_iterations,
istatus);
if (istatus < 0)
{
printf(
"***** row_sparse_Jacobian__ILUCG::solve_linear_system(rhs_gfn=%d, x_gfn=%d):\n"
" error return from [sd]ilucg() routine!\n"
" istatus=%d < 0 ==> bad matrix structure, eg. zero diagonal element!\n",
rhs_gfn, x_gfn,
int(istatus));
abort();
}
return -1.0;
}
} // namespace AHFinderDirect
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <math.h>
#include <string.h>
#include "util_Table.h"
#include "cctk.h"
#include "config.h"
#include "stdc.h"
#include "util.h"
#include "array.h"
#include "cpm_map.h"
#include "linear_map.h"
#include "coords.h"
#include "tgrid.h"
#include "fd_grid.h"
#include "patch.h"
#include "patch_edge.h"
#include "patch_interp.h"
#include "ghost_zone.h"
#include "patch_system.h"
#include "Jacobian.h"
#include "ilucg.h"
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
// this represents a single element stored in the matrix for
// sort_row_into_column_order() and sort_row_into_column_order__cmp()
struct matrix_element
{
int JA;
fp A;
};
Jacobian::Jacobian(patch_system &ps)
: ps_(ps),
N_rows_(ps.N_grid_points()),
N_nonzeros_(0), current_N_rows_(0), N_nonzeros_allocated_(0),
IA_(new integer[N_rows_ + 1]), JA_(NULL), A_(NULL),
itemp_(NULL), rtemp_(NULL)
{
IO_ = 1;
zero_matrix();
}
Jacobian::~Jacobian()
{
if (A_)
delete[] A_;
if (JA_)
delete[] JA_;
if (IA_)
delete[] IA_;
if (rtemp_)
delete[] rtemp_;
if (itemp_)
delete[] itemp_;
}
double Jacobian::element(int II, int JJ)
const
{
const int posn = find_element(II, JJ);
return (posn >= 0) ? A_[posn] : 0.0;
}
void Jacobian::zero_matrix()
{
N_nonzeros_ = 0;
current_N_rows_ = 0;
IA_[0] = IO_;
}
void Jacobian::set_element(int II, int JJ, fp value)
{
const int posn = find_element(II, JJ);
if (posn >= 0)
then A_[posn] = value;
else
insert_element(II, JJ, value);
}
void Jacobian::sum_into_element(int II, int JJ, fp value)
{
const int posn = find_element(II, JJ);
if (posn >= 0)
then A_[posn] += value;
else
insert_element(II, JJ, value);
}
int Jacobian::find_element(int II, int JJ)
const
{
if (II >= current_N_rows_)
then return -1; // this row not defined yet
const int start = IA_[II] - IO_;
const int stop = IA_[II + 1] - IO_;
for (int posn = start; posn < stop; ++posn)
{
if (JA_[posn] - IO_ == JJ)
then return posn; // found
}
return -1; // not found
}
int Jacobian::insert_element(int II, int JJ, double value)
{
if (!((II == current_N_rows_ - 1) || (II == current_N_rows_)))
{
printf(
"***** row_sparse_Jacobian::insert_element(II=%d, JJ=%d, value=%g):\n"
" attempt to insert element elsewhere than {last row, last row+1}!\n"
" N_rows_=%d current_N_rows_=%d IO_=%d\n"
" N_nonzeros_=%d N_nonzeros_allocated_=%d\n",
II, JJ, double(value),
N_rows_, current_N_rows_, IO_,
N_nonzeros_, N_nonzeros_allocated_);
abort();
}
// start a new row if necessary
if (II == current_N_rows_)
then
{
assert(current_N_rows_ < N_rows_);
IA_[current_N_rows_ + 1] = IA_[current_N_rows_];
++current_N_rows_;
}
// insert into current row
assert(II == current_N_rows_ - 1);
if (IA_[II + 1] - IO_ >= N_nonzeros_allocated_)
then grow_arrays();
const int posn = IA_[II + 1] - IO_;
assert(posn < N_nonzeros_allocated_);
JA_[posn] = JJ + IO_;
A_[posn] = value;
++IA_[II + 1];
++N_nonzeros_;
return posn;
}
void Jacobian::grow_arrays()
{
N_nonzeros_allocated_ += base_growth_amount + (N_nonzeros_allocated_ >> 1);
int *const new_JA = new int[N_nonzeros_allocated_];
double *const new_A = new double[N_nonzeros_allocated_];
for (int posn = 0; posn < N_nonzeros_; ++posn)
{
new_JA[posn] = JA_[posn];
new_A[posn] = A_[posn];
}
delete[] A_;
delete[] JA_;
JA_ = new_JA;
A_ = new_A;
}
int compare_matrix_elements(const void *x, const void *y)
{
const struct matrix_element *const px = static_cast<const struct matrix_element *>(x);
const struct matrix_element *const py = static_cast<const struct matrix_element *>(y);
return px->JA - py->JA;
}
void Jacobian::sort_each_row_into_column_order()
{
// buffer must be big enough to hold the largest row
int max_N_in_row = 0;
{
for (int II = 0; II < N_rows_; ++II)
{
max_N_in_row = max(max_N_in_row, IA_[II + 1] - IA_[II]);
}
}
// contiguous buffer for sorting
struct matrix_element *const buffer = new struct matrix_element[max_N_in_row];
{
for (int II = 0; II < N_rows_; ++II)
{
const int N_in_row = IA_[II + 1] - IA_[II];
// copy this row's JA_[] and A_[] values to the buffer
const int start = IA_[II] - IO_;
for (int p = 0; p < N_in_row; ++p)
{
const int posn = start + p;
buffer[p].JA = JA_[posn];
buffer[p].A = A_[posn];
}
// sort the buffer
qsort(static_cast<void *>(buffer), N_in_row, sizeof(buffer[0]),
&compare_matrix_elements);
// copy the buffer values back to this row's JA_[] and A_[]
for (int p = 0; p < N_in_row; ++p)
{
const int posn = start + p;
JA_[posn] = buffer[p].JA;
A_[posn] = buffer[p].A;
}
}
}
delete[] buffer;
}
double Jacobian::solve_linear_system(int rhs_gfn, int x_gfn, bool print_msg_flag)
{
assert(IO_ == Fortran_index_origin);
assert(current_N_rows_ == N_rows_);
if (itemp_ == NULL)
then
{
itemp_ = new int[3 * N_rows_ + 3 * N_nonzeros_ + 2];
rtemp_ = new double[4 * N_rows_ + N_nonzeros_];
}
// initial guess = all zeros
double *x = ps_.gridfn_data(x_gfn);
for (int II = 0; II < N_rows_; ++II)
{
x[II] = 0.0;
}
const int N = N_rows_;
const double *rhs = ps_.gridfn_data(rhs_gfn);
const double eps = 1e-10;
const int max_iterations = N_rows_;
int istatus;
// the actual linear solution
f_ilucg(N,
IA_, JA_, A_,
rhs, x,
itemp_, rtemp_,
eps, max_iterations,
istatus);
if (istatus < 0)
{
printf(
"***** row_sparse_Jacobian__ILUCG::solve_linear_system(rhs_gfn=%d, x_gfn=%d):\n"
" error return from [sd]ilucg() routine!\n"
" istatus=%d < 0 ==> bad matrix structure, eg. zero diagonal element!\n",
rhs_gfn, x_gfn,
int(istatus));
abort();
}
return -1.0;
}
} // namespace AHFinderDirect

View File

@@ -1,90 +1,90 @@
#ifndef AHFINDERDIRECT__JACOBIAN_HH
#define AHFINDERDIRECT__JACOBIAN_HH
namespace AHFinderDirect
{
class Jacobian
{
public:
// basic meta-info
patch_system &my_patch_system() const { return ps_; }
int N_rows() const { return N_rows_; }
// convert (patch,irho,isigma) <--> row/column index
int II_of_patch_irho_isigma(const patch &p, int irho, int isigma)
const
{
return ps_.gpn_of_patch_irho_isigma(p, irho, isigma);
}
const patch &patch_irho_isigma_of_II(int II, int &irho, int &isigma)
const
{
return ps_.patch_irho_isigma_of_gpn(II, irho, isigma);
}
double element(int II, int JJ) const;
// is the matrix element (II,JJ) stored explicitly?
bool is_explicitly_stored(int II, int JJ) const
{
return find_element(II, JJ) > 0;
}
int IO() const { return IO_; }
enum
{
C_index_origin = 0,
Fortran_index_origin = 1
};
void zero_matrix();
void set_element(int II, int JJ, fp value);
void sum_into_element(int II, int JJ, fp value);
int find_element(int II, int JJ) const;
int insert_element(int II, int JJ, fp value);
void grow_arrays();
enum
{
base_growth_amount = 1000
};
void sort_each_row_into_column_order();
double solve_linear_system(int rhs_gfn, int x_gfn,
bool print_msg_flag);
public:
Jacobian(patch_system &ps);
~Jacobian();
protected:
patch_system &ps_;
int N_rows_;
int IO_;
int N_nonzeros_;
int current_N_rows_;
int N_nonzeros_allocated_;
int *IA_;
int *JA_;
double *A_;
int *itemp_;
double *rtemp_;
};
//******************************************************************************
} // namespace AHFinderDirect
#endif /* AHFINDERDIRECT__JACOBIAN_HH */
#ifndef AHFINDERDIRECT__JACOBIAN_HH
#define AHFINDERDIRECT__JACOBIAN_HH
namespace AHFinderDirect
{
class Jacobian
{
public:
// basic meta-info
patch_system &my_patch_system() const { return ps_; }
int N_rows() const { return N_rows_; }
// convert (patch,irho,isigma) <--> row/column index
int II_of_patch_irho_isigma(const patch &p, int irho, int isigma)
const
{
return ps_.gpn_of_patch_irho_isigma(p, irho, isigma);
}
const patch &patch_irho_isigma_of_II(int II, int &irho, int &isigma)
const
{
return ps_.patch_irho_isigma_of_gpn(II, irho, isigma);
}
double element(int II, int JJ) const;
// is the matrix element (II,JJ) stored explicitly?
bool is_explicitly_stored(int II, int JJ) const
{
return find_element(II, JJ) > 0;
}
int IO() const { return IO_; }
enum
{
C_index_origin = 0,
Fortran_index_origin = 1
};
void zero_matrix();
void set_element(int II, int JJ, fp value);
void sum_into_element(int II, int JJ, fp value);
int find_element(int II, int JJ) const;
int insert_element(int II, int JJ, fp value);
void grow_arrays();
enum
{
base_growth_amount = 1000
};
void sort_each_row_into_column_order();
double solve_linear_system(int rhs_gfn, int x_gfn,
bool print_msg_flag);
public:
Jacobian(patch_system &ps);
~Jacobian();
protected:
patch_system &ps_;
int N_rows_;
int IO_;
int N_nonzeros_;
int current_N_rows_;
int N_nonzeros_allocated_;
int *IA_;
int *JA_;
double *A_;
int *itemp_;
double *rtemp_;
};
//******************************************************************************
} // namespace AHFinderDirect
#endif /* AHFINDERDIRECT__JACOBIAN_HH */

File diff suppressed because it is too large Load Diff

View File

@@ -1,55 +1,55 @@
#ifndef PATCH_H
#define PATCH_H
#include <mpi.h>
#include "MyList.h"
#include "Block.h"
#include "var.h"
#include "macrodef.h" //need dim here; Vertex or Cell; ghost_width
class Patch
{
public:
int lev;
int shape[dim];
double bbox[2 * dim]; // this bbox includes buffer points
MyList<Block> *blb, *ble;
int lli[dim], uui[dim]; // denote the buffer points on each boundary
public:
Patch() {};
Patch(int DIM, int *shapei, double *bboxi, int levi, bool buflog, int Symmetry);
~Patch();
void checkPatch(bool buflog);
void checkPatch(bool buflog, const int out_rank);
void checkBlock();
void Interp_Points(MyList<var> *VarList,
int NN, double **XX,
double *Shellf, int Symmetry);
bool Interp_ONE_Point(MyList<var> *VarList, double *XX,
double *Shellf, int Symmetry);
double getdX(int dir);
void Find_Maximum(MyList<var> *VarList, double *XX,
double *Shellf);
bool Find_Point(double *XX);
void Interp_Points(MyList<var> *VarList,
int NN, double **XX,
double *Shellf, int Symmetry,
int Nmin_consumer, int Nmax_consumer);
void Interp_Points(MyList<var> *VarList,
int NN, double **XX,
double *Shellf, int Symmetry, MPI_Comm Comm_here);
bool Interp_ONE_Point(MyList<var> *VarList, double *XX,
double *Shellf, int Symmetry, MPI_Comm Comm_here);
void Find_Maximum(MyList<var> *VarList, double *XX,
double *Shellf, MPI_Comm Comm_here);
};
#endif /* PATCH_H */
#ifndef PATCH_H
#define PATCH_H
#include <mpi.h>
#include "MyList.h"
#include "Block.h"
#include "var.h"
#include "macrodef.h" //need dim here; Vertex or Cell; ghost_width
class Patch
{
public:
int lev;
int shape[dim];
double bbox[2 * dim]; // this bbox includes buffer points
MyList<Block> *blb, *ble;
int lli[dim], uui[dim]; // denote the buffer points on each boundary
public:
Patch() {};
Patch(int DIM, int *shapei, double *bboxi, int levi, bool buflog, int Symmetry);
~Patch();
void checkPatch(bool buflog);
void checkPatch(bool buflog, const int out_rank);
void checkBlock();
void Interp_Points(MyList<var> *VarList,
int NN, double **XX,
double *Shellf, int Symmetry);
bool Interp_ONE_Point(MyList<var> *VarList, double *XX,
double *Shellf, int Symmetry);
double getdX(int dir);
void Find_Maximum(MyList<var> *VarList, double *XX,
double *Shellf);
bool Find_Point(double *XX);
void Interp_Points(MyList<var> *VarList,
int NN, double **XX,
double *Shellf, int Symmetry,
int Nmin_consumer, int Nmax_consumer);
void Interp_Points(MyList<var> *VarList,
int NN, double **XX,
double *Shellf, int Symmetry, MPI_Comm Comm_here);
bool Interp_ONE_Point(MyList<var> *VarList, double *XX,
double *Shellf, int Symmetry, MPI_Comm Comm_here);
void Find_Maximum(MyList<var> *VarList, double *XX,
double *Shellf, MPI_Comm Comm_here);
};
#endif /* PATCH_H */

View File

@@ -1,109 +1,109 @@
#ifndef MYLIST_H
#define MYLIST_H
// Note: There is never an implementation file (*.C) for a template class
template <class T>
class MyList
{
public:
MyList *next;
T *data;
public:
MyList();
MyList(T *p);
~MyList();
void insert(T *p);
void clearList();
void destroyList();
void catList(MyList<T> *p);
void CloneList(MyList<T> *p);
};
template <class T>
MyList<T>::MyList()
{
data = 0;
next = 0;
}
template <class T>
MyList<T>::MyList(T *p)
{
data = p;
next = 0;
}
template <class T>
MyList<T>::~MyList()
{
}
template <class T>
void MyList<T>::insert(T *p)
{
MyList *ct = this;
if (data == 0)
{
data = p;
}
else
{
while (ct->next)
{
ct = ct->next;
}
ct->next = new MyList(p);
ct = ct->next;
ct->next = 0;
}
}
template <class T>
void MyList<T>::clearList()
{
MyList *ct = this, *n;
while (ct)
{
n = ct->next;
delete ct;
ct = n;
}
}
template <class T>
void MyList<T>::destroyList()
{
MyList *ct = this, *n;
while (ct)
{
n = ct->next;
delete ct->data;
delete ct;
ct = n;
}
}
template <class T>
void MyList<T>::catList(MyList<T> *p)
{
MyList *ct = this;
while (ct->next)
{
ct = ct->next;
}
ct->next = p;
}
template <class T>
void MyList<T>::CloneList(MyList<T> *p)
{
MyList *ct = this;
p = 0;
while (ct)
{
if (!p)
p = new MyList<T>(ct->data);
else
p->insert(ct->data);
ct = ct->next;
}
}
#endif /* MyList_H */
#ifndef MYLIST_H
#define MYLIST_H
// Note: There is never an implementation file (*.C) for a template class
template <class T>
class MyList
{
public:
MyList *next;
T *data;
public:
MyList();
MyList(T *p);
~MyList();
void insert(T *p);
void clearList();
void destroyList();
void catList(MyList<T> *p);
void CloneList(MyList<T> *p);
};
template <class T>
MyList<T>::MyList()
{
data = 0;
next = 0;
}
template <class T>
MyList<T>::MyList(T *p)
{
data = p;
next = 0;
}
template <class T>
MyList<T>::~MyList()
{
}
template <class T>
void MyList<T>::insert(T *p)
{
MyList *ct = this;
if (data == 0)
{
data = p;
}
else
{
while (ct->next)
{
ct = ct->next;
}
ct->next = new MyList(p);
ct = ct->next;
ct->next = 0;
}
}
template <class T>
void MyList<T>::clearList()
{
MyList *ct = this, *n;
while (ct)
{
n = ct->next;
delete ct;
ct = n;
}
}
template <class T>
void MyList<T>::destroyList()
{
MyList *ct = this, *n;
while (ct)
{
n = ct->next;
delete ct->data;
delete ct;
ct = n;
}
}
template <class T>
void MyList<T>::catList(MyList<T> *p)
{
MyList *ct = this;
while (ct->next)
{
ct = ct->next;
}
ct->next = p;
}
template <class T>
void MyList<T>::CloneList(MyList<T> *p)
{
MyList *ct = this;
p = 0;
while (ct)
{
if (!p)
p = new MyList<T>(ct->data);
else
p->insert(ct->data);
ct = ct->next;
}
}
#endif /* MyList_H */

View File

@@ -1,225 +1,225 @@
#ifndef NULLEVOL_H
#define NULLEVOL_H
#ifdef fortran1
#define f_setup_dyad setup_dyad
#define f_eth_derivs eth_derivs
#define f_eth_dderivs eth_dderivs
#define f_fill_symmetric_boundarybuffer fill_symmetric_boundarybuffer
#define f_fill_symmetric_boundarybuffer2 fill_symmetric_boundarybuffer2
#define f_calculate_K calculate_k
#define f_NullEvol_beta nullevol_beta
#define f_NullEvol_Q nullevol_q
#define f_NullEvol_U nullevol_u
#define f_NullEvol_W nullevol_w
#define f_NullEvol_Theta nullevol_theta
#define f_NullEvol_Theta_givenx nullevol_theta_givenx
#define f_Eq_Theta eq_theta
#define f_Eq_Theta_2 eq_theta_2
#define f_NullEvol_g01 nullevol_g01
#define f_NullEvol_pg0A nullevol_pg0a
#define f_NullEvol_Theta2 nullevol_theta2
#define f_NullEvol_Thetag00 nullevol_thetag00
#endif
#ifdef fortran2
#define f_setup_dyad SETUP_DYAD
#define f_eth_derivs ETH_DERIVS
#define f_eth_dderivs ETH_DDERIVS
#define f_fill_symmetric_boundarybuffer FILL_SYMMETRIC_BOUNDARYBUFFER
#define f_fill_symmetric_boundarybuffer2 FILL_SYMMETRIC_BOUNDARYBUFFER2
#define f_calculate_K CALCULATE_K
#define f_NullEvol_beta NULLEVOL_BETA
#define f_NullEvol_Q NULLEVOL_Q
#define f_NullEvol_U NULLEVOL_U
#define f_NullEvol_W NULLEVOL_W
#define f_NullEvol_Theta NULLEVOL_THETA
#define f_NullEvol_Theta_givenx NULLEVOL_THETA_GIVENX
#define f_Eq_Theta EQ_THETA
#define f_Eq_Theta_2 EQ_THETA_2
#define f_NullEvol_g01 NULLEVOL_G01
#define f_NullEvol_pg0A NULLEVOL_PG0A
#define f_NullEvol_Theta2 NULLEVOL_THETA2
#define f_NullEvol_Thetag00 NULLEVOL_THETAG00
#endif
#ifdef fortran3
#define f_setup_dyad setup_dyad_
#define f_eth_derivs eth_derivs_
#define f_eth_dderivs eth_dderivs_
#define f_fill_symmetric_boundarybuffer fill_symmetric_boundarybuffer_
#define f_fill_symmetric_boundarybuffer2 fill_symmetric_boundarybuffer2_
#define f_calculate_K calculate_k_
#define f_NullEvol_beta nullevol_beta_
#define f_NullEvol_Q nullevol_q_
#define f_NullEvol_U nullevol_u_
#define f_NullEvol_W nullevol_w_
#define f_NullEvol_Theta nullevol_theta_
#define f_NullEvol_Theta_givenx nullevol_theta_givenx_
#define f_Eq_Theta eq_theta_
#define f_Eq_Theta_2 eq_theta_2_
#define f_NullEvol_g01 nullevol_g01_
#define f_NullEvol_pg0A nullevol_pg0a_
#define f_NullEvol_Theta2 nullevol_theta2_
#define f_NullEvol_Thetag00 nullevol_thetag00_
#endif
extern "C"
{
void f_setup_dyad(int *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *,
int &, double &);
}
extern "C"
{
void f_eth_derivs(int *, double *, double *,
double *, double *,
double *, double *,
int &, int &,
double *, double *, double *, double *, double *, double *);
}
extern "C"
{
void f_eth_dderivs(int *, double *, double *,
double *, double *,
double *, double *,
int &, int &, int &,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *);
}
extern "C"
{
void f_fill_symmetric_boundarybuffer(int *, double *, double *, double *,
double &, double &,
double *, double *, double *, double *, double *, double *, double *, double *,
double *, double *, int &, int &, int &);
}
extern "C"
{
void f_fill_symmetric_boundarybuffer2(int *, double *, double *, double *,
double &, double &,
double *, int &, int &, double *);
}
extern "C"
{
void f_calculate_K(int *, double *, double *, double *,
double *, double *,
double *, double *, double *, double *);
}
extern "C"
{
int f_NullEvol_beta(int *, double *, double *, double *,
double *, double *, double *, double *, double *);
}
extern "C"
{
int f_NullEvol_Q(int *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *);
}
extern "C"
{
int f_NullEvol_U(int *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *,
double *, double *, double &);
}
extern "C"
{
int f_NullEvol_W(int *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *, double &,
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *);
}
extern "C"
{
int f_NullEvol_Theta(int *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *,
double &,
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *);
}
extern "C"
{
int f_NullEvol_Theta_givenx(int *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *,
double &,
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *,
double &, int &);
}
extern "C"
{
int f_Eq_Theta(int *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *, double &,
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *);
}
extern "C"
{
int f_Eq_Theta_2(int *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *, double &,
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *,
double &, int &);
}
extern "C"
{
int f_NullEvol_g01(int *, double *, double *, double *,
double *, double *, double *, double *,
double &);
}
extern "C"
{
int f_NullEvol_pg0A(int *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *,
double &);
}
extern "C"
{
int f_NullEvol_Theta2(int *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *,
double &);
}
extern "C"
{
int f_NullEvol_Thetag00(int *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *,
double &);
}
#endif /* NULLEVOL_H */
#ifndef NULLEVOL_H
#define NULLEVOL_H
#ifdef fortran1
#define f_setup_dyad setup_dyad
#define f_eth_derivs eth_derivs
#define f_eth_dderivs eth_dderivs
#define f_fill_symmetric_boundarybuffer fill_symmetric_boundarybuffer
#define f_fill_symmetric_boundarybuffer2 fill_symmetric_boundarybuffer2
#define f_calculate_K calculate_k
#define f_NullEvol_beta nullevol_beta
#define f_NullEvol_Q nullevol_q
#define f_NullEvol_U nullevol_u
#define f_NullEvol_W nullevol_w
#define f_NullEvol_Theta nullevol_theta
#define f_NullEvol_Theta_givenx nullevol_theta_givenx
#define f_Eq_Theta eq_theta
#define f_Eq_Theta_2 eq_theta_2
#define f_NullEvol_g01 nullevol_g01
#define f_NullEvol_pg0A nullevol_pg0a
#define f_NullEvol_Theta2 nullevol_theta2
#define f_NullEvol_Thetag00 nullevol_thetag00
#endif
#ifdef fortran2
#define f_setup_dyad SETUP_DYAD
#define f_eth_derivs ETH_DERIVS
#define f_eth_dderivs ETH_DDERIVS
#define f_fill_symmetric_boundarybuffer FILL_SYMMETRIC_BOUNDARYBUFFER
#define f_fill_symmetric_boundarybuffer2 FILL_SYMMETRIC_BOUNDARYBUFFER2
#define f_calculate_K CALCULATE_K
#define f_NullEvol_beta NULLEVOL_BETA
#define f_NullEvol_Q NULLEVOL_Q
#define f_NullEvol_U NULLEVOL_U
#define f_NullEvol_W NULLEVOL_W
#define f_NullEvol_Theta NULLEVOL_THETA
#define f_NullEvol_Theta_givenx NULLEVOL_THETA_GIVENX
#define f_Eq_Theta EQ_THETA
#define f_Eq_Theta_2 EQ_THETA_2
#define f_NullEvol_g01 NULLEVOL_G01
#define f_NullEvol_pg0A NULLEVOL_PG0A
#define f_NullEvol_Theta2 NULLEVOL_THETA2
#define f_NullEvol_Thetag00 NULLEVOL_THETAG00
#endif
#ifdef fortran3
#define f_setup_dyad setup_dyad_
#define f_eth_derivs eth_derivs_
#define f_eth_dderivs eth_dderivs_
#define f_fill_symmetric_boundarybuffer fill_symmetric_boundarybuffer_
#define f_fill_symmetric_boundarybuffer2 fill_symmetric_boundarybuffer2_
#define f_calculate_K calculate_k_
#define f_NullEvol_beta nullevol_beta_
#define f_NullEvol_Q nullevol_q_
#define f_NullEvol_U nullevol_u_
#define f_NullEvol_W nullevol_w_
#define f_NullEvol_Theta nullevol_theta_
#define f_NullEvol_Theta_givenx nullevol_theta_givenx_
#define f_Eq_Theta eq_theta_
#define f_Eq_Theta_2 eq_theta_2_
#define f_NullEvol_g01 nullevol_g01_
#define f_NullEvol_pg0A nullevol_pg0a_
#define f_NullEvol_Theta2 nullevol_theta2_
#define f_NullEvol_Thetag00 nullevol_thetag00_
#endif
extern "C"
{
void f_setup_dyad(int *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *,
int &, double &);
}
extern "C"
{
void f_eth_derivs(int *, double *, double *,
double *, double *,
double *, double *,
int &, int &,
double *, double *, double *, double *, double *, double *);
}
extern "C"
{
void f_eth_dderivs(int *, double *, double *,
double *, double *,
double *, double *,
int &, int &, int &,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *);
}
extern "C"
{
void f_fill_symmetric_boundarybuffer(int *, double *, double *, double *,
double &, double &,
double *, double *, double *, double *, double *, double *, double *, double *,
double *, double *, int &, int &, int &);
}
extern "C"
{
void f_fill_symmetric_boundarybuffer2(int *, double *, double *, double *,
double &, double &,
double *, int &, int &, double *);
}
extern "C"
{
void f_calculate_K(int *, double *, double *, double *,
double *, double *,
double *, double *, double *, double *);
}
extern "C"
{
int f_NullEvol_beta(int *, double *, double *, double *,
double *, double *, double *, double *, double *);
}
extern "C"
{
int f_NullEvol_Q(int *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *);
}
extern "C"
{
int f_NullEvol_U(int *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *,
double *, double *, double &);
}
extern "C"
{
int f_NullEvol_W(int *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *, double &,
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *);
}
extern "C"
{
int f_NullEvol_Theta(int *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *,
double &,
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *);
}
extern "C"
{
int f_NullEvol_Theta_givenx(int *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *,
double &,
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *,
double &, int &);
}
extern "C"
{
int f_Eq_Theta(int *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *, double &,
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *);
}
extern "C"
{
int f_Eq_Theta_2(int *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *, double &,
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *,
double &, int &);
}
extern "C"
{
int f_NullEvol_g01(int *, double *, double *, double *,
double *, double *, double *, double *,
double &);
}
extern "C"
{
int f_NullEvol_pg0A(int *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *,
double &);
}
extern "C"
{
int f_NullEvol_Theta2(int *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *,
double &);
}
extern "C"
{
int f_NullEvol_Thetag00(int *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *,
double &);
}
#endif /* NULLEVOL_H */

View File

@@ -1,106 +1,106 @@
#ifndef NULLNEWS_H
#define NULLNEWS_H
#ifdef fortran1
#define f_drive_null_news drive_null_news
#define f_get_null_news2 get_null_news2
#define f_drive_null_news_diff drive_null_news_diff
#define f_omega_rhs omega_rhs
#define f_get_exact_omega get_exact_omega
#define f_get_omega_and_dtomega_pre get_omega_and_dtomega_pre
#define f_get_omega_and_dtomega_LN get_omega_and_dtomega_ln
#define f_get_dtomega get_dtomega
#endif
#ifdef fortran2
#define f_drive_null_news DRIVE_NULL_NEWS
#define f_get_null_news2 GET_NULL_NEWS2
#define f_drive_null_news_diff DRIVE_NULL_NEWS_DIFF
#define f_omega_rhs OMEGA_RHS
#define f_get_exact_omega GET_EXACT_OMEGA
#define f_get_omega_and_dtomega_pre GET_OMEGA_AND_DTOMEGA_PRE
#define f_get_omega_and_dtomega_LN GET_OMEGA_AND_DTOMEGA_LN
#define f_get_dtomega GET_DTOMEGA
#endif
#ifdef fortran3
#define f_drive_null_news drive_null_news_
#define f_get_null_news2 get_null_news2_
#define f_drive_null_news_diff drive_null_news_diff_
#define f_omega_rhs omega_rhs_
#define f_get_exact_omega get_exact_omega_
#define f_get_omega_and_dtomega_pre get_omega_and_dtomega_pre_
#define f_get_omega_and_dtomega_LN get_omega_and_dtomega_ln_
#define f_get_dtomega get_dtomega_
#endif
extern "C"
{
void f_drive_null_news(int *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double &, int &);
}
extern "C"
{
void f_drive_null_news_diff(int *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double &, int &, double &);
}
extern "C"
{
void f_omega_rhs(int *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *);
}
extern "C"
{
void f_get_exact_omega(int *, double *, double *, double *,
double *,
int &, double &, double &);
}
extern "C"
{
void f_get_null_news2(int *, double *, double *, double *,
double *, double *,
double *, double *, double *, double *,
double *, double *, double *,
double *, double *, double *,
double *, double *, double &, int &);
}
extern "C"
{
void f_get_omega_and_dtomega_pre(int *, double *, double *, double *,
double *, double *, double *,
double *, double *, double &);
}
extern "C"
{
void f_get_dtomega(int *, double *, double *, double *,
double *, double *, double *,
double *, double *, double &);
}
extern "C"
{
void f_get_omega_and_dtomega_LN(double &, int *, double *, double *, double *,
double *, double *, double &, int &);
}
#endif /* NULLNEWS_H */
#ifndef NULLNEWS_H
#define NULLNEWS_H
#ifdef fortran1
#define f_drive_null_news drive_null_news
#define f_get_null_news2 get_null_news2
#define f_drive_null_news_diff drive_null_news_diff
#define f_omega_rhs omega_rhs
#define f_get_exact_omega get_exact_omega
#define f_get_omega_and_dtomega_pre get_omega_and_dtomega_pre
#define f_get_omega_and_dtomega_LN get_omega_and_dtomega_ln
#define f_get_dtomega get_dtomega
#endif
#ifdef fortran2
#define f_drive_null_news DRIVE_NULL_NEWS
#define f_get_null_news2 GET_NULL_NEWS2
#define f_drive_null_news_diff DRIVE_NULL_NEWS_DIFF
#define f_omega_rhs OMEGA_RHS
#define f_get_exact_omega GET_EXACT_OMEGA
#define f_get_omega_and_dtomega_pre GET_OMEGA_AND_DTOMEGA_PRE
#define f_get_omega_and_dtomega_LN GET_OMEGA_AND_DTOMEGA_LN
#define f_get_dtomega GET_DTOMEGA
#endif
#ifdef fortran3
#define f_drive_null_news drive_null_news_
#define f_get_null_news2 get_null_news2_
#define f_drive_null_news_diff drive_null_news_diff_
#define f_omega_rhs omega_rhs_
#define f_get_exact_omega get_exact_omega_
#define f_get_omega_and_dtomega_pre get_omega_and_dtomega_pre_
#define f_get_omega_and_dtomega_LN get_omega_and_dtomega_ln_
#define f_get_dtomega get_dtomega_
#endif
extern "C"
{
void f_drive_null_news(int *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double &, int &);
}
extern "C"
{
void f_drive_null_news_diff(int *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double &, int &, double &);
}
extern "C"
{
void f_omega_rhs(int *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *, double *, double *,
double *, double *);
}
extern "C"
{
void f_get_exact_omega(int *, double *, double *, double *,
double *,
int &, double &, double &);
}
extern "C"
{
void f_get_null_news2(int *, double *, double *, double *,
double *, double *,
double *, double *, double *, double *,
double *, double *, double *,
double *, double *, double *,
double *, double *, double &, int &);
}
extern "C"
{
void f_get_omega_and_dtomega_pre(int *, double *, double *, double *,
double *, double *, double *,
double *, double *, double &);
}
extern "C"
{
void f_get_dtomega(int *, double *, double *, double *,
double *, double *, double *,
double *, double *, double &);
}
extern "C"
{
void f_get_omega_and_dtomega_LN(double &, int *, double *, double *, double *,
double *, double *, double &, int &);
}
#endif /* NULLNEWS_H */

View File

@@ -1,189 +1,189 @@
#ifndef NULLSHELLPATCH_H
#define NULLSHELLPATCH_H
#ifdef newc
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cmath>
#include <complex>
using namespace std;
#else
#include <iostream.h>
#include <iomanip.h>
#include <fstream.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <complex.h>
#endif
#include <mpi.h>
#include "MyList.h"
#include "Block.h"
#include "Parallel.h"
#include "ShellPatch.h"
#include "var.h"
#include "macrodef.h" //need dim here; Vertex or Cell; ghost_width
#if (dim != 3)
#error NullShellPatch only supports 3 dimensional stuff yet
#endif
class xp_npatch : public ss_patch
{
public:
xp_npatch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 2; };
};
class xm_npatch : public ss_patch
{
public:
xm_npatch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 3; };
};
class yp_npatch : public ss_patch
{
public:
yp_npatch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 4; };
};
class ym_npatch : public ss_patch
{
public:
ym_npatch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 5; };
};
class zp_npatch : public ss_patch
{
public:
zp_npatch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 0; };
};
class zm_npatch : public ss_patch
{
public:
zm_npatch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 1; };
};
class NullShellPatch
{
public:
struct pointstru
{
double gpox[dim]; // global cordinate
double lpox[dim]; // local cordinate
Block *Bg;
int ssst; //-1: cardisian, others as sst of ss_patch source sst
int tsst; //-1: cardisian, others as sst of ss_patch target sst
double *coef;
int *sind;
int dumyd; // the dimension which has common lines, only useful in interdata_packer
complex<double> swtf; // exp(i gamma) of Eq.(26) of CQG 24 S327
};
var *FXZEO;
var *gx, *gy, *gz;
// we always assume the number of VarList = 2* the number of Varwt
// so VarList must apear with pairs, either components of complex number or a fake pair
var *beta, *W;
var *Rnu, *Inu, *Rk, *Ik, *RB, *IB;
var *RQ, *IQ, *RU, *IU, *RTheta, *ITheta;
var *KK, *HKK, *KKx, *HKKx;
var *RJo, *IJo, *omegao;
var *RJ0, *IJ0, *omega0;
var *RJ, *IJ, *omega;
var *RJ1, *IJ1, *omega1;
var *RJ_rhs, *IJ_rhs, *omega_rhs;
var *quR1, *quR2, *quI1, *quI2;
var *qlR1, *qlR2, *qlI1, *qlI2;
var *gR, *gI;
var *dquR1, *dquR2, *dquI1, *dquI2;
var *bdquR1, *bdquR2, *bdquI1, *bdquI2;
var *dgR, *dgI;
var *bdgR, *bdgI;
var *RNews, *INews;
MyList<var> *StateList, *SynchList_pre, *SynchList_cor, *RHSList;
MyList<var> *OldStateList, *DumpList, *CheckList;
MyList<var> *betaList, *QUList, *WTheList, *TheList, *JrhsList, *J1List;
int betawt[1], QUwt[2], WThewt[2];
int myrank;
int shape[dim]; // for (rho, sigma, X), for rho and sigma means number of points for every pi/2
double Rmin, xmin, xmax;
int Symmetry;
int ingfs, fngfs;
MyList<ss_patch> *PatL;
MyList<pointstru> **ss_src, **ss_dst;
MyList<pointstru> **cs_src, **cs_dst;
public:
NullShellPatch(int *shapei, double Rmini, double xmini, double xmaxi, int Symmetry, int myranki);
~NullShellPatch();
void destroypsuList(MyList<pointstru> *ct);
void fill_symmetric_boundarybuffer(MyList<var> *VarList, int *Varwt);
MyList<Block> *compose_sh(int cpusize);
int getdumydimension(int acsst, int posst);
void Setup_dyad();
void Setup_Initial_Data(bool checkrun, double PhysTime);
void eth_derivs(var *Rv, var *Iv, var *ethRv, var *ethIv, int s, int e);
void eth_dderivs(var *Rv, var *Iv, var *ethRv, var *ethIv, int s, int e1, int e2);
void getlocalpox_ss(int isst, double ix, double iy, double iz, int &sst, double &lx, double &ly, double &lz);
void getlocalpox_fake(double x, double y, double z, int &sst, double &lx, double &ly, double &lz);
void getlocalpox(double x, double y, double z, int &sst, double &lx, double &ly, double &lz);
void getlocalpoxsst_ss(int isst, double ix, double iy, double iz, int lsst, double &lx, double &ly, double &lz);
void getlocalpoxsst(double x, double y, double z, int sst, double &lx, double &ly, double &lz);
void getglobalpox(double &x, double &y, double &z, int sst, double lx, double ly, double lz);
complex<double> get_swtf(double *pox, int tsst, int ssst);
void prolongpointstru(MyList<pointstru> *&psul, MyList<ss_patch> *sPpi, double DH[dim],
MyList<Patch> *Ppi, double CDH[dim], MyList<pointstru> *pss);
bool prolongpointstru(MyList<pointstru> *&psul, bool ssyn, int tsst, MyList<ss_patch> *sPp, double DH[dim],
MyList<Patch> *Pp, double CDH[dim], double x, double y, double z, int Symmetry, int rank_in);
bool prolongpointstru_ss(MyList<pointstru> *&psul, int tsst, MyList<ss_patch> *sPp, double DH[dim],
MyList<Patch> *Pp, double CDH[dim], double x, double y, double z, int Symmetry, int rank_in);
void setupintintstuff(int cpusize, MyList<Patch> *CPatL, int Symmetry);
void checkPatch();
void checkBlock(int sst);
double getdX(int dir);
void shellname(char *sn, int i);
void Dump_xyz(char *tag, double time, double dT);
void Dump_Data(MyList<var> *DumpListi, char *tag, double time, double dT);
void intertransfer(MyList<pointstru> **src, MyList<pointstru> **dst,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /*target */,
int Symmetry, int *Varwt);
int interdata_packer(double *data, MyList<pointstru> *src, MyList<pointstru> *dst, int rank_in, int dir,
MyList<var> *VarLists /* source */, MyList<var> *VarListd /* target */, int Symmetry, int *Varwt);
void Synch(MyList<var> *VarList, int Symmetry, int *Varwt);
void CS_Inter(MyList<var> *VarList, int Symmetry, int *Varwt);
void check_pointstrul(MyList<pointstru> *pp, bool first_only);
void check_pointstrul2(MyList<pointstru> *pp, int first_last_only);
void matchcheck(MyList<Patch> *CPatL);
void Interp_Points(MyList<var> *VarList,
int NN, double **XX, /*input global Cartesian coordinate*/
double *Shellf, int Symmetry);
void Interp_Points_2D(MyList<var> *VarList,
int NN, double **XX, /*input global Cartesian coordinate*/
double *Shellf, int Symmetry);
void Step(double dT, double PhysTime, monitor *ErrorMonitor);
void Null_Boundary(double PhysTime);
void HyperSlice(double dT, double PhysTime, monitor *ErrorMonitor, int RK_count);
double News_Error_Check(double PhysTime, double dT, bool dp);
double Error_Check(double PhysTime, double dT, bool dp);
double EqTheta_Check(double PhysTime, double dT, bool dp);
void Compute_News(double PhysTime, double dT, bool dp);
void Check_News(double PhysTime, double dT, bool dp);
};
#endif /* NULLSHELLPATCH_H */
#ifndef NULLSHELLPATCH_H
#define NULLSHELLPATCH_H
#ifdef newc
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cmath>
#include <complex>
using namespace std;
#else
#include <iostream.h>
#include <iomanip.h>
#include <fstream.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <complex.h>
#endif
#include <mpi.h>
#include "MyList.h"
#include "Block.h"
#include "Parallel.h"
#include "ShellPatch.h"
#include "var.h"
#include "macrodef.h" //need dim here; Vertex or Cell; ghost_width
#if (dim != 3)
#error NullShellPatch only supports 3 dimensional stuff yet
#endif
class xp_npatch : public ss_patch
{
public:
xp_npatch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 2; };
};
class xm_npatch : public ss_patch
{
public:
xm_npatch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 3; };
};
class yp_npatch : public ss_patch
{
public:
yp_npatch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 4; };
};
class ym_npatch : public ss_patch
{
public:
ym_npatch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 5; };
};
class zp_npatch : public ss_patch
{
public:
zp_npatch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 0; };
};
class zm_npatch : public ss_patch
{
public:
zm_npatch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 1; };
};
class NullShellPatch
{
public:
struct pointstru
{
double gpox[dim]; // global cordinate
double lpox[dim]; // local cordinate
Block *Bg;
int ssst; //-1: cardisian, others as sst of ss_patch source sst
int tsst; //-1: cardisian, others as sst of ss_patch target sst
double *coef;
int *sind;
int dumyd; // the dimension which has common lines, only useful in interdata_packer
complex<double> swtf; // exp(i gamma) of Eq.(26) of CQG 24 S327
};
var *FXZEO;
var *gx, *gy, *gz;
// we always assume the number of VarList = 2* the number of Varwt
// so VarList must apear with pairs, either components of complex number or a fake pair
var *beta, *W;
var *Rnu, *Inu, *Rk, *Ik, *RB, *IB;
var *RQ, *IQ, *RU, *IU, *RTheta, *ITheta;
var *KK, *HKK, *KKx, *HKKx;
var *RJo, *IJo, *omegao;
var *RJ0, *IJ0, *omega0;
var *RJ, *IJ, *omega;
var *RJ1, *IJ1, *omega1;
var *RJ_rhs, *IJ_rhs, *omega_rhs;
var *quR1, *quR2, *quI1, *quI2;
var *qlR1, *qlR2, *qlI1, *qlI2;
var *gR, *gI;
var *dquR1, *dquR2, *dquI1, *dquI2;
var *bdquR1, *bdquR2, *bdquI1, *bdquI2;
var *dgR, *dgI;
var *bdgR, *bdgI;
var *RNews, *INews;
MyList<var> *StateList, *SynchList_pre, *SynchList_cor, *RHSList;
MyList<var> *OldStateList, *DumpList, *CheckList;
MyList<var> *betaList, *QUList, *WTheList, *TheList, *JrhsList, *J1List;
int betawt[1], QUwt[2], WThewt[2];
int myrank;
int shape[dim]; // for (rho, sigma, X), for rho and sigma means number of points for every pi/2
double Rmin, xmin, xmax;
int Symmetry;
int ingfs, fngfs;
MyList<ss_patch> *PatL;
MyList<pointstru> **ss_src, **ss_dst;
MyList<pointstru> **cs_src, **cs_dst;
public:
NullShellPatch(int *shapei, double Rmini, double xmini, double xmaxi, int Symmetry, int myranki);
~NullShellPatch();
void destroypsuList(MyList<pointstru> *ct);
void fill_symmetric_boundarybuffer(MyList<var> *VarList, int *Varwt);
MyList<Block> *compose_sh(int cpusize);
int getdumydimension(int acsst, int posst);
void Setup_dyad();
void Setup_Initial_Data(bool checkrun, double PhysTime);
void eth_derivs(var *Rv, var *Iv, var *ethRv, var *ethIv, int s, int e);
void eth_dderivs(var *Rv, var *Iv, var *ethRv, var *ethIv, int s, int e1, int e2);
void getlocalpox_ss(int isst, double ix, double iy, double iz, int &sst, double &lx, double &ly, double &lz);
void getlocalpox_fake(double x, double y, double z, int &sst, double &lx, double &ly, double &lz);
void getlocalpox(double x, double y, double z, int &sst, double &lx, double &ly, double &lz);
void getlocalpoxsst_ss(int isst, double ix, double iy, double iz, int lsst, double &lx, double &ly, double &lz);
void getlocalpoxsst(double x, double y, double z, int sst, double &lx, double &ly, double &lz);
void getglobalpox(double &x, double &y, double &z, int sst, double lx, double ly, double lz);
complex<double> get_swtf(double *pox, int tsst, int ssst);
void prolongpointstru(MyList<pointstru> *&psul, MyList<ss_patch> *sPpi, double DH[dim],
MyList<Patch> *Ppi, double CDH[dim], MyList<pointstru> *pss);
bool prolongpointstru(MyList<pointstru> *&psul, bool ssyn, int tsst, MyList<ss_patch> *sPp, double DH[dim],
MyList<Patch> *Pp, double CDH[dim], double x, double y, double z, int Symmetry, int rank_in);
bool prolongpointstru_ss(MyList<pointstru> *&psul, int tsst, MyList<ss_patch> *sPp, double DH[dim],
MyList<Patch> *Pp, double CDH[dim], double x, double y, double z, int Symmetry, int rank_in);
void setupintintstuff(int cpusize, MyList<Patch> *CPatL, int Symmetry);
void checkPatch();
void checkBlock(int sst);
double getdX(int dir);
void shellname(char *sn, int i);
void Dump_xyz(char *tag, double time, double dT);
void Dump_Data(MyList<var> *DumpListi, char *tag, double time, double dT);
void intertransfer(MyList<pointstru> **src, MyList<pointstru> **dst,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /*target */,
int Symmetry, int *Varwt);
int interdata_packer(double *data, MyList<pointstru> *src, MyList<pointstru> *dst, int rank_in, int dir,
MyList<var> *VarLists /* source */, MyList<var> *VarListd /* target */, int Symmetry, int *Varwt);
void Synch(MyList<var> *VarList, int Symmetry, int *Varwt);
void CS_Inter(MyList<var> *VarList, int Symmetry, int *Varwt);
void check_pointstrul(MyList<pointstru> *pp, bool first_only);
void check_pointstrul2(MyList<pointstru> *pp, int first_last_only);
void matchcheck(MyList<Patch> *CPatL);
void Interp_Points(MyList<var> *VarList,
int NN, double **XX, /*input global Cartesian coordinate*/
double *Shellf, int Symmetry);
void Interp_Points_2D(MyList<var> *VarList,
int NN, double **XX, /*input global Cartesian coordinate*/
double *Shellf, int Symmetry);
void Step(double dT, double PhysTime, monitor *ErrorMonitor);
void Null_Boundary(double PhysTime);
void HyperSlice(double dT, double PhysTime, monitor *ErrorMonitor, int RK_count);
double News_Error_Check(double PhysTime, double dT, bool dp);
double Error_Check(double PhysTime, double dT, bool dp);
double EqTheta_Check(double PhysTime, double dT, bool dp);
void Compute_News(double PhysTime, double dT, bool dp);
void Check_News(double PhysTime, double dT, bool dp);
};
#endif /* NULLSHELLPATCH_H */

View File

@@ -1,183 +1,183 @@
#ifndef NULLSHELLPATCH2_H
#define NULLSHELLPATCH2_H
#ifdef newc
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cmath>
#include <complex>
using namespace std;
#else
#include <iostream.h>
#include <iomanip.h>
#include <fstream.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <complex.h>
#endif
#include <mpi.h>
#include "MyList.h"
#include "Block.h"
#include "Parallel.h"
#include "ShellPatch.h"
#include "var.h"
#include "macrodef.h" //need dim here; Vertex or Cell; ghost_width
#if (dim != 3)
#error NullShellPatch2 only supports 3 dimensional stuff yet
#endif
// x x x x x o *
// * o x x x x x
// each side contribute an overlap points
// so we need half of that
#define overghost ((ghost_width + 1) / 2 + ghost_width)
class NullShellPatch2
{
class xp_npatch : public ss_patch
{
public:
xp_npatch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 2; };
};
class xm_npatch : public ss_patch
{
public:
xm_npatch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 3; };
};
class yp_npatch : public ss_patch
{
public:
yp_npatch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 4; };
};
class ym_npatch : public ss_patch
{
public:
ym_npatch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 5; };
};
class zp_npatch : public ss_patch
{
public:
zp_npatch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 0; };
};
class zm_npatch : public ss_patch
{
public:
zm_npatch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 1; };
};
public:
struct pointstru
{
double gpox[dim]; // global cordinate
double lpox[dim]; // local cordinate
Block *Bg;
int ssst; //-1: cardisian, others as sst of ss_patch source sst
int tsst; //-1: cardisian, others as sst of ss_patch target sst
double *coef;
int *sind; // index position, considered dummy dimension already
int dumyd; // the dimension which has common lines, only useful in interdata_packer
double Jacob[2][2];
int indz; // index position of r direction
};
var *gx, *gy, *gz;
// surface variable
var *g00, *g01, *p02, *p03, *g02, *g03;
var *Theta22, *Theta23, *Theta33;
// evolution variables
var *g22o, *g23o, *g33o;
var *g220, *g230, *g330;
var *g22, *g23, *g33;
var *g221, *g231, *g331;
var *g22_rhs, *g23_rhs, *g33_rhs;
var *RNews, *INews;
var *omega, *dtomega;
MyList<var> *StateList, *SynchList_pre, *SynchList_cor, *RHSList;
MyList<var> *OldStateList, *DumpList, *CheckList;
MyList<var> *NewsList;
MyList<var> *g01List, *pg0AList, *g00List, *ThetaList;
double **g01wt, **pg0Awt, **g00wt, **Thetawt;
int myrank;
int shape[dim]; // for (rho, sigma, X), for rho and sigma means number of points for every pi/2
double Rmin, xmin, xmax;
int Symmetry;
int ingfs, fngfs;
MyList<ss_patch> *PatL;
MyList<pointstru> **ss_src, **ss_dst;
MyList<pointstru> **cs_src, **cs_dst;
public:
NullShellPatch2(int *shapei, double Rmini, double xmini, double xmaxi, int Symmetry, int myranki);
~NullShellPatch2();
double getdX(int dir);
void shellname(char *sn, int i);
void destroypsuList(MyList<pointstru> *ct);
MyList<Block> *compose_sh(int cpusize);
void Dump_xyz(char *tag, double time, double dT);
void Dump_Data(MyList<var> *DumpListi, char *tag, double time, double dT);
void setupintintstuff(int cpusize, MyList<Patch> *CPatL, int Symmetry);
void getlocalpox_ss(int isst, double ix, double iy, double iz, int &sst, double &lx, double &ly, double &lz);
void getlocalpox_fake(double x, double y, double z, int &sst, double &lx, double &ly, double &lz);
void getlocalpox(double x, double y, double z, int &sst, double &lx, double &ly, double &lz);
void getlocalpoxsst_ss(int isst, double ix, double iy, double iz, int lsst, double &lx, double &ly, double &lz);
void getlocalpoxsst(double x, double y, double z, int sst, double &lx, double &ly, double &lz);
void getglobalpox(double &x, double &y, double &z, int sst, double lx, double ly, double lz);
int getdumydimension(int acsst, int posst);
void get_Jacob(double *pox, int tsst, int ssst, double J[2][2]);
void prolongpointstru(MyList<pointstru> *&psul, MyList<ss_patch> *sPpi, double DH[dim],
MyList<Patch> *Ppi, double CDH[dim], MyList<pointstru> *pss);
bool prolongpointstru(MyList<pointstru> *&psul, bool ssyn, int tsst, MyList<ss_patch> *sPp, double DH[dim],
MyList<Patch> *Pp, double CDH[dim], double x, double y, double z, int Symmetry, int rank_in, const int iz);
bool prolongpointstru_ss(MyList<pointstru> *&psul, int tsst, MyList<ss_patch> *sPp, double DH[dim],
MyList<Patch> *Pp, double CDH[dim], double x, double y, double z, int Symmetry, int rank_in, const int iz);
void Setup_Initial_Data(bool checkrun, double PhysTime);
void Step(double dT, double PhysTime, monitor *ErrorMonitor);
void HyperSlice(double dT, double PhysTime, monitor *ErrorMonitor, int RK_count);
void Synch(MyList<var> *VarList, int Symmetry, double **Varwt, const short int svt);
void fill_symmetric_boundarybuffer(MyList<var> *VarList, double **Varwt);
void intertransfer(MyList<pointstru> **src, MyList<pointstru> **dst,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /*target */,
int Symmetry, double **Varwt, const short int svt);
int interdata_packer(double *data, MyList<pointstru> *src, MyList<pointstru> *dst, int rank_in, int dir,
MyList<var> *VarLists /* source */, MyList<var> *VarListd /* target */, int Symmetry, double **Varwt,
const short int svt);
int interdata_packer_pre(double *data, MyList<pointstru> *src, MyList<pointstru> *dst, int rank_in, int dir,
MyList<var> *VarLists /* source */, MyList<var> *VarListd /* target */, int Symmetry, double **Varwt,
const short int svt);
int interdata_packer_pot(double *data, MyList<pointstru> *src, MyList<pointstru> *dst, int rank_in, int dir,
MyList<var> *VarLists /* source */, MyList<var> *VarListd /* target */, int Symmetry, double **Varwt,
const short int svt);
void check_pointstrul(MyList<pointstru> *pp, bool first_only);
void checkBlock(int sst);
void Null_Boundary(double PhysTime);
void Compute_News(double PhysTime);
void Interp_Points_2D(MyList<var> *VarList,
int NN, double **XX, /*input fake global Cartesian coordinate*/
double *Shellf, int Symmetry);
double Error_Check(double PhysTime);
};
#endif /* NULLSHELLPATCH2_H */
#ifndef NULLSHELLPATCH2_H
#define NULLSHELLPATCH2_H
#ifdef newc
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cmath>
#include <complex>
using namespace std;
#else
#include <iostream.h>
#include <iomanip.h>
#include <fstream.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <complex.h>
#endif
#include <mpi.h>
#include "MyList.h"
#include "Block.h"
#include "Parallel.h"
#include "ShellPatch.h"
#include "var.h"
#include "macrodef.h" //need dim here; Vertex or Cell; ghost_width
#if (dim != 3)
#error NullShellPatch2 only supports 3 dimensional stuff yet
#endif
// x x x x x o *
// * o x x x x x
// each side contribute an overlap points
// so we need half of that
#define overghost ((ghost_width + 1) / 2 + ghost_width)
class NullShellPatch2
{
class xp_npatch : public ss_patch
{
public:
xp_npatch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 2; };
};
class xm_npatch : public ss_patch
{
public:
xm_npatch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 3; };
};
class yp_npatch : public ss_patch
{
public:
yp_npatch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 4; };
};
class ym_npatch : public ss_patch
{
public:
ym_npatch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 5; };
};
class zp_npatch : public ss_patch
{
public:
zp_npatch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 0; };
};
class zm_npatch : public ss_patch
{
public:
zm_npatch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 1; };
};
public:
struct pointstru
{
double gpox[dim]; // global cordinate
double lpox[dim]; // local cordinate
Block *Bg;
int ssst; //-1: cardisian, others as sst of ss_patch source sst
int tsst; //-1: cardisian, others as sst of ss_patch target sst
double *coef;
int *sind; // index position, considered dummy dimension already
int dumyd; // the dimension which has common lines, only useful in interdata_packer
double Jacob[2][2];
int indz; // index position of r direction
};
var *gx, *gy, *gz;
// surface variable
var *g00, *g01, *p02, *p03, *g02, *g03;
var *Theta22, *Theta23, *Theta33;
// evolution variables
var *g22o, *g23o, *g33o;
var *g220, *g230, *g330;
var *g22, *g23, *g33;
var *g221, *g231, *g331;
var *g22_rhs, *g23_rhs, *g33_rhs;
var *RNews, *INews;
var *omega, *dtomega;
MyList<var> *StateList, *SynchList_pre, *SynchList_cor, *RHSList;
MyList<var> *OldStateList, *DumpList, *CheckList;
MyList<var> *NewsList;
MyList<var> *g01List, *pg0AList, *g00List, *ThetaList;
double **g01wt, **pg0Awt, **g00wt, **Thetawt;
int myrank;
int shape[dim]; // for (rho, sigma, X), for rho and sigma means number of points for every pi/2
double Rmin, xmin, xmax;
int Symmetry;
int ingfs, fngfs;
MyList<ss_patch> *PatL;
MyList<pointstru> **ss_src, **ss_dst;
MyList<pointstru> **cs_src, **cs_dst;
public:
NullShellPatch2(int *shapei, double Rmini, double xmini, double xmaxi, int Symmetry, int myranki);
~NullShellPatch2();
double getdX(int dir);
void shellname(char *sn, int i);
void destroypsuList(MyList<pointstru> *ct);
MyList<Block> *compose_sh(int cpusize);
void Dump_xyz(char *tag, double time, double dT);
void Dump_Data(MyList<var> *DumpListi, char *tag, double time, double dT);
void setupintintstuff(int cpusize, MyList<Patch> *CPatL, int Symmetry);
void getlocalpox_ss(int isst, double ix, double iy, double iz, int &sst, double &lx, double &ly, double &lz);
void getlocalpox_fake(double x, double y, double z, int &sst, double &lx, double &ly, double &lz);
void getlocalpox(double x, double y, double z, int &sst, double &lx, double &ly, double &lz);
void getlocalpoxsst_ss(int isst, double ix, double iy, double iz, int lsst, double &lx, double &ly, double &lz);
void getlocalpoxsst(double x, double y, double z, int sst, double &lx, double &ly, double &lz);
void getglobalpox(double &x, double &y, double &z, int sst, double lx, double ly, double lz);
int getdumydimension(int acsst, int posst);
void get_Jacob(double *pox, int tsst, int ssst, double J[2][2]);
void prolongpointstru(MyList<pointstru> *&psul, MyList<ss_patch> *sPpi, double DH[dim],
MyList<Patch> *Ppi, double CDH[dim], MyList<pointstru> *pss);
bool prolongpointstru(MyList<pointstru> *&psul, bool ssyn, int tsst, MyList<ss_patch> *sPp, double DH[dim],
MyList<Patch> *Pp, double CDH[dim], double x, double y, double z, int Symmetry, int rank_in, const int iz);
bool prolongpointstru_ss(MyList<pointstru> *&psul, int tsst, MyList<ss_patch> *sPp, double DH[dim],
MyList<Patch> *Pp, double CDH[dim], double x, double y, double z, int Symmetry, int rank_in, const int iz);
void Setup_Initial_Data(bool checkrun, double PhysTime);
void Step(double dT, double PhysTime, monitor *ErrorMonitor);
void HyperSlice(double dT, double PhysTime, monitor *ErrorMonitor, int RK_count);
void Synch(MyList<var> *VarList, int Symmetry, double **Varwt, const short int svt);
void fill_symmetric_boundarybuffer(MyList<var> *VarList, double **Varwt);
void intertransfer(MyList<pointstru> **src, MyList<pointstru> **dst,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /*target */,
int Symmetry, double **Varwt, const short int svt);
int interdata_packer(double *data, MyList<pointstru> *src, MyList<pointstru> *dst, int rank_in, int dir,
MyList<var> *VarLists /* source */, MyList<var> *VarListd /* target */, int Symmetry, double **Varwt,
const short int svt);
int interdata_packer_pre(double *data, MyList<pointstru> *src, MyList<pointstru> *dst, int rank_in, int dir,
MyList<var> *VarLists /* source */, MyList<var> *VarListd /* target */, int Symmetry, double **Varwt,
const short int svt);
int interdata_packer_pot(double *data, MyList<pointstru> *src, MyList<pointstru> *dst, int rank_in, int dir,
MyList<var> *VarLists /* source */, MyList<var> *VarListd /* target */, int Symmetry, double **Varwt,
const short int svt);
void check_pointstrul(MyList<pointstru> *pp, bool first_only);
void checkBlock(int sst);
void Null_Boundary(double PhysTime);
void Compute_News(double PhysTime);
void Interp_Points_2D(MyList<var> *VarList,
int NN, double **XX, /*input fake global Cartesian coordinate*/
double *Shellf, int Symmetry);
double Error_Check(double PhysTime);
};
#endif /* NULLSHELLPATCH2_H */

View File

@@ -1,231 +1,229 @@
#ifndef PARALLEL_H
#define PARALLEL_H
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cmath>
#include <new>
using namespace std;
#include "Parallel_bam.h"
#include "var.h"
#include "MPatch.h"
#include "Block.h"
#include "MyList.h"
#include "macrodef.h" //need dim; ghost_width; CONTRACT
namespace Parallel
{
struct gridseg
{
double llb[dim];
double uub[dim];
int shape[dim];
double illb[dim], iuub[dim]; // only use for OutBdLow2Hi
Block *Bg;
};
int partition1(int &nx, int split_size, int min_width, int cpusize, int shape); // special for 1 diemnsion
int partition2(int *nxy, int split_size, int *min_width, int cpusize, int *shape); // special for 2 diemnsions
int partition3(int *nxyz, int split_size, int *min_width, int cpusize, int *shape);
MyList<Block> *distribute(MyList<Patch> *PatchLIST, int cpusize, int ingfsi, int fngfs, bool periodic, int nodes = 0); // produce corresponding Blocks
MyList<Block> *distribute_optimize(MyList<Patch> *PatchLIST, int cpusize, int ingfsi, int fngfs, bool periodic, int nodes = 0);
Block* splitHotspotBlock(MyList<Block>* &BlL, int _dim,
int ib0_orig, int ib3_orig,
int jb1_orig, int jb4_orig,
int kb2_orig, int kb5_orig,
Patch* PP, int r_left, int r_right,
int ingfsi, int fngfsi, bool periodic,
Block* &split_first_block, Block* &split_last_block);
Block* createMappedBlock(MyList<Block>* &BlL, int _dim, int* shape, double* bbox,
int block_id, int ingfsi, int fngfsi, int lev);
void KillBlocks(MyList<Patch> *PatchLIST);
void setfunction(MyList<Block> *BlL, var *vn, double func(double x, double y, double z));
void setfunction(int rank, MyList<Block> *BlL, var *vn, double func(double x, double y, double z));
void writefile(double time, int nx, int ny, int nz, double xmin, double xmax, double ymin, double ymax,
double zmin, double zmax, char *filename, double *data_out);
void writefile(double time, int nx, int ny, double xmin, double xmax, double ymin, double ymax,
char *filename, double *datain);
void getarrayindex(int DIM, int *shape, int *index, int n);
int getarraylocation(int DIM, int *shape, int *index);
void copy(int DIM, double *llbout, double *uubout, int *Dshape, double *DD, double *llbin, double *uubin,
int *shape, double *datain, double *llb, double *uub);
void Dump_CPU_Data(MyList<Block> *BlL, MyList<var> *DumpList, char *tag, double time, double dT);
void Dump_Data(MyList<Patch> *PL, MyList<var> *DumpList, char *tag, double time, double dT);
void Dump_Data(Patch *PP, MyList<var> *DumpList, char *tag, double time, double dT, int grd);
double *Collect_Data(Patch *PP, var *VP);
void d2Dump_Data(MyList<Patch> *PL, MyList<var> *DumpList, char *tag, double time, double dT);
void d2Dump_Data(Patch *PP, MyList<var> *DumpList, char *tag, double time, double dT, int grd);
void Dump_Data0(Patch *PP, MyList<var> *DumpList, char *tag, double time, double dT);
double global_interp(int DIM, int *ext, double **CoX, double *datain,
double *poX, int ordn, double *SoA, int Symmetry);
double global_interp(int DIM, int *ext, double **CoX, double *datain,
double *poX, int ordn);
double Lagrangian_Int(double x, int npts, double *xpts, double *funcvals);
double LagrangePoly(double x, int pt, int npts, double *xpts);
MyList<gridseg> *build_complete_gsl(Patch *Pat);
MyList<gridseg> *build_complete_gsl(MyList<Patch> *PatL);
MyList<gridseg> *build_complete_gsl_virtual(MyList<Patch> *PatL);
MyList<gridseg> *build_complete_gsl_virtual2(MyList<Patch> *PatL); // - buffer
MyList<gridseg> *build_owned_gsl0(Patch *Pat, int rank_in); // - ghost without extension, special for Sync usage
MyList<gridseg> *build_owned_gsl1(Patch *Pat, int rank_in); // - ghost, similar to build_owned_gsl0 but extend one point on left side for vertex grid
MyList<gridseg> *build_owned_gsl2(Patch *Pat, int rank_in); // - buffer - ghost
MyList<gridseg> *build_owned_gsl3(Patch *Pat, int rank_in, int Symmetry); // - ghost - BD ghost
MyList<gridseg> *build_owned_gsl4(Patch *Pat, int rank_in, int Symmetry); // - buffer - ghost - BD ghost
MyList<gridseg> *build_owned_gsl5(Patch *Pat, int rank_in); // similar to build_owned_gsl2 but no extension
MyList<gridseg> *build_owned_gsl(MyList<Patch> *PatL, int rank_in, int type, int Symmetry);
void build_gstl(MyList<gridseg> *srci, MyList<gridseg> *dsti, MyList<gridseg> **out_src, MyList<gridseg> **out_dst);
int data_packer(double *data, MyList<gridseg> *src, MyList<gridseg> *dst, int rank_in, int dir,
MyList<var> *VarLists, MyList<var> *VarListd, int Symmetry);
void transfer(MyList<gridseg> **src, MyList<gridseg> **dst,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /*target */,
int Symmetry);
int data_packermix(double *data, MyList<gridseg> *src, MyList<gridseg> *dst, int rank_in, int dir,
MyList<var> *VarLists, MyList<var> *VarListd, int Symmetry);
void transfermix(MyList<gridseg> **src, MyList<gridseg> **dst,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /*target */,
int Symmetry);
void Sync(Patch *Pat, MyList<var> *VarList, int Symmetry);
void Sync(MyList<Patch> *PatL, MyList<var> *VarList, int Symmetry);
void Sync_merged(MyList<Patch> *PatL, MyList<var> *VarList, int Symmetry);
struct SyncCache {
bool valid;
int cpusize;
MyList<gridseg> **combined_src;
MyList<gridseg> **combined_dst;
int *send_lengths;
int *recv_lengths;
double **send_bufs;
double **recv_bufs;
int *send_buf_caps;
int *recv_buf_caps;
MPI_Request *reqs;
MPI_Status *stats;
int max_reqs;
bool lengths_valid;
int *tc_req_node;
int *tc_req_is_recv;
int *tc_completed;
SyncCache();
void invalidate();
void destroy();
};
void Sync_cached(MyList<Patch> *PatL, MyList<var> *VarList, int Symmetry, SyncCache &cache);
void transfer_cached(MyList<gridseg> **src, MyList<gridseg> **dst,
MyList<var> *VarList1, MyList<var> *VarList2,
int Symmetry, SyncCache &cache);
struct AsyncSyncState {
int req_no;
bool active;
int *req_node;
int *req_is_recv;
int pending_recv;
AsyncSyncState() : req_no(0), active(false), req_node(0), req_is_recv(0), pending_recv(0) {}
};
void Sync_start(MyList<Patch> *PatL, MyList<var> *VarList, int Symmetry,
SyncCache &cache, AsyncSyncState &state);
void Sync_finish(SyncCache &cache, AsyncSyncState &state,
MyList<var> *VarList, int Symmetry);
void OutBdLow2Hi(Patch *Patc, Patch *Patf,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /* target */,
int Symmetry);
void OutBdLow2Hi(MyList<Patch> *PatcL, MyList<Patch> *PatfL,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /* target */,
int Symmetry);
void OutBdLow2Himix(Patch *Patc, Patch *Patf,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /* target */,
int Symmetry);
void OutBdLow2Himix(MyList<Patch> *PatcL, MyList<Patch> *PatfL,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /* target */,
int Symmetry);
void Restrict_cached(MyList<Patch> *PatcL, MyList<Patch> *PatfL,
MyList<var> *VarList1, MyList<var> *VarList2,
int Symmetry, SyncCache &cache);
void OutBdLow2Hi_cached(MyList<Patch> *PatcL, MyList<Patch> *PatfL,
MyList<var> *VarList1, MyList<var> *VarList2,
int Symmetry, SyncCache &cache);
void OutBdLow2Himix_cached(MyList<Patch> *PatcL, MyList<Patch> *PatfL,
MyList<var> *VarList1, MyList<var> *VarList2,
int Symmetry, SyncCache &cache);
void Prolong(Patch *Patc, Patch *Patf,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /* target */,
int Symmetry);
void Prolongint(Patch *Patc, Patch *Patf,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /* target */,
int Symmetry);
void Restrict(MyList<Patch> *PatcL, MyList<Patch> *PatfL,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /* target */,
int Symmetry);
void Restrict_after(MyList<Patch> *PatcL, MyList<Patch> *PatfL,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /* target */,
int Symmetry); // for -ghost - BDghost
MyList<Parallel::gridseg> *build_PhysBD_gsl(Patch *Pat);
MyList<Parallel::gridseg> *build_ghost_gsl(MyList<Patch> *PatL);
MyList<Parallel::gridseg> *build_ghost_gsl(Patch *Pat);
MyList<Parallel::gridseg> *build_buffer_gsl(Patch *Pat);
MyList<Parallel::gridseg> *build_buffer_gsl(MyList<Patch> *PatL);
MyList<Parallel::gridseg> *gsl_subtract(MyList<Parallel::gridseg> *A, MyList<Parallel::gridseg> *B);
MyList<Parallel::gridseg> *gs_subtract(MyList<Parallel::gridseg> *A, MyList<Parallel::gridseg> *B);
MyList<Parallel::gridseg> *gsl_and(MyList<Parallel::gridseg> *A, MyList<Parallel::gridseg> *B);
MyList<Parallel::gridseg> *gs_and(MyList<Parallel::gridseg> *A, MyList<Parallel::gridseg> *B);
MyList<Parallel::gridseg> *clone_gsl(MyList<Parallel::gridseg> *p, bool first_only);
MyList<Parallel::gridseg> *build_bulk_gsl(Patch *Pat); // similar to build_owned_gsl0 but does not care rank issue
MyList<Parallel::gridseg> *build_bulk_gsl(Block *bp, Patch *Pat);
void build_PhysBD_gstl(Patch *Pat, MyList<Parallel::gridseg> *srci, MyList<Parallel::gridseg> *dsti,
MyList<Parallel::gridseg> **out_src, MyList<Parallel::gridseg> **out_dst);
void PeriodicBD(Patch *Pat, MyList<var> *VarList, int Symmetry);
double L2Norm(Patch *Pat, var *vf);
void L2Norm7(Patch *Pat, var **vf, double *norms);
void checkgsl(MyList<Parallel::gridseg> *pp, bool first_only);
void checkvarl(MyList<var> *pp, bool first_only);
MyList<Parallel::gridseg> *divide_gsl(MyList<Parallel::gridseg> *p, Patch *Pat);
MyList<Parallel::gridseg> *divide_gs(MyList<Parallel::gridseg> *p, Patch *Pat);
void prepare_inter_time_level(Patch *Pat,
MyList<var> *VarList1 /* source (t+dt) */, MyList<var> *VarList2 /* source (t) */,
MyList<var> *VarList3 /* target (t+a*dt) */, int tindex);
void prepare_inter_time_level(Patch *Pat,
MyList<var> *VarList1 /* source (t+dt) */, MyList<var> *VarList2 /* source (t) */,
MyList<var> *VarList3 /* source (t-dt) */, MyList<var> *VarList4 /* target (t+a*dt) */, int tindex);
void prepare_inter_time_level(MyList<Patch> *PatL,
MyList<var> *VarList1 /* source (t+dt) */, MyList<var> *VarList2 /* source (t) */,
MyList<var> *VarList3 /* target (t+a*dt) */, int tindex);
void prepare_inter_time_level(MyList<Patch> *Pat,
MyList<var> *VarList1 /* source (t+dt) */, MyList<var> *VarList2 /* source (t) */,
MyList<var> *VarList3 /* source (t-dt) */, MyList<var> *VarList4 /* target (t+a*dt) */, int tindex);
void merge_gsl(MyList<gridseg> *&A, const double ratio);
bool merge_gs(MyList<gridseg> *D, MyList<gridseg> *B, MyList<gridseg> *&C, const double ratio);
// Add ghost region to tangent plane
// we assume the grids have the same resolution
void add_ghost_touch(MyList<gridseg> *&A);
void cut_gsl(MyList<gridseg> *&A);
bool cut_gs(MyList<gridseg> *D, MyList<gridseg> *B, MyList<gridseg> *&C);
MyList<Parallel::gridseg> *gs_subtract_virtual(MyList<Parallel::gridseg> *A, MyList<Parallel::gridseg> *B);
void fill_level_data(MyList<Patch> *PatLd, MyList<Patch> *PatLs, MyList<Patch> *PatcL,
MyList<var> *OldList, MyList<var> *StateList, MyList<var> *FutureList,
MyList<var> *tmList, int Symmetry, bool BB, bool CC);
bool PatList_Interp_Points(MyList<Patch> *PatL, MyList<var> *VarList,
int NN, double **XX,
double *Shellf, int Symmetry);
void aligncheck(double *bbox0, double *bboxl, int lev, double *DH0, int *shape);
bool point_locat_gsl(double *pox, MyList<Parallel::gridseg> *gsl);
void checkpatchlist(MyList<Patch> *PatL, bool buflog);
double L2Norm(Patch *Pat, var *vf, MPI_Comm Comm_here);
void L2Norm7(Patch *Pat, var **vf, double *norms, MPI_Comm Comm_here);
bool PatList_Interp_Points(MyList<Patch> *PatL, MyList<var> *VarList,
int NN, double **XX,
double *Shellf, int Symmetry, MPI_Comm Comm_here);
#if (PSTR == 1 || PSTR == 2 || PSTR == 3)
MyList<Block> *distribute(MyList<Patch> *PatchLIST, int cpusize, int ingfsi, int fngfsi,
bool periodic, int start_rank, int end_rank, int nodes = 0);
#endif
}
#endif /*PARALLEL_H */
#ifndef PARALLEL_H
#define PARALLEL_H
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cmath>
#include <new>
using namespace std;
#include "Parallel_bam.h"
#include "var.h"
#include "MPatch.h"
#include "Block.h"
#include "MyList.h"
#include "macrodef.h" //need dim; ghost_width; CONTRACT
namespace Parallel
{
struct gridseg
{
double llb[dim];
double uub[dim];
int shape[dim];
double illb[dim], iuub[dim]; // only use for OutBdLow2Hi
Block *Bg;
};
int partition1(int &nx, int split_size, int min_width, int cpusize, int shape); // special for 1 diemnsion
int partition2(int *nxy, int split_size, int *min_width, int cpusize, int *shape); // special for 2 diemnsions
int partition3(int *nxyz, int split_size, int *min_width, int cpusize, int *shape);
MyList<Block> *distribute(MyList<Patch> *PatchLIST, int cpusize, int ingfsi, int fngfs, bool periodic, int nodes = 0); // produce corresponding Blocks
MyList<Block> *distribute_optimize(MyList<Patch> *PatchLIST, int cpusize, int ingfsi, int fngfs, bool periodic, int nodes = 0);
Block* splitHotspotBlock(MyList<Block>* &BlL, int _dim,
int ib0_orig, int ib3_orig,
int jb1_orig, int jb4_orig,
int kb2_orig, int kb5_orig,
Patch* PP, int r_left, int r_right,
int ingfsi, int fngfsi, bool periodic,
Block* &split_first_block, Block* &split_last_block);
Block* createMappedBlock(MyList<Block>* &BlL, int _dim, int* shape, double* bbox,
int block_id, int ingfsi, int fngfsi, int lev);
void KillBlocks(MyList<Patch> *PatchLIST);
void setfunction(MyList<Block> *BlL, var *vn, double func(double x, double y, double z));
void setfunction(int rank, MyList<Block> *BlL, var *vn, double func(double x, double y, double z));
void writefile(double time, int nx, int ny, int nz, double xmin, double xmax, double ymin, double ymax,
double zmin, double zmax, char *filename, double *data_out);
void writefile(double time, int nx, int ny, double xmin, double xmax, double ymin, double ymax,
char *filename, double *datain);
void getarrayindex(int DIM, int *shape, int *index, int n);
int getarraylocation(int DIM, int *shape, int *index);
void copy(int DIM, double *llbout, double *uubout, int *Dshape, double *DD, double *llbin, double *uubin,
int *shape, double *datain, double *llb, double *uub);
void Dump_CPU_Data(MyList<Block> *BlL, MyList<var> *DumpList, char *tag, double time, double dT);
void Dump_Data(MyList<Patch> *PL, MyList<var> *DumpList, char *tag, double time, double dT);
void Dump_Data(Patch *PP, MyList<var> *DumpList, char *tag, double time, double dT, int grd);
double *Collect_Data(Patch *PP, var *VP);
void d2Dump_Data(MyList<Patch> *PL, MyList<var> *DumpList, char *tag, double time, double dT);
void d2Dump_Data(Patch *PP, MyList<var> *DumpList, char *tag, double time, double dT, int grd);
void Dump_Data0(Patch *PP, MyList<var> *DumpList, char *tag, double time, double dT);
double global_interp(int DIM, int *ext, double **CoX, double *datain,
double *poX, int ordn, double *SoA, int Symmetry);
double global_interp(int DIM, int *ext, double **CoX, double *datain,
double *poX, int ordn);
double Lagrangian_Int(double x, int npts, double *xpts, double *funcvals);
double LagrangePoly(double x, int pt, int npts, double *xpts);
MyList<gridseg> *build_complete_gsl(Patch *Pat);
MyList<gridseg> *build_complete_gsl(MyList<Patch> *PatL);
MyList<gridseg> *build_complete_gsl_virtual(MyList<Patch> *PatL);
MyList<gridseg> *build_complete_gsl_virtual2(MyList<Patch> *PatL); // - buffer
MyList<gridseg> *build_owned_gsl0(Patch *Pat, int rank_in); // - ghost without extension, special for Sync usage
MyList<gridseg> *build_owned_gsl1(Patch *Pat, int rank_in); // - ghost, similar to build_owned_gsl0 but extend one point on left side for vertex grid
MyList<gridseg> *build_owned_gsl2(Patch *Pat, int rank_in); // - buffer - ghost
MyList<gridseg> *build_owned_gsl3(Patch *Pat, int rank_in, int Symmetry); // - ghost - BD ghost
MyList<gridseg> *build_owned_gsl4(Patch *Pat, int rank_in, int Symmetry); // - buffer - ghost - BD ghost
MyList<gridseg> *build_owned_gsl5(Patch *Pat, int rank_in); // similar to build_owned_gsl2 but no extension
MyList<gridseg> *build_owned_gsl(MyList<Patch> *PatL, int rank_in, int type, int Symmetry);
void build_gstl(MyList<gridseg> *srci, MyList<gridseg> *dsti, MyList<gridseg> **out_src, MyList<gridseg> **out_dst);
int data_packer(double *data, MyList<gridseg> *src, MyList<gridseg> *dst, int rank_in, int dir,
MyList<var> *VarLists, MyList<var> *VarListd, int Symmetry);
void transfer(MyList<gridseg> **src, MyList<gridseg> **dst,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /*target */,
int Symmetry);
int data_packermix(double *data, MyList<gridseg> *src, MyList<gridseg> *dst, int rank_in, int dir,
MyList<var> *VarLists, MyList<var> *VarListd, int Symmetry);
void transfermix(MyList<gridseg> **src, MyList<gridseg> **dst,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /*target */,
int Symmetry);
void Sync(Patch *Pat, MyList<var> *VarList, int Symmetry);
void Sync(MyList<Patch> *PatL, MyList<var> *VarList, int Symmetry);
void Sync_merged(MyList<Patch> *PatL, MyList<var> *VarList, int Symmetry);
struct SyncCache {
bool valid;
int cpusize;
MyList<gridseg> **combined_src;
MyList<gridseg> **combined_dst;
int *send_lengths;
int *recv_lengths;
double **send_bufs;
double **recv_bufs;
int *send_buf_caps;
int *recv_buf_caps;
MPI_Request *reqs;
MPI_Status *stats;
int max_reqs;
bool lengths_valid;
int *tc_req_node;
int *tc_req_is_recv;
int *tc_completed;
SyncCache();
void invalidate();
void destroy();
};
void Sync_cached(MyList<Patch> *PatL, MyList<var> *VarList, int Symmetry, SyncCache &cache);
void transfer_cached(MyList<gridseg> **src, MyList<gridseg> **dst,
MyList<var> *VarList1, MyList<var> *VarList2,
int Symmetry, SyncCache &cache);
struct AsyncSyncState {
int req_no;
bool active;
int *req_node;
int *req_is_recv;
int pending_recv;
AsyncSyncState() : req_no(0), active(false), req_node(0), req_is_recv(0), pending_recv(0) {}
};
void Sync_start(MyList<Patch> *PatL, MyList<var> *VarList, int Symmetry,
SyncCache &cache, AsyncSyncState &state);
void Sync_finish(SyncCache &cache, AsyncSyncState &state,
MyList<var> *VarList, int Symmetry);
void OutBdLow2Hi(Patch *Patc, Patch *Patf,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /* target */,
int Symmetry);
void OutBdLow2Hi(MyList<Patch> *PatcL, MyList<Patch> *PatfL,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /* target */,
int Symmetry);
void OutBdLow2Himix(Patch *Patc, Patch *Patf,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /* target */,
int Symmetry);
void OutBdLow2Himix(MyList<Patch> *PatcL, MyList<Patch> *PatfL,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /* target */,
int Symmetry);
void Restrict_cached(MyList<Patch> *PatcL, MyList<Patch> *PatfL,
MyList<var> *VarList1, MyList<var> *VarList2,
int Symmetry, SyncCache &cache);
void OutBdLow2Hi_cached(MyList<Patch> *PatcL, MyList<Patch> *PatfL,
MyList<var> *VarList1, MyList<var> *VarList2,
int Symmetry, SyncCache &cache);
void OutBdLow2Himix_cached(MyList<Patch> *PatcL, MyList<Patch> *PatfL,
MyList<var> *VarList1, MyList<var> *VarList2,
int Symmetry, SyncCache &cache);
void Prolong(Patch *Patc, Patch *Patf,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /* target */,
int Symmetry);
void Prolongint(Patch *Patc, Patch *Patf,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /* target */,
int Symmetry);
void Restrict(MyList<Patch> *PatcL, MyList<Patch> *PatfL,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /* target */,
int Symmetry);
void Restrict_after(MyList<Patch> *PatcL, MyList<Patch> *PatfL,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /* target */,
int Symmetry); // for -ghost - BDghost
MyList<Parallel::gridseg> *build_PhysBD_gsl(Patch *Pat);
MyList<Parallel::gridseg> *build_ghost_gsl(MyList<Patch> *PatL);
MyList<Parallel::gridseg> *build_ghost_gsl(Patch *Pat);
MyList<Parallel::gridseg> *build_buffer_gsl(Patch *Pat);
MyList<Parallel::gridseg> *build_buffer_gsl(MyList<Patch> *PatL);
MyList<Parallel::gridseg> *gsl_subtract(MyList<Parallel::gridseg> *A, MyList<Parallel::gridseg> *B);
MyList<Parallel::gridseg> *gs_subtract(MyList<Parallel::gridseg> *A, MyList<Parallel::gridseg> *B);
MyList<Parallel::gridseg> *gsl_and(MyList<Parallel::gridseg> *A, MyList<Parallel::gridseg> *B);
MyList<Parallel::gridseg> *gs_and(MyList<Parallel::gridseg> *A, MyList<Parallel::gridseg> *B);
MyList<Parallel::gridseg> *clone_gsl(MyList<Parallel::gridseg> *p, bool first_only);
MyList<Parallel::gridseg> *build_bulk_gsl(Patch *Pat); // similar to build_owned_gsl0 but does not care rank issue
MyList<Parallel::gridseg> *build_bulk_gsl(Block *bp, Patch *Pat);
void build_PhysBD_gstl(Patch *Pat, MyList<Parallel::gridseg> *srci, MyList<Parallel::gridseg> *dsti,
MyList<Parallel::gridseg> **out_src, MyList<Parallel::gridseg> **out_dst);
void PeriodicBD(Patch *Pat, MyList<var> *VarList, int Symmetry);
double L2Norm(Patch *Pat, var *vf);
void checkgsl(MyList<Parallel::gridseg> *pp, bool first_only);
void checkvarl(MyList<var> *pp, bool first_only);
MyList<Parallel::gridseg> *divide_gsl(MyList<Parallel::gridseg> *p, Patch *Pat);
MyList<Parallel::gridseg> *divide_gs(MyList<Parallel::gridseg> *p, Patch *Pat);
void prepare_inter_time_level(Patch *Pat,
MyList<var> *VarList1 /* source (t+dt) */, MyList<var> *VarList2 /* source (t) */,
MyList<var> *VarList3 /* target (t+a*dt) */, int tindex);
void prepare_inter_time_level(Patch *Pat,
MyList<var> *VarList1 /* source (t+dt) */, MyList<var> *VarList2 /* source (t) */,
MyList<var> *VarList3 /* source (t-dt) */, MyList<var> *VarList4 /* target (t+a*dt) */, int tindex);
void prepare_inter_time_level(MyList<Patch> *PatL,
MyList<var> *VarList1 /* source (t+dt) */, MyList<var> *VarList2 /* source (t) */,
MyList<var> *VarList3 /* target (t+a*dt) */, int tindex);
void prepare_inter_time_level(MyList<Patch> *Pat,
MyList<var> *VarList1 /* source (t+dt) */, MyList<var> *VarList2 /* source (t) */,
MyList<var> *VarList3 /* source (t-dt) */, MyList<var> *VarList4 /* target (t+a*dt) */, int tindex);
void merge_gsl(MyList<gridseg> *&A, const double ratio);
bool merge_gs(MyList<gridseg> *D, MyList<gridseg> *B, MyList<gridseg> *&C, const double ratio);
// Add ghost region to tangent plane
// we assume the grids have the same resolution
void add_ghost_touch(MyList<gridseg> *&A);
void cut_gsl(MyList<gridseg> *&A);
bool cut_gs(MyList<gridseg> *D, MyList<gridseg> *B, MyList<gridseg> *&C);
MyList<Parallel::gridseg> *gs_subtract_virtual(MyList<Parallel::gridseg> *A, MyList<Parallel::gridseg> *B);
void fill_level_data(MyList<Patch> *PatLd, MyList<Patch> *PatLs, MyList<Patch> *PatcL,
MyList<var> *OldList, MyList<var> *StateList, MyList<var> *FutureList,
MyList<var> *tmList, int Symmetry, bool BB, bool CC);
bool PatList_Interp_Points(MyList<Patch> *PatL, MyList<var> *VarList,
int NN, double **XX,
double *Shellf, int Symmetry);
void aligncheck(double *bbox0, double *bboxl, int lev, double *DH0, int *shape);
bool point_locat_gsl(double *pox, MyList<Parallel::gridseg> *gsl);
void checkpatchlist(MyList<Patch> *PatL, bool buflog);
double L2Norm(Patch *Pat, var *vf, MPI_Comm Comm_here);
bool PatList_Interp_Points(MyList<Patch> *PatL, MyList<var> *VarList,
int NN, double **XX,
double *Shellf, int Symmetry, MPI_Comm Comm_here);
#if (PSTR == 1 || PSTR == 2 || PSTR == 3)
MyList<Block> *distribute(MyList<Patch> *PatchLIST, int cpusize, int ingfsi, int fngfsi,
bool periodic, int start_rank, int end_rank, int nodes = 0);
#endif
}
#endif /*PARALLEL_H */

View File

@@ -1,53 +1,53 @@
#ifndef PARALLEL_BAM_H
#define PARALLEL_BAM_H
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cmath>
#include <new>
using namespace std;
#include "var.h"
#include "MPatch.h"
#include "Block.h"
#include "MyList.h"
#include "macrodef.h"
namespace Parallel
{
struct pointstru_bam
{
double pox[dim]; // cordinate
Block *Bgs; // interplate from
Block *Bgd; // interplate for
double *coef; // interpolation coefficients
int sind[dim]; // interpolation starting array index
};
void destroypsuList_bam(MyList<pointstru_bam> *ct);
void OutBdLow2Hi_bam(MyList<Patch> *PLc, MyList<Patch> *PLf,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /* target */,
int Symmetry);
void OutBdLow2Hi_bam(MyList<Patch> *PLc, MyList<Patch> *PLf,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /* target */,
MyList<Parallel::pointstru_bam> *bdsul, int Symmetry);
void Constr_pointstr_OutBdLow2Hi(MyList<Patch> *PLf, MyList<Patch> *PLc,
MyList<Parallel::pointstru_bam> *&bdsul);
void Restrict_bam(MyList<Patch> *PLc, MyList<Patch> *PLf,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /* target */,
int Symmetry);
void Restrict_bam(MyList<Patch> *PLc, MyList<Patch> *PLf,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /* target */,
MyList<Parallel::pointstru_bam> *rsul, int Symmetry);
void Constr_pointstr_Restrict(MyList<Patch> *PLf, MyList<Patch> *PLc,
MyList<Parallel::pointstru_bam> *&rsul);
void intertransfer(MyList<Parallel::pointstru_bam> *&sul,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /*target */,
int Symmetry);
int interdata_packer(double *data, MyList<Parallel::pointstru_bam> *sul, int myrank, int node, int dir,
MyList<var> *VarLists /* source */, MyList<var> *VarListd /* target */, int Symmetry);
}
#endif /*PARALLEL_BAM_H */
#ifndef PARALLEL_BAM_H
#define PARALLEL_BAM_H
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cmath>
#include <new>
using namespace std;
#include "var.h"
#include "MPatch.h"
#include "Block.h"
#include "MyList.h"
#include "macrodef.h"
namespace Parallel
{
struct pointstru_bam
{
double pox[dim]; // cordinate
Block *Bgs; // interplate from
Block *Bgd; // interplate for
double *coef; // interpolation coefficients
int sind[dim]; // interpolation starting array index
};
void destroypsuList_bam(MyList<pointstru_bam> *ct);
void OutBdLow2Hi_bam(MyList<Patch> *PLc, MyList<Patch> *PLf,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /* target */,
int Symmetry);
void OutBdLow2Hi_bam(MyList<Patch> *PLc, MyList<Patch> *PLf,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /* target */,
MyList<Parallel::pointstru_bam> *bdsul, int Symmetry);
void Constr_pointstr_OutBdLow2Hi(MyList<Patch> *PLf, MyList<Patch> *PLc,
MyList<Parallel::pointstru_bam> *&bdsul);
void Restrict_bam(MyList<Patch> *PLc, MyList<Patch> *PLf,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /* target */,
int Symmetry);
void Restrict_bam(MyList<Patch> *PLc, MyList<Patch> *PLf,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /* target */,
MyList<Parallel::pointstru_bam> *rsul, int Symmetry);
void Constr_pointstr_Restrict(MyList<Patch> *PLf, MyList<Patch> *PLc,
MyList<Parallel::pointstru_bam> *&rsul);
void intertransfer(MyList<Parallel::pointstru_bam> *&sul,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /*target */,
int Symmetry);
int interdata_packer(double *data, MyList<Parallel::pointstru_bam> *sul, int myrank, int node, int dir,
MyList<var> *VarLists /* source */, MyList<var> *VarListd /* target */, int Symmetry);
}
#endif /*PARALLEL_BAM_H */

View File

@@ -1,271 +1,271 @@
! define scalar field distribution and potential in F(R) scalar-tensor theory
! 1: Case C of 1112.3928, V=0
! 2: shell with a2^2*phi0/(1+a2^2), f(R) = R+a2*R^2 induced V
! 3: ground state of Schrodinger-Newton system, f(R) = R+a2*R^2 induced V
! 4: a2 = oo and \phi = \phi_0*0.5*(tanh((r+r_0)/\sigma)-tanh((r-r_0)/\sigma))
! 5: shell with phi0*dexp(-(r-r0)**2/sigma), V = 0
! original way, manually define the preprocessor macro
! #define CC 2
! the new way, define according to the preprocessor macro in "macrodef.fh"
#include "macrodef.fh"
#define CC EScalar_CC
subroutine setparameters(a2,r0,phi0,sigma,l2)
implicit none
real*8,intent(out) :: a2,r0,phi0,sigma,l2
! original way: read in parameters one by one
! call seta2(a2)
! call setphi0(phi0)
! new way: read in all parameters at once
call set_escalar_parameter(a2, phi0, r0, sigma, l2)
! r0=120.d0
! sigma=8.d0
! l2=1.d4
! write(*,*)
! write(*,*) " Set_Rho_ADM.f90 a2 = ", a2
! write(*,*) " Set_Rho_ADM.f90 phi0 = ", phi0
! write(*,*) " Set_Rho_ADM.f90 r0 = ", r0
! write(*,*) " Set_Rho_ADM.f90 sigma0 = ", sigma
! write(*,*) " Set_Rho_ADM.f90 l2 = ", l2
! write(*,*)
return
end subroutine setparameters
!===================================================================
function phi(X,Y,Z) result(gont)
implicit none
double precision,intent(in)::X
double precision,intent(in)::Y
double precision,intent(in)::Z
real*8 :: gont
real*8 ::r
real*8 :: a2,r0,phi0,sigma,l2
call setparameters(a2,r0,phi0,sigma,l2)
r=dsqrt(X*X+Y*Y+Z*Z)
#if ( CC == 1)
! configuration 1
gont = phi0*dtanh((r-r0)/sigma)
#elif ( CC == 2)
! configuration 2
phi0 = a2**2*phi0/(1+a2**2)
gont = phi0*dexp(-(r-r0)**2/sigma)
#elif ( CC == 3)
gont = (0.0481646d0*dexp(-0.0581545d0*(r-1.8039d-8)*(r-1.8039d-8)/l2) &
+0.298408d0*dexp(-0.111412d0*(r+9.6741d-9)*(r+9.6741d-9)/l2)+ &
0.42755d0*dexp(-0.207156d0*(r-1.09822d-8)*(r-1.09822d-8)/l2)+ &
0.204229d0*dexp(-0.37742d0*(r+2.13778d-8)*(r+2.13778d-8)/l2)+ &
0.021649d0*dexp(-0.68406d0*(r-8.78608d-8)*(r-8.78608d-8)/l2))/l2
#elif ( CC == 4)
! configuration 4, a2 = oo
phi0 = 0.5d0*phi0
gont = phi0*(dtanh((r+r0)/sigma)-dtanh((r-r0)/sigma))
#elif ( CC == 5)
! configuration 5
gont = phi0*dexp(-(r-r0)**2/sigma)
#endif
return
end function phi
! d phi/dr
function dphi(X,Y,Z) result(gont)
implicit none
double precision,intent(in)::X
double precision,intent(in)::Y
double precision,intent(in)::Z
real*8 :: gont
real*8 ::r
real*8 :: a2,r0,phi0,sigma,l2
call setparameters(a2,r0,phi0,sigma,l2)
r=dsqrt(X*X+Y*Y+Z*Z)
#if ( CC == 1)
! configuration 1
gont = phi0/sigma*(1-(dtanh((r-r0)/sigma))**2)
#elif ( CC == 2)
! configuration 2
phi0 = a2**2*phi0/(1+a2**2)
gont = -2.d0*phi0*(r-r0)/sigma*exp(-(r-r0)**2/sigma)
#elif ( CC == 3)
gont = (-0.5601976461d-2*(r-0.18039d-7)/l2*dexp(-0.581545d-1*(r-0.18039d-7)**2/l2) &
-0.6649246419d-1*(r+0.96741d-8)/l2*dexp(-0.111412d0*(r+.96741e-8)**2/l2) &
-0.1771390956d0*(r-0.109822d-7)/l2*dexp(-0.207156d0*(r-0.109822d-7)**2/l2) &
-0.1541602184d0*(r+0.213778d-7)/l2*dexp(-0.37742d0*(r+0.213778d-7)**2/l2) &
-0.2961842988d-1*(r-0.878608d-7)/l2*dexp(-0.68406*(r-0.878608d-7)**2/l2))/l2
#elif ( CC == 4)
! configuration 4, a2 = oo
phi0 = 0.5d0*phi0
gont = phi0*((1-dtanh((r+r0)/sigma)**2)/sigma- &
(1-dtanh((r-r0)/sigma)**2)/sigma)
#elif ( CC == 5)
! configuration 5
gont = -2.d0*phi0*(r-r0)/sigma*exp(-(r-r0)**2/sigma)
#endif
return
end function dphi
!==================================================================
function potential(X,Y,Z) result(gont)
implicit none
double precision,intent(in)::X
double precision,intent(in)::Y
double precision,intent(in)::Z
real*8 :: gont
real*8 :: phi
real*8 :: PI,v
real*8 :: a2,r0,phi0,sigma,l2
#if ( CC == 1 || CC == 4 || CC == 5)
gont = 0.d0
#elif ( CC == 2 || CC == 3)
call setparameters(a2,r0,phi0,sigma,l2)
PI = dacos(-1.d0)
v = phi(X,Y,Z)
gont = dexp(-8.d0*dsqrt(PI/3)*v)*(1-dexp(4*dsqrt(PI/3)*v))**2/32/PI/a2
#endif
return
end function potential
!==================================================================
!Note this part is for evolution
!not just for initial configuration
!f(R) potential F=R+a_2R^2
subroutine frpotential(ex,Sphi,V,dVdSphi)
implicit none
integer,intent(in ):: ex(1:3)
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Sphi
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: V,dVdSphi
real*8 :: a2,r0,phi0,sigma,l2
real*8, parameter :: Four = 4.d0, TWO = 2.d0,ONE = 1.d0,ZEO=0.d0
real*8 :: PI
PI = dacos(-ONE)
#if ( CC == 1 || CC == 4 || CC == 5)
V = ZEO
dVdSphi = ZEO
#elif ( CC == 2 || CC == 3)
call setparameters(a2,r0,phi0,sigma,l2)
V = dexp(-8.d0*dsqrt(PI/3)*Sphi)*(1-dexp(4*dsqrt(PI/3)*Sphi))**2/32/PI/a2
dVdSphi = 1.d0/a2/1.2d1*dsqrt(3.d0/PI)*dexp(-8.d0*dsqrt(PI/3.d0)*Sphi)*(-1+dexp(4*dsqrt(Pi/3)*Sphi))
#endif
return
end subroutine frpotential
!==================================================================
!f(R) potential F=R+a_2R^2
!fprim(R) = 1+2*a_2*R
subroutine frfprim(ex,RR,fprim)
implicit none
integer,intent(in ):: ex(1:3)
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: RR
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: fprim
real*8 :: a2,r0,phi0,sigma,l2
real*8, parameter :: ONE=1.d0, TWO = 2.d0
#if ( CC == 1 || CC == 4 || CC == 5)
fprim = ONE
#elif ( CC == 2 || CC == 3)
call setparameters(a2,r0,phi0,sigma,l2)
fprim = ONE+TWO*a2*RR
#endif
return
end subroutine frfprim
!==================================================================
subroutine set_rho_adm2(ex,rho,X,Y,Z)
implicit none
! argument variables
integer,intent(in)::ex
double precision,intent(in),dimension(ex)::X
double precision,intent(in),dimension(ex)::Y
double precision,intent(in),dimension(ex)::Z
double precision,intent(out),dimension(ex)::rho
integer :: i
real*8 :: dphi
do i=1,ex
! rho(i) = dphi(X,Y,Z)
rho(i) = dphi(X(i),Y(i),Z(i))
rho(i) = rho(i)*rho(i)
enddo
return
end subroutine set_rho_adm2
subroutine set_rho_adm1(ex,rho,X,Y,Z)
implicit none
! argument variables
integer,intent(in)::ex
double precision,intent(in),dimension(ex)::X
double precision,intent(in),dimension(ex)::Y
double precision,intent(in),dimension(ex)::Z
double precision,intent(out),dimension(ex)::rho
real*8 :: potential
integer :: i
do i=1,ex
rho(i) = potential(X(i),Y(i),Z(i))
enddo
return
end subroutine set_rho_adm1
subroutine set_rho_adm(ex,rho,X,Y,Z)
implicit none
! argument variables
integer,intent(in)::ex
double precision,intent(in),dimension(ex)::X
double precision,intent(in),dimension(ex)::Y
double precision,intent(in),dimension(ex)::Z
! in psivac, out rho_adm
double precision,intent(inout),dimension(ex)::rho
double precision,dimension(ex)::rho1,rho2
call set_rho_adm1(ex,rho1,X,Y,Z)
call set_rho_adm2(ex,rho2,X,Y,Z)
rho = rho**4
rho = rho**2*rho1+rho*rho2
return
end subroutine set_rho_adm
! define scalar field distribution and potential in F(R) scalar-tensor theory
! 1: Case C of 1112.3928, V=0
! 2: shell with a2^2*phi0/(1+a2^2), f(R) = R+a2*R^2 induced V
! 3: ground state of Schrodinger-Newton system, f(R) = R+a2*R^2 induced V
! 4: a2 = oo and \phi = \phi_0*0.5*(tanh((r+r_0)/\sigma)-tanh((r-r_0)/\sigma))
! 5: shell with phi0*dexp(-(r-r0)**2/sigma), V = 0
! original way, manually define the preprocessor macro
! #define CC 2
! the new way, define according to the preprocessor macro in "macrodef.fh"
#include "macrodef.fh"
#define CC EScalar_CC
subroutine setparameters(a2,r0,phi0,sigma,l2)
implicit none
real*8,intent(out) :: a2,r0,phi0,sigma,l2
! original way: read in parameters one by one
! call seta2(a2)
! call setphi0(phi0)
! new way: read in all parameters at once
call set_escalar_parameter(a2, phi0, r0, sigma, l2)
! r0=120.d0
! sigma=8.d0
! l2=1.d4
! write(*,*)
! write(*,*) " Set_Rho_ADM.f90 a2 = ", a2
! write(*,*) " Set_Rho_ADM.f90 phi0 = ", phi0
! write(*,*) " Set_Rho_ADM.f90 r0 = ", r0
! write(*,*) " Set_Rho_ADM.f90 sigma0 = ", sigma
! write(*,*) " Set_Rho_ADM.f90 l2 = ", l2
! write(*,*)
return
end subroutine setparameters
!===================================================================
function phi(X,Y,Z) result(gont)
implicit none
double precision,intent(in)::X
double precision,intent(in)::Y
double precision,intent(in)::Z
real*8 :: gont
real*8 ::r
real*8 :: a2,r0,phi0,sigma,l2
call setparameters(a2,r0,phi0,sigma,l2)
r=dsqrt(X*X+Y*Y+Z*Z)
#if ( CC == 1)
! configuration 1
gont = phi0*dtanh((r-r0)/sigma)
#elif ( CC == 2)
! configuration 2
phi0 = a2**2*phi0/(1+a2**2)
gont = phi0*dexp(-(r-r0)**2/sigma)
#elif ( CC == 3)
gont = (0.0481646d0*dexp(-0.0581545d0*(r-1.8039d-8)*(r-1.8039d-8)/l2) &
+0.298408d0*dexp(-0.111412d0*(r+9.6741d-9)*(r+9.6741d-9)/l2)+ &
0.42755d0*dexp(-0.207156d0*(r-1.09822d-8)*(r-1.09822d-8)/l2)+ &
0.204229d0*dexp(-0.37742d0*(r+2.13778d-8)*(r+2.13778d-8)/l2)+ &
0.021649d0*dexp(-0.68406d0*(r-8.78608d-8)*(r-8.78608d-8)/l2))/l2
#elif ( CC == 4)
! configuration 4, a2 = oo
phi0 = 0.5d0*phi0
gont = phi0*(dtanh((r+r0)/sigma)-dtanh((r-r0)/sigma))
#elif ( CC == 5)
! configuration 5
gont = phi0*dexp(-(r-r0)**2/sigma)
#endif
return
end function phi
! d phi/dr
function dphi(X,Y,Z) result(gont)
implicit none
double precision,intent(in)::X
double precision,intent(in)::Y
double precision,intent(in)::Z
real*8 :: gont
real*8 ::r
real*8 :: a2,r0,phi0,sigma,l2
call setparameters(a2,r0,phi0,sigma,l2)
r=dsqrt(X*X+Y*Y+Z*Z)
#if ( CC == 1)
! configuration 1
gont = phi0/sigma*(1-(dtanh((r-r0)/sigma))**2)
#elif ( CC == 2)
! configuration 2
phi0 = a2**2*phi0/(1+a2**2)
gont = -2.d0*phi0*(r-r0)/sigma*exp(-(r-r0)**2/sigma)
#elif ( CC == 3)
gont = (-0.5601976461d-2*(r-0.18039d-7)/l2*dexp(-0.581545d-1*(r-0.18039d-7)**2/l2) &
-0.6649246419d-1*(r+0.96741d-8)/l2*dexp(-0.111412d0*(r+.96741e-8)**2/l2) &
-0.1771390956d0*(r-0.109822d-7)/l2*dexp(-0.207156d0*(r-0.109822d-7)**2/l2) &
-0.1541602184d0*(r+0.213778d-7)/l2*dexp(-0.37742d0*(r+0.213778d-7)**2/l2) &
-0.2961842988d-1*(r-0.878608d-7)/l2*dexp(-0.68406*(r-0.878608d-7)**2/l2))/l2
#elif ( CC == 4)
! configuration 4, a2 = oo
phi0 = 0.5d0*phi0
gont = phi0*((1-dtanh((r+r0)/sigma)**2)/sigma- &
(1-dtanh((r-r0)/sigma)**2)/sigma)
#elif ( CC == 5)
! configuration 5
gont = -2.d0*phi0*(r-r0)/sigma*exp(-(r-r0)**2/sigma)
#endif
return
end function dphi
!==================================================================
function potential(X,Y,Z) result(gont)
implicit none
double precision,intent(in)::X
double precision,intent(in)::Y
double precision,intent(in)::Z
real*8 :: gont
real*8 :: phi
real*8 :: PI,v
real*8 :: a2,r0,phi0,sigma,l2
#if ( CC == 1 || CC == 4 || CC == 5)
gont = 0.d0
#elif ( CC == 2 || CC == 3)
call setparameters(a2,r0,phi0,sigma,l2)
PI = dacos(-1.d0)
v = phi(X,Y,Z)
gont = dexp(-8.d0*dsqrt(PI/3)*v)*(1-dexp(4*dsqrt(PI/3)*v))**2/32/PI/a2
#endif
return
end function potential
!==================================================================
!Note this part is for evolution
!not just for initial configuration
!f(R) potential F=R+a_2R^2
subroutine frpotential(ex,Sphi,V,dVdSphi)
implicit none
integer,intent(in ):: ex(1:3)
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Sphi
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: V,dVdSphi
real*8 :: a2,r0,phi0,sigma,l2
real*8, parameter :: Four = 4.d0, TWO = 2.d0,ONE = 1.d0,ZEO=0.d0
real*8 :: PI
PI = dacos(-ONE)
#if ( CC == 1 || CC == 4 || CC == 5)
V = ZEO
dVdSphi = ZEO
#elif ( CC == 2 || CC == 3)
call setparameters(a2,r0,phi0,sigma,l2)
V = dexp(-8.d0*dsqrt(PI/3)*Sphi)*(1-dexp(4*dsqrt(PI/3)*Sphi))**2/32/PI/a2
dVdSphi = 1.d0/a2/1.2d1*dsqrt(3.d0/PI)*dexp(-8.d0*dsqrt(PI/3.d0)*Sphi)*(-1+dexp(4*dsqrt(Pi/3)*Sphi))
#endif
return
end subroutine frpotential
!==================================================================
!f(R) potential F=R+a_2R^2
!fprim(R) = 1+2*a_2*R
subroutine frfprim(ex,RR,fprim)
implicit none
integer,intent(in ):: ex(1:3)
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: RR
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: fprim
real*8 :: a2,r0,phi0,sigma,l2
real*8, parameter :: ONE=1.d0, TWO = 2.d0
#if ( CC == 1 || CC == 4 || CC == 5)
fprim = ONE
#elif ( CC == 2 || CC == 3)
call setparameters(a2,r0,phi0,sigma,l2)
fprim = ONE+TWO*a2*RR
#endif
return
end subroutine frfprim
!==================================================================
subroutine set_rho_adm2(ex,rho,X,Y,Z)
implicit none
! argument variables
integer,intent(in)::ex
double precision,intent(in),dimension(ex)::X
double precision,intent(in),dimension(ex)::Y
double precision,intent(in),dimension(ex)::Z
double precision,intent(out),dimension(ex)::rho
integer :: i
real*8 :: dphi
do i=1,ex
! rho(i) = dphi(X,Y,Z)
rho(i) = dphi(X(i),Y(i),Z(i))
rho(i) = rho(i)*rho(i)
enddo
return
end subroutine set_rho_adm2
subroutine set_rho_adm1(ex,rho,X,Y,Z)
implicit none
! argument variables
integer,intent(in)::ex
double precision,intent(in),dimension(ex)::X
double precision,intent(in),dimension(ex)::Y
double precision,intent(in),dimension(ex)::Z
double precision,intent(out),dimension(ex)::rho
real*8 :: potential
integer :: i
do i=1,ex
rho(i) = potential(X(i),Y(i),Z(i))
enddo
return
end subroutine set_rho_adm1
subroutine set_rho_adm(ex,rho,X,Y,Z)
implicit none
! argument variables
integer,intent(in)::ex
double precision,intent(in),dimension(ex)::X
double precision,intent(in),dimension(ex)::Y
double precision,intent(in),dimension(ex)::Z
! in psivac, out rho_adm
double precision,intent(inout),dimension(ex)::rho
double precision,dimension(ex)::rho1,rho2
call set_rho_adm1(ex,rho1,X,Y,Z)
call set_rho_adm2(ex,rho2,X,Y,Z)
rho = rho**4
rho = rho**2*rho1+rho*rho2
return
end subroutine set_rho_adm

View File

@@ -1,205 +1,204 @@
#ifndef SHELLPATCH_H
#define SHELLPATCH_H
#include <mpi.h>
#include "MyList.h"
#include "Block.h"
#include "Parallel.h"
#include "var.h"
#include "monitor.h"
#include "macrodef.h" //need dim here; Vertex or Cell; ghost_width
#if (dim != 3)
#error shellpatch only supports 3 dimensional stuff yet
#endif
class ss_patch
{
public:
int sst; // ss_patch type: 0:zp, 1:zm, 2:xp, 3:xm, 4:yp, 5:ym
int myrank;
int shape[dim];
double bbox[2 * dim]; // this bbox includes nominal points and overlap points
MyList<Block> *blb, *ble;
int ingfs, fngfs;
ss_patch() {};
ss_patch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki);
~ss_patch();
virtual void setupcordtrans() {};
void Sync(MyList<var> *VarList, int Symmetry);
MyList<Parallel::gridseg> *build_bulk_gsl(Block *bp);
MyList<Parallel::gridseg> *build_ghost_gsl();
MyList<Parallel::gridseg> *build_owned_gsl0(int rank_in);
};
class xp_patch : public ss_patch
{
public:
xp_patch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 2; };
void setupcordtrans();
};
class xm_patch : public ss_patch
{
public:
xm_patch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 3; };
void setupcordtrans();
};
class yp_patch : public ss_patch
{
public:
yp_patch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 4; };
void setupcordtrans();
};
class ym_patch : public ss_patch
{
public:
ym_patch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 5; };
void setupcordtrans();
};
class zp_patch : public ss_patch
{
public:
zp_patch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 0; };
void setupcordtrans();
};
class zm_patch : public ss_patch
{
public:
zm_patch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 1; };
void setupcordtrans();
};
// Shell Patch system
// for derivatives usage we ask 27 more double type grid functions
// here we use **sngfs corresponding to fngfs to store them:
// drho/dx, drho/dy, drho/dz
// dsigma/dx, dsigma/dy, dsigma/dz
// dR/dx, dR/dy, dR/dz
// drho/dxdx, drho/dxdy, drho/dxdz, drho/dydy, drho/dydz, drho/dzdz
// dsigma/dxdx, dsigma/dxdy, dsigma/dxdz, dsigma/dydy, dsigma/dydz, dsigma/dzdz
// dR/dxdx, dR/dxdy, dR/dxdz, dR/dydy, dR/dydz, dR/dzdz
class ShellPatch
{
public:
struct pointstru
{
double gpox[dim]; // global cordinate
double lpox[dim]; // local cordinate
Block *Bg;
int ssst; //-1: cardisian, others as sst of ss_patch source sst
int tsst; //-1: cardisian, others as sst of ss_patch target sst
double *coef;
int *sind;
int dumyd; // the dimension which has common lines, only useful in interdata_packer
//-1: means no dumy dimension at all; 0: means rho; 1: means sigma
};
int myrank;
int shape[dim]; // for (rho, sigma, R), for rho and sigma means number of points for every pi/2
double Rrange[2]; // for Rmin and Rmax
int Symmetry;
int ingfs, fngfs;
MyList<ss_patch> *PatL;
// we use fngfs+v to reference the variable
enum
{
gx = 0,
gy,
gz,
drhodx,
drhody,
drhodz,
dsigmadx,
dsigmady,
dsigmadz,
dRdx,
dRdy,
dRdz,
drhodxx,
drhodxy,
drhodxz,
drhodyy,
drhodyz,
drhodzz,
dsigmadxx,
dsigmadxy,
dsigmadxz,
dsigmadyy,
dsigmadyz,
dsigmadzz,
dRdxx,
dRdxy,
dRdxz,
dRdyy,
dRdyz,
dRdzz
};
MyList<pointstru> **ss_src, **ss_dst;
// at means target
MyList<pointstru> **csatc_src, **csatc_dst;
MyList<pointstru> **csats_src, **csats_dst;
public:
ShellPatch(int ingfsi, int fngfsi, char *filename, int Symmetry, int myranki, monitor *ErrorMonitor);
~ShellPatch();
MyList<Block> *compose_sh(int cpusize, int nodes = 0);
MyList<Block> *compose_shr(int cpusize, int nodes = 0);
void setupcordtrans();
double getR(double r);
double getsr(double R);
void checkPatch();
void checkBlock(int sst);
void check_pointstrul(MyList<pointstru> *pp, bool first_only);
void check_pointstrul2(MyList<pointstru> *pp, int first_last_only);
double getdX(int dir); //(rho, sigma, R)
void Dump_xyz(char *tag, double time, double dT);
void Dump_Data(MyList<var> *DumpList, char *tag, double time, double dT);
double *Collect_Data(ss_patch *PP, var *VP);
void getlocalpoxsst(double gx, double gy, double gz, int sst, double &lx, double &ly, double &lz);
void getlocalpox(double gx, double gy, double gz, int &sst, double &lx, double &ly, double &lz);
void getglobalpox(double &x, double &y, double &z, int sst, double lx, double ly, double lz);
void prolongpointstru(MyList<pointstru> *&psul, MyList<ss_patch> *sPp, double DH[dim],
MyList<Patch> *Pp, double CDH[dim], MyList<pointstru> *pss);
bool prolongpointstru(MyList<pointstru> *&psul, bool ssyn, int tsst, MyList<ss_patch> *sPp, double DH[dim],
MyList<Patch> *Pp, double CDH[dim], double x, double y, double z, int Symmetry, int rank_in);
void setupintintstuff(int cpusize, MyList<Patch> *CPatL, int Symmetry);
void intertransfer(MyList<pointstru> **src, MyList<pointstru> **dst,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /*target */,
int Symmetry);
int interdata_packer(double *data, MyList<pointstru> *src, MyList<pointstru> *dst,
int rank_in, int dir,
MyList<var> *VarLists /* source */, MyList<var> *VarListd /* target */,
int Symmetry);
void Synch(MyList<var> *VarList, int Symmetry);
void CS_Inter(MyList<var> *VarList, int Symmetry);
void destroypsuList(MyList<pointstru> *ct);
int getdumydimension(int acsst, int posst); // -1 means no dumy dimension
void matchcheck(MyList<Patch> *CPatL);
void shellname(char *sn, int i);
void Interp_Points(MyList<var> *VarList,
int NN, double **XX, /*input global Cartesian coordinate*/
double *Shellf, int Symmetry);
bool Interp_One_Point(MyList<var> *VarList,
double *XX, /*input global Cartesian coordinate*/
double *Shellf, int Symmetry);
void write_Pablo_file_ss(int *ext, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax,
char *filename, int sst);
double L2Norm(var *vf);
void L2Norm7(var **vf, double *norms);
void Find_Maximum(MyList<var> *VarList, double *XX, double *Shellf);
};
#endif /* SHELLPATCH_H */
#ifndef SHELLPATCH_H
#define SHELLPATCH_H
#include <mpi.h>
#include "MyList.h"
#include "Block.h"
#include "Parallel.h"
#include "var.h"
#include "monitor.h"
#include "macrodef.h" //need dim here; Vertex or Cell; ghost_width
#if (dim != 3)
#error shellpatch only supports 3 dimensional stuff yet
#endif
class ss_patch
{
public:
int sst; // ss_patch type: 0:zp, 1:zm, 2:xp, 3:xm, 4:yp, 5:ym
int myrank;
int shape[dim];
double bbox[2 * dim]; // this bbox includes nominal points and overlap points
MyList<Block> *blb, *ble;
int ingfs, fngfs;
ss_patch() {};
ss_patch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki);
~ss_patch();
virtual void setupcordtrans() {};
void Sync(MyList<var> *VarList, int Symmetry);
MyList<Parallel::gridseg> *build_bulk_gsl(Block *bp);
MyList<Parallel::gridseg> *build_ghost_gsl();
MyList<Parallel::gridseg> *build_owned_gsl0(int rank_in);
};
class xp_patch : public ss_patch
{
public:
xp_patch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 2; };
void setupcordtrans();
};
class xm_patch : public ss_patch
{
public:
xm_patch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 3; };
void setupcordtrans();
};
class yp_patch : public ss_patch
{
public:
yp_patch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 4; };
void setupcordtrans();
};
class ym_patch : public ss_patch
{
public:
ym_patch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 5; };
void setupcordtrans();
};
class zp_patch : public ss_patch
{
public:
zp_patch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 0; };
void setupcordtrans();
};
class zm_patch : public ss_patch
{
public:
zm_patch(int ingfsi, int fngfsi, int *shapei, double *bboxi, int myranki) : ss_patch(ingfsi, fngfsi, shapei, bboxi, myranki) { sst = 1; };
void setupcordtrans();
};
// Shell Patch system
// for derivatives usage we ask 27 more double type grid functions
// here we use **sngfs corresponding to fngfs to store them:
// drho/dx, drho/dy, drho/dz
// dsigma/dx, dsigma/dy, dsigma/dz
// dR/dx, dR/dy, dR/dz
// drho/dxdx, drho/dxdy, drho/dxdz, drho/dydy, drho/dydz, drho/dzdz
// dsigma/dxdx, dsigma/dxdy, dsigma/dxdz, dsigma/dydy, dsigma/dydz, dsigma/dzdz
// dR/dxdx, dR/dxdy, dR/dxdz, dR/dydy, dR/dydz, dR/dzdz
class ShellPatch
{
public:
struct pointstru
{
double gpox[dim]; // global cordinate
double lpox[dim]; // local cordinate
Block *Bg;
int ssst; //-1: cardisian, others as sst of ss_patch source sst
int tsst; //-1: cardisian, others as sst of ss_patch target sst
double *coef;
int *sind;
int dumyd; // the dimension which has common lines, only useful in interdata_packer
//-1: means no dumy dimension at all; 0: means rho; 1: means sigma
};
int myrank;
int shape[dim]; // for (rho, sigma, R), for rho and sigma means number of points for every pi/2
double Rrange[2]; // for Rmin and Rmax
int Symmetry;
int ingfs, fngfs;
MyList<ss_patch> *PatL;
// we use fngfs+v to reference the variable
enum
{
gx = 0,
gy,
gz,
drhodx,
drhody,
drhodz,
dsigmadx,
dsigmady,
dsigmadz,
dRdx,
dRdy,
dRdz,
drhodxx,
drhodxy,
drhodxz,
drhodyy,
drhodyz,
drhodzz,
dsigmadxx,
dsigmadxy,
dsigmadxz,
dsigmadyy,
dsigmadyz,
dsigmadzz,
dRdxx,
dRdxy,
dRdxz,
dRdyy,
dRdyz,
dRdzz
};
MyList<pointstru> **ss_src, **ss_dst;
// at means target
MyList<pointstru> **csatc_src, **csatc_dst;
MyList<pointstru> **csats_src, **csats_dst;
public:
ShellPatch(int ingfsi, int fngfsi, char *filename, int Symmetry, int myranki, monitor *ErrorMonitor);
~ShellPatch();
MyList<Block> *compose_sh(int cpusize, int nodes = 0);
MyList<Block> *compose_shr(int cpusize, int nodes = 0);
void setupcordtrans();
double getR(double r);
double getsr(double R);
void checkPatch();
void checkBlock(int sst);
void check_pointstrul(MyList<pointstru> *pp, bool first_only);
void check_pointstrul2(MyList<pointstru> *pp, int first_last_only);
double getdX(int dir); //(rho, sigma, R)
void Dump_xyz(char *tag, double time, double dT);
void Dump_Data(MyList<var> *DumpList, char *tag, double time, double dT);
double *Collect_Data(ss_patch *PP, var *VP);
void getlocalpoxsst(double gx, double gy, double gz, int sst, double &lx, double &ly, double &lz);
void getlocalpox(double gx, double gy, double gz, int &sst, double &lx, double &ly, double &lz);
void getglobalpox(double &x, double &y, double &z, int sst, double lx, double ly, double lz);
void prolongpointstru(MyList<pointstru> *&psul, MyList<ss_patch> *sPp, double DH[dim],
MyList<Patch> *Pp, double CDH[dim], MyList<pointstru> *pss);
bool prolongpointstru(MyList<pointstru> *&psul, bool ssyn, int tsst, MyList<ss_patch> *sPp, double DH[dim],
MyList<Patch> *Pp, double CDH[dim], double x, double y, double z, int Symmetry, int rank_in);
void setupintintstuff(int cpusize, MyList<Patch> *CPatL, int Symmetry);
void intertransfer(MyList<pointstru> **src, MyList<pointstru> **dst,
MyList<var> *VarList1 /* source */, MyList<var> *VarList2 /*target */,
int Symmetry);
int interdata_packer(double *data, MyList<pointstru> *src, MyList<pointstru> *dst,
int rank_in, int dir,
MyList<var> *VarLists /* source */, MyList<var> *VarListd /* target */,
int Symmetry);
void Synch(MyList<var> *VarList, int Symmetry);
void CS_Inter(MyList<var> *VarList, int Symmetry);
void destroypsuList(MyList<pointstru> *ct);
int getdumydimension(int acsst, int posst); // -1 means no dumy dimension
void matchcheck(MyList<Patch> *CPatL);
void shellname(char *sn, int i);
void Interp_Points(MyList<var> *VarList,
int NN, double **XX, /*input global Cartesian coordinate*/
double *Shellf, int Symmetry);
bool Interp_One_Point(MyList<var> *VarList,
double *XX, /*input global Cartesian coordinate*/
double *Shellf, int Symmetry);
void write_Pablo_file_ss(int *ext, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax,
char *filename, int sst);
double L2Norm(var *vf);
void Find_Maximum(MyList<var> *VarList, double *XX, double *Shellf);
};
#endif /* SHELLPATCH_H */

View File

@@ -1,221 +1,221 @@
#ifdef newc
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cmath>
#include <strstream>
using namespace std;
#else
#include <iostream.h>
#include <iomanip.h>
#include <fstream.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#endif
#include "TwoPunctures.h"
inline string &lTrim(string &ss)
{
string::iterator p = find_if(ss.begin(), ss.end(), not1(ptr_fun<int, int>(isspace)));
ss.erase(ss.begin(), p);
return ss;
}
inline string &rTrim(string &ss)
{
string::reverse_iterator p = find_if(ss.rbegin(), ss.rend(), not1(ptr_fun<int, int>(isspace)));
ss.erase(p.base(), ss.end());
return ss;
}
inline string &Trim(string &st)
{
lTrim(rTrim(st));
return st;
}
int parse_parts(string str, string &sgrp, string &skey, string &sval, int &ind)
{
int pos1, pos2;
string s0;
ind = 0;
// remove comments
str = str.substr(0, str.find("#"));
if (rTrim(str).empty())
return 0; // continue;
// parse {group, key, val}
pos1 = str.find("::");
pos2 = str.find("=");
if (pos1 == string::npos || pos2 == string::npos)
return -1;
s0 = str.substr(0, pos1);
sgrp = lTrim(s0);
s0 = str.substr(pos1 + 2, pos2 - pos1 - 2);
skey = rTrim(s0);
s0 = str.substr(pos2 + 1);
sval = Trim(s0);
pos1 = sval.find("\"");
pos2 = sval.rfind("\"");
if (pos1 != string::npos)
{
sval = sval.substr(1, pos2 - 1);
}
pos1 = skey.find("[");
pos2 = skey.find("]");
if (pos1 != string::npos)
{
s0 = skey.substr(0, pos1);
ind = atoi(skey.substr(pos1 + 1, pos2 - pos1 - 1).c_str());
skey = s0;
}
return 1;
}
//=======================================
int main(int argc, char *argv[])
{
double mp, mm, b, Mp, Mm, admtol, Newtontol;
int nA, nB, nphi, Newtonmaxit;
double P_plusx, P_plusy, P_plusz;
double P_minusx, P_minusy, P_minusz;
double S_plusx, S_plusy, S_plusz;
double S_minusx, S_minusy, S_minusz;
// read parameter from file
{
const int LEN = 256;
char pline[LEN];
string str, sgrp, skey, sval;
int sind;
const char pname[] = "TwoPunctureinput.par";
ifstream inf(pname, ifstream::in);
if (!inf.good())
{
cout << "Can not open parameter file " << pname << endl;
exit(0);
}
for (int i = 1; inf.good(); i++)
{
inf.getline(pline, LEN);
str = pline;
int status = parse_parts(str, sgrp, skey, sval, sind);
if (status == -1)
{
cout << "error reading parameter file " << pname << " in line " << i << endl;
exit(0);
}
else if (status == 0)
continue;
// we assume input in Brugmann's convention
if (sgrp == "ABE")
{
if (skey == "mm")
mm = atof(sval.c_str());
else if (skey == "mp")
mp = atof(sval.c_str());
else if (skey == "b")
b = atof(sval.c_str());
else if (skey == "P_plusx")
P_plusy = -atof(sval.c_str());
else if (skey == "P_plusy")
P_plusx = atof(sval.c_str());
else if (skey == "P_plusz")
P_plusz = atof(sval.c_str());
else if (skey == "P_minusx")
P_minusy = -atof(sval.c_str());
else if (skey == "P_minusy")
P_minusx = atof(sval.c_str());
else if (skey == "P_minusz")
P_minusz = atof(sval.c_str());
else if (skey == "S_plusx")
S_plusy = -atof(sval.c_str());
else if (skey == "S_plusy")
S_plusx = atof(sval.c_str());
else if (skey == "S_plusz")
S_plusz = atof(sval.c_str());
else if (skey == "S_minusx")
S_minusy = -atof(sval.c_str());
else if (skey == "S_minusy")
S_minusx = atof(sval.c_str());
else if (skey == "S_minusz")
S_minusz = atof(sval.c_str());
else if (skey == "Mp")
Mp = atof(sval.c_str());
else if (skey == "Mm")
Mm = atof(sval.c_str());
else if (skey == "admtol")
admtol = atof(sval.c_str());
else if (skey == "Newtontol")
Newtontol = atof(sval.c_str());
else if (skey == "nA")
nA = atoi(sval.c_str());
else if (skey == "nB")
nB = atoi(sval.c_str());
else if (skey == "nphi")
nphi = atoi(sval.c_str());
else if (skey == "Newtonmaxit")
Newtonmaxit = atoi(sval.c_str());
}
}
inf.close();
}
// echo parameters
{
cout << "///////////////////////////////////////////////////////////////" << endl;
cout << " mp = " << mp << endl;
cout << " mm = " << mm << endl;
cout << " b = " << b << endl;
cout << " P_plusx = " << P_plusx << endl;
cout << " P_plusy = " << P_plusy << endl;
cout << " P_plusz = " << P_plusz << endl;
cout << " P_minusx = " << P_minusx << endl;
cout << " P_minusy = " << P_minusy << endl;
cout << " P_minusz = " << P_minusz << endl;
cout << " S_plusx = " << S_plusx << endl;
cout << " S_plusy = " << S_plusy << endl;
cout << " S_plusz = " << S_plusz << endl;
cout << " S_minusx = " << S_minusx << endl;
cout << " S_minusy = " << S_minusy << endl;
cout << " S_minusz = " << S_minusz << endl;
cout << " Mp = " << Mp << endl;
cout << " Mm = " << Mm << endl;
cout << " admtol = " << admtol << endl;
cout << " Newtontol = " << Newtontol << endl;
cout << " nA = " << nA << endl;
cout << " nB = " << nB << endl;
cout << " nphi = " << nphi << endl;
cout << "Newtonmaxit = " << Newtonmaxit << endl;
cout << "///////////////////////////////////////////////////////////////" << endl;
}
//===========================the computation body====================================================
TwoPunctures *ADM;
ADM = new TwoPunctures(mp, mm, b, P_plusx, P_plusy, P_plusz, S_plusx, S_plusy, S_plusz,
P_minusx, P_minusy, P_minusz, S_minusx, S_minusy, S_minusz,
nA, nB, nphi, Mp, Mm, admtol, Newtontol, Newtonmaxit);
ADM->Solve();
ADM->Save("Ansorg.psid");
delete ADM;
//=======================caculation done=============================================================
cout << "===============================================================" << endl;
cout << "Initial data is successfully producede!!" << endl;
exit(0);
}
#ifdef newc
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cmath>
#include <strstream>
using namespace std;
#else
#include <iostream.h>
#include <iomanip.h>
#include <fstream.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#endif
#include "TwoPunctures.h"
inline string &lTrim(string &ss)
{
string::iterator p = find_if(ss.begin(), ss.end(), not1(ptr_fun<int, int>(isspace)));
ss.erase(ss.begin(), p);
return ss;
}
inline string &rTrim(string &ss)
{
string::reverse_iterator p = find_if(ss.rbegin(), ss.rend(), not1(ptr_fun<int, int>(isspace)));
ss.erase(p.base(), ss.end());
return ss;
}
inline string &Trim(string &st)
{
lTrim(rTrim(st));
return st;
}
int parse_parts(string str, string &sgrp, string &skey, string &sval, int &ind)
{
int pos1, pos2;
string s0;
ind = 0;
// remove comments
str = str.substr(0, str.find("#"));
if (rTrim(str).empty())
return 0; // continue;
// parse {group, key, val}
pos1 = str.find("::");
pos2 = str.find("=");
if (pos1 == string::npos || pos2 == string::npos)
return -1;
s0 = str.substr(0, pos1);
sgrp = lTrim(s0);
s0 = str.substr(pos1 + 2, pos2 - pos1 - 2);
skey = rTrim(s0);
s0 = str.substr(pos2 + 1);
sval = Trim(s0);
pos1 = sval.find("\"");
pos2 = sval.rfind("\"");
if (pos1 != string::npos)
{
sval = sval.substr(1, pos2 - 1);
}
pos1 = skey.find("[");
pos2 = skey.find("]");
if (pos1 != string::npos)
{
s0 = skey.substr(0, pos1);
ind = atoi(skey.substr(pos1 + 1, pos2 - pos1 - 1).c_str());
skey = s0;
}
return 1;
}
//=======================================
int main(int argc, char *argv[])
{
double mp, mm, b, Mp, Mm, admtol, Newtontol;
int nA, nB, nphi, Newtonmaxit;
double P_plusx, P_plusy, P_plusz;
double P_minusx, P_minusy, P_minusz;
double S_plusx, S_plusy, S_plusz;
double S_minusx, S_minusy, S_minusz;
// read parameter from file
{
const int LEN = 256;
char pline[LEN];
string str, sgrp, skey, sval;
int sind;
const char pname[] = "TwoPunctureinput.par";
ifstream inf(pname, ifstream::in);
if (!inf.good())
{
cout << "Can not open parameter file " << pname << endl;
exit(0);
}
for (int i = 1; inf.good(); i++)
{
inf.getline(pline, LEN);
str = pline;
int status = parse_parts(str, sgrp, skey, sval, sind);
if (status == -1)
{
cout << "error reading parameter file " << pname << " in line " << i << endl;
exit(0);
}
else if (status == 0)
continue;
// we assume input in Brugmann's convention
if (sgrp == "ABE")
{
if (skey == "mm")
mm = atof(sval.c_str());
else if (skey == "mp")
mp = atof(sval.c_str());
else if (skey == "b")
b = atof(sval.c_str());
else if (skey == "P_plusx")
P_plusy = -atof(sval.c_str());
else if (skey == "P_plusy")
P_plusx = atof(sval.c_str());
else if (skey == "P_plusz")
P_plusz = atof(sval.c_str());
else if (skey == "P_minusx")
P_minusy = -atof(sval.c_str());
else if (skey == "P_minusy")
P_minusx = atof(sval.c_str());
else if (skey == "P_minusz")
P_minusz = atof(sval.c_str());
else if (skey == "S_plusx")
S_plusy = -atof(sval.c_str());
else if (skey == "S_plusy")
S_plusx = atof(sval.c_str());
else if (skey == "S_plusz")
S_plusz = atof(sval.c_str());
else if (skey == "S_minusx")
S_minusy = -atof(sval.c_str());
else if (skey == "S_minusy")
S_minusx = atof(sval.c_str());
else if (skey == "S_minusz")
S_minusz = atof(sval.c_str());
else if (skey == "Mp")
Mp = atof(sval.c_str());
else if (skey == "Mm")
Mm = atof(sval.c_str());
else if (skey == "admtol")
admtol = atof(sval.c_str());
else if (skey == "Newtontol")
Newtontol = atof(sval.c_str());
else if (skey == "nA")
nA = atoi(sval.c_str());
else if (skey == "nB")
nB = atoi(sval.c_str());
else if (skey == "nphi")
nphi = atoi(sval.c_str());
else if (skey == "Newtonmaxit")
Newtonmaxit = atoi(sval.c_str());
}
}
inf.close();
}
// echo parameters
{
cout << "///////////////////////////////////////////////////////////////" << endl;
cout << " mp = " << mp << endl;
cout << " mm = " << mm << endl;
cout << " b = " << b << endl;
cout << " P_plusx = " << P_plusx << endl;
cout << " P_plusy = " << P_plusy << endl;
cout << " P_plusz = " << P_plusz << endl;
cout << " P_minusx = " << P_minusx << endl;
cout << " P_minusy = " << P_minusy << endl;
cout << " P_minusz = " << P_minusz << endl;
cout << " S_plusx = " << S_plusx << endl;
cout << " S_plusy = " << S_plusy << endl;
cout << " S_plusz = " << S_plusz << endl;
cout << " S_minusx = " << S_minusx << endl;
cout << " S_minusy = " << S_minusy << endl;
cout << " S_minusz = " << S_minusz << endl;
cout << " Mp = " << Mp << endl;
cout << " Mm = " << Mm << endl;
cout << " admtol = " << admtol << endl;
cout << " Newtontol = " << Newtontol << endl;
cout << " nA = " << nA << endl;
cout << " nB = " << nB << endl;
cout << " nphi = " << nphi << endl;
cout << "Newtonmaxit = " << Newtonmaxit << endl;
cout << "///////////////////////////////////////////////////////////////" << endl;
}
//===========================the computation body====================================================
TwoPunctures *ADM;
ADM = new TwoPunctures(mp, mm, b, P_plusx, P_plusy, P_plusz, S_plusx, S_plusy, S_plusz,
P_minusx, P_minusy, P_minusz, S_minusx, S_minusy, S_minusz,
nA, nB, nphi, Mp, Mm, admtol, Newtontol, Newtonmaxit);
ADM->Solve();
ADM->Save("Ansorg.psid");
delete ADM;
//=======================caculation done=============================================================
cout << "===============================================================" << endl;
cout << "Initial data is successfully producede!!" << endl;
exit(0);
}

View File

@@ -1,167 +1,167 @@
#ifndef TWO_PUNCTURES_H
#define TWO_PUNCTURES_H
#include <omp.h>
#define StencilSize 19
#define N_PlaneRelax 1
#define NRELAX 200
#define Step_Relax 1
#define Pi 3.14159265358979323846264338328
#define Pih 1.57079632679489661923132169164 /* Pi/2*/
#define Piq 0.78539816339744830961566084582 /* Pi/4*/
#define TINY 1.0e-20
class TwoPunctures
{
public:
typedef struct DERIVS
{
double *d0, *d1, *d2, *d3, *d11, *d12, *d13, *d22, *d23, *d33;
} derivs;
double *F;
derivs u, v;
private:
double par_m_plus, par_m_minus, par_b;
double par_P_plus[3], par_P_minus[3];
double par_S_plus[3], par_S_minus[3];
int npoints_A, npoints_B, npoints_phi;
double target_M_plus, target_M_minus;
double admMass;
double adm_tol;
double Newton_tol;
int Newton_maxit;
int ntotal;
// ===== Precomputed spectral derivative matrices =====
double *D1_A, *D2_A;
double *D1_B, *D2_B;
double *DF1_phi, *DF2_phi;
// ===== Pre-allocated workspace for LineRelax (per-thread) =====
int max_threads;
double **ws_diag_be, **ws_e_be, **ws_f_be, **ws_b_be, **ws_x_be;
double **ws_l_be, **ws_u_be, **ws_d_be, **ws_y_be;
double **ws_diag_al, **ws_e_al, **ws_f_al, **ws_b_al, **ws_x_al;
double **ws_l_al, **ws_u_al, **ws_d_al, **ws_y_al;
struct parameters
{
int nvar, n1, n2, n3;
double b;
};
public:
TwoPunctures(double mp, double mm, double b, double P_plusx, double P_plusy, double P_plusz,
double S_plusx, double S_plusy, double S_plusz,
double P_minusx, double P_minusy, double P_minusz,
double S_minusx, double S_minusy, double S_minusz,
int nA, int nB, int nphi,
double Mp, double Mm, double admtol, double Newtontol,
int Newtonmaxit);
~TwoPunctures();
// 02/07: New/modified methods
void allocate_workspace();
void free_workspace();
void precompute_derivative_matrices();
void build_cheb_deriv_matrices(int n, double *D1, double *D2);
void build_fourier_deriv_matrices(int N, double *DF1, double *DF2);
void Derivatives_AB3_MatMul(int nvar, int n1, int n2, int n3, derivs v);
void ThomasAlgorithm_ws(int N, double *b, double *a, double *c, double *x, double *q,
double *l, double *u_ws, double *d, double *y);
void LineRelax_be_omp(double *dv,
int const i, int const k, int const nvar,
int const n1, int const n2, int const n3,
double const *rhs, int const *ncols, int **cols,
double **JFD, int tid);
void LineRelax_al_omp(double *dv,
int const j, int const k, int const nvar,
int const n1, int const n2, int const n3,
double const *rhs, int const *ncols,
int **cols, double **JFD, int tid);
void relax_omp(double *dv, int const nvar, int const n1, int const n2, int const n3,
double const *rhs, int const *ncols, int **cols, double **JFD);
void Solve();
void set_initial_guess(derivs v);
int index(int i, int j, int k, int l, int a, int b, int c, int d);
int *ivector(long nl, long nh);
double *dvector(long nl, long nh);
int **imatrix(long nrl, long nrh, long ncl, long nch);
double **dmatrix(long nrl, long nrh, long ncl, long nch);
double ***d3tensor(long nrl, long nrh, long ncl, long nch, long ndl, long ndh);
void free_ivector(int *v, long nl, long nh);
void free_dvector(double *v, long nl, long nh);
void free_imatrix(int **m, long nrl, long nrh, long ncl, long nch);
void free_dmatrix(double **m, long nrl, long nrh, long ncl, long nch);
void free_d3tensor(double ***t, long nrl, long nrh, long ncl, long nch,
long ndl, long ndh);
int minimum2(int i, int j);
int minimum3(int i, int j, int k);
int maximum2(int i, int j);
int maximum3(int i, int j, int k);
int pow_int(int mantisse, int exponent);
void chebft_Zeros(double u[], int n, int inv);
void chebft_Extremes(double u[], int n, int inv);
void chder(double *c, double *cder, int n);
double chebev(double a, double b, double c[], int m, double x);
void fourft(double *u, int N, int inv);
void fourder(double u[], double du[], int N);
void fourder2(double u[], double d2u[], int N);
double fourev(double *u, int N, double x);
double norm1(double *v, int n);
double norm2(double *v, int n);
double scalarproduct(double *v, double *w, int n);
double PunctIntPolAtArbitPosition(int ivar, int nvar, int n1,
int n2, int n3, derivs v, double x, double y,
double z);
double PunctEvalAtArbitPosition(double *v, int ivar, double A, double B, double phi,
int nvar, int n1, int n2, int n3);
void AB_To_XR(int nvar, double A, double B, double *X, double *R,
derivs U);
void C_To_c(int nvar, double X, double R, double *x, double *r,
derivs U);
void rx3_To_xyz(int nvar, double x, double r, double phi,
double *y, double *z, derivs U);
void Derivatives_AB3(int nvar, int n1, int n2, int n3, derivs v);
void Newton(int const nvar, int const n1, int const n2, int const n3,
derivs v, double const tol, int const itmax);
void F_of_v(int nvar, int n1, int n2, int n3, derivs v, double *F,
derivs u);
double norm_inf(double const *F, int const ntotal);
int bicgstab(int const nvar, int const n1, int const n2, int const n3,
derivs v, derivs dv, int const itmax, double const tol,
double *normres);
void allocate_derivs(derivs *v, int n);
void free_derivs(derivs *v, int n);
int Index(int ivar, int i, int j, int k, int nvar, int n1, int n2, int n3);
void NonLinEquations(double rho_adm, double A, double B, double X, double R, double x, double r, double phi,
double y, double z, derivs U, double *values);
double BY_KKofxyz(double x, double y, double z);
void SetMatrix_JFD(int nvar, int n1, int n2, int n3, derivs u, int *ncols, int **cols, double **Matrix);
void J_times_dv(int nvar, int n1, int n2, int n3, derivs dv, double *Jdv, derivs u);
void JFD_times_dv(int i, int j, int k, int nvar, int n1, int n2,
int n3, derivs dv, derivs u, double *values);
void LinEquations(double A, double B, double X, double R,
double x, double r, double phi,
double y, double z, derivs dU, derivs U, double *values);
void ThomasAlgorithm(int N, double *b, double *a, double *c, double *x, double *q);
void Save(char *fname);
// provided by Vasileios Paschalidis (vpaschal@illinois.edu)
double Spec_IntPolABphiFast(parameters par, double *v, int ivar, double A, double B, double phi);
double Spec_IntPolFast(parameters par, int ivar, double *v, double x, double y, double z);
void SpecCoef(parameters par, int ivar, double *v, double *cf);
};
#ifndef TWO_PUNCTURES_H
#define TWO_PUNCTURES_H
#include <omp.h>
#define StencilSize 19
#define N_PlaneRelax 1
#define NRELAX 200
#define Step_Relax 1
#define Pi 3.14159265358979323846264338328
#define Pih 1.57079632679489661923132169164 /* Pi/2*/
#define Piq 0.78539816339744830961566084582 /* Pi/4*/
#define TINY 1.0e-20
class TwoPunctures
{
public:
typedef struct DERIVS
{
double *d0, *d1, *d2, *d3, *d11, *d12, *d13, *d22, *d23, *d33;
} derivs;
double *F;
derivs u, v;
private:
double par_m_plus, par_m_minus, par_b;
double par_P_plus[3], par_P_minus[3];
double par_S_plus[3], par_S_minus[3];
int npoints_A, npoints_B, npoints_phi;
double target_M_plus, target_M_minus;
double admMass;
double adm_tol;
double Newton_tol;
int Newton_maxit;
int ntotal;
// ===== Precomputed spectral derivative matrices =====
double *D1_A, *D2_A;
double *D1_B, *D2_B;
double *DF1_phi, *DF2_phi;
// ===== Pre-allocated workspace for LineRelax (per-thread) =====
int max_threads;
double **ws_diag_be, **ws_e_be, **ws_f_be, **ws_b_be, **ws_x_be;
double **ws_l_be, **ws_u_be, **ws_d_be, **ws_y_be;
double **ws_diag_al, **ws_e_al, **ws_f_al, **ws_b_al, **ws_x_al;
double **ws_l_al, **ws_u_al, **ws_d_al, **ws_y_al;
struct parameters
{
int nvar, n1, n2, n3;
double b;
};
public:
TwoPunctures(double mp, double mm, double b, double P_plusx, double P_plusy, double P_plusz,
double S_plusx, double S_plusy, double S_plusz,
double P_minusx, double P_minusy, double P_minusz,
double S_minusx, double S_minusy, double S_minusz,
int nA, int nB, int nphi,
double Mp, double Mm, double admtol, double Newtontol,
int Newtonmaxit);
~TwoPunctures();
// 02/07: New/modified methods
void allocate_workspace();
void free_workspace();
void precompute_derivative_matrices();
void build_cheb_deriv_matrices(int n, double *D1, double *D2);
void build_fourier_deriv_matrices(int N, double *DF1, double *DF2);
void Derivatives_AB3_MatMul(int nvar, int n1, int n2, int n3, derivs v);
void ThomasAlgorithm_ws(int N, double *b, double *a, double *c, double *x, double *q,
double *l, double *u_ws, double *d, double *y);
void LineRelax_be_omp(double *dv,
int const i, int const k, int const nvar,
int const n1, int const n2, int const n3,
double const *rhs, int const *ncols, int **cols,
double **JFD, int tid);
void LineRelax_al_omp(double *dv,
int const j, int const k, int const nvar,
int const n1, int const n2, int const n3,
double const *rhs, int const *ncols,
int **cols, double **JFD, int tid);
void relax_omp(double *dv, int const nvar, int const n1, int const n2, int const n3,
double const *rhs, int const *ncols, int **cols, double **JFD);
void Solve();
void set_initial_guess(derivs v);
int index(int i, int j, int k, int l, int a, int b, int c, int d);
int *ivector(long nl, long nh);
double *dvector(long nl, long nh);
int **imatrix(long nrl, long nrh, long ncl, long nch);
double **dmatrix(long nrl, long nrh, long ncl, long nch);
double ***d3tensor(long nrl, long nrh, long ncl, long nch, long ndl, long ndh);
void free_ivector(int *v, long nl, long nh);
void free_dvector(double *v, long nl, long nh);
void free_imatrix(int **m, long nrl, long nrh, long ncl, long nch);
void free_dmatrix(double **m, long nrl, long nrh, long ncl, long nch);
void free_d3tensor(double ***t, long nrl, long nrh, long ncl, long nch,
long ndl, long ndh);
int minimum2(int i, int j);
int minimum3(int i, int j, int k);
int maximum2(int i, int j);
int maximum3(int i, int j, int k);
int pow_int(int mantisse, int exponent);
void chebft_Zeros(double u[], int n, int inv);
void chebft_Extremes(double u[], int n, int inv);
void chder(double *c, double *cder, int n);
double chebev(double a, double b, double c[], int m, double x);
void fourft(double *u, int N, int inv);
void fourder(double u[], double du[], int N);
void fourder2(double u[], double d2u[], int N);
double fourev(double *u, int N, double x);
double norm1(double *v, int n);
double norm2(double *v, int n);
double scalarproduct(double *v, double *w, int n);
double PunctIntPolAtArbitPosition(int ivar, int nvar, int n1,
int n2, int n3, derivs v, double x, double y,
double z);
double PunctEvalAtArbitPosition(double *v, int ivar, double A, double B, double phi,
int nvar, int n1, int n2, int n3);
void AB_To_XR(int nvar, double A, double B, double *X, double *R,
derivs U);
void C_To_c(int nvar, double X, double R, double *x, double *r,
derivs U);
void rx3_To_xyz(int nvar, double x, double r, double phi,
double *y, double *z, derivs U);
void Derivatives_AB3(int nvar, int n1, int n2, int n3, derivs v);
void Newton(int const nvar, int const n1, int const n2, int const n3,
derivs v, double const tol, int const itmax);
void F_of_v(int nvar, int n1, int n2, int n3, derivs v, double *F,
derivs u);
double norm_inf(double const *F, int const ntotal);
int bicgstab(int const nvar, int const n1, int const n2, int const n3,
derivs v, derivs dv, int const itmax, double const tol,
double *normres);
void allocate_derivs(derivs *v, int n);
void free_derivs(derivs *v, int n);
int Index(int ivar, int i, int j, int k, int nvar, int n1, int n2, int n3);
void NonLinEquations(double rho_adm, double A, double B, double X, double R, double x, double r, double phi,
double y, double z, derivs U, double *values);
double BY_KKofxyz(double x, double y, double z);
void SetMatrix_JFD(int nvar, int n1, int n2, int n3, derivs u, int *ncols, int **cols, double **Matrix);
void J_times_dv(int nvar, int n1, int n2, int n3, derivs dv, double *Jdv, derivs u);
void JFD_times_dv(int i, int j, int k, int nvar, int n1, int n2,
int n3, derivs dv, derivs u, double *values);
void LinEquations(double A, double B, double X, double R,
double x, double r, double phi,
double y, double z, derivs dU, derivs U, double *values);
void ThomasAlgorithm(int N, double *b, double *a, double *c, double *x, double *q);
void Save(char *fname);
// provided by Vasileios Paschalidis (vpaschal@illinois.edu)
double Spec_IntPolABphiFast(parameters par, double *v, int ivar, double A, double B, double phi);
double Spec_IntPolFast(parameters par, int ivar, double *v, double x, double y, double z);
void SpecCoef(parameters par, int ivar, double *v, double *cf);
};
#endif /* TWO_PUNCTURES_H */

View File

@@ -1,64 +1,64 @@
#ifndef Z4c_CLASS_H
#define Z4c_CLASS_H
#ifdef newc
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cmath>
using namespace std;
#else
#include <iostream.h>
#include <iomanip.h>
#include <fstream.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#endif
#include <mpi.h>
#include "cgh.h"
#include "ShellPatch.h"
#include "misc.h"
#include "var.h"
#include "MyList.h"
#include "monitor.h"
#include "surface_integral.h"
#include "macrodef.h"
#ifdef USE_GPU
#include "bssn_gpu_class.h"
#else
#include "bssn_class.h"
#endif
class Z4c_class : public bssn_class
{
public:
Z4c_class(double Couranti, double StartTimei, double TotalTimei, double DumpTimei, double d2DumpTimei, double CheckTimei, double AnasTimei,
int Symmetryi, int checkruni, char *checkfilenamei, double numepssi, double numepsbi, double numepshi,
int a_levi, int maxli, int decni, double maxrexi, double drexi);
~Z4c_class();
void Initialize();
void Check_extrop();
// Since we have set zero to variables at very begining
// we can neglect TZ for initial data setting
void Step(int lev, int YN);
void Interp_Constraint();
void Constraint_Out();
void Compute_Constraint();
protected:
var *TZo;
var *TZ0;
var *TZ;
var *TZ1;
var *TZ_rhs;
};
#endif /* Z4c_CLASS_H */
#ifndef Z4c_CLASS_H
#define Z4c_CLASS_H
#ifdef newc
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cmath>
using namespace std;
#else
#include <iostream.h>
#include <iomanip.h>
#include <fstream.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#endif
#include <mpi.h>
#include "cgh.h"
#include "ShellPatch.h"
#include "misc.h"
#include "var.h"
#include "MyList.h"
#include "monitor.h"
#include "surface_integral.h"
#include "macrodef.h"
#ifdef USE_GPU
#include "bssn_gpu_class.h"
#else
#include "bssn_class.h"
#endif
class Z4c_class : public bssn_class
{
public:
Z4c_class(double Couranti, double StartTimei, double TotalTimei, double DumpTimei, double d2DumpTimei, double CheckTimei, double AnasTimei,
int Symmetryi, int checkruni, char *checkfilenamei, double numepssi, double numepsbi, double numepshi,
int a_levi, int maxli, int decni, double maxrexi, double drexi);
~Z4c_class();
void Initialize();
void Check_extrop();
// Since we have set zero to variables at very begining
// we can neglect TZ for initial data setting
void Step(int lev, int YN);
void Interp_Constraint();
void Constraint_Out();
void Compute_Constraint();
protected:
var *TZo;
var *TZ0;
var *TZ;
var *TZ1;
var *TZ_rhs;
};
#endif /* Z4c_CLASS_H */

View File

@@ -1,382 +1,382 @@
!-------------------------------------------------------------------------------!
! computed constraint for ADM formalism !
!-------------------------------------------------------------------------------!
subroutine constraint_adm(ex, X, Y, Z,&
dxx,gxy,gxz,dyy,gyz,dzz, &
Kxx,Kxy,Kxz,Kyy,Kyz,Kzz, &
Lap,Sfx,Sfy,Sfz,rho,Sx,Sy,Sz,&
ham_Res, movx_Res, movy_Res, movz_Res, &
Symmetry)
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 ) :: dxx,gxy,gxz,dyy,gyz,dzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Kxx,Kxy,Kxz,Kyy,Kyz,Kzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Lap,Sfx,Sfy,Sfz
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: rho,Sx,Sy,Sz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: ham_Res, movx_Res, movy_Res, movz_Res
!~~~~~~> Other variables:
! inverse metric
real*8, dimension(ex(1),ex(2),ex(3)) :: gupxx,gupxy,gupxz
real*8, dimension(ex(1),ex(2),ex(3)) :: gupyy,gupyz,gupzz
! first order derivative of metric, @_k g_ij
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxx,gxyx,gxzx
real*8, dimension(ex(1),ex(2),ex(3)) :: gyyx,gyzx,gzzx
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxy,gxyy,gxzy
real*8, dimension(ex(1),ex(2),ex(3)) :: gyyy,gyzy,gzzy
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxz,gxyz,gxzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gyyz,gyzz,gzzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gxx,gyy,gzz,trK,fx,fy,fz
real*8, dimension(ex(1),ex(2),ex(3)) :: Rxx,Rxy,Rxz,Ryy,Ryz,Rzz
real*8, dimension(ex(1),ex(2),ex(3)) :: Gamxxx, Gamxxy, Gamxxz
real*8, dimension(ex(1),ex(2),ex(3)) :: Gamxyy, Gamxyz, Gamxzz
real*8, dimension(ex(1),ex(2),ex(3)) :: Gamyxx, Gamyxy, Gamyxz
real*8, dimension(ex(1),ex(2),ex(3)) :: Gamyyy, Gamyyz, Gamyzz
real*8, dimension(ex(1),ex(2),ex(3)) :: Gamzxx, Gamzxy, Gamzxz
real*8, dimension(ex(1),ex(2),ex(3)) :: Gamzyy, Gamzyz, Gamzzz
integer, parameter :: NO_SYMM = 0, EQUATORIAL = 1, OCTANT = 2
real*8, parameter :: ZERO = 0.D0, HALF = 0.5d0, ONE = 1.d0, TWO = 2.d0, FOUR = 4.d0
real*8, parameter :: F2o3 = 2.d0/3.d0, F8 = 8.d0, F16 = 1.6d1, SIX = 6.d0
real*8, parameter :: SYM = 1.D0, ANTI= - 1.D0
real*8 :: PI
call adm_ricci_gamma(ex, X, Y, Z, &
dxx , gxy , gxz , dyy , gyz , dzz,&
Gamxxx,Gamxxy,Gamxxz,Gamxyy,Gamxyz,Gamxzz,&
Gamyxx,Gamyxy,Gamyxz,Gamyyy,Gamyyz,Gamyzz,&
Gamzxx,Gamzxy,Gamzxz,Gamzyy,Gamzyz,Gamzzz,&
Rxx,Rxy,Rxz,Ryy,Ryz,Rzz,&
Symmetry)
PI = dacos(-ONE)
gxx = dxx + ONE
gyy = dyy + ONE
gzz = dzz + ONE
! invert metric
gupzz = gxx * gyy * gzz + gxy * gyz * gxz + gxz * gxy * gyz - &
gxz * gyy * gxz - gxy * gxy * gzz - gxx * gyz * gyz
gupxx = ( gyy * gzz - gyz * gyz ) / gupzz
gupxy = - ( gxy * gzz - gyz * gxz ) / gupzz
gupxz = ( gxy * gyz - gyy * gxz ) / gupzz
gupyy = ( gxx * gzz - gxz * gxz ) / gupzz
gupyz = - ( gxx * gyz - gxy * gxz ) / gupzz
gupzz = ( gxx * gyy - gxy * gxy ) / gupzz
trK = gupxx * Kxx + gupyy * Kyy + gupzz * Kzz &
+ TWO * (gupxy * Kxy + gupxz * Kxz + gupyz * Kyz)
! ham_Res = trR + K^2 - K_ij * K^ij - 16 * PI * rho
ham_Res = gupxx * Rxx + gupyy * Ryy + gupzz * Rzz + &
TWO* ( gupxy * Rxy + gupxz * Rxz + gupyz * Ryz )
ham_Res = ham_Res + trK * trK -(&
gupxx * ( &
gupxx * Kxx * Kxx + gupyy * Kxy * Kxy + gupzz * Kxz * Kxz + &
TWO * (gupxy * Kxx * Kxy + gupxz * Kxx * Kxz + gupyz * Kxy * Kxz) ) + &
gupyy * ( &
gupxx * Kxy * Kxy + gupyy * Kyy * Kyy + gupzz * Kyz * Kyz + &
TWO * (gupxy * Kxy * Kyy + gupxz * Kxy * Kyz + gupyz * Kyy * Kyz) ) + &
gupzz * ( &
gupxx * Kxz * Kxz + gupyy * Kyz * Kyz + gupzz * Kzz * Kzz + &
TWO * (gupxy * Kxz * Kyz + gupxz * Kxz * Kzz + gupyz * Kyz * Kzz) ) + &
TWO * ( &
gupxy * ( &
gupxx * Kxx * Kxy + gupyy * Kxy * Kyy + gupzz * Kxz * Kyz + &
gupxy * (Kxx * Kyy + Kxy * Kxy) + &
gupxz * (Kxx * Kyz + Kxz * Kxy) + &
gupyz * (Kxy * Kyz + Kxz * Kyy) ) + &
gupxz * ( &
gupxx * Kxx * Kxz + gupyy * Kxy * Kyz + gupzz * Kxz * Kzz + &
gupxy * (Kxx * Kyz + Kxy * Kxz) + &
gupxz * (Kxx * Kzz + Kxz * Kxz) + &
gupyz * (Kxy * Kzz + Kxz * Kyz) ) + &
gupyz * ( &
gupxx * Kxy * Kxz + gupyy * Kyy * Kyz + gupzz * Kyz * Kzz + &
gupxy * (Kxy * Kyz + Kyy * Kxz) + &
gupxz * (Kxy * Kzz + Kyz * Kxz) + &
gupyz * (Kyy * Kzz + Kyz * Kyz) ) ))- F16 * PI * rho
! mov_Res_j = gupkj*D_k K_ij - d_j trK - 8 PI s_j where D respect to physical metric
! store D_i K_jk
call fderivs(ex,Kxx,gxxx,gxxy,gxxz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0)
call fderivs(ex,Kxy,gxyx,gxyy,gxyz,X,Y,Z,ANTI,ANTI,SYM ,Symmetry,0)
call fderivs(ex,Kxz,gxzx,gxzy,gxzz,X,Y,Z,ANTI,SYM ,ANTI,Symmetry,0)
call fderivs(ex,Kyy,gyyx,gyyy,gyyz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0)
call fderivs(ex,Kyz,gyzx,gyzy,gyzz,X,Y,Z,SYM ,ANTI,ANTI,Symmetry,0)
call fderivs(ex,Kzz,gzzx,gzzy,gzzz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0)
gxxx = gxxx - ( Gamxxx * Kxx + Gamyxx * Kxy + Gamzxx * Kxz &
+ Gamxxx * Kxx + Gamyxx * Kxy + Gamzxx * Kxz)
gxyx = gxyx - ( Gamxxy * Kxx + Gamyxy * Kxy + Gamzxy * Kxz &
+ Gamxxx * Kxy + Gamyxx * Kyy + Gamzxx * Kyz)
gxzx = gxzx - ( Gamxxz * Kxx + Gamyxz * Kxy + Gamzxz * Kxz &
+ Gamxxx * Kxz + Gamyxx * Kyz + Gamzxx * Kzz)
gyyx = gyyx - ( Gamxxy * Kxy + Gamyxy * Kyy + Gamzxy * Kyz &
+ Gamxxy * Kxy + Gamyxy * Kyy + Gamzxy * Kyz)
gyzx = gyzx - ( Gamxxz * Kxy + Gamyxz * Kyy + Gamzxz * Kyz &
+ Gamxxy * Kxz + Gamyxy * Kyz + Gamzxy * Kzz)
gzzx = gzzx - ( Gamxxz * Kxz + Gamyxz * Kyz + Gamzxz * Kzz &
+ Gamxxz * Kxz + Gamyxz * Kyz + Gamzxz * Kzz)
gxxy = gxxy - ( Gamxxy * Kxx + Gamyxy * Kxy + Gamzxy * Kxz &
+ Gamxxy * Kxx + Gamyxy * Kxy + Gamzxy * Kxz)
gxyy = gxyy - ( Gamxyy * Kxx + Gamyyy * Kxy + Gamzyy * Kxz &
+ Gamxxy * Kxy + Gamyxy * Kyy + Gamzxy * Kyz)
gxzy = gxzy - ( Gamxyz * Kxx + Gamyyz * Kxy + Gamzyz * Kxz &
+ Gamxxy * Kxz + Gamyxy * Kyz + Gamzxy * Kzz)
gyyy = gyyy - ( Gamxyy * Kxy + Gamyyy * Kyy + Gamzyy * Kyz &
+ Gamxyy * Kxy + Gamyyy * Kyy + Gamzyy * Kyz)
gyzy = gyzy - ( Gamxyz * Kxy + Gamyyz * Kyy + Gamzyz * Kyz &
+ Gamxyy * Kxz + Gamyyy * Kyz + Gamzyy * Kzz)
gzzy = gzzy - ( Gamxyz * Kxz + Gamyyz * Kyz + Gamzyz * Kzz &
+ Gamxyz * Kxz + Gamyyz * Kyz + Gamzyz * Kzz)
gxxz = gxxz - ( Gamxxz * Kxx + Gamyxz * Kxy + Gamzxz * Kxz &
+ Gamxxz * Kxx + Gamyxz * Kxy + Gamzxz * Kxz)
gxyz = gxyz - ( Gamxyz * Kxx + Gamyyz * Kxy + Gamzyz * Kxz &
+ Gamxxz * Kxy + Gamyxz * Kyy + Gamzxz * Kyz)
gxzz = gxzz - ( Gamxzz * Kxx + Gamyzz * Kxy + Gamzzz * Kxz &
+ Gamxxz * Kxz + Gamyxz * Kyz + Gamzxz * Kzz)
gyyz = gyyz - ( Gamxyz * Kxy + Gamyyz * Kyy + Gamzyz * Kyz &
+ Gamxyz * Kxy + Gamyyz * Kyy + Gamzyz * Kyz)
gyzz = gyzz - ( Gamxzz * Kxy + Gamyzz * Kyy + Gamzzz * Kyz &
+ Gamxyz * Kxz + Gamyyz * Kyz + Gamzyz * Kzz)
gzzz = gzzz - ( Gamxzz * Kxz + Gamyzz * Kyz + Gamzzz * Kzz &
+ Gamxzz * Kxz + Gamyzz * Kyz + Gamzzz * Kzz)
movx_Res = gupxx*gxxx + gupyy*gxyy + gupzz*gxzz &
+gupxy*gxyx + gupxz*gxzx + gupyz*gxzy &
+gupxy*gxxy + gupxz*gxxz + gupyz*gxyz
movy_Res = gupxx*gxyx + gupyy*gyyy + gupzz*gyzz &
+gupxy*gyyx + gupxz*gyzx + gupyz*gyzy &
+gupxy*gxyy + gupxz*gxyz + gupyz*gyyz
movz_Res = gupxx*gxzx + gupyy*gyzy + gupzz*gzzz &
+gupxy*gyzx + gupxz*gzzx + gupyz*gzzy &
+gupxy*gxzy + gupxz*gxzz + gupyz*gyzz
call fderivs(ex,trK,fx,fy,fz,X,Y,Z,SYM,SYM,SYM,Symmetry,0)
movx_Res = movx_Res - fx - F8*PI*sx
movy_Res = movy_Res - fy - F8*PI*sy
movz_Res = movz_Res - fz - F8*PI*sz
return
end subroutine constraint_adm
!-------------------------------------------------------------------------------!
! computed constraint for ADM formalism for shell !
!-------------------------------------------------------------------------------!
subroutine constraint_adm_ss(ex,crho,sigma,R, X, Y, Z,&
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz, &
drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz, &
dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz, &
dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz, &
dxx,gxy,gxz,dyy,gyz,dzz, &
Kxx,Kxy,Kxz,Kyy,Kyz,Kzz, &
Lap,Sfx,Sfy,Sfz,rho,Sx,Sy,Sz,&
Gamxxx, Gamxxy, Gamxxz,Gamxyy, Gamxyz, Gamxzz, &
Gamyxx, Gamyxy, Gamyxz,Gamyyy, Gamyyz, Gamyzz, &
Gamzxx, Gamzxy, Gamzxz,Gamzyy, Gamzyz, Gamzzz, &
Rxx,Rxy,Rxz,Ryy,Ryz,Rzz, &
ham_Res, movx_Res, movy_Res, movz_Res, &
Symmetry,Lev,sst)
implicit none
!~~~~~~> Input parameters:
integer,intent(in ):: ex(1:3),symmetry,Lev,sst
double precision,intent(in),dimension(ex(1))::crho
double precision,intent(in),dimension(ex(2))::sigma
double precision,intent(in),dimension(ex(3))::R
real*8, intent(in ),dimension(ex(1),ex(2),ex(3)):: X,Y,Z
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::drhodx, drhody, drhodz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dsigmadx,dsigmady,dsigmadz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dRdx,dRdy,dRdz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: dxx,gxy,gxz,dyy,gyz,dzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Kxx,Kxy,Kxz,Kyy,Kyz,Kzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Lap,Sfx,Sfy,Sfz
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: rho,Sx,Sy,Sz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Rxx,Rxy,Rxz,Ryy,Ryz,Rzz
! second kind of Christofel symble Gamma^i_jk respect to physical metric
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamxxx, Gamxxy, Gamxxz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamxyy, Gamxyz, Gamxzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamyxx, Gamyxy, Gamyxz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamyyy, Gamyyz, Gamyzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamzxx, Gamzxy, Gamzxz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamzyy, Gamzyz, Gamzzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: ham_Res, movx_Res, movy_Res, movz_Res
!~~~~~~> Other variables:
! inverse metric
real*8, dimension(ex(1),ex(2),ex(3)) :: gupxx,gupxy,gupxz
real*8, dimension(ex(1),ex(2),ex(3)) :: gupyy,gupyz,gupzz
! first order derivative of metric, @_k g_ij
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxx,gxyx,gxzx
real*8, dimension(ex(1),ex(2),ex(3)) :: gyyx,gyzx,gzzx
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxy,gxyy,gxzy
real*8, dimension(ex(1),ex(2),ex(3)) :: gyyy,gyzy,gzzy
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxz,gxyz,gxzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gyyz,gyzz,gzzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gxx,gyy,gzz,trK,fx,fy,fz
integer, parameter :: NO_SYMM = 0, EQUATORIAL = 1, OCTANT = 2
real*8, parameter :: ZERO = 0.D0, HALF = 0.5d0, ONE = 1.d0, TWO = 2.d0, FOUR = 4.d0
real*8, parameter :: F2o3 = 2.d0/3.d0, F8 = 8.d0, F16 = 1.6d1, SIX = 6.d0
real*8, parameter :: SYM = 1.D0, ANTI= - 1.D0
real*8 :: PI
call adm_ricci_gamma_ss(ex,crho,sigma,R,X, Y, Z, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz, &
drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz, &
dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz, &
dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz, &
dxx , gxy , gxz , dyy , gyz , dzz,&
Gamxxx,Gamxxy,Gamxxz,Gamxyy,Gamxyz,Gamxzz,&
Gamyxx,Gamyxy,Gamyxz,Gamyyy,Gamyyz,Gamyzz,&
Gamzxx,Gamzxy,Gamzxz,Gamzyy,Gamzyz,Gamzzz,&
Rxx,Rxy,Rxz,Ryy,Ryz,Rzz,&
Symmetry,Lev,sst)
PI = dacos(-ONE)
gxx = dxx + ONE
gyy = dyy + ONE
gzz = dzz + ONE
! invert metric
gupzz = gxx * gyy * gzz + gxy * gyz * gxz + gxz * gxy * gyz - &
gxz * gyy * gxz - gxy * gxy * gzz - gxx * gyz * gyz
gupxx = ( gyy * gzz - gyz * gyz ) / gupzz
gupxy = - ( gxy * gzz - gyz * gxz ) / gupzz
gupxz = ( gxy * gyz - gyy * gxz ) / gupzz
gupyy = ( gxx * gzz - gxz * gxz ) / gupzz
gupyz = - ( gxx * gyz - gxy * gxz ) / gupzz
gupzz = ( gxx * gyy - gxy * gxy ) / gupzz
trK = gupxx * Kxx + gupyy * Kyy + gupzz * Kzz &
+ TWO * (gupxy * Kxy + gupxz * Kxz + gupyz * Kyz)
! ham_Res = trR + K^2 - K_ij * K^ij - 16 * PI * rho
ham_Res = gupxx * Rxx + gupyy * Ryy + gupzz * Rzz + &
TWO* ( gupxy * Rxy + gupxz * Rxz + gupyz * Ryz )
ham_Res = ham_Res + trK * trK -(&
gupxx * ( &
gupxx * Kxx * Kxx + gupyy * Kxy * Kxy + gupzz * Kxz * Kxz + &
TWO * (gupxy * Kxx * Kxy + gupxz * Kxx * Kxz + gupyz * Kxy * Kxz) ) + &
gupyy * ( &
gupxx * Kxy * Kxy + gupyy * Kyy * Kyy + gupzz * Kyz * Kyz + &
TWO * (gupxy * Kxy * Kyy + gupxz * Kxy * Kyz + gupyz * Kyy * Kyz) ) + &
gupzz * ( &
gupxx * Kxz * Kxz + gupyy * Kyz * Kyz + gupzz * Kzz * Kzz + &
TWO * (gupxy * Kxz * Kyz + gupxz * Kxz * Kzz + gupyz * Kyz * Kzz) ) + &
TWO * ( &
gupxy * ( &
gupxx * Kxx * Kxy + gupyy * Kxy * Kyy + gupzz * Kxz * Kyz + &
gupxy * (Kxx * Kyy + Kxy * Kxy) + &
gupxz * (Kxx * Kyz + Kxz * Kxy) + &
gupyz * (Kxy * Kyz + Kxz * Kyy) ) + &
gupxz * ( &
gupxx * Kxx * Kxz + gupyy * Kxy * Kyz + gupzz * Kxz * Kzz + &
gupxy * (Kxx * Kyz + Kxy * Kxz) + &
gupxz * (Kxx * Kzz + Kxz * Kxz) + &
gupyz * (Kxy * Kzz + Kxz * Kyz) ) + &
gupyz * ( &
gupxx * Kxy * Kxz + gupyy * Kyy * Kyz + gupzz * Kyz * Kzz + &
gupxy * (Kxy * Kyz + Kyy * Kxz) + &
gupxz * (Kxy * Kzz + Kyz * Kxz) + &
gupyz * (Kyy * Kzz + Kyz * Kyz) ) ))- F16 * PI * rho
! mov_Res_j = gupkj*D_k K_ij - d_j trK - 8 PI s_j where D respect to physical metric
! store D_i K_jk
call fderivs_shc(ex,Kxx,gxxx,gxxy,gxxz,crho,sigma,R, SYM, SYM,SYM,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz)
call fderivs_shc(ex,Kxy,gxyx,gxyy,gxyz,crho,sigma,R,ANTI,ANTI,SYM,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz)
call fderivs_shc(ex,Kxz,gxzx,gxzy,gxzz,crho,sigma,R,ANTI,SYM ,ANTI,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz)
call fderivs_shc(ex,Kyy,gyyx,gyyy,gyyz,crho,sigma,R, SYM, SYM,SYM,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz)
call fderivs_shc(ex,Kyz,gyzx,gyzy,gyzz,crho,sigma,R,SYM ,ANTI,ANTI,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz)
call fderivs_shc(ex,Kzz,gzzx,gzzy,gzzz,crho,sigma,R, SYM, SYM,SYM,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz)
gxxx = gxxx - ( Gamxxx * Kxx + Gamyxx * Kxy + Gamzxx * Kxz &
+ Gamxxx * Kxx + Gamyxx * Kxy + Gamzxx * Kxz)
gxyx = gxyx - ( Gamxxy * Kxx + Gamyxy * Kxy + Gamzxy * Kxz &
+ Gamxxx * Kxy + Gamyxx * Kyy + Gamzxx * Kyz)
gxzx = gxzx - ( Gamxxz * Kxx + Gamyxz * Kxy + Gamzxz * Kxz &
+ Gamxxx * Kxz + Gamyxx * Kyz + Gamzxx * Kzz)
gyyx = gyyx - ( Gamxxy * Kxy + Gamyxy * Kyy + Gamzxy * Kyz &
+ Gamxxy * Kxy + Gamyxy * Kyy + Gamzxy * Kyz)
gyzx = gyzx - ( Gamxxz * Kxy + Gamyxz * Kyy + Gamzxz * Kyz &
+ Gamxxy * Kxz + Gamyxy * Kyz + Gamzxy * Kzz)
gzzx = gzzx - ( Gamxxz * Kxz + Gamyxz * Kyz + Gamzxz * Kzz &
+ Gamxxz * Kxz + Gamyxz * Kyz + Gamzxz * Kzz)
gxxy = gxxy - ( Gamxxy * Kxx + Gamyxy * Kxy + Gamzxy * Kxz &
+ Gamxxy * Kxx + Gamyxy * Kxy + Gamzxy * Kxz)
gxyy = gxyy - ( Gamxyy * Kxx + Gamyyy * Kxy + Gamzyy * Kxz &
+ Gamxxy * Kxy + Gamyxy * Kyy + Gamzxy * Kyz)
gxzy = gxzy - ( Gamxyz * Kxx + Gamyyz * Kxy + Gamzyz * Kxz &
+ Gamxxy * Kxz + Gamyxy * Kyz + Gamzxy * Kzz)
gyyy = gyyy - ( Gamxyy * Kxy + Gamyyy * Kyy + Gamzyy * Kyz &
+ Gamxyy * Kxy + Gamyyy * Kyy + Gamzyy * Kyz)
gyzy = gyzy - ( Gamxyz * Kxy + Gamyyz * Kyy + Gamzyz * Kyz &
+ Gamxyy * Kxz + Gamyyy * Kyz + Gamzyy * Kzz)
gzzy = gzzy - ( Gamxyz * Kxz + Gamyyz * Kyz + Gamzyz * Kzz &
+ Gamxyz * Kxz + Gamyyz * Kyz + Gamzyz * Kzz)
gxxz = gxxz - ( Gamxxz * Kxx + Gamyxz * Kxy + Gamzxz * Kxz &
+ Gamxxz * Kxx + Gamyxz * Kxy + Gamzxz * Kxz)
gxyz = gxyz - ( Gamxyz * Kxx + Gamyyz * Kxy + Gamzyz * Kxz &
+ Gamxxz * Kxy + Gamyxz * Kyy + Gamzxz * Kyz)
gxzz = gxzz - ( Gamxzz * Kxx + Gamyzz * Kxy + Gamzzz * Kxz &
+ Gamxxz * Kxz + Gamyxz * Kyz + Gamzxz * Kzz)
gyyz = gyyz - ( Gamxyz * Kxy + Gamyyz * Kyy + Gamzyz * Kyz &
+ Gamxyz * Kxy + Gamyyz * Kyy + Gamzyz * Kyz)
gyzz = gyzz - ( Gamxzz * Kxy + Gamyzz * Kyy + Gamzzz * Kyz &
+ Gamxyz * Kxz + Gamyyz * Kyz + Gamzyz * Kzz)
gzzz = gzzz - ( Gamxzz * Kxz + Gamyzz * Kyz + Gamzzz * Kzz &
+ Gamxzz * Kxz + Gamyzz * Kyz + Gamzzz * Kzz)
movx_Res = gupxx*gxxx + gupyy*gxyy + gupzz*gxzz &
+gupxy*gxyx + gupxz*gxzx + gupyz*gxzy &
+gupxy*gxxy + gupxz*gxxz + gupyz*gxyz
movy_Res = gupxx*gxyx + gupyy*gyyy + gupzz*gyzz &
+gupxy*gyyx + gupxz*gyzx + gupyz*gyzy &
+gupxy*gxyy + gupxz*gxyz + gupyz*gyyz
movz_Res = gupxx*gxzx + gupyy*gyzy + gupzz*gzzz &
+gupxy*gyzx + gupxz*gzzx + gupyz*gzzy &
+gupxy*gxzy + gupxz*gxzz + gupyz*gyzz
call fderivs_shc(ex,trK,fx,fy,fz,crho,sigma,R, SYM, SYM,SYM,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz)
movx_Res = movx_Res - fx - F8*PI*sx
movy_Res = movy_Res - fy - F8*PI*sy
movz_Res = movz_Res - fz - F8*PI*sz
return
end subroutine constraint_adm_ss
!-------------------------------------------------------------------------------!
! computed constraint for ADM formalism !
!-------------------------------------------------------------------------------!
subroutine constraint_adm(ex, X, Y, Z,&
dxx,gxy,gxz,dyy,gyz,dzz, &
Kxx,Kxy,Kxz,Kyy,Kyz,Kzz, &
Lap,Sfx,Sfy,Sfz,rho,Sx,Sy,Sz,&
ham_Res, movx_Res, movy_Res, movz_Res, &
Symmetry)
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 ) :: dxx,gxy,gxz,dyy,gyz,dzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Kxx,Kxy,Kxz,Kyy,Kyz,Kzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Lap,Sfx,Sfy,Sfz
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: rho,Sx,Sy,Sz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: ham_Res, movx_Res, movy_Res, movz_Res
!~~~~~~> Other variables:
! inverse metric
real*8, dimension(ex(1),ex(2),ex(3)) :: gupxx,gupxy,gupxz
real*8, dimension(ex(1),ex(2),ex(3)) :: gupyy,gupyz,gupzz
! first order derivative of metric, @_k g_ij
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxx,gxyx,gxzx
real*8, dimension(ex(1),ex(2),ex(3)) :: gyyx,gyzx,gzzx
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxy,gxyy,gxzy
real*8, dimension(ex(1),ex(2),ex(3)) :: gyyy,gyzy,gzzy
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxz,gxyz,gxzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gyyz,gyzz,gzzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gxx,gyy,gzz,trK,fx,fy,fz
real*8, dimension(ex(1),ex(2),ex(3)) :: Rxx,Rxy,Rxz,Ryy,Ryz,Rzz
real*8, dimension(ex(1),ex(2),ex(3)) :: Gamxxx, Gamxxy, Gamxxz
real*8, dimension(ex(1),ex(2),ex(3)) :: Gamxyy, Gamxyz, Gamxzz
real*8, dimension(ex(1),ex(2),ex(3)) :: Gamyxx, Gamyxy, Gamyxz
real*8, dimension(ex(1),ex(2),ex(3)) :: Gamyyy, Gamyyz, Gamyzz
real*8, dimension(ex(1),ex(2),ex(3)) :: Gamzxx, Gamzxy, Gamzxz
real*8, dimension(ex(1),ex(2),ex(3)) :: Gamzyy, Gamzyz, Gamzzz
integer, parameter :: NO_SYMM = 0, EQUATORIAL = 1, OCTANT = 2
real*8, parameter :: ZERO = 0.D0, HALF = 0.5d0, ONE = 1.d0, TWO = 2.d0, FOUR = 4.d0
real*8, parameter :: F2o3 = 2.d0/3.d0, F8 = 8.d0, F16 = 1.6d1, SIX = 6.d0
real*8, parameter :: SYM = 1.D0, ANTI= - 1.D0
real*8 :: PI
call adm_ricci_gamma(ex, X, Y, Z, &
dxx , gxy , gxz , dyy , gyz , dzz,&
Gamxxx,Gamxxy,Gamxxz,Gamxyy,Gamxyz,Gamxzz,&
Gamyxx,Gamyxy,Gamyxz,Gamyyy,Gamyyz,Gamyzz,&
Gamzxx,Gamzxy,Gamzxz,Gamzyy,Gamzyz,Gamzzz,&
Rxx,Rxy,Rxz,Ryy,Ryz,Rzz,&
Symmetry)
PI = dacos(-ONE)
gxx = dxx + ONE
gyy = dyy + ONE
gzz = dzz + ONE
! invert metric
gupzz = gxx * gyy * gzz + gxy * gyz * gxz + gxz * gxy * gyz - &
gxz * gyy * gxz - gxy * gxy * gzz - gxx * gyz * gyz
gupxx = ( gyy * gzz - gyz * gyz ) / gupzz
gupxy = - ( gxy * gzz - gyz * gxz ) / gupzz
gupxz = ( gxy * gyz - gyy * gxz ) / gupzz
gupyy = ( gxx * gzz - gxz * gxz ) / gupzz
gupyz = - ( gxx * gyz - gxy * gxz ) / gupzz
gupzz = ( gxx * gyy - gxy * gxy ) / gupzz
trK = gupxx * Kxx + gupyy * Kyy + gupzz * Kzz &
+ TWO * (gupxy * Kxy + gupxz * Kxz + gupyz * Kyz)
! ham_Res = trR + K^2 - K_ij * K^ij - 16 * PI * rho
ham_Res = gupxx * Rxx + gupyy * Ryy + gupzz * Rzz + &
TWO* ( gupxy * Rxy + gupxz * Rxz + gupyz * Ryz )
ham_Res = ham_Res + trK * trK -(&
gupxx * ( &
gupxx * Kxx * Kxx + gupyy * Kxy * Kxy + gupzz * Kxz * Kxz + &
TWO * (gupxy * Kxx * Kxy + gupxz * Kxx * Kxz + gupyz * Kxy * Kxz) ) + &
gupyy * ( &
gupxx * Kxy * Kxy + gupyy * Kyy * Kyy + gupzz * Kyz * Kyz + &
TWO * (gupxy * Kxy * Kyy + gupxz * Kxy * Kyz + gupyz * Kyy * Kyz) ) + &
gupzz * ( &
gupxx * Kxz * Kxz + gupyy * Kyz * Kyz + gupzz * Kzz * Kzz + &
TWO * (gupxy * Kxz * Kyz + gupxz * Kxz * Kzz + gupyz * Kyz * Kzz) ) + &
TWO * ( &
gupxy * ( &
gupxx * Kxx * Kxy + gupyy * Kxy * Kyy + gupzz * Kxz * Kyz + &
gupxy * (Kxx * Kyy + Kxy * Kxy) + &
gupxz * (Kxx * Kyz + Kxz * Kxy) + &
gupyz * (Kxy * Kyz + Kxz * Kyy) ) + &
gupxz * ( &
gupxx * Kxx * Kxz + gupyy * Kxy * Kyz + gupzz * Kxz * Kzz + &
gupxy * (Kxx * Kyz + Kxy * Kxz) + &
gupxz * (Kxx * Kzz + Kxz * Kxz) + &
gupyz * (Kxy * Kzz + Kxz * Kyz) ) + &
gupyz * ( &
gupxx * Kxy * Kxz + gupyy * Kyy * Kyz + gupzz * Kyz * Kzz + &
gupxy * (Kxy * Kyz + Kyy * Kxz) + &
gupxz * (Kxy * Kzz + Kyz * Kxz) + &
gupyz * (Kyy * Kzz + Kyz * Kyz) ) ))- F16 * PI * rho
! mov_Res_j = gupkj*D_k K_ij - d_j trK - 8 PI s_j where D respect to physical metric
! store D_i K_jk
call fderivs(ex,Kxx,gxxx,gxxy,gxxz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0)
call fderivs(ex,Kxy,gxyx,gxyy,gxyz,X,Y,Z,ANTI,ANTI,SYM ,Symmetry,0)
call fderivs(ex,Kxz,gxzx,gxzy,gxzz,X,Y,Z,ANTI,SYM ,ANTI,Symmetry,0)
call fderivs(ex,Kyy,gyyx,gyyy,gyyz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0)
call fderivs(ex,Kyz,gyzx,gyzy,gyzz,X,Y,Z,SYM ,ANTI,ANTI,Symmetry,0)
call fderivs(ex,Kzz,gzzx,gzzy,gzzz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0)
gxxx = gxxx - ( Gamxxx * Kxx + Gamyxx * Kxy + Gamzxx * Kxz &
+ Gamxxx * Kxx + Gamyxx * Kxy + Gamzxx * Kxz)
gxyx = gxyx - ( Gamxxy * Kxx + Gamyxy * Kxy + Gamzxy * Kxz &
+ Gamxxx * Kxy + Gamyxx * Kyy + Gamzxx * Kyz)
gxzx = gxzx - ( Gamxxz * Kxx + Gamyxz * Kxy + Gamzxz * Kxz &
+ Gamxxx * Kxz + Gamyxx * Kyz + Gamzxx * Kzz)
gyyx = gyyx - ( Gamxxy * Kxy + Gamyxy * Kyy + Gamzxy * Kyz &
+ Gamxxy * Kxy + Gamyxy * Kyy + Gamzxy * Kyz)
gyzx = gyzx - ( Gamxxz * Kxy + Gamyxz * Kyy + Gamzxz * Kyz &
+ Gamxxy * Kxz + Gamyxy * Kyz + Gamzxy * Kzz)
gzzx = gzzx - ( Gamxxz * Kxz + Gamyxz * Kyz + Gamzxz * Kzz &
+ Gamxxz * Kxz + Gamyxz * Kyz + Gamzxz * Kzz)
gxxy = gxxy - ( Gamxxy * Kxx + Gamyxy * Kxy + Gamzxy * Kxz &
+ Gamxxy * Kxx + Gamyxy * Kxy + Gamzxy * Kxz)
gxyy = gxyy - ( Gamxyy * Kxx + Gamyyy * Kxy + Gamzyy * Kxz &
+ Gamxxy * Kxy + Gamyxy * Kyy + Gamzxy * Kyz)
gxzy = gxzy - ( Gamxyz * Kxx + Gamyyz * Kxy + Gamzyz * Kxz &
+ Gamxxy * Kxz + Gamyxy * Kyz + Gamzxy * Kzz)
gyyy = gyyy - ( Gamxyy * Kxy + Gamyyy * Kyy + Gamzyy * Kyz &
+ Gamxyy * Kxy + Gamyyy * Kyy + Gamzyy * Kyz)
gyzy = gyzy - ( Gamxyz * Kxy + Gamyyz * Kyy + Gamzyz * Kyz &
+ Gamxyy * Kxz + Gamyyy * Kyz + Gamzyy * Kzz)
gzzy = gzzy - ( Gamxyz * Kxz + Gamyyz * Kyz + Gamzyz * Kzz &
+ Gamxyz * Kxz + Gamyyz * Kyz + Gamzyz * Kzz)
gxxz = gxxz - ( Gamxxz * Kxx + Gamyxz * Kxy + Gamzxz * Kxz &
+ Gamxxz * Kxx + Gamyxz * Kxy + Gamzxz * Kxz)
gxyz = gxyz - ( Gamxyz * Kxx + Gamyyz * Kxy + Gamzyz * Kxz &
+ Gamxxz * Kxy + Gamyxz * Kyy + Gamzxz * Kyz)
gxzz = gxzz - ( Gamxzz * Kxx + Gamyzz * Kxy + Gamzzz * Kxz &
+ Gamxxz * Kxz + Gamyxz * Kyz + Gamzxz * Kzz)
gyyz = gyyz - ( Gamxyz * Kxy + Gamyyz * Kyy + Gamzyz * Kyz &
+ Gamxyz * Kxy + Gamyyz * Kyy + Gamzyz * Kyz)
gyzz = gyzz - ( Gamxzz * Kxy + Gamyzz * Kyy + Gamzzz * Kyz &
+ Gamxyz * Kxz + Gamyyz * Kyz + Gamzyz * Kzz)
gzzz = gzzz - ( Gamxzz * Kxz + Gamyzz * Kyz + Gamzzz * Kzz &
+ Gamxzz * Kxz + Gamyzz * Kyz + Gamzzz * Kzz)
movx_Res = gupxx*gxxx + gupyy*gxyy + gupzz*gxzz &
+gupxy*gxyx + gupxz*gxzx + gupyz*gxzy &
+gupxy*gxxy + gupxz*gxxz + gupyz*gxyz
movy_Res = gupxx*gxyx + gupyy*gyyy + gupzz*gyzz &
+gupxy*gyyx + gupxz*gyzx + gupyz*gyzy &
+gupxy*gxyy + gupxz*gxyz + gupyz*gyyz
movz_Res = gupxx*gxzx + gupyy*gyzy + gupzz*gzzz &
+gupxy*gyzx + gupxz*gzzx + gupyz*gzzy &
+gupxy*gxzy + gupxz*gxzz + gupyz*gyzz
call fderivs(ex,trK,fx,fy,fz,X,Y,Z,SYM,SYM,SYM,Symmetry,0)
movx_Res = movx_Res - fx - F8*PI*sx
movy_Res = movy_Res - fy - F8*PI*sy
movz_Res = movz_Res - fz - F8*PI*sz
return
end subroutine constraint_adm
!-------------------------------------------------------------------------------!
! computed constraint for ADM formalism for shell !
!-------------------------------------------------------------------------------!
subroutine constraint_adm_ss(ex,crho,sigma,R, X, Y, Z,&
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz, &
drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz, &
dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz, &
dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz, &
dxx,gxy,gxz,dyy,gyz,dzz, &
Kxx,Kxy,Kxz,Kyy,Kyz,Kzz, &
Lap,Sfx,Sfy,Sfz,rho,Sx,Sy,Sz,&
Gamxxx, Gamxxy, Gamxxz,Gamxyy, Gamxyz, Gamxzz, &
Gamyxx, Gamyxy, Gamyxz,Gamyyy, Gamyyz, Gamyzz, &
Gamzxx, Gamzxy, Gamzxz,Gamzyy, Gamzyz, Gamzzz, &
Rxx,Rxy,Rxz,Ryy,Ryz,Rzz, &
ham_Res, movx_Res, movy_Res, movz_Res, &
Symmetry,Lev,sst)
implicit none
!~~~~~~> Input parameters:
integer,intent(in ):: ex(1:3),symmetry,Lev,sst
double precision,intent(in),dimension(ex(1))::crho
double precision,intent(in),dimension(ex(2))::sigma
double precision,intent(in),dimension(ex(3))::R
real*8, intent(in ),dimension(ex(1),ex(2),ex(3)):: X,Y,Z
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::drhodx, drhody, drhodz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dsigmadx,dsigmady,dsigmadz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dRdx,dRdy,dRdz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: dxx,gxy,gxz,dyy,gyz,dzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Kxx,Kxy,Kxz,Kyy,Kyz,Kzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Lap,Sfx,Sfy,Sfz
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: rho,Sx,Sy,Sz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Rxx,Rxy,Rxz,Ryy,Ryz,Rzz
! second kind of Christofel symble Gamma^i_jk respect to physical metric
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamxxx, Gamxxy, Gamxxz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamxyy, Gamxyz, Gamxzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamyxx, Gamyxy, Gamyxz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamyyy, Gamyyz, Gamyzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamzxx, Gamzxy, Gamzxz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamzyy, Gamzyz, Gamzzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: ham_Res, movx_Res, movy_Res, movz_Res
!~~~~~~> Other variables:
! inverse metric
real*8, dimension(ex(1),ex(2),ex(3)) :: gupxx,gupxy,gupxz
real*8, dimension(ex(1),ex(2),ex(3)) :: gupyy,gupyz,gupzz
! first order derivative of metric, @_k g_ij
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxx,gxyx,gxzx
real*8, dimension(ex(1),ex(2),ex(3)) :: gyyx,gyzx,gzzx
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxy,gxyy,gxzy
real*8, dimension(ex(1),ex(2),ex(3)) :: gyyy,gyzy,gzzy
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxz,gxyz,gxzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gyyz,gyzz,gzzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gxx,gyy,gzz,trK,fx,fy,fz
integer, parameter :: NO_SYMM = 0, EQUATORIAL = 1, OCTANT = 2
real*8, parameter :: ZERO = 0.D0, HALF = 0.5d0, ONE = 1.d0, TWO = 2.d0, FOUR = 4.d0
real*8, parameter :: F2o3 = 2.d0/3.d0, F8 = 8.d0, F16 = 1.6d1, SIX = 6.d0
real*8, parameter :: SYM = 1.D0, ANTI= - 1.D0
real*8 :: PI
call adm_ricci_gamma_ss(ex,crho,sigma,R,X, Y, Z, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz, &
drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz, &
dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz, &
dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz, &
dxx , gxy , gxz , dyy , gyz , dzz,&
Gamxxx,Gamxxy,Gamxxz,Gamxyy,Gamxyz,Gamxzz,&
Gamyxx,Gamyxy,Gamyxz,Gamyyy,Gamyyz,Gamyzz,&
Gamzxx,Gamzxy,Gamzxz,Gamzyy,Gamzyz,Gamzzz,&
Rxx,Rxy,Rxz,Ryy,Ryz,Rzz,&
Symmetry,Lev,sst)
PI = dacos(-ONE)
gxx = dxx + ONE
gyy = dyy + ONE
gzz = dzz + ONE
! invert metric
gupzz = gxx * gyy * gzz + gxy * gyz * gxz + gxz * gxy * gyz - &
gxz * gyy * gxz - gxy * gxy * gzz - gxx * gyz * gyz
gupxx = ( gyy * gzz - gyz * gyz ) / gupzz
gupxy = - ( gxy * gzz - gyz * gxz ) / gupzz
gupxz = ( gxy * gyz - gyy * gxz ) / gupzz
gupyy = ( gxx * gzz - gxz * gxz ) / gupzz
gupyz = - ( gxx * gyz - gxy * gxz ) / gupzz
gupzz = ( gxx * gyy - gxy * gxy ) / gupzz
trK = gupxx * Kxx + gupyy * Kyy + gupzz * Kzz &
+ TWO * (gupxy * Kxy + gupxz * Kxz + gupyz * Kyz)
! ham_Res = trR + K^2 - K_ij * K^ij - 16 * PI * rho
ham_Res = gupxx * Rxx + gupyy * Ryy + gupzz * Rzz + &
TWO* ( gupxy * Rxy + gupxz * Rxz + gupyz * Ryz )
ham_Res = ham_Res + trK * trK -(&
gupxx * ( &
gupxx * Kxx * Kxx + gupyy * Kxy * Kxy + gupzz * Kxz * Kxz + &
TWO * (gupxy * Kxx * Kxy + gupxz * Kxx * Kxz + gupyz * Kxy * Kxz) ) + &
gupyy * ( &
gupxx * Kxy * Kxy + gupyy * Kyy * Kyy + gupzz * Kyz * Kyz + &
TWO * (gupxy * Kxy * Kyy + gupxz * Kxy * Kyz + gupyz * Kyy * Kyz) ) + &
gupzz * ( &
gupxx * Kxz * Kxz + gupyy * Kyz * Kyz + gupzz * Kzz * Kzz + &
TWO * (gupxy * Kxz * Kyz + gupxz * Kxz * Kzz + gupyz * Kyz * Kzz) ) + &
TWO * ( &
gupxy * ( &
gupxx * Kxx * Kxy + gupyy * Kxy * Kyy + gupzz * Kxz * Kyz + &
gupxy * (Kxx * Kyy + Kxy * Kxy) + &
gupxz * (Kxx * Kyz + Kxz * Kxy) + &
gupyz * (Kxy * Kyz + Kxz * Kyy) ) + &
gupxz * ( &
gupxx * Kxx * Kxz + gupyy * Kxy * Kyz + gupzz * Kxz * Kzz + &
gupxy * (Kxx * Kyz + Kxy * Kxz) + &
gupxz * (Kxx * Kzz + Kxz * Kxz) + &
gupyz * (Kxy * Kzz + Kxz * Kyz) ) + &
gupyz * ( &
gupxx * Kxy * Kxz + gupyy * Kyy * Kyz + gupzz * Kyz * Kzz + &
gupxy * (Kxy * Kyz + Kyy * Kxz) + &
gupxz * (Kxy * Kzz + Kyz * Kxz) + &
gupyz * (Kyy * Kzz + Kyz * Kyz) ) ))- F16 * PI * rho
! mov_Res_j = gupkj*D_k K_ij - d_j trK - 8 PI s_j where D respect to physical metric
! store D_i K_jk
call fderivs_shc(ex,Kxx,gxxx,gxxy,gxxz,crho,sigma,R, SYM, SYM,SYM,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz)
call fderivs_shc(ex,Kxy,gxyx,gxyy,gxyz,crho,sigma,R,ANTI,ANTI,SYM,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz)
call fderivs_shc(ex,Kxz,gxzx,gxzy,gxzz,crho,sigma,R,ANTI,SYM ,ANTI,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz)
call fderivs_shc(ex,Kyy,gyyx,gyyy,gyyz,crho,sigma,R, SYM, SYM,SYM,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz)
call fderivs_shc(ex,Kyz,gyzx,gyzy,gyzz,crho,sigma,R,SYM ,ANTI,ANTI,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz)
call fderivs_shc(ex,Kzz,gzzx,gzzy,gzzz,crho,sigma,R, SYM, SYM,SYM,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz)
gxxx = gxxx - ( Gamxxx * Kxx + Gamyxx * Kxy + Gamzxx * Kxz &
+ Gamxxx * Kxx + Gamyxx * Kxy + Gamzxx * Kxz)
gxyx = gxyx - ( Gamxxy * Kxx + Gamyxy * Kxy + Gamzxy * Kxz &
+ Gamxxx * Kxy + Gamyxx * Kyy + Gamzxx * Kyz)
gxzx = gxzx - ( Gamxxz * Kxx + Gamyxz * Kxy + Gamzxz * Kxz &
+ Gamxxx * Kxz + Gamyxx * Kyz + Gamzxx * Kzz)
gyyx = gyyx - ( Gamxxy * Kxy + Gamyxy * Kyy + Gamzxy * Kyz &
+ Gamxxy * Kxy + Gamyxy * Kyy + Gamzxy * Kyz)
gyzx = gyzx - ( Gamxxz * Kxy + Gamyxz * Kyy + Gamzxz * Kyz &
+ Gamxxy * Kxz + Gamyxy * Kyz + Gamzxy * Kzz)
gzzx = gzzx - ( Gamxxz * Kxz + Gamyxz * Kyz + Gamzxz * Kzz &
+ Gamxxz * Kxz + Gamyxz * Kyz + Gamzxz * Kzz)
gxxy = gxxy - ( Gamxxy * Kxx + Gamyxy * Kxy + Gamzxy * Kxz &
+ Gamxxy * Kxx + Gamyxy * Kxy + Gamzxy * Kxz)
gxyy = gxyy - ( Gamxyy * Kxx + Gamyyy * Kxy + Gamzyy * Kxz &
+ Gamxxy * Kxy + Gamyxy * Kyy + Gamzxy * Kyz)
gxzy = gxzy - ( Gamxyz * Kxx + Gamyyz * Kxy + Gamzyz * Kxz &
+ Gamxxy * Kxz + Gamyxy * Kyz + Gamzxy * Kzz)
gyyy = gyyy - ( Gamxyy * Kxy + Gamyyy * Kyy + Gamzyy * Kyz &
+ Gamxyy * Kxy + Gamyyy * Kyy + Gamzyy * Kyz)
gyzy = gyzy - ( Gamxyz * Kxy + Gamyyz * Kyy + Gamzyz * Kyz &
+ Gamxyy * Kxz + Gamyyy * Kyz + Gamzyy * Kzz)
gzzy = gzzy - ( Gamxyz * Kxz + Gamyyz * Kyz + Gamzyz * Kzz &
+ Gamxyz * Kxz + Gamyyz * Kyz + Gamzyz * Kzz)
gxxz = gxxz - ( Gamxxz * Kxx + Gamyxz * Kxy + Gamzxz * Kxz &
+ Gamxxz * Kxx + Gamyxz * Kxy + Gamzxz * Kxz)
gxyz = gxyz - ( Gamxyz * Kxx + Gamyyz * Kxy + Gamzyz * Kxz &
+ Gamxxz * Kxy + Gamyxz * Kyy + Gamzxz * Kyz)
gxzz = gxzz - ( Gamxzz * Kxx + Gamyzz * Kxy + Gamzzz * Kxz &
+ Gamxxz * Kxz + Gamyxz * Kyz + Gamzxz * Kzz)
gyyz = gyyz - ( Gamxyz * Kxy + Gamyyz * Kyy + Gamzyz * Kyz &
+ Gamxyz * Kxy + Gamyyz * Kyy + Gamzyz * Kyz)
gyzz = gyzz - ( Gamxzz * Kxy + Gamyzz * Kyy + Gamzzz * Kyz &
+ Gamxyz * Kxz + Gamyyz * Kyz + Gamzyz * Kzz)
gzzz = gzzz - ( Gamxzz * Kxz + Gamyzz * Kyz + Gamzzz * Kzz &
+ Gamxzz * Kxz + Gamyzz * Kyz + Gamzzz * Kzz)
movx_Res = gupxx*gxxx + gupyy*gxyy + gupzz*gxzz &
+gupxy*gxyx + gupxz*gxzx + gupyz*gxzy &
+gupxy*gxxy + gupxz*gxxz + gupyz*gxyz
movy_Res = gupxx*gxyx + gupyy*gyyy + gupzz*gyzz &
+gupxy*gyyx + gupxz*gyzx + gupyz*gyzy &
+gupxy*gxyy + gupxz*gxyz + gupyz*gyyz
movz_Res = gupxx*gxzx + gupyy*gyzy + gupzz*gzzz &
+gupxy*gyzx + gupxz*gzzx + gupyz*gzzy &
+gupxy*gxzy + gupxz*gxzz + gupyz*gyzz
call fderivs_shc(ex,trK,fx,fy,fz,crho,sigma,R, SYM, SYM,SYM,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz)
movx_Res = movx_Res - fx - F8*PI*sx
movy_Res = movy_Res - fy - F8*PI*sy
movz_Res = movz_Res - fz - F8*PI*sz
return
end subroutine constraint_adm_ss

View File

@@ -1,306 +1,306 @@
! for ADM variables
subroutine adm_ricci_gamma(ex, X, Y, Z, &
dxx , gxy , gxz , dyy , gyz , dzz,&
Gamxxx,Gamxxy,Gamxxz,Gamxyy,Gamxyz,Gamxzz,&
Gamyxx,Gamyxy,Gamyxz,Gamyyy,Gamyyz,Gamyzz,&
Gamzxx,Gamzxy,Gamzxz,Gamzyy,Gamzyz,Gamzzz,&
Rxx,Rxy,Rxz,Ryy,Ryz,Rzz,&
Symmetry)
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 ) :: dxx,gxy,gxz,dyy,gyz,dzz
! when out, physical second kind of connection
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamxxx, Gamxxy, Gamxxz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamxyy, Gamxyz, Gamxzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamyxx, Gamyxy, Gamyxz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamyyy, Gamyyz, Gamyzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamzxx, Gamzxy, Gamzxz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamzyy, Gamzyz, Gamzzz
! when out, physical Ricci tensor
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Rxx,Rxy,Rxz,Ryy,Ryz,Rzz
!~~~~~~> Other variables:
real*8, dimension(ex(1),ex(2),ex(3)) :: gxx,gyy,gzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxx,gxyx,gxzx,gyyx,gyzx,gzzx
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxy,gxyy,gxzy,gyyy,gyzy,gzzy
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxz,gxyz,gxzz,gyyz,gyzz,gzzz
real*8, dimension(ex(1),ex(2),ex(3)) :: ass_Gamxxx,ass_Gamxxy,ass_Gamxxz
real*8, dimension(ex(1),ex(2),ex(3)) :: ass_Gamxyy,ass_Gamxyz,ass_Gamxzz
real*8, dimension(ex(1),ex(2),ex(3)) :: ass_Gamyxx,ass_Gamyxy,ass_Gamyxz
real*8, dimension(ex(1),ex(2),ex(3)) :: ass_Gamyyy,ass_Gamyyz,ass_Gamyzz
real*8, dimension(ex(1),ex(2),ex(3)) :: ass_Gamzxx,ass_Gamzxy,ass_Gamzxz
real*8, dimension(ex(1),ex(2),ex(3)) :: ass_Gamzyy,ass_Gamzyz,ass_Gamzzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gupxx,gupxy,gupxz
real*8, dimension(ex(1),ex(2),ex(3)) :: gupyy,gupyz,gupzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxxx,gxxxy,gxxxz,gxxyy,gxxyz,gxxzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gxyxx,gxyxy,gxyxz,gxyyy,gxyyz,gxyzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gxzxx,gxzxy,gxzxz,gxzyy,gxzyz,gxzzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gyyxx,gyyxy,gyyxz,gyyyy,gyyyz,gyyzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gyzxx,gyzxy,gyzxz,gyzyy,gyzyz,gyzzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gzzxx,gzzxy,gzzxz,gzzyy,gzzyz,gzzzz
real*8, dimension(ex(1),ex(2),ex(3)) :: Rxyxy, Rxyxz, Rxyyz, Rxzxz, Rxzyz, Ryzyz
real*8, parameter :: ONE = 1.D0, TWO = 2.D0, FOUR = 4.D0
real*8, parameter :: HALF = 0.5D0, F2o3 = 2.d0/3.d0, F3o2 = 1.5d0
real*8, parameter :: SYM = 1.D0, ANTI= - 1.D0
gxx = dxx + ONE
gyy = dyy + ONE
gzz = dzz + ONE
call fderivs(ex,dxx,gxxx,gxxy,gxxz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0)
call fderivs(ex,gxy,gxyx,gxyy,gxyz,X,Y,Z,ANTI,ANTI,SYM ,Symmetry,0)
call fderivs(ex,gxz,gxzx,gxzy,gxzz,X,Y,Z,ANTI,SYM ,ANTI,Symmetry,0)
call fderivs(ex,dyy,gyyx,gyyy,gyyz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0)
call fderivs(ex,gyz,gyzx,gyzy,gyzz,X,Y,Z,SYM ,ANTI,ANTI,Symmetry,0)
call fderivs(ex,dzz,gzzx,gzzy,gzzz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0)
call kind1_connection(ex, &
gxxx,gxyx,gxzx,gyyx,gyzx,gzzx, &
gxxy,gxyy,gxzy,gyyy,gyzy,gzzy, &
gxxz,gxyz,gxzz,gyyz,gyzz,gzzz, &
ass_Gamxxx, ass_Gamxxy, ass_Gamxxz, ass_Gamxyy, ass_Gamxyz, ass_Gamxzz, &
ass_Gamyxx, ass_Gamyxy, ass_Gamyxz, ass_Gamyyy, ass_Gamyyz, ass_Gamyzz, &
ass_Gamzxx, ass_Gamzxy, ass_Gamzxz, ass_Gamzyy, ass_Gamzyz, ass_Gamzzz)
! invert metric
gupzz = gxx * gyy * gzz + gxy * gyz * gxz + gxz * gxy * gyz - &
gxz * gyy * gxz - gxy * gxy * gzz - gxx * gyz * gyz
gupxx = ( gyy * gzz - gyz * gyz ) / gupzz
gupxy = - ( gxy * gzz - gyz * gxz ) / gupzz
gupxz = ( gxy * gyz - gyy * gxz ) / gupzz
gupyy = ( gxx * gzz - gxz * gxz ) / gupzz
gupyz = - ( gxx * gyz - gxy * gxz ) / gupzz
gupzz = ( gxx * gyy - gxy * gxy ) / gupzz
call kind2_connection(ex, &
gupxx,gupxy,gupxz,gupyy,gupyz,gupzz, &
ass_Gamxxx, ass_Gamxxy, ass_Gamxxz, ass_Gamxyy, ass_Gamxyz, ass_Gamxzz, &
ass_Gamyxx, ass_Gamyxy, ass_Gamyxz, ass_Gamyyy, ass_Gamyyz, ass_Gamyzz, &
ass_Gamzxx, ass_Gamzxy, ass_Gamzxz, ass_Gamzyy, ass_Gamzyz, ass_Gamzzz, &
Gamxxx, Gamxxy, Gamxxz, Gamxyy, Gamxyz, Gamxzz, &
Gamyxx, Gamyxy, Gamyxz, Gamyyy, Gamyyz, Gamyzz, &
Gamzxx, Gamzxy, Gamzxz, Gamzyy, Gamzyz, Gamzzz)
call fdderivs(ex,dxx,gxxxx,gxxxy,gxxxz,gxxyy,gxxyz,gxxzz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0)
call fdderivs(ex,gxy,gxyxx,gxyxy,gxyxz,gxyyy,gxyyz,gxyzz,X,Y,Z,ANTI,ANTI,SYM ,Symmetry,0)
call fdderivs(ex,gxz,gxzxx,gxzxy,gxzxz,gxzyy,gxzyz,gxzzz,X,Y,Z,ANTI,SYM ,ANTI,Symmetry,0)
call fdderivs(ex,dyy,gyyxx,gyyxy,gyyxz,gyyyy,gyyyz,gyyzz,X,Y,Z,SYM, SYM ,SYM ,Symmetry,0)
call fdderivs(ex,gyz,gyzxx,gyzxy,gyzxz,gyzyy,gyzyz,gyzzz,X,Y,Z,SYM ,ANTI,ANTI,Symmetry,0)
call fdderivs(ex,dzz,gzzxx,gzzxy,gzzxz,gzzyy,gzzyz,gzzzz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0)
call adm_riemann(ex, &
gxxxx,gxxxy,gxxxz,gxxyy,gxxyz,gxxzz, &
gxyxx,gxyxy,gxyxz,gxyyy,gxyyz,gxyzz, &
gxzxx,gxzxy,gxzxz,gxzyy,gxzyz,gxzzz, &
gyyxx,gyyxy,gyyxz,gyyyy,gyyyz,gyyzz, &
gyzxx,gyzxy,gyzxz,gyzyy,gyzyz,gyzzz, &
gzzxx,gzzxy,gzzxz,gzzyy,gzzyz,gzzzz, &
Gamxxx, Gamxxy, Gamxxz, Gamxyy, Gamxyz, Gamxzz, &
Gamyxx, Gamyxy, Gamyxz, Gamyyy, Gamyyz, Gamyzz, &
Gamzxx, Gamzxy, Gamzxz, Gamzyy, Gamzyz, Gamzzz, &
ass_Gamxxx,ass_Gamxxy,ass_Gamxxz, ass_Gamxyy,ass_Gamxyz,ass_Gamxzz, &
ass_Gamyxx,ass_Gamyxy,ass_Gamyxz, ass_Gamyyy,ass_Gamyyz,ass_Gamyzz, &
ass_Gamzxx,ass_Gamzxy,ass_Gamzxz, ass_Gamzyy,ass_Gamzyz,ass_Gamzzz, &
Rxyxy, Rxyxz, Rxyyz, Rxzxz, Rxzyz, Ryzyz)
call adm_ricci(ex, &
gupxx , gupxy , gupxz , gupyy , gupyz , gupzz , &
Rxyxy, Rxyxz, Rxyyz, Rxzxz, Rxzyz, Ryzyz, &
Rxx , Rxy , Rxz , Ryy , Ryz , Rzz)
return
end subroutine adm_ricci_gamma
!----------------------------------------------------------------------------
subroutine adm_ricci_gamma_ss(ex,crho,sigma,R,X, Y, Z, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz, &
drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz, &
dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz, &
dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz, &
dxx , gxy , gxz , dyy , gyz , dzz,&
Gamxxx,Gamxxy,Gamxxz,Gamxyy,Gamxyz,Gamxzz,&
Gamyxx,Gamyxy,Gamyxz,Gamyyy,Gamyyz,Gamyzz,&
Gamzxx,Gamzxy,Gamzxz,Gamzyy,Gamzyz,Gamzzz,&
Rxx,Rxy,Rxz,Ryy,Ryz,Rzz,&
Symmetry,Lev,sst)
implicit none
!~~~~~~> Input parameters:
integer,intent(in ):: ex(1:3), Symmetry,Lev,sst
double precision,intent(in),dimension(ex(1))::crho
double precision,intent(in),dimension(ex(2))::sigma
double precision,intent(in),dimension(ex(3))::R
real*8, intent(in ),dimension(ex(1),ex(2),ex(3)):: X,Y,Z
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::drhodx, drhody, drhodz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dsigmadx,dsigmady,dsigmadz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dRdx,dRdy,dRdz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: dxx,gxy,gxz,dyy,gyz,dzz
! when out, physical second kind of connection
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamxxx, Gamxxy, Gamxxz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamxyy, Gamxyz, Gamxzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamyxx, Gamyxy, Gamyxz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamyyy, Gamyyz, Gamyzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamzxx, Gamzxy, Gamzxz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamzyy, Gamzyz, Gamzzz
! when out, physical Ricci tensor
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Rxx,Rxy,Rxz,Ryy,Ryz,Rzz
!~~~~~~> Other variables:
real*8, dimension(ex(1),ex(2),ex(3)) :: gxx,gyy,gzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxx,gxyx,gxzx,gyyx,gyzx,gzzx
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxy,gxyy,gxzy,gyyy,gyzy,gzzy
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxz,gxyz,gxzz,gyyz,gyzz,gzzz
real*8, dimension(ex(1),ex(2),ex(3)) :: ass_Gamxxx,ass_Gamxxy,ass_Gamxxz
real*8, dimension(ex(1),ex(2),ex(3)) :: ass_Gamxyy,ass_Gamxyz,ass_Gamxzz
real*8, dimension(ex(1),ex(2),ex(3)) :: ass_Gamyxx,ass_Gamyxy,ass_Gamyxz
real*8, dimension(ex(1),ex(2),ex(3)) :: ass_Gamyyy,ass_Gamyyz,ass_Gamyzz
real*8, dimension(ex(1),ex(2),ex(3)) :: ass_Gamzxx,ass_Gamzxy,ass_Gamzxz
real*8, dimension(ex(1),ex(2),ex(3)) :: ass_Gamzyy,ass_Gamzyz,ass_Gamzzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gupxx,gupxy,gupxz
real*8, dimension(ex(1),ex(2),ex(3)) :: gupyy,gupyz,gupzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxxx,gxxxy,gxxxz,gxxyy,gxxyz,gxxzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gxyxx,gxyxy,gxyxz,gxyyy,gxyyz,gxyzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gxzxx,gxzxy,gxzxz,gxzyy,gxzyz,gxzzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gyyxx,gyyxy,gyyxz,gyyyy,gyyyz,gyyzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gyzxx,gyzxy,gyzxz,gyzyy,gyzyz,gyzzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gzzxx,gzzxy,gzzxz,gzzyy,gzzyz,gzzzz
real*8, dimension(ex(1),ex(2),ex(3)) :: Rxyxy, Rxyxz, Rxyyz, Rxzxz, Rxzyz, Ryzyz
real*8, parameter :: ONE = 1.D0, TWO = 2.D0, FOUR = 4.D0
real*8, parameter :: HALF = 0.5D0, F2o3 = 2.d0/3.d0, F3o2 = 1.5d0
real*8, parameter :: SYM = 1.D0, ANTI= - 1.D0
gxx = dxx + ONE
gyy = dyy + ONE
gzz = dzz + ONE
call fderivs_shc(ex,dxx,gxxx,gxxy,gxxz,crho,sigma,R, SYM, SYM,SYM,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz)
call fderivs_shc(ex,gxy,gxyx,gxyy,gxyz,crho,sigma,R,ANTI,ANTI,SYM,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz)
call fderivs_shc(ex,gxz,gxzx,gxzy,gxzz,crho,sigma,R,ANTI,SYM ,ANTI,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz)
call fderivs_shc(ex,dyy,gyyx,gyyy,gyyz,crho,sigma,R, SYM, SYM,SYM,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz)
call fderivs_shc(ex,gyz,gyzx,gyzy,gyzz,crho,sigma,R,SYM ,ANTI,ANTI,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz)
call fderivs_shc(ex,dzz,gzzx,gzzy,gzzz,crho,sigma,R, SYM, SYM,SYM,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz)
call kind1_connection(ex, &
gxxx,gxyx,gxzx,gyyx,gyzx,gzzx, &
gxxy,gxyy,gxzy,gyyy,gyzy,gzzy, &
gxxz,gxyz,gxzz,gyyz,gyzz,gzzz, &
ass_Gamxxx, ass_Gamxxy, ass_Gamxxz, ass_Gamxyy, ass_Gamxyz, ass_Gamxzz, &
ass_Gamyxx, ass_Gamyxy, ass_Gamyxz, ass_Gamyyy, ass_Gamyyz, ass_Gamyzz, &
ass_Gamzxx, ass_Gamzxy, ass_Gamzxz, ass_Gamzyy, ass_Gamzyz, ass_Gamzzz)
! invert metric
gupzz = gxx * gyy * gzz + gxy * gyz * gxz + gxz * gxy * gyz - &
gxz * gyy * gxz - gxy * gxy * gzz - gxx * gyz * gyz
gupxx = ( gyy * gzz - gyz * gyz ) / gupzz
gupxy = - ( gxy * gzz - gyz * gxz ) / gupzz
gupxz = ( gxy * gyz - gyy * gxz ) / gupzz
gupyy = ( gxx * gzz - gxz * gxz ) / gupzz
gupyz = - ( gxx * gyz - gxy * gxz ) / gupzz
gupzz = ( gxx * gyy - gxy * gxy ) / gupzz
call kind2_connection(ex, &
gupxx,gupxy,gupxz,gupyy,gupyz,gupzz, &
ass_Gamxxx, ass_Gamxxy, ass_Gamxxz, ass_Gamxyy, ass_Gamxyz, ass_Gamxzz, &
ass_Gamyxx, ass_Gamyxy, ass_Gamyxz, ass_Gamyyy, ass_Gamyyz, ass_Gamyzz, &
ass_Gamzxx, ass_Gamzxy, ass_Gamzxz, ass_Gamzyy, ass_Gamzyz, ass_Gamzzz, &
Gamxxx, Gamxxy, Gamxxz, Gamxyy, Gamxyz, Gamxzz, &
Gamyxx, Gamyxy, Gamyxz, Gamyyy, Gamyyz, Gamyzz, &
Gamzxx, Gamzxy, Gamzxz, Gamzyy, Gamzyz, Gamzzz)
call fdderivs_shc(ex,dxx,gxxxx,gxxxy,gxxxz,gxxyy,gxxyz,gxxzz,crho,sigma,R, SYM, SYM,SYM ,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz, &
drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz, &
dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz, &
dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz)
call fdderivs_shc(ex,dyy,gyyxx,gyyxy,gyyxz,gyyyy,gyyyz,gyyzz,crho,sigma,R, SYM, SYM,SYM ,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz, &
drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz, &
dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz, &
dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz)
call fdderivs_shc(ex,dzz,gzzxx,gzzxy,gzzxz,gzzyy,gzzyz,gzzzz,crho,sigma,R, SYM, SYM,SYM ,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz, &
drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz, &
dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz, &
dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz)
call fdderivs_shc(ex,gxy,gxyxx,gxyxy,gxyxz,gxyyy,gxyyz,gxyzz,crho,sigma,R,ANTI,ANTI,SYM ,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz, &
drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz, &
dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz, &
dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz)
call fdderivs_shc(ex,gxz,gxzxx,gxzxy,gxzxz,gxzyy,gxzyz,gxzzz,crho,sigma,R,ANTI,SYM ,ANTI,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz, &
drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz, &
dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz, &
dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz)
call fdderivs_shc(ex,gyz,gyzxx,gyzxy,gyzxz,gyzyy,gyzyz,gyzzz,crho,sigma,R,SYM ,ANTI,ANTI,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz, &
drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz, &
dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz, &
dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz)
call adm_riemann(ex, &
gxxxx,gxxxy,gxxxz,gxxyy,gxxyz,gxxzz, &
gxyxx,gxyxy,gxyxz,gxyyy,gxyyz,gxyzz, &
gxzxx,gxzxy,gxzxz,gxzyy,gxzyz,gxzzz, &
gyyxx,gyyxy,gyyxz,gyyyy,gyyyz,gyyzz, &
gyzxx,gyzxy,gyzxz,gyzyy,gyzyz,gyzzz, &
gzzxx,gzzxy,gzzxz,gzzyy,gzzyz,gzzzz, &
Gamxxx, Gamxxy, Gamxxz, Gamxyy, Gamxyz, Gamxzz, &
Gamyxx, Gamyxy, Gamyxz, Gamyyy, Gamyyz, Gamyzz, &
Gamzxx, Gamzxy, Gamzxz, Gamzyy, Gamzyz, Gamzzz, &
ass_Gamxxx,ass_Gamxxy,ass_Gamxxz, ass_Gamxyy,ass_Gamxyz,ass_Gamxzz, &
ass_Gamyxx,ass_Gamyxy,ass_Gamyxz, ass_Gamyyy,ass_Gamyyz,ass_Gamyzz, &
ass_Gamzxx,ass_Gamzxy,ass_Gamzxz, ass_Gamzyy,ass_Gamzyz,ass_Gamzzz, &
Rxyxy, Rxyxz, Rxyyz, Rxzxz, Rxzyz, Ryzyz)
call adm_ricci(ex, &
gupxx , gupxy , gupxz , gupyy , gupyz , gupzz , &
Rxyxy, Rxyxz, Rxyyz, Rxzxz, Rxzyz, Ryzyz, &
Rxx , Rxy , Rxz , Ryy , Ryz , Rzz)
return
end subroutine adm_ricci_gamma_ss
! for ADM variables
subroutine adm_ricci_gamma(ex, X, Y, Z, &
dxx , gxy , gxz , dyy , gyz , dzz,&
Gamxxx,Gamxxy,Gamxxz,Gamxyy,Gamxyz,Gamxzz,&
Gamyxx,Gamyxy,Gamyxz,Gamyyy,Gamyyz,Gamyzz,&
Gamzxx,Gamzxy,Gamzxz,Gamzyy,Gamzyz,Gamzzz,&
Rxx,Rxy,Rxz,Ryy,Ryz,Rzz,&
Symmetry)
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 ) :: dxx,gxy,gxz,dyy,gyz,dzz
! when out, physical second kind of connection
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamxxx, Gamxxy, Gamxxz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamxyy, Gamxyz, Gamxzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamyxx, Gamyxy, Gamyxz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamyyy, Gamyyz, Gamyzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamzxx, Gamzxy, Gamzxz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamzyy, Gamzyz, Gamzzz
! when out, physical Ricci tensor
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Rxx,Rxy,Rxz,Ryy,Ryz,Rzz
!~~~~~~> Other variables:
real*8, dimension(ex(1),ex(2),ex(3)) :: gxx,gyy,gzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxx,gxyx,gxzx,gyyx,gyzx,gzzx
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxy,gxyy,gxzy,gyyy,gyzy,gzzy
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxz,gxyz,gxzz,gyyz,gyzz,gzzz
real*8, dimension(ex(1),ex(2),ex(3)) :: ass_Gamxxx,ass_Gamxxy,ass_Gamxxz
real*8, dimension(ex(1),ex(2),ex(3)) :: ass_Gamxyy,ass_Gamxyz,ass_Gamxzz
real*8, dimension(ex(1),ex(2),ex(3)) :: ass_Gamyxx,ass_Gamyxy,ass_Gamyxz
real*8, dimension(ex(1),ex(2),ex(3)) :: ass_Gamyyy,ass_Gamyyz,ass_Gamyzz
real*8, dimension(ex(1),ex(2),ex(3)) :: ass_Gamzxx,ass_Gamzxy,ass_Gamzxz
real*8, dimension(ex(1),ex(2),ex(3)) :: ass_Gamzyy,ass_Gamzyz,ass_Gamzzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gupxx,gupxy,gupxz
real*8, dimension(ex(1),ex(2),ex(3)) :: gupyy,gupyz,gupzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxxx,gxxxy,gxxxz,gxxyy,gxxyz,gxxzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gxyxx,gxyxy,gxyxz,gxyyy,gxyyz,gxyzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gxzxx,gxzxy,gxzxz,gxzyy,gxzyz,gxzzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gyyxx,gyyxy,gyyxz,gyyyy,gyyyz,gyyzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gyzxx,gyzxy,gyzxz,gyzyy,gyzyz,gyzzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gzzxx,gzzxy,gzzxz,gzzyy,gzzyz,gzzzz
real*8, dimension(ex(1),ex(2),ex(3)) :: Rxyxy, Rxyxz, Rxyyz, Rxzxz, Rxzyz, Ryzyz
real*8, parameter :: ONE = 1.D0, TWO = 2.D0, FOUR = 4.D0
real*8, parameter :: HALF = 0.5D0, F2o3 = 2.d0/3.d0, F3o2 = 1.5d0
real*8, parameter :: SYM = 1.D0, ANTI= - 1.D0
gxx = dxx + ONE
gyy = dyy + ONE
gzz = dzz + ONE
call fderivs(ex,dxx,gxxx,gxxy,gxxz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0)
call fderivs(ex,gxy,gxyx,gxyy,gxyz,X,Y,Z,ANTI,ANTI,SYM ,Symmetry,0)
call fderivs(ex,gxz,gxzx,gxzy,gxzz,X,Y,Z,ANTI,SYM ,ANTI,Symmetry,0)
call fderivs(ex,dyy,gyyx,gyyy,gyyz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0)
call fderivs(ex,gyz,gyzx,gyzy,gyzz,X,Y,Z,SYM ,ANTI,ANTI,Symmetry,0)
call fderivs(ex,dzz,gzzx,gzzy,gzzz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0)
call kind1_connection(ex, &
gxxx,gxyx,gxzx,gyyx,gyzx,gzzx, &
gxxy,gxyy,gxzy,gyyy,gyzy,gzzy, &
gxxz,gxyz,gxzz,gyyz,gyzz,gzzz, &
ass_Gamxxx, ass_Gamxxy, ass_Gamxxz, ass_Gamxyy, ass_Gamxyz, ass_Gamxzz, &
ass_Gamyxx, ass_Gamyxy, ass_Gamyxz, ass_Gamyyy, ass_Gamyyz, ass_Gamyzz, &
ass_Gamzxx, ass_Gamzxy, ass_Gamzxz, ass_Gamzyy, ass_Gamzyz, ass_Gamzzz)
! invert metric
gupzz = gxx * gyy * gzz + gxy * gyz * gxz + gxz * gxy * gyz - &
gxz * gyy * gxz - gxy * gxy * gzz - gxx * gyz * gyz
gupxx = ( gyy * gzz - gyz * gyz ) / gupzz
gupxy = - ( gxy * gzz - gyz * gxz ) / gupzz
gupxz = ( gxy * gyz - gyy * gxz ) / gupzz
gupyy = ( gxx * gzz - gxz * gxz ) / gupzz
gupyz = - ( gxx * gyz - gxy * gxz ) / gupzz
gupzz = ( gxx * gyy - gxy * gxy ) / gupzz
call kind2_connection(ex, &
gupxx,gupxy,gupxz,gupyy,gupyz,gupzz, &
ass_Gamxxx, ass_Gamxxy, ass_Gamxxz, ass_Gamxyy, ass_Gamxyz, ass_Gamxzz, &
ass_Gamyxx, ass_Gamyxy, ass_Gamyxz, ass_Gamyyy, ass_Gamyyz, ass_Gamyzz, &
ass_Gamzxx, ass_Gamzxy, ass_Gamzxz, ass_Gamzyy, ass_Gamzyz, ass_Gamzzz, &
Gamxxx, Gamxxy, Gamxxz, Gamxyy, Gamxyz, Gamxzz, &
Gamyxx, Gamyxy, Gamyxz, Gamyyy, Gamyyz, Gamyzz, &
Gamzxx, Gamzxy, Gamzxz, Gamzyy, Gamzyz, Gamzzz)
call fdderivs(ex,dxx,gxxxx,gxxxy,gxxxz,gxxyy,gxxyz,gxxzz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0)
call fdderivs(ex,gxy,gxyxx,gxyxy,gxyxz,gxyyy,gxyyz,gxyzz,X,Y,Z,ANTI,ANTI,SYM ,Symmetry,0)
call fdderivs(ex,gxz,gxzxx,gxzxy,gxzxz,gxzyy,gxzyz,gxzzz,X,Y,Z,ANTI,SYM ,ANTI,Symmetry,0)
call fdderivs(ex,dyy,gyyxx,gyyxy,gyyxz,gyyyy,gyyyz,gyyzz,X,Y,Z,SYM, SYM ,SYM ,Symmetry,0)
call fdderivs(ex,gyz,gyzxx,gyzxy,gyzxz,gyzyy,gyzyz,gyzzz,X,Y,Z,SYM ,ANTI,ANTI,Symmetry,0)
call fdderivs(ex,dzz,gzzxx,gzzxy,gzzxz,gzzyy,gzzyz,gzzzz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0)
call adm_riemann(ex, &
gxxxx,gxxxy,gxxxz,gxxyy,gxxyz,gxxzz, &
gxyxx,gxyxy,gxyxz,gxyyy,gxyyz,gxyzz, &
gxzxx,gxzxy,gxzxz,gxzyy,gxzyz,gxzzz, &
gyyxx,gyyxy,gyyxz,gyyyy,gyyyz,gyyzz, &
gyzxx,gyzxy,gyzxz,gyzyy,gyzyz,gyzzz, &
gzzxx,gzzxy,gzzxz,gzzyy,gzzyz,gzzzz, &
Gamxxx, Gamxxy, Gamxxz, Gamxyy, Gamxyz, Gamxzz, &
Gamyxx, Gamyxy, Gamyxz, Gamyyy, Gamyyz, Gamyzz, &
Gamzxx, Gamzxy, Gamzxz, Gamzyy, Gamzyz, Gamzzz, &
ass_Gamxxx,ass_Gamxxy,ass_Gamxxz, ass_Gamxyy,ass_Gamxyz,ass_Gamxzz, &
ass_Gamyxx,ass_Gamyxy,ass_Gamyxz, ass_Gamyyy,ass_Gamyyz,ass_Gamyzz, &
ass_Gamzxx,ass_Gamzxy,ass_Gamzxz, ass_Gamzyy,ass_Gamzyz,ass_Gamzzz, &
Rxyxy, Rxyxz, Rxyyz, Rxzxz, Rxzyz, Ryzyz)
call adm_ricci(ex, &
gupxx , gupxy , gupxz , gupyy , gupyz , gupzz , &
Rxyxy, Rxyxz, Rxyyz, Rxzxz, Rxzyz, Ryzyz, &
Rxx , Rxy , Rxz , Ryy , Ryz , Rzz)
return
end subroutine adm_ricci_gamma
!----------------------------------------------------------------------------
subroutine adm_ricci_gamma_ss(ex,crho,sigma,R,X, Y, Z, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz, &
drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz, &
dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz, &
dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz, &
dxx , gxy , gxz , dyy , gyz , dzz,&
Gamxxx,Gamxxy,Gamxxz,Gamxyy,Gamxyz,Gamxzz,&
Gamyxx,Gamyxy,Gamyxz,Gamyyy,Gamyyz,Gamyzz,&
Gamzxx,Gamzxy,Gamzxz,Gamzyy,Gamzyz,Gamzzz,&
Rxx,Rxy,Rxz,Ryy,Ryz,Rzz,&
Symmetry,Lev,sst)
implicit none
!~~~~~~> Input parameters:
integer,intent(in ):: ex(1:3), Symmetry,Lev,sst
double precision,intent(in),dimension(ex(1))::crho
double precision,intent(in),dimension(ex(2))::sigma
double precision,intent(in),dimension(ex(3))::R
real*8, intent(in ),dimension(ex(1),ex(2),ex(3)):: X,Y,Z
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::drhodx, drhody, drhodz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dsigmadx,dsigmady,dsigmadz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dRdx,dRdy,dRdz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: dxx,gxy,gxz,dyy,gyz,dzz
! when out, physical second kind of connection
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamxxx, Gamxxy, Gamxxz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamxyy, Gamxyz, Gamxzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamyxx, Gamyxy, Gamyxz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamyyy, Gamyyz, Gamyzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamzxx, Gamzxy, Gamzxz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamzyy, Gamzyz, Gamzzz
! when out, physical Ricci tensor
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Rxx,Rxy,Rxz,Ryy,Ryz,Rzz
!~~~~~~> Other variables:
real*8, dimension(ex(1),ex(2),ex(3)) :: gxx,gyy,gzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxx,gxyx,gxzx,gyyx,gyzx,gzzx
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxy,gxyy,gxzy,gyyy,gyzy,gzzy
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxz,gxyz,gxzz,gyyz,gyzz,gzzz
real*8, dimension(ex(1),ex(2),ex(3)) :: ass_Gamxxx,ass_Gamxxy,ass_Gamxxz
real*8, dimension(ex(1),ex(2),ex(3)) :: ass_Gamxyy,ass_Gamxyz,ass_Gamxzz
real*8, dimension(ex(1),ex(2),ex(3)) :: ass_Gamyxx,ass_Gamyxy,ass_Gamyxz
real*8, dimension(ex(1),ex(2),ex(3)) :: ass_Gamyyy,ass_Gamyyz,ass_Gamyzz
real*8, dimension(ex(1),ex(2),ex(3)) :: ass_Gamzxx,ass_Gamzxy,ass_Gamzxz
real*8, dimension(ex(1),ex(2),ex(3)) :: ass_Gamzyy,ass_Gamzyz,ass_Gamzzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gupxx,gupxy,gupxz
real*8, dimension(ex(1),ex(2),ex(3)) :: gupyy,gupyz,gupzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxxx,gxxxy,gxxxz,gxxyy,gxxyz,gxxzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gxyxx,gxyxy,gxyxz,gxyyy,gxyyz,gxyzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gxzxx,gxzxy,gxzxz,gxzyy,gxzyz,gxzzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gyyxx,gyyxy,gyyxz,gyyyy,gyyyz,gyyzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gyzxx,gyzxy,gyzxz,gyzyy,gyzyz,gyzzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gzzxx,gzzxy,gzzxz,gzzyy,gzzyz,gzzzz
real*8, dimension(ex(1),ex(2),ex(3)) :: Rxyxy, Rxyxz, Rxyyz, Rxzxz, Rxzyz, Ryzyz
real*8, parameter :: ONE = 1.D0, TWO = 2.D0, FOUR = 4.D0
real*8, parameter :: HALF = 0.5D0, F2o3 = 2.d0/3.d0, F3o2 = 1.5d0
real*8, parameter :: SYM = 1.D0, ANTI= - 1.D0
gxx = dxx + ONE
gyy = dyy + ONE
gzz = dzz + ONE
call fderivs_shc(ex,dxx,gxxx,gxxy,gxxz,crho,sigma,R, SYM, SYM,SYM,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz)
call fderivs_shc(ex,gxy,gxyx,gxyy,gxyz,crho,sigma,R,ANTI,ANTI,SYM,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz)
call fderivs_shc(ex,gxz,gxzx,gxzy,gxzz,crho,sigma,R,ANTI,SYM ,ANTI,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz)
call fderivs_shc(ex,dyy,gyyx,gyyy,gyyz,crho,sigma,R, SYM, SYM,SYM,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz)
call fderivs_shc(ex,gyz,gyzx,gyzy,gyzz,crho,sigma,R,SYM ,ANTI,ANTI,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz)
call fderivs_shc(ex,dzz,gzzx,gzzy,gzzz,crho,sigma,R, SYM, SYM,SYM,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz)
call kind1_connection(ex, &
gxxx,gxyx,gxzx,gyyx,gyzx,gzzx, &
gxxy,gxyy,gxzy,gyyy,gyzy,gzzy, &
gxxz,gxyz,gxzz,gyyz,gyzz,gzzz, &
ass_Gamxxx, ass_Gamxxy, ass_Gamxxz, ass_Gamxyy, ass_Gamxyz, ass_Gamxzz, &
ass_Gamyxx, ass_Gamyxy, ass_Gamyxz, ass_Gamyyy, ass_Gamyyz, ass_Gamyzz, &
ass_Gamzxx, ass_Gamzxy, ass_Gamzxz, ass_Gamzyy, ass_Gamzyz, ass_Gamzzz)
! invert metric
gupzz = gxx * gyy * gzz + gxy * gyz * gxz + gxz * gxy * gyz - &
gxz * gyy * gxz - gxy * gxy * gzz - gxx * gyz * gyz
gupxx = ( gyy * gzz - gyz * gyz ) / gupzz
gupxy = - ( gxy * gzz - gyz * gxz ) / gupzz
gupxz = ( gxy * gyz - gyy * gxz ) / gupzz
gupyy = ( gxx * gzz - gxz * gxz ) / gupzz
gupyz = - ( gxx * gyz - gxy * gxz ) / gupzz
gupzz = ( gxx * gyy - gxy * gxy ) / gupzz
call kind2_connection(ex, &
gupxx,gupxy,gupxz,gupyy,gupyz,gupzz, &
ass_Gamxxx, ass_Gamxxy, ass_Gamxxz, ass_Gamxyy, ass_Gamxyz, ass_Gamxzz, &
ass_Gamyxx, ass_Gamyxy, ass_Gamyxz, ass_Gamyyy, ass_Gamyyz, ass_Gamyzz, &
ass_Gamzxx, ass_Gamzxy, ass_Gamzxz, ass_Gamzyy, ass_Gamzyz, ass_Gamzzz, &
Gamxxx, Gamxxy, Gamxxz, Gamxyy, Gamxyz, Gamxzz, &
Gamyxx, Gamyxy, Gamyxz, Gamyyy, Gamyyz, Gamyzz, &
Gamzxx, Gamzxy, Gamzxz, Gamzyy, Gamzyz, Gamzzz)
call fdderivs_shc(ex,dxx,gxxxx,gxxxy,gxxxz,gxxyy,gxxyz,gxxzz,crho,sigma,R, SYM, SYM,SYM ,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz, &
drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz, &
dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz, &
dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz)
call fdderivs_shc(ex,dyy,gyyxx,gyyxy,gyyxz,gyyyy,gyyyz,gyyzz,crho,sigma,R, SYM, SYM,SYM ,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz, &
drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz, &
dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz, &
dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz)
call fdderivs_shc(ex,dzz,gzzxx,gzzxy,gzzxz,gzzyy,gzzyz,gzzzz,crho,sigma,R, SYM, SYM,SYM ,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz, &
drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz, &
dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz, &
dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz)
call fdderivs_shc(ex,gxy,gxyxx,gxyxy,gxyxz,gxyyy,gxyyz,gxyzz,crho,sigma,R,ANTI,ANTI,SYM ,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz, &
drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz, &
dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz, &
dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz)
call fdderivs_shc(ex,gxz,gxzxx,gxzxy,gxzxz,gxzyy,gxzyz,gxzzz,crho,sigma,R,ANTI,SYM ,ANTI,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz, &
drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz, &
dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz, &
dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz)
call fdderivs_shc(ex,gyz,gyzxx,gyzxy,gyzxz,gyzyy,gyzyz,gyzzz,crho,sigma,R,SYM ,ANTI,ANTI,Symmetry,Lev,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz, &
drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz, &
dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz, &
dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz)
call adm_riemann(ex, &
gxxxx,gxxxy,gxxxz,gxxyy,gxxyz,gxxzz, &
gxyxx,gxyxy,gxyxz,gxyyy,gxyyz,gxyzz, &
gxzxx,gxzxy,gxzxz,gxzyy,gxzyz,gxzzz, &
gyyxx,gyyxy,gyyxz,gyyyy,gyyyz,gyyzz, &
gyzxx,gyzxy,gyzxz,gyzyy,gyzyz,gyzzz, &
gzzxx,gzzxy,gzzxz,gzzyy,gzzyz,gzzzz, &
Gamxxx, Gamxxy, Gamxxz, Gamxyy, Gamxyz, Gamxzz, &
Gamyxx, Gamyxy, Gamyxz, Gamyyy, Gamyyz, Gamyzz, &
Gamzxx, Gamzxy, Gamzxz, Gamzyy, Gamzyz, Gamzzz, &
ass_Gamxxx,ass_Gamxxy,ass_Gamxxz, ass_Gamxyy,ass_Gamxyz,ass_Gamxzz, &
ass_Gamyxx,ass_Gamyxy,ass_Gamyxz, ass_Gamyyy,ass_Gamyyz,ass_Gamyzz, &
ass_Gamzxx,ass_Gamzxy,ass_Gamzxz, ass_Gamzyy,ass_Gamzyz,ass_Gamzzz, &
Rxyxy, Rxyxz, Rxyyz, Rxzxz, Rxzyz, Ryzyz)
call adm_ricci(ex, &
gupxx , gupxy , gupxz , gupyy , gupyz , gupzz , &
Rxyxy, Rxyxz, Rxyyz, Rxzxz, Rxzyz, Ryzyz, &
Rxx , Rxy , Rxz , Ryy , Ryz , Rzz)
return
end subroutine adm_ricci_gamma_ss

View File

@@ -1,186 +1,186 @@
#include <assert.h>
#include <stddef.h> // NULL
#include <stdlib.h> // size_t
#include "cctk.h"
#include "stdc.h"
#include "util.h"
#include "array.h"
namespace AHFinderDirect
{
namespace jtutil
{
template <typename T>
array1d<T>::array1d(int min_i_in, int max_i_in,
T *array_in /* = NULL */,
int stride_i_in /* = 0 */)
: array_(array_in),
offset_(0), // temp value, changed below
stride_i_(stride_i_in),
min_i_(min_i_in), max_i_(max_i_in),
we_own_array_(array_in == NULL)
{
if (stride_i_ == 0)
then stride_i_ = 1;
// must use unchecked subscripting here since setup isn't done yet
offset_ = -subscript_unchecked(min_i_); // RHS uses offset_ = 0
assert(subscript_unchecked(min_i_) == 0);
max_subscript_ = subscript_unchecked(max_i_);
if (we_own_array_)
then
{
// allocate it
const int N_allocate = N_i();
array_ = new T[N_allocate];
}
// explicitly initialize array (new[] *doesn't* do this automagically)
for (int i = min_i(); i <= max_i(); ++i)
{
operator()(i) = T(0);
}
}
//
// This function destroys an array1d object.
//
template <typename T>
array1d<T>::~array1d()
{
if (we_own_array_)
then delete[] array_;
}
//
// This function constructs an array2d object.
//
template <typename T>
array2d<T>::array2d(int min_i_in, int max_i_in,
int min_j_in, int max_j_in,
T *array_in /* = NULL */,
int stride_i_in /* = 0 */, int stride_j_in /* = 0 */)
: array_(array_in),
offset_(0), // temp value, changed below
stride_i_(stride_i_in), stride_j_(stride_j_in),
min_i_(min_i_in), max_i_(max_i_in),
min_j_(min_j_in), max_j_(max_j_in),
we_own_array_(array_in == NULL)
{
if (stride_j_ == 0)
then stride_j_ = 1;
if (stride_i_ == 0)
then stride_i_ = N_j();
// must use unchecked subscripting here since setup isn't done yet
offset_ = -subscript_unchecked(min_i_, min_j_); // RHS uses offset_ = 0
assert(subscript_unchecked(min_i_, min_j_) == 0);
max_subscript_ = subscript_unchecked(max_i_, max_j_);
if (we_own_array_)
then
{
// allocate it
const int N_allocate = N_i() * N_j();
array_ = new T[N_allocate];
}
// explicitly initialize array (new[] *doesn't* do this automagically)
for (int i = min_i(); i <= max_i(); ++i)
{
for (int j = min_j(); j <= max_j(); ++j)
{
operator()(i, j) = T(0);
}
}
}
//
// This function destroys an array2d object.
//
template <typename T>
array2d<T>::~array2d()
{
if (we_own_array_)
then delete[] array_;
}
//
// This function constructs an array3d object.
//
template <typename T>
array3d<T>::array3d(int min_i_in, int max_i_in,
int min_j_in, int max_j_in,
int min_k_in, int max_k_in,
T *array_in /* = NULL */,
int stride_i_in /* = 0 */, int stride_j_in /* = 0 */,
int stride_k_in /* = 0 */)
: array_(array_in),
offset_(0), // temp value, changed below
stride_i_(stride_i_in), stride_j_(stride_j_in),
stride_k_(stride_k_in),
min_i_(min_i_in), max_i_(max_i_in),
min_j_(min_j_in), max_j_(max_j_in),
min_k_(min_k_in), max_k_(max_k_in),
we_own_array_(array_in == NULL)
{
if (stride_k_ == 0)
then stride_k_ = 1;
if (stride_j_ == 0)
then stride_j_ = N_k();
if (stride_i_ == 0)
then stride_i_ = N_j() * N_k();
// must use unchecked subscripting here since setup isn't done yet
offset_ = -subscript_unchecked(min_i_, min_j_, min_k_); // RHS uses offset_ = 0
assert(subscript_unchecked(min_i_, min_j_, min_k_) == 0);
max_subscript_ = subscript_unchecked(max_i_, max_j_, max_k_);
if (we_own_array_)
then
{
// allocate it
const int N_allocate = N_i() * N_j() * N_k();
array_ = new T[N_allocate];
}
// explicitly initialize array (new[] *doesn't* do this automagically)
for (int i = min_i(); i <= max_i(); ++i)
{
for (int j = min_j(); j <= max_j(); ++j)
{
for (int k = min_k(); k <= max_k(); ++k)
{
operator()(i, j, k) = T(0);
}
}
}
}
//
// This function destroys an array3d object.
//
template <typename T>
array3d<T>::~array3d()
{
if (we_own_array_)
then delete[] array_;
}
template class array1d<int>;
// FIXME: we shouldn't have to instantiate these both, the const one
// is actually trivially derivable from the non-const one. :(
template class array1d<void *>;
template class array1d<const void *>;
template class array1d<CCTK_REAL>;
template class array2d<CCTK_INT>;
template class array2d<CCTK_REAL>;
template class array3d<CCTK_REAL>;
} // namespace jtutil
} // namespace AHFinderDirect
#include <assert.h>
#include <stddef.h> // NULL
#include <stdlib.h> // size_t
#include "cctk.h"
#include "stdc.h"
#include "util.h"
#include "array.h"
namespace AHFinderDirect
{
namespace jtutil
{
template <typename T>
array1d<T>::array1d(int min_i_in, int max_i_in,
T *array_in /* = NULL */,
int stride_i_in /* = 0 */)
: array_(array_in),
offset_(0), // temp value, changed below
stride_i_(stride_i_in),
min_i_(min_i_in), max_i_(max_i_in),
we_own_array_(array_in == NULL)
{
if (stride_i_ == 0)
then stride_i_ = 1;
// must use unchecked subscripting here since setup isn't done yet
offset_ = -subscript_unchecked(min_i_); // RHS uses offset_ = 0
assert(subscript_unchecked(min_i_) == 0);
max_subscript_ = subscript_unchecked(max_i_);
if (we_own_array_)
then
{
// allocate it
const int N_allocate = N_i();
array_ = new T[N_allocate];
}
// explicitly initialize array (new[] *doesn't* do this automagically)
for (int i = min_i(); i <= max_i(); ++i)
{
operator()(i) = T(0);
}
}
//
// This function destroys an array1d object.
//
template <typename T>
array1d<T>::~array1d()
{
if (we_own_array_)
then delete[] array_;
}
//
// This function constructs an array2d object.
//
template <typename T>
array2d<T>::array2d(int min_i_in, int max_i_in,
int min_j_in, int max_j_in,
T *array_in /* = NULL */,
int stride_i_in /* = 0 */, int stride_j_in /* = 0 */)
: array_(array_in),
offset_(0), // temp value, changed below
stride_i_(stride_i_in), stride_j_(stride_j_in),
min_i_(min_i_in), max_i_(max_i_in),
min_j_(min_j_in), max_j_(max_j_in),
we_own_array_(array_in == NULL)
{
if (stride_j_ == 0)
then stride_j_ = 1;
if (stride_i_ == 0)
then stride_i_ = N_j();
// must use unchecked subscripting here since setup isn't done yet
offset_ = -subscript_unchecked(min_i_, min_j_); // RHS uses offset_ = 0
assert(subscript_unchecked(min_i_, min_j_) == 0);
max_subscript_ = subscript_unchecked(max_i_, max_j_);
if (we_own_array_)
then
{
// allocate it
const int N_allocate = N_i() * N_j();
array_ = new T[N_allocate];
}
// explicitly initialize array (new[] *doesn't* do this automagically)
for (int i = min_i(); i <= max_i(); ++i)
{
for (int j = min_j(); j <= max_j(); ++j)
{
operator()(i, j) = T(0);
}
}
}
//
// This function destroys an array2d object.
//
template <typename T>
array2d<T>::~array2d()
{
if (we_own_array_)
then delete[] array_;
}
//
// This function constructs an array3d object.
//
template <typename T>
array3d<T>::array3d(int min_i_in, int max_i_in,
int min_j_in, int max_j_in,
int min_k_in, int max_k_in,
T *array_in /* = NULL */,
int stride_i_in /* = 0 */, int stride_j_in /* = 0 */,
int stride_k_in /* = 0 */)
: array_(array_in),
offset_(0), // temp value, changed below
stride_i_(stride_i_in), stride_j_(stride_j_in),
stride_k_(stride_k_in),
min_i_(min_i_in), max_i_(max_i_in),
min_j_(min_j_in), max_j_(max_j_in),
min_k_(min_k_in), max_k_(max_k_in),
we_own_array_(array_in == NULL)
{
if (stride_k_ == 0)
then stride_k_ = 1;
if (stride_j_ == 0)
then stride_j_ = N_k();
if (stride_i_ == 0)
then stride_i_ = N_j() * N_k();
// must use unchecked subscripting here since setup isn't done yet
offset_ = -subscript_unchecked(min_i_, min_j_, min_k_); // RHS uses offset_ = 0
assert(subscript_unchecked(min_i_, min_j_, min_k_) == 0);
max_subscript_ = subscript_unchecked(max_i_, max_j_, max_k_);
if (we_own_array_)
then
{
// allocate it
const int N_allocate = N_i() * N_j() * N_k();
array_ = new T[N_allocate];
}
// explicitly initialize array (new[] *doesn't* do this automagically)
for (int i = min_i(); i <= max_i(); ++i)
{
for (int j = min_j(); j <= max_j(); ++j)
{
for (int k = min_k(); k <= max_k(); ++k)
{
operator()(i, j, k) = T(0);
}
}
}
}
//
// This function destroys an array3d object.
//
template <typename T>
array3d<T>::~array3d()
{
if (we_own_array_)
then delete[] array_;
}
template class array1d<int>;
// FIXME: we shouldn't have to instantiate these both, the const one
// is actually trivially derivable from the non-const one. :(
template class array1d<void *>;
template class array1d<const void *>;
template class array1d<CCTK_REAL>;
template class array2d<CCTK_INT>;
template class array2d<CCTK_REAL>;
template class array3d<CCTK_REAL>;
} // namespace jtutil
} // namespace AHFinderDirect

View File

@@ -1,292 +1,292 @@
#ifndef AHFINDERDIRECT__ARRAY_HH
#define AHFINDERDIRECT__ARRAY_HH
namespace AHFinderDirect
{
namespace jtutil
{
//******************************************************************************
template <typename T>
class array1d
{
public:
int min_i() const { return min_i_; }
int max_i() const { return max_i_; }
int N_i() const { return jtutil::how_many_in_range(min_i_, max_i_); }
bool is_valid_i(int i) const { return (i >= min_i_) && (i <= max_i_); }
int subscript_unchecked(int i) const
{
return offset_ + stride_i_ * i;
}
int subscript(int i) const
{
assert(is_valid_i(i));
const int posn = subscript_unchecked(i);
assert(posn >= 0);
assert(posn <= max_subscript_);
return posn;
}
int subscript_offset() const { return offset_; }
int subscript_stride_i() const { return stride_i_; }
// normal-use access functions
// ... rvalue
const T &operator()(int i) const { return array_[subscript(i)]; }
// ... lvalue
T &operator()(int i) { return array_[subscript(i)]; }
// get access to internal 0-origin 1D storage array
// (low-level, dangerous, use with caution!)
// ... semantics of N_array() may not be what you want
// if strides specify noncontiguous storage
int N_array() const { return max_subscript_ + stride_i_; }
const T *data_array() const { return const_cast<const T *>(array_); }
T *data_array() { return array_; }
// constructor, destructor
// ... constructor initializes all array elements to T(0.0)
// ... omitted strides default to C storage order
array1d(int min_i_in, int max_i_in,
T *array_in = NULL, // caller-provided storage array
// if non-NULL
int stride_i_in = 0);
~array1d();
private:
// we forbid copying and passing by value
// by declaring the copy constructor and assignment operator
// private, but never defining them
array1d(const array1d<T> &rhs);
array1d<T> &operator=(const array1d<T> &rhs);
private:
// n.b. we declare the array pointer first in the class
// ==> it's probably at 0 offset
// ==> we may get slightly faster array access
T *array_; // --> new-allocated 1D storage array
// subscripting info
// n.b. put this next in class so it should be in the same
// cpu cache line as array_ ==> faster array access
int offset_, stride_i_;
// min/max array bounds
const int min_i_, max_i_;
int max_subscript_;
// n.b. put this at end of class since performance doesn't matter
bool we_own_array_; // true ==> array_ --> new[] array which we own
// false ==> array_ --> client-owned storage
};
//******************************************************************************
template <typename T>
class array2d
{
public:
// array info
int min_i() const { return min_i_; }
int max_i() const { return max_i_; }
int min_j() const { return min_j_; }
int max_j() const { return max_j_; }
int N_i() const { return jtutil::how_many_in_range(min_i_, max_i_); }
int N_j() const { return jtutil::how_many_in_range(min_j_, max_j_); }
bool is_valid_i(int i) const { return (i >= min_i_) && (i <= max_i_); }
bool is_valid_j(int j) const { return (j >= min_j_) && (j <= max_j_); }
bool is_valid_ij(int i, int j) const
{
return is_valid_i(i) && is_valid_j(j);
}
int subscript_unchecked(int i, int j) const
{
return offset_ + stride_i_ * i + stride_j_ * j;
}
int subscript(int i, int j) const
{
// n.b. we want each assert() here to be on a separate
// source line, so an assert() failure message can
// pinpoint *which* index is bad
assert(is_valid_i(i));
assert(is_valid_j(j));
const int posn = subscript_unchecked(i, j);
assert(posn >= 0);
assert(posn <= max_subscript_);
return posn;
}
int subscript_offset() const { return offset_; }
int subscript_stride_i() const { return stride_i_; }
int subscript_stride_j() const { return stride_j_; }
// normal-use access functions
// ... rvalue
const T &operator()(int i, int j) const
{
return array_[subscript(i, j)];
}
// ... lvalue
T &operator()(int i, int j)
{
return array_[subscript(i, j)];
}
// get access to internal 0-origin 1D storage array
// (low-level, dangerous, use with caution!)
// ... semantics of N_array() may not be what you want
// if strides specify noncontiguous storage
int N_array() const { return max_subscript_ + stride_j_; }
const T *data_array() const { return const_cast<const T *>(array_); }
T *data_array() { return array_; }
// constructor, destructor
// ... constructor initializes all array elements to T(0.0)
// ... omitted strides default to C storage order
array2d(int min_i_in, int max_i_in,
int min_j_in, int max_j_in,
T *array_in = NULL, // caller-provided storage array
// if non-NULL
int stride_i_in = 0, int stride_j_in = 0);
~array2d();
private:
// we forbid copying and passing by value
// by declaring the copy constructor and assignment operator
// private, but never defining them
array2d(const array2d<T> &rhs);
array2d<T> &operator=(const array2d<T> &rhs);
private:
// n.b. we declare the array pointer first in the class
// ==> it's probably at 0 offset
// ==> we may get slightly faster array access
T *array_; // --> new-allocated 1D storage array
// subscripting info
// n.b. put this next in class so it should be in the same
// cpu cache line as array_ ==> faster array access
int offset_, stride_i_, stride_j_;
// min/max array bounds
const int min_i_, max_i_;
const int min_j_, max_j_;
int max_subscript_;
// n.b. put this at end of class since performance doesn't matter
bool we_own_array_; // true ==> array_ --> new[] array which we own
// false ==> array_ --> client-owned storage
};
//******************************************************************************
template <typename T>
class array3d
{
public:
// array info
int min_i() const { return min_i_; }
int max_i() const { return max_i_; }
int min_j() const { return min_j_; }
int max_j() const { return max_j_; }
int min_k() const { return min_k_; }
int max_k() const { return max_k_; }
int N_i() const { return jtutil::how_many_in_range(min_i_, max_i_); }
int N_j() const { return jtutil::how_many_in_range(min_j_, max_j_); }
int N_k() const { return jtutil::how_many_in_range(min_k_, max_k_); }
bool is_valid_i(int i) const { return (i >= min_i_) && (i <= max_i_); }
bool is_valid_j(int j) const { return (j >= min_j_) && (j <= max_j_); }
bool is_valid_k(int k) const { return (k >= min_k_) && (k <= max_k_); }
bool is_valid_ijk(int i, int j, int k) const
{
return is_valid_i(i) && is_valid_j(j) && is_valid_k(k);
}
int subscript_unchecked(int i, int j, int k) const
{
return offset_ + stride_i_ * i + stride_j_ * j + stride_k_ * k;
}
int subscript(int i, int j, int k) const
{
// n.b. we want each assert() here to be on a separate
// source line, so an assert() failure message can
// pinpoint *which* index is bad
assert(is_valid_i(i));
assert(is_valid_j(j));
assert(is_valid_k(k));
const int posn = subscript_unchecked(i, j, k);
assert(posn >= 0);
assert(posn <= max_subscript_);
return posn;
}
int subscript_offset() const { return offset_; }
int subscript_stride_i() const { return stride_i_; }
int subscript_stride_j() const { return stride_j_; }
int subscript_stride_k() const { return stride_k_; }
// normal-use access functions
// ... rvalue
const T &operator()(int i, int j, int k) const
{
return array_[subscript(i, j, k)];
}
// ... lvalue
T &operator()(int i, int j, int k)
{
return array_[subscript(i, j, k)];
}
// get access to internal 0-origin 1D storage array
// (low-level, dangerous, use with caution!)
// ... semantics of N_array() may not be what you want
// if strides specify noncontiguous storage
int N_array() const { return max_subscript_ + stride_k_; }
const T *data_array() const { return const_cast<const T *>(array_); }
T *data_array() { return array_; }
// constructor, destructor
// ... constructor initializes all array elements to T(0.0)
// ... omitted strides default to C storage order
array3d(int min_i_in, int max_i_in,
int min_j_in, int max_j_in,
int min_k_in, int max_k_in,
T *array_in = NULL, // caller-provided storage array
// if non-NULL
int stride_i_in = 0, int stride_j_in = 0, int stride_k_in = 0);
~array3d();
private:
// we forbid copying and passing by value
// by declaring the copy constructor and assignment operator
// private, but never defining them
array3d(const array3d<T> &rhs);
array3d<T> &operator=(const array3d<T> &rhs);
private:
// n.b. we declare the array pointer first in the class
// ==> it's probably at 0 offset
// ==> we may get slightly faster array access
T *array_; // --> new-allocated 1D storage array
// subscripting info
// n.b. put this next in class so it should be in the same
// cpu cache line as array_ ==> faster array access
int offset_, stride_i_, stride_j_, stride_k_;
// min/max array bounds
const int min_i_, max_i_;
const int min_j_, max_j_;
const int min_k_, max_k_;
int max_subscript_;
// n.b. put this at end of class since performance doesn't matter
bool we_own_array_; // true ==> array_ --> new[] array which we own
// false ==> array_ --> client-owned storage
};
} // namespace jtutil
} // namespace AHFinderDirect
#endif /* AHFINDERDIRECT__ARRAY_HH */
#ifndef AHFINDERDIRECT__ARRAY_HH
#define AHFINDERDIRECT__ARRAY_HH
namespace AHFinderDirect
{
namespace jtutil
{
//******************************************************************************
template <typename T>
class array1d
{
public:
int min_i() const { return min_i_; }
int max_i() const { return max_i_; }
int N_i() const { return jtutil::how_many_in_range(min_i_, max_i_); }
bool is_valid_i(int i) const { return (i >= min_i_) && (i <= max_i_); }
int subscript_unchecked(int i) const
{
return offset_ + stride_i_ * i;
}
int subscript(int i) const
{
assert(is_valid_i(i));
const int posn = subscript_unchecked(i);
assert(posn >= 0);
assert(posn <= max_subscript_);
return posn;
}
int subscript_offset() const { return offset_; }
int subscript_stride_i() const { return stride_i_; }
// normal-use access functions
// ... rvalue
const T &operator()(int i) const { return array_[subscript(i)]; }
// ... lvalue
T &operator()(int i) { return array_[subscript(i)]; }
// get access to internal 0-origin 1D storage array
// (low-level, dangerous, use with caution!)
// ... semantics of N_array() may not be what you want
// if strides specify noncontiguous storage
int N_array() const { return max_subscript_ + stride_i_; }
const T *data_array() const { return const_cast<const T *>(array_); }
T *data_array() { return array_; }
// constructor, destructor
// ... constructor initializes all array elements to T(0.0)
// ... omitted strides default to C storage order
array1d(int min_i_in, int max_i_in,
T *array_in = NULL, // caller-provided storage array
// if non-NULL
int stride_i_in = 0);
~array1d();
private:
// we forbid copying and passing by value
// by declaring the copy constructor and assignment operator
// private, but never defining them
array1d(const array1d<T> &rhs);
array1d<T> &operator=(const array1d<T> &rhs);
private:
// n.b. we declare the array pointer first in the class
// ==> it's probably at 0 offset
// ==> we may get slightly faster array access
T *array_; // --> new-allocated 1D storage array
// subscripting info
// n.b. put this next in class so it should be in the same
// cpu cache line as array_ ==> faster array access
int offset_, stride_i_;
// min/max array bounds
const int min_i_, max_i_;
int max_subscript_;
// n.b. put this at end of class since performance doesn't matter
bool we_own_array_; // true ==> array_ --> new[] array which we own
// false ==> array_ --> client-owned storage
};
//******************************************************************************
template <typename T>
class array2d
{
public:
// array info
int min_i() const { return min_i_; }
int max_i() const { return max_i_; }
int min_j() const { return min_j_; }
int max_j() const { return max_j_; }
int N_i() const { return jtutil::how_many_in_range(min_i_, max_i_); }
int N_j() const { return jtutil::how_many_in_range(min_j_, max_j_); }
bool is_valid_i(int i) const { return (i >= min_i_) && (i <= max_i_); }
bool is_valid_j(int j) const { return (j >= min_j_) && (j <= max_j_); }
bool is_valid_ij(int i, int j) const
{
return is_valid_i(i) && is_valid_j(j);
}
int subscript_unchecked(int i, int j) const
{
return offset_ + stride_i_ * i + stride_j_ * j;
}
int subscript(int i, int j) const
{
// n.b. we want each assert() here to be on a separate
// source line, so an assert() failure message can
// pinpoint *which* index is bad
assert(is_valid_i(i));
assert(is_valid_j(j));
const int posn = subscript_unchecked(i, j);
assert(posn >= 0);
assert(posn <= max_subscript_);
return posn;
}
int subscript_offset() const { return offset_; }
int subscript_stride_i() const { return stride_i_; }
int subscript_stride_j() const { return stride_j_; }
// normal-use access functions
// ... rvalue
const T &operator()(int i, int j) const
{
return array_[subscript(i, j)];
}
// ... lvalue
T &operator()(int i, int j)
{
return array_[subscript(i, j)];
}
// get access to internal 0-origin 1D storage array
// (low-level, dangerous, use with caution!)
// ... semantics of N_array() may not be what you want
// if strides specify noncontiguous storage
int N_array() const { return max_subscript_ + stride_j_; }
const T *data_array() const { return const_cast<const T *>(array_); }
T *data_array() { return array_; }
// constructor, destructor
// ... constructor initializes all array elements to T(0.0)
// ... omitted strides default to C storage order
array2d(int min_i_in, int max_i_in,
int min_j_in, int max_j_in,
T *array_in = NULL, // caller-provided storage array
// if non-NULL
int stride_i_in = 0, int stride_j_in = 0);
~array2d();
private:
// we forbid copying and passing by value
// by declaring the copy constructor and assignment operator
// private, but never defining them
array2d(const array2d<T> &rhs);
array2d<T> &operator=(const array2d<T> &rhs);
private:
// n.b. we declare the array pointer first in the class
// ==> it's probably at 0 offset
// ==> we may get slightly faster array access
T *array_; // --> new-allocated 1D storage array
// subscripting info
// n.b. put this next in class so it should be in the same
// cpu cache line as array_ ==> faster array access
int offset_, stride_i_, stride_j_;
// min/max array bounds
const int min_i_, max_i_;
const int min_j_, max_j_;
int max_subscript_;
// n.b. put this at end of class since performance doesn't matter
bool we_own_array_; // true ==> array_ --> new[] array which we own
// false ==> array_ --> client-owned storage
};
//******************************************************************************
template <typename T>
class array3d
{
public:
// array info
int min_i() const { return min_i_; }
int max_i() const { return max_i_; }
int min_j() const { return min_j_; }
int max_j() const { return max_j_; }
int min_k() const { return min_k_; }
int max_k() const { return max_k_; }
int N_i() const { return jtutil::how_many_in_range(min_i_, max_i_); }
int N_j() const { return jtutil::how_many_in_range(min_j_, max_j_); }
int N_k() const { return jtutil::how_many_in_range(min_k_, max_k_); }
bool is_valid_i(int i) const { return (i >= min_i_) && (i <= max_i_); }
bool is_valid_j(int j) const { return (j >= min_j_) && (j <= max_j_); }
bool is_valid_k(int k) const { return (k >= min_k_) && (k <= max_k_); }
bool is_valid_ijk(int i, int j, int k) const
{
return is_valid_i(i) && is_valid_j(j) && is_valid_k(k);
}
int subscript_unchecked(int i, int j, int k) const
{
return offset_ + stride_i_ * i + stride_j_ * j + stride_k_ * k;
}
int subscript(int i, int j, int k) const
{
// n.b. we want each assert() here to be on a separate
// source line, so an assert() failure message can
// pinpoint *which* index is bad
assert(is_valid_i(i));
assert(is_valid_j(j));
assert(is_valid_k(k));
const int posn = subscript_unchecked(i, j, k);
assert(posn >= 0);
assert(posn <= max_subscript_);
return posn;
}
int subscript_offset() const { return offset_; }
int subscript_stride_i() const { return stride_i_; }
int subscript_stride_j() const { return stride_j_; }
int subscript_stride_k() const { return stride_k_; }
// normal-use access functions
// ... rvalue
const T &operator()(int i, int j, int k) const
{
return array_[subscript(i, j, k)];
}
// ... lvalue
T &operator()(int i, int j, int k)
{
return array_[subscript(i, j, k)];
}
// get access to internal 0-origin 1D storage array
// (low-level, dangerous, use with caution!)
// ... semantics of N_array() may not be what you want
// if strides specify noncontiguous storage
int N_array() const { return max_subscript_ + stride_k_; }
const T *data_array() const { return const_cast<const T *>(array_); }
T *data_array() { return array_; }
// constructor, destructor
// ... constructor initializes all array elements to T(0.0)
// ... omitted strides default to C storage order
array3d(int min_i_in, int max_i_in,
int min_j_in, int max_j_in,
int min_k_in, int max_k_in,
T *array_in = NULL, // caller-provided storage array
// if non-NULL
int stride_i_in = 0, int stride_j_in = 0, int stride_k_in = 0);
~array3d();
private:
// we forbid copying and passing by value
// by declaring the copy constructor and assignment operator
// private, but never defining them
array3d(const array3d<T> &rhs);
array3d<T> &operator=(const array3d<T> &rhs);
private:
// n.b. we declare the array pointer first in the class
// ==> it's probably at 0 offset
// ==> we may get slightly faster array access
T *array_; // --> new-allocated 1D storage array
// subscripting info
// n.b. put this next in class so it should be in the same
// cpu cache line as array_ ==> faster array access
int offset_, stride_i_, stride_j_, stride_k_;
// min/max array bounds
const int min_i_, max_i_;
const int min_j_, max_j_;
const int min_k_, max_k_;
int max_subscript_;
// n.b. put this at end of class since performance doesn't matter
bool we_own_array_; // true ==> array_ --> new[] array which we own
// false ==> array_ --> client-owned storage
};
} // namespace jtutil
} // namespace AHFinderDirect
#endif /* AHFINDERDIRECT__ARRAY_HH */

View File

@@ -1,40 +1,40 @@
!-------------------------------------------------------------------------------!
! convert bssn variables to ADM variables !
!-------------------------------------------------------------------------------!
subroutine bssn2adm(ex,chi,trK, &
gxx,gxy,gxz,gyy,gyz,gzz, &
Axx,Axy,Axz,Ayy,Ayz,Azz, &
adm_gxx,adm_gxy,adm_gxz,adm_gyy,adm_gyz,adm_gzz, &
Kxx,Kxy,Kxz,Kyy,Kyz,Kzz)
implicit none
!~~~~~~> Input parameters:
integer,intent(in ):: ex(1:3)
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::chi,trK
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::gxx,gxy,gxz,gyy,gyz,gzz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::Axx,Axy,Axz,Ayy,Ayz,Azz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: adm_gxx,adm_gxy,adm_gxz,adm_gyy,adm_gyz,adm_gzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Kxx,Kxy,Kxz,Kyy,Kyz,Kzz
real*8, parameter :: F1o3=1.d0/3.d0
adm_gxx = gxx/chi
adm_gxy = gxy/chi
adm_gxz = gxz/chi
adm_gyy = gyy/chi
adm_gyz = gyz/chi
adm_gzz = gzz/chi
Kxx = Axx/chi+F1o3*trK*adm_gxx
Kxy = Axy/chi+F1o3*trK*adm_gxy
Kxz = Axz/chi+F1o3*trK*adm_gxz
Kyy = Ayy/chi+F1o3*trK*adm_gyy
Kyz = Ayz/chi+F1o3*trK*adm_gyz
Kzz = Azz/chi+F1o3*trK*adm_gzz
return
end subroutine bssn2adm
!-------------------------------------------------------------------------------!
! convert bssn variables to ADM variables !
!-------------------------------------------------------------------------------!
subroutine bssn2adm(ex,chi,trK, &
gxx,gxy,gxz,gyy,gyz,gzz, &
Axx,Axy,Axz,Ayy,Ayz,Azz, &
adm_gxx,adm_gxy,adm_gxz,adm_gyy,adm_gyz,adm_gzz, &
Kxx,Kxy,Kxz,Kyy,Kyz,Kzz)
implicit none
!~~~~~~> Input parameters:
integer,intent(in ):: ex(1:3)
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::chi,trK
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::gxx,gxy,gxz,gyy,gyz,gzz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::Axx,Axy,Axz,Ayy,Ayz,Azz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: adm_gxx,adm_gxy,adm_gxz,adm_gyy,adm_gyz,adm_gzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Kxx,Kxy,Kxz,Kyy,Kyz,Kzz
real*8, parameter :: F1o3=1.d0/3.d0
adm_gxx = gxx/chi
adm_gxy = gxy/chi
adm_gxz = gxz/chi
adm_gyy = gyy/chi
adm_gyz = gyz/chi
adm_gzz = gzz/chi
Kxx = Axx/chi+F1o3*trK*adm_gxx
Kxy = Axy/chi+F1o3*trK*adm_gxy
Kxz = Axz/chi+F1o3*trK*adm_gxz
Kyy = Ayy/chi+F1o3*trK*adm_gyy
Kyz = Ayz/chi+F1o3*trK*adm_gyz
Kzz = Azz/chi+F1o3*trK*adm_gzz
return
end subroutine bssn2adm

View File

@@ -1,69 +1,69 @@
#ifndef BSSNEM_CLASS_H
#define BSSNEM_CLASS_H
#ifdef newc
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cmath>
using namespace std;
#else
#include <iostream.h>
#include <iomanip.h>
#include <fstream.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#endif
#include <mpi.h>
#include "cgh.h"
#include "ShellPatch.h"
#include "misc.h"
#include "var.h"
#include "MyList.h"
#include "monitor.h"
#include "surface_integral.h"
#include "macrodef.h"
#ifdef USE_GPU
#include "bssn_gpu_class.h"
#else
#include "bssn_class.h"
#endif
class bssnEM_class : public bssn_class
{
public:
bssnEM_class(double Couranti, double StartTimei, double TotalTimei, double DumpTimei, double d2DumpTimei, double CheckTimei, double AnasTimei,
int Symmetryi, int checkruni, char *checkfilenamei, double numepssi, double numepsbi, double numepshi,
int a_levi, int maxli, int decni, double maxrexi, double drexi);
~bssnEM_class();
void Initialize();
void Read_Ansorg();
void Setup_Initial_Data();
void Step(int lev, int YN);
void Compute_Phi2(int lev);
void AnalysisStuff_EM(int lev, double dT_lev);
void Interp_Constraint();
protected:
var *Exo, *Eyo, *Ezo, *Bxo, *Byo, *Bzo, *Kpsio, *Kphio;
var *Ex0, *Ey0, *Ez0, *Bx0, *By0, *Bz0, *Kpsi0, *Kphi0;
var *Ex, *Ey, *Ez, *Bx, *By, *Bz, *Kpsi, *Kphi;
var *Ex1, *Ey1, *Ez1, *Bx1, *By1, *Bz1, *Kpsi1, *Kphi1;
var *Ex_rhs, *Ey_rhs, *Ez_rhs, *Bx_rhs, *By_rhs, *Bz_rhs, *Kpsi_rhs, *Kphi_rhs;
var *Jx, *Jy, *Jz, *qchar;
var *Rphi2, *Iphi2;
var *Rphi1, *Iphi1;
monitor *Phi2Monitor;
monitor *Phi1Monitor;
};
#endif /* BSSNEM_CLASS_H */
#ifndef BSSNEM_CLASS_H
#define BSSNEM_CLASS_H
#ifdef newc
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cmath>
using namespace std;
#else
#include <iostream.h>
#include <iomanip.h>
#include <fstream.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#endif
#include <mpi.h>
#include "cgh.h"
#include "ShellPatch.h"
#include "misc.h"
#include "var.h"
#include "MyList.h"
#include "monitor.h"
#include "surface_integral.h"
#include "macrodef.h"
#ifdef USE_GPU
#include "bssn_gpu_class.h"
#else
#include "bssn_class.h"
#endif
class bssnEM_class : public bssn_class
{
public:
bssnEM_class(double Couranti, double StartTimei, double TotalTimei, double DumpTimei, double d2DumpTimei, double CheckTimei, double AnasTimei,
int Symmetryi, int checkruni, char *checkfilenamei, double numepssi, double numepsbi, double numepshi,
int a_levi, int maxli, int decni, double maxrexi, double drexi);
~bssnEM_class();
void Initialize();
void Read_Ansorg();
void Setup_Initial_Data();
void Step(int lev, int YN);
void Compute_Phi2(int lev);
void AnalysisStuff_EM(int lev, double dT_lev);
void Interp_Constraint();
protected:
var *Exo, *Eyo, *Ezo, *Bxo, *Byo, *Bzo, *Kpsio, *Kphio;
var *Ex0, *Ey0, *Ez0, *Bx0, *By0, *Bz0, *Kpsi0, *Kphi0;
var *Ex, *Ey, *Ez, *Bx, *By, *Bz, *Kpsi, *Kphi;
var *Ex1, *Ey1, *Ez1, *Bx1, *By1, *Bz1, *Kpsi1, *Kphi1;
var *Ex_rhs, *Ey_rhs, *Ez_rhs, *Bx_rhs, *By_rhs, *Bz_rhs, *Kpsi_rhs, *Kphi_rhs;
var *Jx, *Jy, *Jz, *qchar;
var *Rphi2, *Iphi2;
var *Rphi1, *Iphi1;
monitor *Phi2Monitor;
monitor *Phi1Monitor;
};
#endif /* BSSNEM_CLASS_H */

View File

@@ -1,70 +1,70 @@
#ifndef BSSNESCALAR_CLASS_H
#define BSSNESCALAR_CLASS_H
#ifdef newc
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cmath>
using namespace std;
#else
#include <iostream.h>
#include <iomanip.h>
#include <fstream.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#endif
#include <mpi.h>
#include "cgh.h"
#include "ShellPatch.h"
#include "misc.h"
#include "var.h"
#include "MyList.h"
#include "monitor.h"
#include "surface_integral.h"
#include "macrodef.h"
#ifdef USE_GPU
#include "bssn_gpu_class.h"
#else
#include "bssn_class.h"
#endif
class bssnEScalar_class : public bssn_class
{
public:
bssnEScalar_class(double Couranti, double StartTimei, double TotalTimei, double DumpTimei, double d2DumpTimei, double CheckTimei, double AnasTimei,
int Symmetryi, int checkruni, char *checkfilenamei, double numepssi, double numepsbi, double numepshi,
int a_levi, int maxli, int decni, double maxrexi, double drexi);
~bssnEScalar_class();
void Initialize();
void Read_Ansorg();
void Read_Pablo();
void Compute_Psi4(int lev);
void Step(int lev, int YN);
void AnalysisStuff_EScalar(int lev, double dT_lev);
void Interp_Constraint();
void Constraint_Out();
protected:
var *Sphio, *Spio;
var *Sphi0, *Spi0;
var *Sphi, *Spi;
var *Sphi1, *Spi1;
var *Sphi_rhs, *Spi_rhs;
var *Cons_fR;
monitor *MaxScalar_Monitor;
};
#endif /* BSSNESCALAR_CLASS_H */
#ifndef BSSNESCALAR_CLASS_H
#define BSSNESCALAR_CLASS_H
#ifdef newc
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cmath>
using namespace std;
#else
#include <iostream.h>
#include <iomanip.h>
#include <fstream.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#endif
#include <mpi.h>
#include "cgh.h"
#include "ShellPatch.h"
#include "misc.h"
#include "var.h"
#include "MyList.h"
#include "monitor.h"
#include "surface_integral.h"
#include "macrodef.h"
#ifdef USE_GPU
#include "bssn_gpu_class.h"
#else
#include "bssn_class.h"
#endif
class bssnEScalar_class : public bssn_class
{
public:
bssnEScalar_class(double Couranti, double StartTimei, double TotalTimei, double DumpTimei, double d2DumpTimei, double CheckTimei, double AnasTimei,
int Symmetryi, int checkruni, char *checkfilenamei, double numepssi, double numepsbi, double numepshi,
int a_levi, int maxli, int decni, double maxrexi, double drexi);
~bssnEScalar_class();
void Initialize();
void Read_Ansorg();
void Read_Pablo();
void Compute_Psi4(int lev);
void Step(int lev, int YN);
void AnalysisStuff_EScalar(int lev, double dT_lev);
void Interp_Constraint();
void Constraint_Out();
protected:
var *Sphio, *Spio;
var *Sphi0, *Spi0;
var *Sphi, *Spi;
var *Sphi1, *Spi1;
var *Sphi_rhs, *Spi_rhs;
var *Cons_fR;
monitor *MaxScalar_Monitor;
};
#endif /* BSSNESCALAR_CLASS_H */

View File

@@ -1,206 +1,205 @@
#ifndef BSSN_CLASS_H
#define BSSN_CLASS_H
#ifdef newc
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cmath>
using namespace std;
#else
#include <iostream.h>
#include <iomanip.h>
#include <fstream.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#endif
#include <mpi.h>
#include "macrodef.h"
#include "cgh.h"
#include "ShellPatch.h"
#include "misc.h"
#include "var.h"
#include "MyList.h"
#include "monitor.h"
#include "surface_integral.h"
#include "checkpoint.h"
extern void setpbh(int iBHN, double **iPBH, double *iMass, int rBHN);
class bssn_class
{
public:
int ngfs;
int nprocs, myrank;
cgh *GH;
ShellPatch *SH;
double PhysTime;
int checkrun;
char checkfilename[50];
int Steps;
double StartTime, TotalTime;
double AnasTime, DumpTime, d2DumpTime, CheckTime;
double LastAnas, LastConsOut;
int *ConstraintRefreshLevels;
double Courant;
double numepss, numepsb, numepsh;
int Symmetry;
int maxl, decn;
double maxrex, drex;
int trfls, a_lev;
double dT;
double chitiny;
double **Porg0, **Porgbr, **Porg, **Porg1, **Porg_rhs;
int BH_num, BH_num_input;
double *Mass, *Pmom, *Spin;
double ADMMass;
var *phio, *trKo;
var *gxxo, *gxyo, *gxzo, *gyyo, *gyzo, *gzzo;
var *Axxo, *Axyo, *Axzo, *Ayyo, *Ayzo, *Azzo;
var *Gmxo, *Gmyo, *Gmzo;
var *Lapo, *Sfxo, *Sfyo, *Sfzo;
var *dtSfxo, *dtSfyo, *dtSfzo;
var *phi0, *trK0;
var *gxx0, *gxy0, *gxz0, *gyy0, *gyz0, *gzz0;
var *Axx0, *Axy0, *Axz0, *Ayy0, *Ayz0, *Azz0;
var *Gmx0, *Gmy0, *Gmz0;
var *Lap0, *Sfx0, *Sfy0, *Sfz0;
var *dtSfx0, *dtSfy0, *dtSfz0;
var *phi, *trK;
var *gxx, *gxy, *gxz, *gyy, *gyz, *gzz;
var *Axx, *Axy, *Axz, *Ayy, *Ayz, *Azz;
var *Gmx, *Gmy, *Gmz;
var *Lap, *Sfx, *Sfy, *Sfz;
var *dtSfx, *dtSfy, *dtSfz;
var *phi1, *trK1;
var *gxx1, *gxy1, *gxz1, *gyy1, *gyz1, *gzz1;
var *Axx1, *Axy1, *Axz1, *Ayy1, *Ayz1, *Azz1;
var *Gmx1, *Gmy1, *Gmz1;
var *Lap1, *Sfx1, *Sfy1, *Sfz1;
var *dtSfx1, *dtSfy1, *dtSfz1;
var *phi_rhs, *trK_rhs;
var *gxx_rhs, *gxy_rhs, *gxz_rhs, *gyy_rhs, *gyz_rhs, *gzz_rhs;
var *Axx_rhs, *Axy_rhs, *Axz_rhs, *Ayy_rhs, *Ayz_rhs, *Azz_rhs;
var *Gmx_rhs, *Gmy_rhs, *Gmz_rhs;
var *Lap_rhs, *Sfx_rhs, *Sfy_rhs, *Sfz_rhs;
var *dtSfx_rhs, *dtSfy_rhs, *dtSfz_rhs;
var *rho, *Sx, *Sy, *Sz, *Sxx, *Sxy, *Sxz, *Syy, *Syz, *Szz;
var *Gamxxx, *Gamxxy, *Gamxxz, *Gamxyy, *Gamxyz, *Gamxzz;
var *Gamyxx, *Gamyxy, *Gamyxz, *Gamyyy, *Gamyyz, *Gamyzz;
var *Gamzxx, *Gamzxy, *Gamzxz, *Gamzyy, *Gamzyz, *Gamzzz;
var *Rxx, *Rxy, *Rxz, *Ryy, *Ryz, *Rzz;
var *Rpsi4, *Ipsi4;
var *t1Rpsi4, *t1Ipsi4, *t2Rpsi4, *t2Ipsi4;
var *Cons_Ham, *Cons_Px, *Cons_Py, *Cons_Pz, *Cons_Gx, *Cons_Gy, *Cons_Gz;
#ifdef Point_Psi4
var *phix, *phiy, *phiz;
var *trKx, *trKy, *trKz;
var *Axxx, *Axxy, *Axxz;
var *Axyx, *Axyy, *Axyz;
var *Axzx, *Axzy, *Axzz;
var *Ayyx, *Ayyy, *Ayyz;
var *Ayzx, *Ayzy, *Ayzz;
var *Azzx, *Azzy, *Azzz;
#endif
// FIXME: uc = StateList, up = OldStateList, upp = SynchList_cor; so never touch these three data
MyList<var> *StateList, *SynchList_pre, *SynchList_cor, *RHSList;
MyList<var> *OldStateList, *DumpList;
MyList<var> *ConstraintList;
Parallel::SyncCache *sync_cache_pre; // per-level cache for predictor sync
Parallel::SyncCache *sync_cache_cor; // per-level cache for corrector sync
Parallel::SyncCache *sync_cache_rp_coarse; // RestrictProlong sync on PatL[lev-1]
Parallel::SyncCache *sync_cache_rp_fine; // RestrictProlong sync on PatL[lev]
Parallel::SyncCache *sync_cache_restrict; // cached Restrict in RestrictProlong
Parallel::SyncCache *sync_cache_outbd; // cached OutBdLow2Hi in RestrictProlong
monitor *ErrorMonitor, *Psi4Monitor, *BHMonitor, *MAPMonitor;
monitor *ConVMonitor, *TimingMonitor;
surface_integral *Waveshell;
checkpoint *CheckPoint;
public:
bssn_class(double Couranti, double StartTimei, double TotalTimei, double DumpTimei, double d2DumpTimei, double CheckTimei, double AnasTimei,
int Symmetryi, int checkruni, char *checkfilenamei, double numepssi, double numepsbi, double numepshi,
int a_levi, int maxli, int decni, double maxrexi, double drexi);
~bssn_class();
void Evolve(int Steps);
void RecursiveStep(int lev);
#if (PSTR == 3)
void RecursiveStep(int lev, int num);
#endif
#if (PSTR == 1 || PSTR == 2 || PSTR == 3)
void ParallelStep();
void SHStep();
#endif
void RestrictProlong(int lev, int YN, bool BB, MyList<var> *SL, MyList<var> *OL, MyList<var> *corL);
void RestrictProlong_aux(int lev, int YN, bool BB, MyList<var> *SL, MyList<var> *OL, MyList<var> *corL);
void RestrictProlong(int lev, int YN, bool BB);
void ProlongRestrict(int lev, int YN, bool BB);
void Setup_Black_Hole_position();
void compute_Porg_rhs(double **BH_PS, double **BH_RHS, var *forx, var *fory, var *forz, int lev);
bool read_Pablo_file(int *ext, double *datain, char *filename);
void write_Pablo_file(int *ext, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax,
char *filename);
void AnalysisStuff(int lev, double dT_lev);
void Setup_KerrSchild();
void Enforce_algcon(int lev, int fg);
void testRestrict();
void testOutBd();
bool check_Stdin_Abort();
virtual void Setup_Initial_Data_Cao();
virtual void Setup_Initial_Data_Lousto();
virtual void Initialize();
virtual void Read_Ansorg();
virtual void Read_Pablo() {};
virtual void Compute_Psi4(int lev);
virtual void Step(int lev, int YN);
virtual void Interp_Constraint(bool infg);
virtual void Constraint_Out();
virtual void Compute_Constraint();
#ifdef With_AHF
protected:
MyList<var> *AHList, *AHDList, *GaugeList;
int AHfindevery;
double AHdumptime;
int *lastahdumpid, HN_num; // number of possible horizons
int *findeveryl;
double *xc, *yc, *zc, *xr, *yr, *zr;
bool *trigger;
double *dTT;
int *dumpid;
public:
void AH_Prepare_derivatives();
bool AH_Interp_Points(MyList<var> *VarList,
int NN, double **XX,
double *Shellf, int Symmetryi);
void AH_Step_Find(int lev, double dT_lev);
#endif
};
#endif /* BSSN_CLASS_H */
#ifndef BSSN_CLASS_H
#define BSSN_CLASS_H
#ifdef newc
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cmath>
using namespace std;
#else
#include <iostream.h>
#include <iomanip.h>
#include <fstream.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#endif
#include <mpi.h>
#include "macrodef.h"
#include "cgh.h"
#include "ShellPatch.h"
#include "misc.h"
#include "var.h"
#include "MyList.h"
#include "monitor.h"
#include "surface_integral.h"
#include "checkpoint.h"
extern void setpbh(int iBHN, double **iPBH, double *iMass, int rBHN);
class bssn_class
{
public:
int ngfs;
int nprocs, myrank;
cgh *GH;
ShellPatch *SH;
double PhysTime;
int checkrun;
char checkfilename[50];
int Steps;
double StartTime, TotalTime;
double AnasTime, DumpTime, d2DumpTime, CheckTime;
double LastAnas, LastConsOut;
double Courant;
double numepss, numepsb, numepsh;
int Symmetry;
int maxl, decn;
double maxrex, drex;
int trfls, a_lev;
double dT;
double chitiny;
double **Porg0, **Porgbr, **Porg, **Porg1, **Porg_rhs;
int BH_num, BH_num_input;
double *Mass, *Pmom, *Spin;
double ADMMass;
var *phio, *trKo;
var *gxxo, *gxyo, *gxzo, *gyyo, *gyzo, *gzzo;
var *Axxo, *Axyo, *Axzo, *Ayyo, *Ayzo, *Azzo;
var *Gmxo, *Gmyo, *Gmzo;
var *Lapo, *Sfxo, *Sfyo, *Sfzo;
var *dtSfxo, *dtSfyo, *dtSfzo;
var *phi0, *trK0;
var *gxx0, *gxy0, *gxz0, *gyy0, *gyz0, *gzz0;
var *Axx0, *Axy0, *Axz0, *Ayy0, *Ayz0, *Azz0;
var *Gmx0, *Gmy0, *Gmz0;
var *Lap0, *Sfx0, *Sfy0, *Sfz0;
var *dtSfx0, *dtSfy0, *dtSfz0;
var *phi, *trK;
var *gxx, *gxy, *gxz, *gyy, *gyz, *gzz;
var *Axx, *Axy, *Axz, *Ayy, *Ayz, *Azz;
var *Gmx, *Gmy, *Gmz;
var *Lap, *Sfx, *Sfy, *Sfz;
var *dtSfx, *dtSfy, *dtSfz;
var *phi1, *trK1;
var *gxx1, *gxy1, *gxz1, *gyy1, *gyz1, *gzz1;
var *Axx1, *Axy1, *Axz1, *Ayy1, *Ayz1, *Azz1;
var *Gmx1, *Gmy1, *Gmz1;
var *Lap1, *Sfx1, *Sfy1, *Sfz1;
var *dtSfx1, *dtSfy1, *dtSfz1;
var *phi_rhs, *trK_rhs;
var *gxx_rhs, *gxy_rhs, *gxz_rhs, *gyy_rhs, *gyz_rhs, *gzz_rhs;
var *Axx_rhs, *Axy_rhs, *Axz_rhs, *Ayy_rhs, *Ayz_rhs, *Azz_rhs;
var *Gmx_rhs, *Gmy_rhs, *Gmz_rhs;
var *Lap_rhs, *Sfx_rhs, *Sfy_rhs, *Sfz_rhs;
var *dtSfx_rhs, *dtSfy_rhs, *dtSfz_rhs;
var *rho, *Sx, *Sy, *Sz, *Sxx, *Sxy, *Sxz, *Syy, *Syz, *Szz;
var *Gamxxx, *Gamxxy, *Gamxxz, *Gamxyy, *Gamxyz, *Gamxzz;
var *Gamyxx, *Gamyxy, *Gamyxz, *Gamyyy, *Gamyyz, *Gamyzz;
var *Gamzxx, *Gamzxy, *Gamzxz, *Gamzyy, *Gamzyz, *Gamzzz;
var *Rxx, *Rxy, *Rxz, *Ryy, *Ryz, *Rzz;
var *Rpsi4, *Ipsi4;
var *t1Rpsi4, *t1Ipsi4, *t2Rpsi4, *t2Ipsi4;
var *Cons_Ham, *Cons_Px, *Cons_Py, *Cons_Pz, *Cons_Gx, *Cons_Gy, *Cons_Gz;
#ifdef Point_Psi4
var *phix, *phiy, *phiz;
var *trKx, *trKy, *trKz;
var *Axxx, *Axxy, *Axxz;
var *Axyx, *Axyy, *Axyz;
var *Axzx, *Axzy, *Axzz;
var *Ayyx, *Ayyy, *Ayyz;
var *Ayzx, *Ayzy, *Ayzz;
var *Azzx, *Azzy, *Azzz;
#endif
// FIXME: uc = StateList, up = OldStateList, upp = SynchList_cor; so never touch these three data
MyList<var> *StateList, *SynchList_pre, *SynchList_cor, *RHSList;
MyList<var> *OldStateList, *DumpList;
MyList<var> *ConstraintList;
Parallel::SyncCache *sync_cache_pre; // per-level cache for predictor sync
Parallel::SyncCache *sync_cache_cor; // per-level cache for corrector sync
Parallel::SyncCache *sync_cache_rp_coarse; // RestrictProlong sync on PatL[lev-1]
Parallel::SyncCache *sync_cache_rp_fine; // RestrictProlong sync on PatL[lev]
Parallel::SyncCache *sync_cache_restrict; // cached Restrict in RestrictProlong
Parallel::SyncCache *sync_cache_outbd; // cached OutBdLow2Hi in RestrictProlong
monitor *ErrorMonitor, *Psi4Monitor, *BHMonitor, *MAPMonitor;
monitor *ConVMonitor;
surface_integral *Waveshell;
checkpoint *CheckPoint;
public:
bssn_class(double Couranti, double StartTimei, double TotalTimei, double DumpTimei, double d2DumpTimei, double CheckTimei, double AnasTimei,
int Symmetryi, int checkruni, char *checkfilenamei, double numepssi, double numepsbi, double numepshi,
int a_levi, int maxli, int decni, double maxrexi, double drexi);
~bssn_class();
void Evolve(int Steps);
void RecursiveStep(int lev);
#if (PSTR == 3)
void RecursiveStep(int lev, int num);
#endif
#if (PSTR == 1 || PSTR == 2 || PSTR == 3)
void ParallelStep();
void SHStep();
#endif
void RestrictProlong(int lev, int YN, bool BB, MyList<var> *SL, MyList<var> *OL, MyList<var> *corL);
void RestrictProlong_aux(int lev, int YN, bool BB, MyList<var> *SL, MyList<var> *OL, MyList<var> *corL);
void RestrictProlong(int lev, int YN, bool BB);
void ProlongRestrict(int lev, int YN, bool BB);
void Setup_Black_Hole_position();
void compute_Porg_rhs(double **BH_PS, double **BH_RHS, var *forx, var *fory, var *forz, int lev);
bool read_Pablo_file(int *ext, double *datain, char *filename);
void write_Pablo_file(int *ext, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax,
char *filename);
void AnalysisStuff(int lev, double dT_lev);
void Setup_KerrSchild();
void Enforce_algcon(int lev, int fg);
void testRestrict();
void testOutBd();
bool check_Stdin_Abort();
virtual void Setup_Initial_Data_Cao();
virtual void Setup_Initial_Data_Lousto();
virtual void Initialize();
virtual void Read_Ansorg();
virtual void Read_Pablo() {};
virtual void Compute_Psi4(int lev);
virtual void Step(int lev, int YN);
virtual void Interp_Constraint(bool infg);
virtual void Constraint_Out();
virtual void Compute_Constraint();
#ifdef With_AHF
protected:
MyList<var> *AHList, *AHDList, *GaugeList;
int AHfindevery;
double AHdumptime;
int *lastahdumpid, HN_num; // number of possible horizons
int *findeveryl;
double *xc, *yc, *zc, *xr, *yr, *zr;
bool *trigger;
double *dTT;
int *dumpid;
public:
void AH_Prepare_derivatives();
bool AH_Interp_Points(MyList<var> *VarList,
int NN, double **XX,
double *Shellf, int Symmetryi);
void AH_Step_Find(int lev, double dT_lev);
#endif
};
#endif /* BSSN_CLASS_H */

View File

@@ -1,73 +1,73 @@
#ifndef BSSN_GPU_H_
#define BSSN_GPU_H_
#include "bssn_macro.h"
#include "macrodef.fh"
#define DEVICE_ID 0
// #define DEVICE_ID_BY_MPI_RANK
#define GRID_DIM 256
#define BLOCK_DIM 128
#define _FH2_(i, j, k) fh[(i) + (j) * _1D_SIZE[2] + (k) * _2D_SIZE[2]]
#define _FH3_(i, j, k) fh[(i) + (j) * _1D_SIZE[3] + (k) * _2D_SIZE[3]]
#define pow2(x) ((x) * (x))
#define TimeBetween(a, b) ((b.tv_sec - a.tv_sec) + (b.tv_usec - a.tv_usec) / 1000000.0f)
#define M_ metac.
#define Mh_ meta->
#define Ms_ metassc.
#define Msh_ metass->
// #define TIMING
#define RHS_SS_PARA int calledby, int mpi_rank, int *ex, double &T, double *crho, double *sigma, double *R, double *X, double *Y, double *Z, double *drhodx, double *drhody, double *drhodz, double *dsigmadx, double *dsigmady, double *dsigmadz, double *dRdx, double *dRdy, double *dRdz, double *drhodxx, double *drhodxy, double *drhodxz, double *drhodyy, double *drhodyz, double *drhodzz, double *dsigmadxx, double *dsigmadxy, double *dsigmadxz, double *dsigmadyy, double *dsigmadyz, double *dsigmadzz, double *dRdxx, double *dRdxy, double *dRdxz, double *dRdyy, double *dRdyz, double *dRdzz, double *chi, double *trK, double *dxx, double *gxy, double *gxz, double *dyy, double *gyz, double *dzz, double *Axx, double *Axy, double *Axz, double *Ayy, double *Ayz, double *Azz, double *Gamx, double *Gamy, double *Gamz, double *Lap, double *betax, double *betay, double *betaz, double *dtSfx, double *dtSfy, double *dtSfz, double *chi_rhs, double *trK_rhs, double *gxx_rhs, double *gxy_rhs, double *gxz_rhs, double *gyy_rhs, double *gyz_rhs, double *gzz_rhs, double *Axx_rhs, double *Axy_rhs, double *Axz_rhs, double *Ayy_rhs, double *Ayz_rhs, double *Azz_rhs, double *Gamx_rhs, double *Gamy_rhs, double *Gamz_rhs, double *Lap_rhs, double *betax_rhs, double *betay_rhs, double *betaz_rhs, double *dtSfx_rhs, double *dtSfy_rhs, double *dtSfz_rhs, double *rho, double *Sx, double *Sy, double *Sz, double *Sxx, double *Sxy, double *Sxz, double *Syy, double *Syz, double *Szz, double *Gamxxx, double *Gamxxy, double *Gamxxz, double *Gamxyy, double *Gamxyz, double *Gamxzz, double *Gamyxx, double *Gamyxy, double *Gamyxz, double *Gamyyy, double *Gamyyz, double *Gamyzz, double *Gamzxx, double *Gamzxy, double *Gamzxz, double *Gamzyy, double *Gamzyz, double *Gamzzz, double *Rxx, double *Rxy, double *Rxz, double *Ryy, double *Ryz, double *Rzz, double *ham_Res, double *movx_Res, double *movy_Res, double *movz_Res, double *Gmx_Res, double *Gmy_Res, double *Gmz_Res, int &Symmetry, int &Lev, double &eps, int &sst, int &co
/** main function */
int gpu_rhs(int calledby, int mpi_rank, int *ex, double &T,
double *X, double *Y, double *Z,
double *chi, double *trK,
double *dxx, double *gxy, double *gxz, double *dyy, double *gyz, double *dzz,
double *Axx, double *Axy, double *Axz, double *Ayy, double *Ayz, double *Azz,
double *Gamx, double *Gamy, double *Gamz,
double *Lap, double *betax, double *betay, double *betaz,
double *dtSfx, double *dtSfy, double *dtSfz,
double *chi_rhs, double *trK_rhs,
double *gxx_rhs, double *gxy_rhs, double *gxz_rhs, double *gyy_rhs, double *gyz_rhs, double *gzz_rhs,
double *Axx_rhs, double *Axy_rhs, double *Axz_rhs, double *Ayy_rhs, double *Ayz_rhs, double *Azz_rhs,
double *Gamx_rhs, double *Gamy_rhs, double *Gamz_rhs,
double *Lap_rhs, double *betax_rhs, double *betay_rhs, double *betaz_rhs,
double *dtSfx_rhs, double *dtSfy_rhs, double *dtSfz_rhs,
double *rho, double *Sx, double *Sy, double *Sz, double *Sxx,
double *Sxy, double *Sxz, double *Syy, double *Syz, double *Szz,
double *Gamxxx, double *Gamxxy, double *Gamxxz, double *Gamxyy, double *Gamxyz, double *Gamxzz,
double *Gamyxx, double *Gamyxy, double *Gamyxz, double *Gamyyy, double *Gamyyz, double *Gamyzz,
double *Gamzxx, double *Gamzxy, double *Gamzxz, double *Gamzyy, double *Gamzyz, double *Gamzzz,
double *Rxx, double *Rxy, double *Rxz, double *Ryy, double *Ryz, double *Rzz,
double *ham_Res, double *movx_Res, double *movy_Res, double *movz_Res,
double *Gmx_Res, double *Gmy_Res, double *Gmz_Res,
int &Symmetry, int &Lev, double &eps, int &co);
int gpu_rhs_ss(RHS_SS_PARA);
/** Init GPU side data in GPUMeta. */
// void init_fluid_meta_gpu(GPUMeta *gpu_meta);
#endif
#ifndef BSSN_GPU_H_
#define BSSN_GPU_H_
#include "bssn_macro.h"
#include "macrodef.fh"
#define DEVICE_ID 0
// #define DEVICE_ID_BY_MPI_RANK
#define GRID_DIM 256
#define BLOCK_DIM 128
#define _FH2_(i, j, k) fh[(i) + (j) * _1D_SIZE[2] + (k) * _2D_SIZE[2]]
#define _FH3_(i, j, k) fh[(i) + (j) * _1D_SIZE[3] + (k) * _2D_SIZE[3]]
#define pow2(x) ((x) * (x))
#define TimeBetween(a, b) ((b.tv_sec - a.tv_sec) + (b.tv_usec - a.tv_usec) / 1000000.0f)
#define M_ metac.
#define Mh_ meta->
#define Ms_ metassc.
#define Msh_ metass->
// #define TIMING
#define RHS_SS_PARA int calledby, int mpi_rank, int *ex, double &T, double *crho, double *sigma, double *R, double *X, double *Y, double *Z, double *drhodx, double *drhody, double *drhodz, double *dsigmadx, double *dsigmady, double *dsigmadz, double *dRdx, double *dRdy, double *dRdz, double *drhodxx, double *drhodxy, double *drhodxz, double *drhodyy, double *drhodyz, double *drhodzz, double *dsigmadxx, double *dsigmadxy, double *dsigmadxz, double *dsigmadyy, double *dsigmadyz, double *dsigmadzz, double *dRdxx, double *dRdxy, double *dRdxz, double *dRdyy, double *dRdyz, double *dRdzz, double *chi, double *trK, double *dxx, double *gxy, double *gxz, double *dyy, double *gyz, double *dzz, double *Axx, double *Axy, double *Axz, double *Ayy, double *Ayz, double *Azz, double *Gamx, double *Gamy, double *Gamz, double *Lap, double *betax, double *betay, double *betaz, double *dtSfx, double *dtSfy, double *dtSfz, double *chi_rhs, double *trK_rhs, double *gxx_rhs, double *gxy_rhs, double *gxz_rhs, double *gyy_rhs, double *gyz_rhs, double *gzz_rhs, double *Axx_rhs, double *Axy_rhs, double *Axz_rhs, double *Ayy_rhs, double *Ayz_rhs, double *Azz_rhs, double *Gamx_rhs, double *Gamy_rhs, double *Gamz_rhs, double *Lap_rhs, double *betax_rhs, double *betay_rhs, double *betaz_rhs, double *dtSfx_rhs, double *dtSfy_rhs, double *dtSfz_rhs, double *rho, double *Sx, double *Sy, double *Sz, double *Sxx, double *Sxy, double *Sxz, double *Syy, double *Syz, double *Szz, double *Gamxxx, double *Gamxxy, double *Gamxxz, double *Gamxyy, double *Gamxyz, double *Gamxzz, double *Gamyxx, double *Gamyxy, double *Gamyxz, double *Gamyyy, double *Gamyyz, double *Gamyzz, double *Gamzxx, double *Gamzxy, double *Gamzxz, double *Gamzyy, double *Gamzyz, double *Gamzzz, double *Rxx, double *Rxy, double *Rxz, double *Ryy, double *Ryz, double *Rzz, double *ham_Res, double *movx_Res, double *movy_Res, double *movz_Res, double *Gmx_Res, double *Gmy_Res, double *Gmz_Res, int &Symmetry, int &Lev, double &eps, int &sst, int &co
/** main function */
int gpu_rhs(int calledby, int mpi_rank, int *ex, double &T,
double *X, double *Y, double *Z,
double *chi, double *trK,
double *dxx, double *gxy, double *gxz, double *dyy, double *gyz, double *dzz,
double *Axx, double *Axy, double *Axz, double *Ayy, double *Ayz, double *Azz,
double *Gamx, double *Gamy, double *Gamz,
double *Lap, double *betax, double *betay, double *betaz,
double *dtSfx, double *dtSfy, double *dtSfz,
double *chi_rhs, double *trK_rhs,
double *gxx_rhs, double *gxy_rhs, double *gxz_rhs, double *gyy_rhs, double *gyz_rhs, double *gzz_rhs,
double *Axx_rhs, double *Axy_rhs, double *Axz_rhs, double *Ayy_rhs, double *Ayz_rhs, double *Azz_rhs,
double *Gamx_rhs, double *Gamy_rhs, double *Gamz_rhs,
double *Lap_rhs, double *betax_rhs, double *betay_rhs, double *betaz_rhs,
double *dtSfx_rhs, double *dtSfy_rhs, double *dtSfz_rhs,
double *rho, double *Sx, double *Sy, double *Sz, double *Sxx,
double *Sxy, double *Sxz, double *Syy, double *Syz, double *Szz,
double *Gamxxx, double *Gamxxy, double *Gamxxz, double *Gamxyy, double *Gamxyz, double *Gamxzz,
double *Gamyxx, double *Gamyxy, double *Gamyxz, double *Gamyyy, double *Gamyyz, double *Gamyzz,
double *Gamzxx, double *Gamzxy, double *Gamzxz, double *Gamzyy, double *Gamzyz, double *Gamzzz,
double *Rxx, double *Rxy, double *Rxz, double *Ryy, double *Ryz, double *Rzz,
double *ham_Res, double *movx_Res, double *movy_Res, double *movz_Res,
double *Gmx_Res, double *Gmy_Res, double *Gmz_Res,
int &Symmetry, int &Lev, double &eps, int &co);
int gpu_rhs_ss(RHS_SS_PARA);
/** Init GPU side data in GPUMeta. */
// void init_fluid_meta_gpu(GPUMeta *gpu_meta);
#endif

View File

@@ -1,210 +1,210 @@
#ifndef BSSN_GPU_CLASS_H
#define BSSN_GPU_CLASS_H
#ifdef newc
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cmath>
using namespace std;
#else
#include <iostream.h>
#include <iomanip.h>
#include <fstream.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#endif
#include <mpi.h>
#include "macrodef.h"
#include "cgh.h"
#include "ShellPatch.h"
#include "misc.h"
#include "var.h"
#include "MyList.h"
#include "monitor.h"
#include "surface_integral.h"
#include "checkpoint.h"
// added by yangquan
#include "bssn_macro.h"
extern void setpbh(int iBHN, double **iPBH, double *iMass, int rBHN);
class bssn_class
{
public:
// added by yangquan
//----------------------
int gpu_num_mynode;
int cpu_core_num_mynode;
int mpi_process_num_mynode;
int my_sequence_mynode;
int mynode_id;
int use_gpu;
virtual void Step_GPU(int lev, int YN);
virtual void Get_runtime_envirment();
// virtual void Step_OPENMP(int lev,int YN);
//----------------------
int ngfs;
int nprocs, myrank;
cgh *GH;
ShellPatch *SH;
double PhysTime;
int checkrun;
char checkfilename[50];
int Steps;
double StartTime, TotalTime;
double AnasTime, DumpTime, d2DumpTime, CheckTime;
double LastAnas, LastConsOut;
double Courant;
double numepss, numepsb, numepsh;
int Symmetry;
int maxl, decn;
double maxrex, drex;
int trfls, a_lev;
double dT;
double chitiny;
double **Porg0, **Porgbr, **Porg, **Porg1, **Porg_rhs;
int BH_num, BH_num_input;
double *Mass, *Pmom, *Spin;
double ADMMass;
var *phio, *trKo;
var *gxxo, *gxyo, *gxzo, *gyyo, *gyzo, *gzzo;
var *Axxo, *Axyo, *Axzo, *Ayyo, *Ayzo, *Azzo;
var *Gmxo, *Gmyo, *Gmzo;
var *Lapo, *Sfxo, *Sfyo, *Sfzo;
var *dtSfxo, *dtSfyo, *dtSfzo;
var *phi0, *trK0;
var *gxx0, *gxy0, *gxz0, *gyy0, *gyz0, *gzz0;
var *Axx0, *Axy0, *Axz0, *Ayy0, *Ayz0, *Azz0;
var *Gmx0, *Gmy0, *Gmz0;
var *Lap0, *Sfx0, *Sfy0, *Sfz0;
var *dtSfx0, *dtSfy0, *dtSfz0;
var *phi, *trK;
var *gxx, *gxy, *gxz, *gyy, *gyz, *gzz;
var *Axx, *Axy, *Axz, *Ayy, *Ayz, *Azz;
var *Gmx, *Gmy, *Gmz;
var *Lap, *Sfx, *Sfy, *Sfz;
var *dtSfx, *dtSfy, *dtSfz;
var *phi1, *trK1;
var *gxx1, *gxy1, *gxz1, *gyy1, *gyz1, *gzz1;
var *Axx1, *Axy1, *Axz1, *Ayy1, *Ayz1, *Azz1;
var *Gmx1, *Gmy1, *Gmz1;
var *Lap1, *Sfx1, *Sfy1, *Sfz1;
var *dtSfx1, *dtSfy1, *dtSfz1;
var *phi_rhs, *trK_rhs;
var *gxx_rhs, *gxy_rhs, *gxz_rhs, *gyy_rhs, *gyz_rhs, *gzz_rhs;
var *Axx_rhs, *Axy_rhs, *Axz_rhs, *Ayy_rhs, *Ayz_rhs, *Azz_rhs;
var *Gmx_rhs, *Gmy_rhs, *Gmz_rhs;
var *Lap_rhs, *Sfx_rhs, *Sfy_rhs, *Sfz_rhs;
var *dtSfx_rhs, *dtSfy_rhs, *dtSfz_rhs;
var *rho, *Sx, *Sy, *Sz, *Sxx, *Sxy, *Sxz, *Syy, *Syz, *Szz;
var *Gamxxx, *Gamxxy, *Gamxxz, *Gamxyy, *Gamxyz, *Gamxzz;
var *Gamyxx, *Gamyxy, *Gamyxz, *Gamyyy, *Gamyyz, *Gamyzz;
var *Gamzxx, *Gamzxy, *Gamzxz, *Gamzyy, *Gamzyz, *Gamzzz;
var *Rxx, *Rxy, *Rxz, *Ryy, *Ryz, *Rzz;
var *Rpsi4, *Ipsi4;
var *t1Rpsi4, *t1Ipsi4, *t2Rpsi4, *t2Ipsi4;
var *Cons_Ham, *Cons_Px, *Cons_Py, *Cons_Pz, *Cons_Gx, *Cons_Gy, *Cons_Gz;
#ifdef Point_Psi4
var *phix, *phiy, *phiz;
var *trKx, *trKy, *trKz;
var *Axxx, *Axxy, *Axxz;
var *Axyx, *Axyy, *Axyz;
var *Axzx, *Axzy, *Axzz;
var *Ayyx, *Ayyy, *Ayyz;
var *Ayzx, *Ayzy, *Ayzz;
var *Azzx, *Azzy, *Azzz;
#endif
// FIXME: uc = StateList, up = OldStateList, upp = SynchList_cor; so never touch these three data
MyList<var> *StateList, *SynchList_pre, *SynchList_cor, *RHSList;
MyList<var> *OldStateList, *DumpList;
MyList<var> *ConstraintList;
monitor *ErrorMonitor, *Psi4Monitor, *BHMonitor, *MAPMonitor;
monitor *ConVMonitor;
surface_integral *Waveshell;
checkpoint *CheckPoint;
public:
bssn_class(double Couranti, double StartTimei, double TotalTimei, double DumpTimei, double d2DumpTimei, double CheckTimei, double AnasTimei,
int Symmetryi, int checkruni, char *checkfilenamei, double numepssi, double numepsbi, double numepshi,
int a_levi, int maxli, int decni, double maxrexi, double drexi);
~bssn_class();
void Evolve(int Steps);
void RecursiveStep(int lev);
#if (PSTR == 1)
void ParallelStep();
void SHStep();
#endif
void RestrictProlong(int lev, int YN, bool BB, MyList<var> *SL, MyList<var> *OL, MyList<var> *corL);
void RestrictProlong_aux(int lev, int YN, bool BB, MyList<var> *SL, MyList<var> *OL, MyList<var> *corL);
void RestrictProlong(int lev, int YN, bool BB);
void ProlongRestrict(int lev, int YN, bool BB);
void Setup_Black_Hole_position();
void compute_Porg_rhs(double **BH_PS, double **BH_RHS, var *forx, var *fory, var *forz, int lev);
bool read_Pablo_file(int *ext, double *datain, char *filename);
void write_Pablo_file(int *ext, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax,
char *filename);
void AnalysisStuff(int lev, double dT_lev);
void Setup_KerrSchild();
void Enforce_algcon(int lev, int fg);
void testRestrict();
void testOutBd();
virtual void Setup_Initial_Data_Lousto();
virtual void Setup_Initial_Data_Cao();
virtual void Initialize();
virtual void Read_Ansorg();
virtual void Read_Pablo() {};
virtual void Compute_Psi4(int lev);
virtual void Step(int lev, int YN);
virtual void Interp_Constraint(bool infg);
virtual void Constraint_Out();
virtual void Compute_Constraint();
#ifdef With_AHF
protected:
MyList<var> *AHList, *AHDList, *GaugeList;
int AHfindevery;
double AHdumptime;
int *lastahdumpid, HN_num; // number of possible horizons
int *findeveryl;
double *xc, *yc, *zc, *xr, *yr, *zr;
bool *trigger;
double *dTT;
int *dumpid;
public:
void AH_Prepare_derivatives();
bool AH_Interp_Points(MyList<var> *VarList,
int NN, double **XX,
double *Shellf, int Symmetryi);
void AH_Step_Find(int lev, double dT_lev);
#endif
};
#endif /* BSSN_GPU_CLASS_H */
#ifndef BSSN_GPU_CLASS_H
#define BSSN_GPU_CLASS_H
#ifdef newc
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cmath>
using namespace std;
#else
#include <iostream.h>
#include <iomanip.h>
#include <fstream.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#endif
#include <mpi.h>
#include "macrodef.h"
#include "cgh.h"
#include "ShellPatch.h"
#include "misc.h"
#include "var.h"
#include "MyList.h"
#include "monitor.h"
#include "surface_integral.h"
#include "checkpoint.h"
// added by yangquan
#include "bssn_macro.h"
extern void setpbh(int iBHN, double **iPBH, double *iMass, int rBHN);
class bssn_class
{
public:
// added by yangquan
//----------------------
int gpu_num_mynode;
int cpu_core_num_mynode;
int mpi_process_num_mynode;
int my_sequence_mynode;
int mynode_id;
int use_gpu;
virtual void Step_GPU(int lev, int YN);
virtual void Get_runtime_envirment();
// virtual void Step_OPENMP(int lev,int YN);
//----------------------
int ngfs;
int nprocs, myrank;
cgh *GH;
ShellPatch *SH;
double PhysTime;
int checkrun;
char checkfilename[50];
int Steps;
double StartTime, TotalTime;
double AnasTime, DumpTime, d2DumpTime, CheckTime;
double LastAnas, LastConsOut;
double Courant;
double numepss, numepsb, numepsh;
int Symmetry;
int maxl, decn;
double maxrex, drex;
int trfls, a_lev;
double dT;
double chitiny;
double **Porg0, **Porgbr, **Porg, **Porg1, **Porg_rhs;
int BH_num, BH_num_input;
double *Mass, *Pmom, *Spin;
double ADMMass;
var *phio, *trKo;
var *gxxo, *gxyo, *gxzo, *gyyo, *gyzo, *gzzo;
var *Axxo, *Axyo, *Axzo, *Ayyo, *Ayzo, *Azzo;
var *Gmxo, *Gmyo, *Gmzo;
var *Lapo, *Sfxo, *Sfyo, *Sfzo;
var *dtSfxo, *dtSfyo, *dtSfzo;
var *phi0, *trK0;
var *gxx0, *gxy0, *gxz0, *gyy0, *gyz0, *gzz0;
var *Axx0, *Axy0, *Axz0, *Ayy0, *Ayz0, *Azz0;
var *Gmx0, *Gmy0, *Gmz0;
var *Lap0, *Sfx0, *Sfy0, *Sfz0;
var *dtSfx0, *dtSfy0, *dtSfz0;
var *phi, *trK;
var *gxx, *gxy, *gxz, *gyy, *gyz, *gzz;
var *Axx, *Axy, *Axz, *Ayy, *Ayz, *Azz;
var *Gmx, *Gmy, *Gmz;
var *Lap, *Sfx, *Sfy, *Sfz;
var *dtSfx, *dtSfy, *dtSfz;
var *phi1, *trK1;
var *gxx1, *gxy1, *gxz1, *gyy1, *gyz1, *gzz1;
var *Axx1, *Axy1, *Axz1, *Ayy1, *Ayz1, *Azz1;
var *Gmx1, *Gmy1, *Gmz1;
var *Lap1, *Sfx1, *Sfy1, *Sfz1;
var *dtSfx1, *dtSfy1, *dtSfz1;
var *phi_rhs, *trK_rhs;
var *gxx_rhs, *gxy_rhs, *gxz_rhs, *gyy_rhs, *gyz_rhs, *gzz_rhs;
var *Axx_rhs, *Axy_rhs, *Axz_rhs, *Ayy_rhs, *Ayz_rhs, *Azz_rhs;
var *Gmx_rhs, *Gmy_rhs, *Gmz_rhs;
var *Lap_rhs, *Sfx_rhs, *Sfy_rhs, *Sfz_rhs;
var *dtSfx_rhs, *dtSfy_rhs, *dtSfz_rhs;
var *rho, *Sx, *Sy, *Sz, *Sxx, *Sxy, *Sxz, *Syy, *Syz, *Szz;
var *Gamxxx, *Gamxxy, *Gamxxz, *Gamxyy, *Gamxyz, *Gamxzz;
var *Gamyxx, *Gamyxy, *Gamyxz, *Gamyyy, *Gamyyz, *Gamyzz;
var *Gamzxx, *Gamzxy, *Gamzxz, *Gamzyy, *Gamzyz, *Gamzzz;
var *Rxx, *Rxy, *Rxz, *Ryy, *Ryz, *Rzz;
var *Rpsi4, *Ipsi4;
var *t1Rpsi4, *t1Ipsi4, *t2Rpsi4, *t2Ipsi4;
var *Cons_Ham, *Cons_Px, *Cons_Py, *Cons_Pz, *Cons_Gx, *Cons_Gy, *Cons_Gz;
#ifdef Point_Psi4
var *phix, *phiy, *phiz;
var *trKx, *trKy, *trKz;
var *Axxx, *Axxy, *Axxz;
var *Axyx, *Axyy, *Axyz;
var *Axzx, *Axzy, *Axzz;
var *Ayyx, *Ayyy, *Ayyz;
var *Ayzx, *Ayzy, *Ayzz;
var *Azzx, *Azzy, *Azzz;
#endif
// FIXME: uc = StateList, up = OldStateList, upp = SynchList_cor; so never touch these three data
MyList<var> *StateList, *SynchList_pre, *SynchList_cor, *RHSList;
MyList<var> *OldStateList, *DumpList;
MyList<var> *ConstraintList;
monitor *ErrorMonitor, *Psi4Monitor, *BHMonitor, *MAPMonitor;
monitor *ConVMonitor;
surface_integral *Waveshell;
checkpoint *CheckPoint;
public:
bssn_class(double Couranti, double StartTimei, double TotalTimei, double DumpTimei, double d2DumpTimei, double CheckTimei, double AnasTimei,
int Symmetryi, int checkruni, char *checkfilenamei, double numepssi, double numepsbi, double numepshi,
int a_levi, int maxli, int decni, double maxrexi, double drexi);
~bssn_class();
void Evolve(int Steps);
void RecursiveStep(int lev);
#if (PSTR == 1)
void ParallelStep();
void SHStep();
#endif
void RestrictProlong(int lev, int YN, bool BB, MyList<var> *SL, MyList<var> *OL, MyList<var> *corL);
void RestrictProlong_aux(int lev, int YN, bool BB, MyList<var> *SL, MyList<var> *OL, MyList<var> *corL);
void RestrictProlong(int lev, int YN, bool BB);
void ProlongRestrict(int lev, int YN, bool BB);
void Setup_Black_Hole_position();
void compute_Porg_rhs(double **BH_PS, double **BH_RHS, var *forx, var *fory, var *forz, int lev);
bool read_Pablo_file(int *ext, double *datain, char *filename);
void write_Pablo_file(int *ext, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax,
char *filename);
void AnalysisStuff(int lev, double dT_lev);
void Setup_KerrSchild();
void Enforce_algcon(int lev, int fg);
void testRestrict();
void testOutBd();
virtual void Setup_Initial_Data_Lousto();
virtual void Setup_Initial_Data_Cao();
virtual void Initialize();
virtual void Read_Ansorg();
virtual void Read_Pablo() {};
virtual void Compute_Psi4(int lev);
virtual void Step(int lev, int YN);
virtual void Interp_Constraint(bool infg);
virtual void Constraint_Out();
virtual void Compute_Constraint();
#ifdef With_AHF
protected:
MyList<var> *AHList, *AHDList, *GaugeList;
int AHfindevery;
double AHdumptime;
int *lastahdumpid, HN_num; // number of possible horizons
int *findeveryl;
double *xc, *yc, *zc, *xr, *yr, *zr;
bool *trigger;
double *dTT;
int *dumpid;
public:
void AH_Prepare_derivatives();
bool AH_Interp_Points(MyList<var> *VarList,
int NN, double **XX,
double *Shellf, int Symmetryi);
void AH_Step_Find(int lev, double dT_lev);
#endif
};
#endif /* BSSN_GPU_CLASS_H */

View File

@@ -1,124 +1,124 @@
#include "bssn_macro.h"
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
int compare_two_file(char *fname1, char *fname2, int data_num)
{
// read file
fstream file1(fname1, ios_base::in);
fstream file2(fname2, ios_base::in);
double *d1, *d2;
d1 = (double *)malloc(sizeof(double) * data_num);
d2 = (double *)malloc(sizeof(double) * data_num);
for (int i = 0; i < data_num; ++i)
{
file1.read((char *)(d1 + i), sizeof(double));
file2.read((char *)(d2 + i), sizeof(double));
}
// compare data
bool is_match = true;
for (int i = 0; i < data_num; ++i)
{
if (d1[i] != d2[i])
{
is_match = false;
cout << "miss match at position " << i << endl;
break;
}
}
if (is_match)
cout << "Result is right." << endl;
free(d1);
free(d2);
file1.close();
file2.close();
return 0;
}
void printMatrix(int ftag1, int ftag2, double *d1, double *d2, int ord)
{
char fname1[32];
char fname2[32];
// char ftag1[32]; char ftag2[32];
// sprintf(ftag1,"%d",ftag1);
strcpy(fname1, "matrix_f.show");
// strcat(fname1,ftag1);
// sprintf(ftag2,"%d",ftag2);
strcpy(fname2, "matrix_g.show");
// strcat(fname2,ftag2);
ofstream fout0, fout1, fout2;
fout1.open(fname1);
fout2.open(fname2);
for (int k = 0; k < 65; k++)
{
fout1 << "---------square " << k << " ----------" << endl;
fout2 << "---------square " << k << " ----------" << endl;
for (int j = 0; j < 67 + ord * 2; j++)
{
for (int i = 0; i < 67 + ord * 2; i++)
{
fout1 << d1[i + j * (67 + ord * 2) + k * ((67 + ord * 2) * (67 + ord * 2))] << ' ';
fout2 << d2[i + j * (67 + ord * 2) + k * ((67 + ord * 2) * (67 + ord * 2))] << ' ';
// fout1<<test_output_g[i+j*(cg->shape[0]) + k*(_2d_size)] <<' ';
// fout2<<test_fh_f [i+j*(cg->shape[0]) + k*(_2d_size)] <<' ';
}
fout1 << endl;
fout2 << endl;
}
}
}
int compare_result(int ftag1, double *d2, int data_num)
{
// read file
char fname1[32];
char ftag[32];
// itoa(filetag,ftag,10);
sprintf(ftag, "%d", ftag1);
strcpy(fname1, "matrix_f.out");
strcat(fname1, ftag);
fstream file1(fname1, ios_base::in);
double *d1;
d1 = (double *)malloc(sizeof(double) * data_num);
for (int i = 0; i < data_num; ++i)
{
file1.read((char *)(d1 + i), sizeof(double));
}
// compare data
bool is_match = true;
double delta;
for (int i = 0; i < data_num; ++i)
{
delta = d1[i] - d2[i];
if (delta < 0)
delta = -delta;
if (delta > 1e-14)
{
is_match = false;
cout << fname1 << "::miss match at position " << i << endl;
break;
}
// if(i<100 && i>50)
// cout<<d1[i]<<" "<<d2[i]<<endl;
}
if (is_match)
cout << ftag1 << "::matched." << endl;
if (ftag1 == 0)
{
printMatrix(1, 2, d1, d2, 3);
}
free(d1);
file1.close();
return 0;
}
#include "bssn_macro.h"
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
int compare_two_file(char *fname1, char *fname2, int data_num)
{
// read file
fstream file1(fname1, ios_base::in);
fstream file2(fname2, ios_base::in);
double *d1, *d2;
d1 = (double *)malloc(sizeof(double) * data_num);
d2 = (double *)malloc(sizeof(double) * data_num);
for (int i = 0; i < data_num; ++i)
{
file1.read((char *)(d1 + i), sizeof(double));
file2.read((char *)(d2 + i), sizeof(double));
}
// compare data
bool is_match = true;
for (int i = 0; i < data_num; ++i)
{
if (d1[i] != d2[i])
{
is_match = false;
cout << "miss match at position " << i << endl;
break;
}
}
if (is_match)
cout << "Result is right." << endl;
free(d1);
free(d2);
file1.close();
file2.close();
return 0;
}
void printMatrix(int ftag1, int ftag2, double *d1, double *d2, int ord)
{
char fname1[32];
char fname2[32];
// char ftag1[32]; char ftag2[32];
// sprintf(ftag1,"%d",ftag1);
strcpy(fname1, "matrix_f.show");
// strcat(fname1,ftag1);
// sprintf(ftag2,"%d",ftag2);
strcpy(fname2, "matrix_g.show");
// strcat(fname2,ftag2);
ofstream fout0, fout1, fout2;
fout1.open(fname1);
fout2.open(fname2);
for (int k = 0; k < 65; k++)
{
fout1 << "---------square " << k << " ----------" << endl;
fout2 << "---------square " << k << " ----------" << endl;
for (int j = 0; j < 67 + ord * 2; j++)
{
for (int i = 0; i < 67 + ord * 2; i++)
{
fout1 << d1[i + j * (67 + ord * 2) + k * ((67 + ord * 2) * (67 + ord * 2))] << ' ';
fout2 << d2[i + j * (67 + ord * 2) + k * ((67 + ord * 2) * (67 + ord * 2))] << ' ';
// fout1<<test_output_g[i+j*(cg->shape[0]) + k*(_2d_size)] <<' ';
// fout2<<test_fh_f [i+j*(cg->shape[0]) + k*(_2d_size)] <<' ';
}
fout1 << endl;
fout2 << endl;
}
}
}
int compare_result(int ftag1, double *d2, int data_num)
{
// read file
char fname1[32];
char ftag[32];
// itoa(filetag,ftag,10);
sprintf(ftag, "%d", ftag1);
strcpy(fname1, "matrix_f.out");
strcat(fname1, ftag);
fstream file1(fname1, ios_base::in);
double *d1;
d1 = (double *)malloc(sizeof(double) * data_num);
for (int i = 0; i < data_num; ++i)
{
file1.read((char *)(d1 + i), sizeof(double));
}
// compare data
bool is_match = true;
double delta;
for (int i = 0; i < data_num; ++i)
{
delta = d1[i] - d2[i];
if (delta < 0)
delta = -delta;
if (delta > 1e-14)
{
is_match = false;
cout << fname1 << "::miss match at position " << i << endl;
break;
}
// if(i<100 && i>50)
// cout<<d1[i]<<" "<<d2[i]<<endl;
}
if (is_match)
cout << ftag1 << "::matched." << endl;
if (ftag1 == 0)
{
printMatrix(1, 2, d1, d2, 3);
}
free(d1);
file1.close();
return 0;
}

View File

@@ -1,94 +1,94 @@
#ifndef BSSN_STEP_H
#define BSSN_STEP_H
//1---------------------FLAGS---------------------
#define USE_GPU
#define MAX_GPU_PROCESS_NUM 1
#define COUNT_CPU_RHS_TIME
//2---------------------TIMER---------------------
//2.1 TIMER_INIT
//2.2 TIMER_TIC_WITHOUT_OUTPUT
//2.3 TIMER_TIC(tag,order,label)
//2.4 TIMER_TIC_TAIL_OF_FUNC(tag,label)
#define TIME_COUNT_EACH_RANK 0
#define TIMER_INIT \
double clock_prev,clock_curr,step_begin_clock;\
if(1 == 1){\
clock_curr =MPI_Wtime();\
step_begin_clock = MPI_Wtime();\
}else{\
if(myrank == 0){\
clock_curr= MPI_Wtime();\
step_begin_clock = MPI_Wtime();\
}\
}
#define TIMER_TIC(tag,order,label) \
if(TIME_COUNT_EACH_RANK == 1){\
clock_prev= clock_curr;\
clock_curr = MPI_Wtime();\
cout<<#tag <<order <<":MPI Rank: "<<myrank<<" "<<#label <<" "<<(clock_curr-clock_prev)<<endl;\
}else{\
if(myrank==0){\
clock_prev= clock_curr;\
clock_curr = MPI_Wtime();\
cout<<#tag <<order <<" "<<#label " "<<(clock_curr-clock_prev)<<endl;\
}\
}
#define TIMER_TIC_EACH_PROC(tag,order,label) \
clock_prev= clock_curr;\
clock_curr = MPI_Wtime();\
cout<<#tag <<order <<":MPI Rank: "<<myrank<<" "<<#label <<" "<<(clock_curr-clock_prev)<<endl;\
}
#define TIMER_TIC_WITHOUT_OUTPUT \
if(TIME_COUNT_EACH_RANK == 1){\
clock_curr = MPI_Wtime();\
}else{\
if(myrank==0){\
clock_curr = MPI_Wtime();\
}\
}
#define TIMER_TIC_TAIL_OF_FUNC(tag,label) \
if(TIME_COUNT_EACH_RANK == 1){\
cout<<#tag <<"MPI Rank: "<<myrank<<" "<<#label <<" "<<(MPI_Wtime()-step_begin_clock)<<" seconds!"<<endl;\
}else{\
if(myrank==0)\
{\
cout<<#tag <<#label <<" "<<(MPI_Wtime()-step_begin_clock)<<" seconds!"<<endl;\
}\
}
//3---------------------GPU---------------------
#define CALLED_BY_STEP 0
#define CALLED_BY_CONSTRAINT 1
#define RHS_PARA_CALLED_FIRST_TIME cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[phi0->sgfn],cg->fgfs[trK0->sgfn],cg->fgfs[gxx0->sgfn],cg->fgfs[gxy0->sgfn],cg->fgfs[gxz0->sgfn],cg->fgfs[gyy0->sgfn],cg->fgfs[gyz0->sgfn],cg->fgfs[gzz0->sgfn],cg->fgfs[Axx0->sgfn],cg->fgfs[Axy0->sgfn],cg->fgfs[Axz0->sgfn],cg->fgfs[Ayy0->sgfn],cg->fgfs[Ayz0->sgfn],cg->fgfs[Azz0->sgfn],cg->fgfs[Gmx0->sgfn],cg->fgfs[Gmy0->sgfn],cg->fgfs[Gmz0->sgfn],cg->fgfs[Lap0->sgfn],cg->fgfs[Sfx0->sgfn],cg->fgfs[Sfy0->sgfn],cg->fgfs[Sfz0->sgfn],cg->fgfs[dtSfx0->sgfn],cg->fgfs[dtSfy0->sgfn],cg->fgfs[dtSfz0->sgfn],cg->fgfs[phi_rhs->sgfn],cg->fgfs[trK_rhs->sgfn],cg->fgfs[gxx_rhs->sgfn],cg->fgfs[gxy_rhs->sgfn],cg->fgfs[gxz_rhs->sgfn],cg->fgfs[gyy_rhs->sgfn],cg->fgfs[gyz_rhs->sgfn],cg->fgfs[gzz_rhs->sgfn],cg->fgfs[Axx_rhs->sgfn],cg->fgfs[Axy_rhs->sgfn],cg->fgfs[Axz_rhs->sgfn],cg->fgfs[Ayy_rhs->sgfn],cg->fgfs[Ayz_rhs->sgfn],cg->fgfs[Azz_rhs->sgfn],cg->fgfs[Gmx_rhs->sgfn],cg->fgfs[Gmy_rhs->sgfn],cg->fgfs[Gmz_rhs->sgfn],cg->fgfs[Lap_rhs->sgfn],cg->fgfs[Sfx_rhs->sgfn],cg->fgfs[Sfy_rhs->sgfn],cg->fgfs[Sfz_rhs->sgfn],cg->fgfs[dtSfx_rhs->sgfn],cg->fgfs[dtSfy_rhs->sgfn],cg->fgfs[dtSfz_rhs->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,ndeps,pre
#define RHS_PARA_CALLED_THEN cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[phi->sgfn],cg->fgfs[trK->sgfn],cg->fgfs[gxx->sgfn],cg->fgfs[gxy->sgfn],cg->fgfs[gxz->sgfn],cg->fgfs[gyy->sgfn],cg->fgfs[gyz->sgfn],cg->fgfs[gzz->sgfn],cg->fgfs[Axx->sgfn],cg->fgfs[Axy->sgfn],cg->fgfs[Axz->sgfn],cg->fgfs[Ayy->sgfn],cg->fgfs[Ayz->sgfn],cg->fgfs[Azz->sgfn],cg->fgfs[Gmx->sgfn],cg->fgfs[Gmy->sgfn],cg->fgfs[Gmz->sgfn],cg->fgfs[Lap->sgfn],cg->fgfs[Sfx->sgfn],cg->fgfs[Sfy->sgfn],cg->fgfs[Sfz->sgfn],cg->fgfs[dtSfx->sgfn],cg->fgfs[dtSfy->sgfn],cg->fgfs[dtSfz->sgfn],cg->fgfs[phi1->sgfn],cg->fgfs[trK1->sgfn],cg->fgfs[gxx1->sgfn],cg->fgfs[gxy1->sgfn],cg->fgfs[gxz1->sgfn],cg->fgfs[gyy1->sgfn],cg->fgfs[gyz1->sgfn],cg->fgfs[gzz1->sgfn],cg->fgfs[Axx1->sgfn],cg->fgfs[Axy1->sgfn],cg->fgfs[Axz1->sgfn],cg->fgfs[Ayy1->sgfn],cg->fgfs[Ayz1->sgfn],cg->fgfs[Azz1->sgfn],cg->fgfs[Gmx1->sgfn],cg->fgfs[Gmy1->sgfn],cg->fgfs[Gmz1->sgfn],cg->fgfs[Lap1->sgfn],cg->fgfs[Sfx1->sgfn],cg->fgfs[Sfy1->sgfn],cg->fgfs[Sfz1->sgfn],cg->fgfs[dtSfx1->sgfn],cg->fgfs[dtSfy1->sgfn],cg->fgfs[dtSfz1->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,ndeps,cor
#define RHS_PARA_CALLED_Constraint_Out cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[phi0->sgfn],cg->fgfs[trK0->sgfn],cg->fgfs[gxx0->sgfn],cg->fgfs[gxy0->sgfn],cg->fgfs[gxz0->sgfn],cg->fgfs[gyy0->sgfn],cg->fgfs[gyz0->sgfn],cg->fgfs[gzz0->sgfn],cg->fgfs[Axx0->sgfn],cg->fgfs[Axy0->sgfn],cg->fgfs[Axz0->sgfn],cg->fgfs[Ayy0->sgfn],cg->fgfs[Ayz0->sgfn],cg->fgfs[Azz0->sgfn],cg->fgfs[Gmx0->sgfn],cg->fgfs[Gmy0->sgfn],cg->fgfs[Gmz0->sgfn],cg->fgfs[Lap0->sgfn],cg->fgfs[Sfx0->sgfn],cg->fgfs[Sfy0->sgfn],cg->fgfs[Sfz0->sgfn],cg->fgfs[dtSfx0->sgfn],cg->fgfs[dtSfy0->sgfn],cg->fgfs[dtSfz0->sgfn],cg->fgfs[phi_rhs->sgfn],cg->fgfs[trK_rhs->sgfn],cg->fgfs[gxx_rhs->sgfn],cg->fgfs[gxy_rhs->sgfn],cg->fgfs[gxz_rhs->sgfn],cg->fgfs[gyy_rhs->sgfn],cg->fgfs[gyz_rhs->sgfn],cg->fgfs[gzz_rhs->sgfn],cg->fgfs[Axx_rhs->sgfn],cg->fgfs[Axy_rhs->sgfn],cg->fgfs[Axz_rhs->sgfn],cg->fgfs[Ayy_rhs->sgfn],cg->fgfs[Ayz_rhs->sgfn],cg->fgfs[Azz_rhs->sgfn],cg->fgfs[Gmx_rhs->sgfn],cg->fgfs[Gmy_rhs->sgfn],cg->fgfs[Gmz_rhs->sgfn],cg->fgfs[Lap_rhs->sgfn],cg->fgfs[Sfx_rhs->sgfn],cg->fgfs[Sfy_rhs->sgfn],cg->fgfs[Sfz_rhs->sgfn],cg->fgfs[dtSfx_rhs->sgfn],cg->fgfs[dtSfy_rhs->sgfn],cg->fgfs[dtSfz_rhs->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,ndeps,pre
#define RHS_PARA_CALLED_Interp_Constraint cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[phi0->sgfn],cg->fgfs[trK0->sgfn],cg->fgfs[gxx0->sgfn],cg->fgfs[gxy0->sgfn],cg->fgfs[gxz0->sgfn],cg->fgfs[gyy0->sgfn],cg->fgfs[gyz0->sgfn],cg->fgfs[gzz0->sgfn],cg->fgfs[Axx0->sgfn],cg->fgfs[Axy0->sgfn],cg->fgfs[Axz0->sgfn],cg->fgfs[Ayy0->sgfn],cg->fgfs[Ayz0->sgfn],cg->fgfs[Azz0->sgfn],cg->fgfs[Gmx0->sgfn],cg->fgfs[Gmy0->sgfn],cg->fgfs[Gmz0->sgfn],cg->fgfs[Lap0->sgfn],cg->fgfs[Sfx0->sgfn],cg->fgfs[Sfy0->sgfn],cg->fgfs[Sfz0->sgfn],cg->fgfs[dtSfx0->sgfn],cg->fgfs[dtSfy0->sgfn],cg->fgfs[dtSfz0->sgfn],cg->fgfs[phi_rhs->sgfn],cg->fgfs[trK_rhs->sgfn],cg->fgfs[gxx_rhs->sgfn],cg->fgfs[gxy_rhs->sgfn],cg->fgfs[gxz_rhs->sgfn],cg->fgfs[gyy_rhs->sgfn],cg->fgfs[gyz_rhs->sgfn],cg->fgfs[gzz_rhs->sgfn],cg->fgfs[Axx_rhs->sgfn],cg->fgfs[Axy_rhs->sgfn],cg->fgfs[Axz_rhs->sgfn],cg->fgfs[Ayy_rhs->sgfn],cg->fgfs[Ayz_rhs->sgfn],cg->fgfs[Azz_rhs->sgfn],cg->fgfs[Gmx_rhs->sgfn],cg->fgfs[Gmy_rhs->sgfn],cg->fgfs[Gmz_rhs->sgfn],cg->fgfs[Lap_rhs->sgfn],cg->fgfs[Sfx_rhs->sgfn],cg->fgfs[Sfy_rhs->sgfn],cg->fgfs[Sfz_rhs->sgfn],cg->fgfs[dtSfx_rhs->sgfn],cg->fgfs[dtSfy_rhs->sgfn],cg->fgfs[dtSfz_rhs->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,ndeps,pre
#define RHS_SS_PARA_CALLED_FIRST_TIME cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[fngfs+ShellPatch::gx],cg->fgfs[fngfs+ShellPatch::gy],cg->fgfs[fngfs+ShellPatch::gz],cg->fgfs[fngfs+ShellPatch::drhodx],cg->fgfs[fngfs+ShellPatch::drhody],cg->fgfs[fngfs+ShellPatch::drhodz],cg->fgfs[fngfs+ShellPatch::dsigmadx],cg->fgfs[fngfs+ShellPatch::dsigmady],cg->fgfs[fngfs+ShellPatch::dsigmadz],cg->fgfs[fngfs+ShellPatch::dRdx],cg->fgfs[fngfs+ShellPatch::dRdy],cg->fgfs[fngfs+ShellPatch::dRdz],cg->fgfs[fngfs+ShellPatch::drhodxx],cg->fgfs[fngfs+ShellPatch::drhodxy],cg->fgfs[fngfs+ShellPatch::drhodxz],cg->fgfs[fngfs+ShellPatch::drhodyy],cg->fgfs[fngfs+ShellPatch::drhodyz],cg->fgfs[fngfs+ShellPatch::drhodzz],cg->fgfs[fngfs+ShellPatch::dsigmadxx],cg->fgfs[fngfs+ShellPatch::dsigmadxy],cg->fgfs[fngfs+ShellPatch::dsigmadxz],cg->fgfs[fngfs+ShellPatch::dsigmadyy],cg->fgfs[fngfs+ShellPatch::dsigmadyz],cg->fgfs[fngfs+ShellPatch::dsigmadzz],cg->fgfs[fngfs+ShellPatch::dRdxx],cg->fgfs[fngfs+ShellPatch::dRdxy],cg->fgfs[fngfs+ShellPatch::dRdxz],cg->fgfs[fngfs+ShellPatch::dRdyy],cg->fgfs[fngfs+ShellPatch::dRdyz],cg->fgfs[fngfs+ShellPatch::dRdzz],cg->fgfs[phi0->sgfn],cg->fgfs[trK0->sgfn],cg->fgfs[gxx0->sgfn],cg->fgfs[gxy0->sgfn],cg->fgfs[gxz0->sgfn],cg->fgfs[gyy0->sgfn],cg->fgfs[gyz0->sgfn],cg->fgfs[gzz0->sgfn],cg->fgfs[Axx0->sgfn],cg->fgfs[Axy0->sgfn],cg->fgfs[Axz0->sgfn],cg->fgfs[Ayy0->sgfn],cg->fgfs[Ayz0->sgfn],cg->fgfs[Azz0->sgfn],cg->fgfs[Gmx0->sgfn],cg->fgfs[Gmy0->sgfn],cg->fgfs[Gmz0->sgfn],cg->fgfs[Lap0->sgfn],cg->fgfs[Sfx0->sgfn],cg->fgfs[Sfy0->sgfn],cg->fgfs[Sfz0->sgfn],cg->fgfs[dtSfx0->sgfn],cg->fgfs[dtSfy0->sgfn],cg->fgfs[dtSfz0->sgfn],cg->fgfs[phi_rhs->sgfn],cg->fgfs[trK_rhs->sgfn],cg->fgfs[gxx_rhs->sgfn],cg->fgfs[gxy_rhs->sgfn],cg->fgfs[gxz_rhs->sgfn],cg->fgfs[gyy_rhs->sgfn],cg->fgfs[gyz_rhs->sgfn],cg->fgfs[gzz_rhs->sgfn],cg->fgfs[Axx_rhs->sgfn],cg->fgfs[Axy_rhs->sgfn],cg->fgfs[Axz_rhs->sgfn],cg->fgfs[Ayy_rhs->sgfn],cg->fgfs[Ayz_rhs->sgfn],cg->fgfs[Azz_rhs->sgfn],cg->fgfs[Gmx_rhs->sgfn],cg->fgfs[Gmy_rhs->sgfn],cg->fgfs[Gmz_rhs->sgfn],cg->fgfs[Lap_rhs->sgfn],cg->fgfs[Sfx_rhs->sgfn],cg->fgfs[Sfy_rhs->sgfn],cg->fgfs[Sfz_rhs->sgfn],cg->fgfs[dtSfx_rhs->sgfn],cg->fgfs[dtSfy_rhs->sgfn],cg->fgfs[dtSfz_rhs->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,numepsh,sPp->data->sst,pre
#define RHS_SS_PARA_CALLED_THEN cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[fngfs+ShellPatch::gx],cg->fgfs[fngfs+ShellPatch::gy],cg->fgfs[fngfs+ShellPatch::gz],cg->fgfs[fngfs+ShellPatch::drhodx],cg->fgfs[fngfs+ShellPatch::drhody],cg->fgfs[fngfs+ShellPatch::drhodz],cg->fgfs[fngfs+ShellPatch::dsigmadx],cg->fgfs[fngfs+ShellPatch::dsigmady],cg->fgfs[fngfs+ShellPatch::dsigmadz],cg->fgfs[fngfs+ShellPatch::dRdx],cg->fgfs[fngfs+ShellPatch::dRdy],cg->fgfs[fngfs+ShellPatch::dRdz],cg->fgfs[fngfs+ShellPatch::drhodxx],cg->fgfs[fngfs+ShellPatch::drhodxy],cg->fgfs[fngfs+ShellPatch::drhodxz],cg->fgfs[fngfs+ShellPatch::drhodyy],cg->fgfs[fngfs+ShellPatch::drhodyz],cg->fgfs[fngfs+ShellPatch::drhodzz],cg->fgfs[fngfs+ShellPatch::dsigmadxx],cg->fgfs[fngfs+ShellPatch::dsigmadxy],cg->fgfs[fngfs+ShellPatch::dsigmadxz],cg->fgfs[fngfs+ShellPatch::dsigmadyy],cg->fgfs[fngfs+ShellPatch::dsigmadyz],cg->fgfs[fngfs+ShellPatch::dsigmadzz],cg->fgfs[fngfs+ShellPatch::dRdxx],cg->fgfs[fngfs+ShellPatch::dRdxy],cg->fgfs[fngfs+ShellPatch::dRdxz],cg->fgfs[fngfs+ShellPatch::dRdyy],cg->fgfs[fngfs+ShellPatch::dRdyz],cg->fgfs[fngfs+ShellPatch::dRdzz],cg->fgfs[phi->sgfn],cg->fgfs[trK->sgfn],cg->fgfs[gxx->sgfn],cg->fgfs[gxy->sgfn],cg->fgfs[gxz->sgfn],cg->fgfs[gyy->sgfn],cg->fgfs[gyz->sgfn],cg->fgfs[gzz->sgfn],cg->fgfs[Axx->sgfn],cg->fgfs[Axy->sgfn],cg->fgfs[Axz->sgfn],cg->fgfs[Ayy->sgfn],cg->fgfs[Ayz->sgfn],cg->fgfs[Azz->sgfn],cg->fgfs[Gmx->sgfn],cg->fgfs[Gmy->sgfn],cg->fgfs[Gmz->sgfn],cg->fgfs[Lap->sgfn],cg->fgfs[Sfx->sgfn],cg->fgfs[Sfy->sgfn],cg->fgfs[Sfz->sgfn],cg->fgfs[dtSfx->sgfn],cg->fgfs[dtSfy->sgfn],cg->fgfs[dtSfz->sgfn],cg->fgfs[phi1->sgfn],cg->fgfs[trK1->sgfn],cg->fgfs[gxx1->sgfn],cg->fgfs[gxy1->sgfn],cg->fgfs[gxz1->sgfn],cg->fgfs[gyy1->sgfn],cg->fgfs[gyz1->sgfn],cg->fgfs[gzz1->sgfn],cg->fgfs[Axx1->sgfn],cg->fgfs[Axy1->sgfn],cg->fgfs[Axz1->sgfn],cg->fgfs[Ayy1->sgfn],cg->fgfs[Ayz1->sgfn],cg->fgfs[Azz1->sgfn],cg->fgfs[Gmx1->sgfn],cg->fgfs[Gmy1->sgfn],cg->fgfs[Gmz1->sgfn],cg->fgfs[Lap1->sgfn],cg->fgfs[Sfx1->sgfn],cg->fgfs[Sfy1->sgfn],cg->fgfs[Sfz1->sgfn],cg->fgfs[dtSfx1->sgfn],cg->fgfs[dtSfy1->sgfn],cg->fgfs[dtSfz1->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,numepsh,sPp->data->sst,cor
#define RHS_PARA_CALLED_Constraint_Out_SS cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[fngfs+ShellPatch::gx],cg->fgfs[fngfs+ShellPatch::gy],cg->fgfs[fngfs+ShellPatch::gz],cg->fgfs[fngfs+ShellPatch::drhodx],cg->fgfs[fngfs+ShellPatch::drhody],cg->fgfs[fngfs+ShellPatch::drhodz],cg->fgfs[fngfs+ShellPatch::dsigmadx],cg->fgfs[fngfs+ShellPatch::dsigmady],cg->fgfs[fngfs+ShellPatch::dsigmadz],cg->fgfs[fngfs+ShellPatch::dRdx],cg->fgfs[fngfs+ShellPatch::dRdy],cg->fgfs[fngfs+ShellPatch::dRdz],cg->fgfs[fngfs+ShellPatch::drhodxx],cg->fgfs[fngfs+ShellPatch::drhodxy],cg->fgfs[fngfs+ShellPatch::drhodxz],cg->fgfs[fngfs+ShellPatch::drhodyy],cg->fgfs[fngfs+ShellPatch::drhodyz],cg->fgfs[fngfs+ShellPatch::drhodzz],cg->fgfs[fngfs+ShellPatch::dsigmadxx],cg->fgfs[fngfs+ShellPatch::dsigmadxy],cg->fgfs[fngfs+ShellPatch::dsigmadxz],cg->fgfs[fngfs+ShellPatch::dsigmadyy],cg->fgfs[fngfs+ShellPatch::dsigmadyz],cg->fgfs[fngfs+ShellPatch::dsigmadzz],cg->fgfs[fngfs+ShellPatch::dRdxx],cg->fgfs[fngfs+ShellPatch::dRdxy],cg->fgfs[fngfs+ShellPatch::dRdxz],cg->fgfs[fngfs+ShellPatch::dRdyy],cg->fgfs[fngfs+ShellPatch::dRdyz],cg->fgfs[fngfs+ShellPatch::dRdzz],cg->fgfs[phi0->sgfn],cg->fgfs[trK0->sgfn],cg->fgfs[gxx0->sgfn],cg->fgfs[gxy0->sgfn],cg->fgfs[gxz0->sgfn],cg->fgfs[gyy0->sgfn],cg->fgfs[gyz0->sgfn],cg->fgfs[gzz0->sgfn],cg->fgfs[Axx0->sgfn],cg->fgfs[Axy0->sgfn],cg->fgfs[Axz0->sgfn],cg->fgfs[Ayy0->sgfn],cg->fgfs[Ayz0->sgfn],cg->fgfs[Azz0->sgfn],cg->fgfs[Gmx0->sgfn],cg->fgfs[Gmy0->sgfn],cg->fgfs[Gmz0->sgfn],cg->fgfs[Lap0->sgfn],cg->fgfs[Sfx0->sgfn],cg->fgfs[Sfy0->sgfn],cg->fgfs[Sfz0->sgfn],cg->fgfs[dtSfx0->sgfn],cg->fgfs[dtSfy0->sgfn],cg->fgfs[dtSfz0->sgfn],cg->fgfs[phi_rhs->sgfn],cg->fgfs[trK_rhs->sgfn],cg->fgfs[gxx_rhs->sgfn],cg->fgfs[gxy_rhs->sgfn],cg->fgfs[gxz_rhs->sgfn],cg->fgfs[gyy_rhs->sgfn],cg->fgfs[gyz_rhs->sgfn],cg->fgfs[gzz_rhs->sgfn],cg->fgfs[Axx_rhs->sgfn],cg->fgfs[Axy_rhs->sgfn],cg->fgfs[Axz_rhs->sgfn],cg->fgfs[Ayy_rhs->sgfn],cg->fgfs[Ayz_rhs->sgfn],cg->fgfs[Azz_rhs->sgfn],cg->fgfs[Gmx_rhs->sgfn],cg->fgfs[Gmy_rhs->sgfn],cg->fgfs[Gmz_rhs->sgfn],cg->fgfs[Lap_rhs->sgfn],cg->fgfs[Sfx_rhs->sgfn],cg->fgfs[Sfy_rhs->sgfn],cg->fgfs[Sfz_rhs->sgfn],cg->fgfs[dtSfx_rhs->sgfn],cg->fgfs[dtSfy_rhs->sgfn],cg->fgfs[dtSfz_rhs->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,numepsh,sPp->data->sst,pre
#define RHS_PARA_CALLED_Intrp_Constraint_Out_SS cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[fngfs+ShellPatch::gx],cg->fgfs[fngfs+ShellPatch::gy],cg->fgfs[fngfs+ShellPatch::gz],cg->fgfs[fngfs+ShellPatch::drhodx],cg->fgfs[fngfs+ShellPatch::drhody],cg->fgfs[fngfs+ShellPatch::drhodz],cg->fgfs[fngfs+ShellPatch::dsigmadx],cg->fgfs[fngfs+ShellPatch::dsigmady],cg->fgfs[fngfs+ShellPatch::dsigmadz],cg->fgfs[fngfs+ShellPatch::dRdx],cg->fgfs[fngfs+ShellPatch::dRdy],cg->fgfs[fngfs+ShellPatch::dRdz],cg->fgfs[fngfs+ShellPatch::drhodxx],cg->fgfs[fngfs+ShellPatch::drhodxy],cg->fgfs[fngfs+ShellPatch::drhodxz],cg->fgfs[fngfs+ShellPatch::drhodyy],cg->fgfs[fngfs+ShellPatch::drhodyz],cg->fgfs[fngfs+ShellPatch::drhodzz],cg->fgfs[fngfs+ShellPatch::dsigmadxx],cg->fgfs[fngfs+ShellPatch::dsigmadxy],cg->fgfs[fngfs+ShellPatch::dsigmadxz],cg->fgfs[fngfs+ShellPatch::dsigmadyy],cg->fgfs[fngfs+ShellPatch::dsigmadyz],cg->fgfs[fngfs+ShellPatch::dsigmadzz],cg->fgfs[fngfs+ShellPatch::dRdxx],cg->fgfs[fngfs+ShellPatch::dRdxy],cg->fgfs[fngfs+ShellPatch::dRdxz],cg->fgfs[fngfs+ShellPatch::dRdyy],cg->fgfs[fngfs+ShellPatch::dRdyz],cg->fgfs[fngfs+ShellPatch::dRdzz],cg->fgfs[phi0->sgfn],cg->fgfs[trK0->sgfn],cg->fgfs[gxx0->sgfn],cg->fgfs[gxy0->sgfn],cg->fgfs[gxz0->sgfn],cg->fgfs[gyy0->sgfn],cg->fgfs[gyz0->sgfn],cg->fgfs[gzz0->sgfn],cg->fgfs[Axx0->sgfn],cg->fgfs[Axy0->sgfn],cg->fgfs[Axz0->sgfn],cg->fgfs[Ayy0->sgfn],cg->fgfs[Ayz0->sgfn],cg->fgfs[Azz0->sgfn],cg->fgfs[Gmx0->sgfn],cg->fgfs[Gmy0->sgfn],cg->fgfs[Gmz0->sgfn],cg->fgfs[Lap0->sgfn],cg->fgfs[Sfx0->sgfn],cg->fgfs[Sfy0->sgfn],cg->fgfs[Sfz0->sgfn],cg->fgfs[dtSfx0->sgfn],cg->fgfs[dtSfy0->sgfn],cg->fgfs[dtSfz0->sgfn],cg->fgfs[phi_rhs->sgfn],cg->fgfs[trK_rhs->sgfn],cg->fgfs[gxx_rhs->sgfn],cg->fgfs[gxy_rhs->sgfn],cg->fgfs[gxz_rhs->sgfn],cg->fgfs[gyy_rhs->sgfn],cg->fgfs[gyz_rhs->sgfn],cg->fgfs[gzz_rhs->sgfn],cg->fgfs[Axx_rhs->sgfn],cg->fgfs[Axy_rhs->sgfn],cg->fgfs[Axz_rhs->sgfn],cg->fgfs[Ayy_rhs->sgfn],cg->fgfs[Ayz_rhs->sgfn],cg->fgfs[Azz_rhs->sgfn],cg->fgfs[Gmx_rhs->sgfn],cg->fgfs[Gmy_rhs->sgfn],cg->fgfs[Gmz_rhs->sgfn],cg->fgfs[Lap_rhs->sgfn],cg->fgfs[Sfx_rhs->sgfn],cg->fgfs[Sfy_rhs->sgfn],cg->fgfs[Sfz_rhs->sgfn],cg->fgfs[dtSfx_rhs->sgfn],cg->fgfs[dtSfy_rhs->sgfn],cg->fgfs[dtSfz_rhs->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,numepsh,sPp->data->sst,pre
//4------------tool------------------------------
int compare_result(int ftag1,double * d2,int data_num);
#endif
#ifndef BSSN_STEP_H
#define BSSN_STEP_H
//1---------------------FLAGS---------------------
#define USE_GPU
#define MAX_GPU_PROCESS_NUM 1
#define COUNT_CPU_RHS_TIME
//2---------------------TIMER---------------------
//2.1 TIMER_INIT
//2.2 TIMER_TIC_WITHOUT_OUTPUT
//2.3 TIMER_TIC(tag,order,label)
//2.4 TIMER_TIC_TAIL_OF_FUNC(tag,label)
#define TIME_COUNT_EACH_RANK 0
#define TIMER_INIT \
double clock_prev,clock_curr,step_begin_clock;\
if(1 == 1){\
clock_curr =MPI_Wtime();\
step_begin_clock = MPI_Wtime();\
}else{\
if(myrank == 0){\
clock_curr= MPI_Wtime();\
step_begin_clock = MPI_Wtime();\
}\
}
#define TIMER_TIC(tag,order,label) \
if(TIME_COUNT_EACH_RANK == 1){\
clock_prev= clock_curr;\
clock_curr = MPI_Wtime();\
cout<<#tag <<order <<":MPI Rank: "<<myrank<<" "<<#label <<" "<<(clock_curr-clock_prev)<<endl;\
}else{\
if(myrank==0){\
clock_prev= clock_curr;\
clock_curr = MPI_Wtime();\
cout<<#tag <<order <<" "<<#label " "<<(clock_curr-clock_prev)<<endl;\
}\
}
#define TIMER_TIC_EACH_PROC(tag,order,label) \
clock_prev= clock_curr;\
clock_curr = MPI_Wtime();\
cout<<#tag <<order <<":MPI Rank: "<<myrank<<" "<<#label <<" "<<(clock_curr-clock_prev)<<endl;\
}
#define TIMER_TIC_WITHOUT_OUTPUT \
if(TIME_COUNT_EACH_RANK == 1){\
clock_curr = MPI_Wtime();\
}else{\
if(myrank==0){\
clock_curr = MPI_Wtime();\
}\
}
#define TIMER_TIC_TAIL_OF_FUNC(tag,label) \
if(TIME_COUNT_EACH_RANK == 1){\
cout<<#tag <<"MPI Rank: "<<myrank<<" "<<#label <<" "<<(MPI_Wtime()-step_begin_clock)<<" seconds!"<<endl;\
}else{\
if(myrank==0)\
{\
cout<<#tag <<#label <<" "<<(MPI_Wtime()-step_begin_clock)<<" seconds!"<<endl;\
}\
}
//3---------------------GPU---------------------
#define CALLED_BY_STEP 0
#define CALLED_BY_CONSTRAINT 1
#define RHS_PARA_CALLED_FIRST_TIME cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[phi0->sgfn],cg->fgfs[trK0->sgfn],cg->fgfs[gxx0->sgfn],cg->fgfs[gxy0->sgfn],cg->fgfs[gxz0->sgfn],cg->fgfs[gyy0->sgfn],cg->fgfs[gyz0->sgfn],cg->fgfs[gzz0->sgfn],cg->fgfs[Axx0->sgfn],cg->fgfs[Axy0->sgfn],cg->fgfs[Axz0->sgfn],cg->fgfs[Ayy0->sgfn],cg->fgfs[Ayz0->sgfn],cg->fgfs[Azz0->sgfn],cg->fgfs[Gmx0->sgfn],cg->fgfs[Gmy0->sgfn],cg->fgfs[Gmz0->sgfn],cg->fgfs[Lap0->sgfn],cg->fgfs[Sfx0->sgfn],cg->fgfs[Sfy0->sgfn],cg->fgfs[Sfz0->sgfn],cg->fgfs[dtSfx0->sgfn],cg->fgfs[dtSfy0->sgfn],cg->fgfs[dtSfz0->sgfn],cg->fgfs[phi_rhs->sgfn],cg->fgfs[trK_rhs->sgfn],cg->fgfs[gxx_rhs->sgfn],cg->fgfs[gxy_rhs->sgfn],cg->fgfs[gxz_rhs->sgfn],cg->fgfs[gyy_rhs->sgfn],cg->fgfs[gyz_rhs->sgfn],cg->fgfs[gzz_rhs->sgfn],cg->fgfs[Axx_rhs->sgfn],cg->fgfs[Axy_rhs->sgfn],cg->fgfs[Axz_rhs->sgfn],cg->fgfs[Ayy_rhs->sgfn],cg->fgfs[Ayz_rhs->sgfn],cg->fgfs[Azz_rhs->sgfn],cg->fgfs[Gmx_rhs->sgfn],cg->fgfs[Gmy_rhs->sgfn],cg->fgfs[Gmz_rhs->sgfn],cg->fgfs[Lap_rhs->sgfn],cg->fgfs[Sfx_rhs->sgfn],cg->fgfs[Sfy_rhs->sgfn],cg->fgfs[Sfz_rhs->sgfn],cg->fgfs[dtSfx_rhs->sgfn],cg->fgfs[dtSfy_rhs->sgfn],cg->fgfs[dtSfz_rhs->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,ndeps,pre
#define RHS_PARA_CALLED_THEN cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[phi->sgfn],cg->fgfs[trK->sgfn],cg->fgfs[gxx->sgfn],cg->fgfs[gxy->sgfn],cg->fgfs[gxz->sgfn],cg->fgfs[gyy->sgfn],cg->fgfs[gyz->sgfn],cg->fgfs[gzz->sgfn],cg->fgfs[Axx->sgfn],cg->fgfs[Axy->sgfn],cg->fgfs[Axz->sgfn],cg->fgfs[Ayy->sgfn],cg->fgfs[Ayz->sgfn],cg->fgfs[Azz->sgfn],cg->fgfs[Gmx->sgfn],cg->fgfs[Gmy->sgfn],cg->fgfs[Gmz->sgfn],cg->fgfs[Lap->sgfn],cg->fgfs[Sfx->sgfn],cg->fgfs[Sfy->sgfn],cg->fgfs[Sfz->sgfn],cg->fgfs[dtSfx->sgfn],cg->fgfs[dtSfy->sgfn],cg->fgfs[dtSfz->sgfn],cg->fgfs[phi1->sgfn],cg->fgfs[trK1->sgfn],cg->fgfs[gxx1->sgfn],cg->fgfs[gxy1->sgfn],cg->fgfs[gxz1->sgfn],cg->fgfs[gyy1->sgfn],cg->fgfs[gyz1->sgfn],cg->fgfs[gzz1->sgfn],cg->fgfs[Axx1->sgfn],cg->fgfs[Axy1->sgfn],cg->fgfs[Axz1->sgfn],cg->fgfs[Ayy1->sgfn],cg->fgfs[Ayz1->sgfn],cg->fgfs[Azz1->sgfn],cg->fgfs[Gmx1->sgfn],cg->fgfs[Gmy1->sgfn],cg->fgfs[Gmz1->sgfn],cg->fgfs[Lap1->sgfn],cg->fgfs[Sfx1->sgfn],cg->fgfs[Sfy1->sgfn],cg->fgfs[Sfz1->sgfn],cg->fgfs[dtSfx1->sgfn],cg->fgfs[dtSfy1->sgfn],cg->fgfs[dtSfz1->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,ndeps,cor
#define RHS_PARA_CALLED_Constraint_Out cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[phi0->sgfn],cg->fgfs[trK0->sgfn],cg->fgfs[gxx0->sgfn],cg->fgfs[gxy0->sgfn],cg->fgfs[gxz0->sgfn],cg->fgfs[gyy0->sgfn],cg->fgfs[gyz0->sgfn],cg->fgfs[gzz0->sgfn],cg->fgfs[Axx0->sgfn],cg->fgfs[Axy0->sgfn],cg->fgfs[Axz0->sgfn],cg->fgfs[Ayy0->sgfn],cg->fgfs[Ayz0->sgfn],cg->fgfs[Azz0->sgfn],cg->fgfs[Gmx0->sgfn],cg->fgfs[Gmy0->sgfn],cg->fgfs[Gmz0->sgfn],cg->fgfs[Lap0->sgfn],cg->fgfs[Sfx0->sgfn],cg->fgfs[Sfy0->sgfn],cg->fgfs[Sfz0->sgfn],cg->fgfs[dtSfx0->sgfn],cg->fgfs[dtSfy0->sgfn],cg->fgfs[dtSfz0->sgfn],cg->fgfs[phi_rhs->sgfn],cg->fgfs[trK_rhs->sgfn],cg->fgfs[gxx_rhs->sgfn],cg->fgfs[gxy_rhs->sgfn],cg->fgfs[gxz_rhs->sgfn],cg->fgfs[gyy_rhs->sgfn],cg->fgfs[gyz_rhs->sgfn],cg->fgfs[gzz_rhs->sgfn],cg->fgfs[Axx_rhs->sgfn],cg->fgfs[Axy_rhs->sgfn],cg->fgfs[Axz_rhs->sgfn],cg->fgfs[Ayy_rhs->sgfn],cg->fgfs[Ayz_rhs->sgfn],cg->fgfs[Azz_rhs->sgfn],cg->fgfs[Gmx_rhs->sgfn],cg->fgfs[Gmy_rhs->sgfn],cg->fgfs[Gmz_rhs->sgfn],cg->fgfs[Lap_rhs->sgfn],cg->fgfs[Sfx_rhs->sgfn],cg->fgfs[Sfy_rhs->sgfn],cg->fgfs[Sfz_rhs->sgfn],cg->fgfs[dtSfx_rhs->sgfn],cg->fgfs[dtSfy_rhs->sgfn],cg->fgfs[dtSfz_rhs->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,ndeps,pre
#define RHS_PARA_CALLED_Interp_Constraint cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[phi0->sgfn],cg->fgfs[trK0->sgfn],cg->fgfs[gxx0->sgfn],cg->fgfs[gxy0->sgfn],cg->fgfs[gxz0->sgfn],cg->fgfs[gyy0->sgfn],cg->fgfs[gyz0->sgfn],cg->fgfs[gzz0->sgfn],cg->fgfs[Axx0->sgfn],cg->fgfs[Axy0->sgfn],cg->fgfs[Axz0->sgfn],cg->fgfs[Ayy0->sgfn],cg->fgfs[Ayz0->sgfn],cg->fgfs[Azz0->sgfn],cg->fgfs[Gmx0->sgfn],cg->fgfs[Gmy0->sgfn],cg->fgfs[Gmz0->sgfn],cg->fgfs[Lap0->sgfn],cg->fgfs[Sfx0->sgfn],cg->fgfs[Sfy0->sgfn],cg->fgfs[Sfz0->sgfn],cg->fgfs[dtSfx0->sgfn],cg->fgfs[dtSfy0->sgfn],cg->fgfs[dtSfz0->sgfn],cg->fgfs[phi_rhs->sgfn],cg->fgfs[trK_rhs->sgfn],cg->fgfs[gxx_rhs->sgfn],cg->fgfs[gxy_rhs->sgfn],cg->fgfs[gxz_rhs->sgfn],cg->fgfs[gyy_rhs->sgfn],cg->fgfs[gyz_rhs->sgfn],cg->fgfs[gzz_rhs->sgfn],cg->fgfs[Axx_rhs->sgfn],cg->fgfs[Axy_rhs->sgfn],cg->fgfs[Axz_rhs->sgfn],cg->fgfs[Ayy_rhs->sgfn],cg->fgfs[Ayz_rhs->sgfn],cg->fgfs[Azz_rhs->sgfn],cg->fgfs[Gmx_rhs->sgfn],cg->fgfs[Gmy_rhs->sgfn],cg->fgfs[Gmz_rhs->sgfn],cg->fgfs[Lap_rhs->sgfn],cg->fgfs[Sfx_rhs->sgfn],cg->fgfs[Sfy_rhs->sgfn],cg->fgfs[Sfz_rhs->sgfn],cg->fgfs[dtSfx_rhs->sgfn],cg->fgfs[dtSfy_rhs->sgfn],cg->fgfs[dtSfz_rhs->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,ndeps,pre
#define RHS_SS_PARA_CALLED_FIRST_TIME cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[fngfs+ShellPatch::gx],cg->fgfs[fngfs+ShellPatch::gy],cg->fgfs[fngfs+ShellPatch::gz],cg->fgfs[fngfs+ShellPatch::drhodx],cg->fgfs[fngfs+ShellPatch::drhody],cg->fgfs[fngfs+ShellPatch::drhodz],cg->fgfs[fngfs+ShellPatch::dsigmadx],cg->fgfs[fngfs+ShellPatch::dsigmady],cg->fgfs[fngfs+ShellPatch::dsigmadz],cg->fgfs[fngfs+ShellPatch::dRdx],cg->fgfs[fngfs+ShellPatch::dRdy],cg->fgfs[fngfs+ShellPatch::dRdz],cg->fgfs[fngfs+ShellPatch::drhodxx],cg->fgfs[fngfs+ShellPatch::drhodxy],cg->fgfs[fngfs+ShellPatch::drhodxz],cg->fgfs[fngfs+ShellPatch::drhodyy],cg->fgfs[fngfs+ShellPatch::drhodyz],cg->fgfs[fngfs+ShellPatch::drhodzz],cg->fgfs[fngfs+ShellPatch::dsigmadxx],cg->fgfs[fngfs+ShellPatch::dsigmadxy],cg->fgfs[fngfs+ShellPatch::dsigmadxz],cg->fgfs[fngfs+ShellPatch::dsigmadyy],cg->fgfs[fngfs+ShellPatch::dsigmadyz],cg->fgfs[fngfs+ShellPatch::dsigmadzz],cg->fgfs[fngfs+ShellPatch::dRdxx],cg->fgfs[fngfs+ShellPatch::dRdxy],cg->fgfs[fngfs+ShellPatch::dRdxz],cg->fgfs[fngfs+ShellPatch::dRdyy],cg->fgfs[fngfs+ShellPatch::dRdyz],cg->fgfs[fngfs+ShellPatch::dRdzz],cg->fgfs[phi0->sgfn],cg->fgfs[trK0->sgfn],cg->fgfs[gxx0->sgfn],cg->fgfs[gxy0->sgfn],cg->fgfs[gxz0->sgfn],cg->fgfs[gyy0->sgfn],cg->fgfs[gyz0->sgfn],cg->fgfs[gzz0->sgfn],cg->fgfs[Axx0->sgfn],cg->fgfs[Axy0->sgfn],cg->fgfs[Axz0->sgfn],cg->fgfs[Ayy0->sgfn],cg->fgfs[Ayz0->sgfn],cg->fgfs[Azz0->sgfn],cg->fgfs[Gmx0->sgfn],cg->fgfs[Gmy0->sgfn],cg->fgfs[Gmz0->sgfn],cg->fgfs[Lap0->sgfn],cg->fgfs[Sfx0->sgfn],cg->fgfs[Sfy0->sgfn],cg->fgfs[Sfz0->sgfn],cg->fgfs[dtSfx0->sgfn],cg->fgfs[dtSfy0->sgfn],cg->fgfs[dtSfz0->sgfn],cg->fgfs[phi_rhs->sgfn],cg->fgfs[trK_rhs->sgfn],cg->fgfs[gxx_rhs->sgfn],cg->fgfs[gxy_rhs->sgfn],cg->fgfs[gxz_rhs->sgfn],cg->fgfs[gyy_rhs->sgfn],cg->fgfs[gyz_rhs->sgfn],cg->fgfs[gzz_rhs->sgfn],cg->fgfs[Axx_rhs->sgfn],cg->fgfs[Axy_rhs->sgfn],cg->fgfs[Axz_rhs->sgfn],cg->fgfs[Ayy_rhs->sgfn],cg->fgfs[Ayz_rhs->sgfn],cg->fgfs[Azz_rhs->sgfn],cg->fgfs[Gmx_rhs->sgfn],cg->fgfs[Gmy_rhs->sgfn],cg->fgfs[Gmz_rhs->sgfn],cg->fgfs[Lap_rhs->sgfn],cg->fgfs[Sfx_rhs->sgfn],cg->fgfs[Sfy_rhs->sgfn],cg->fgfs[Sfz_rhs->sgfn],cg->fgfs[dtSfx_rhs->sgfn],cg->fgfs[dtSfy_rhs->sgfn],cg->fgfs[dtSfz_rhs->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,numepsh,sPp->data->sst,pre
#define RHS_SS_PARA_CALLED_THEN cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[fngfs+ShellPatch::gx],cg->fgfs[fngfs+ShellPatch::gy],cg->fgfs[fngfs+ShellPatch::gz],cg->fgfs[fngfs+ShellPatch::drhodx],cg->fgfs[fngfs+ShellPatch::drhody],cg->fgfs[fngfs+ShellPatch::drhodz],cg->fgfs[fngfs+ShellPatch::dsigmadx],cg->fgfs[fngfs+ShellPatch::dsigmady],cg->fgfs[fngfs+ShellPatch::dsigmadz],cg->fgfs[fngfs+ShellPatch::dRdx],cg->fgfs[fngfs+ShellPatch::dRdy],cg->fgfs[fngfs+ShellPatch::dRdz],cg->fgfs[fngfs+ShellPatch::drhodxx],cg->fgfs[fngfs+ShellPatch::drhodxy],cg->fgfs[fngfs+ShellPatch::drhodxz],cg->fgfs[fngfs+ShellPatch::drhodyy],cg->fgfs[fngfs+ShellPatch::drhodyz],cg->fgfs[fngfs+ShellPatch::drhodzz],cg->fgfs[fngfs+ShellPatch::dsigmadxx],cg->fgfs[fngfs+ShellPatch::dsigmadxy],cg->fgfs[fngfs+ShellPatch::dsigmadxz],cg->fgfs[fngfs+ShellPatch::dsigmadyy],cg->fgfs[fngfs+ShellPatch::dsigmadyz],cg->fgfs[fngfs+ShellPatch::dsigmadzz],cg->fgfs[fngfs+ShellPatch::dRdxx],cg->fgfs[fngfs+ShellPatch::dRdxy],cg->fgfs[fngfs+ShellPatch::dRdxz],cg->fgfs[fngfs+ShellPatch::dRdyy],cg->fgfs[fngfs+ShellPatch::dRdyz],cg->fgfs[fngfs+ShellPatch::dRdzz],cg->fgfs[phi->sgfn],cg->fgfs[trK->sgfn],cg->fgfs[gxx->sgfn],cg->fgfs[gxy->sgfn],cg->fgfs[gxz->sgfn],cg->fgfs[gyy->sgfn],cg->fgfs[gyz->sgfn],cg->fgfs[gzz->sgfn],cg->fgfs[Axx->sgfn],cg->fgfs[Axy->sgfn],cg->fgfs[Axz->sgfn],cg->fgfs[Ayy->sgfn],cg->fgfs[Ayz->sgfn],cg->fgfs[Azz->sgfn],cg->fgfs[Gmx->sgfn],cg->fgfs[Gmy->sgfn],cg->fgfs[Gmz->sgfn],cg->fgfs[Lap->sgfn],cg->fgfs[Sfx->sgfn],cg->fgfs[Sfy->sgfn],cg->fgfs[Sfz->sgfn],cg->fgfs[dtSfx->sgfn],cg->fgfs[dtSfy->sgfn],cg->fgfs[dtSfz->sgfn],cg->fgfs[phi1->sgfn],cg->fgfs[trK1->sgfn],cg->fgfs[gxx1->sgfn],cg->fgfs[gxy1->sgfn],cg->fgfs[gxz1->sgfn],cg->fgfs[gyy1->sgfn],cg->fgfs[gyz1->sgfn],cg->fgfs[gzz1->sgfn],cg->fgfs[Axx1->sgfn],cg->fgfs[Axy1->sgfn],cg->fgfs[Axz1->sgfn],cg->fgfs[Ayy1->sgfn],cg->fgfs[Ayz1->sgfn],cg->fgfs[Azz1->sgfn],cg->fgfs[Gmx1->sgfn],cg->fgfs[Gmy1->sgfn],cg->fgfs[Gmz1->sgfn],cg->fgfs[Lap1->sgfn],cg->fgfs[Sfx1->sgfn],cg->fgfs[Sfy1->sgfn],cg->fgfs[Sfz1->sgfn],cg->fgfs[dtSfx1->sgfn],cg->fgfs[dtSfy1->sgfn],cg->fgfs[dtSfz1->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,numepsh,sPp->data->sst,cor
#define RHS_PARA_CALLED_Constraint_Out_SS cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[fngfs+ShellPatch::gx],cg->fgfs[fngfs+ShellPatch::gy],cg->fgfs[fngfs+ShellPatch::gz],cg->fgfs[fngfs+ShellPatch::drhodx],cg->fgfs[fngfs+ShellPatch::drhody],cg->fgfs[fngfs+ShellPatch::drhodz],cg->fgfs[fngfs+ShellPatch::dsigmadx],cg->fgfs[fngfs+ShellPatch::dsigmady],cg->fgfs[fngfs+ShellPatch::dsigmadz],cg->fgfs[fngfs+ShellPatch::dRdx],cg->fgfs[fngfs+ShellPatch::dRdy],cg->fgfs[fngfs+ShellPatch::dRdz],cg->fgfs[fngfs+ShellPatch::drhodxx],cg->fgfs[fngfs+ShellPatch::drhodxy],cg->fgfs[fngfs+ShellPatch::drhodxz],cg->fgfs[fngfs+ShellPatch::drhodyy],cg->fgfs[fngfs+ShellPatch::drhodyz],cg->fgfs[fngfs+ShellPatch::drhodzz],cg->fgfs[fngfs+ShellPatch::dsigmadxx],cg->fgfs[fngfs+ShellPatch::dsigmadxy],cg->fgfs[fngfs+ShellPatch::dsigmadxz],cg->fgfs[fngfs+ShellPatch::dsigmadyy],cg->fgfs[fngfs+ShellPatch::dsigmadyz],cg->fgfs[fngfs+ShellPatch::dsigmadzz],cg->fgfs[fngfs+ShellPatch::dRdxx],cg->fgfs[fngfs+ShellPatch::dRdxy],cg->fgfs[fngfs+ShellPatch::dRdxz],cg->fgfs[fngfs+ShellPatch::dRdyy],cg->fgfs[fngfs+ShellPatch::dRdyz],cg->fgfs[fngfs+ShellPatch::dRdzz],cg->fgfs[phi0->sgfn],cg->fgfs[trK0->sgfn],cg->fgfs[gxx0->sgfn],cg->fgfs[gxy0->sgfn],cg->fgfs[gxz0->sgfn],cg->fgfs[gyy0->sgfn],cg->fgfs[gyz0->sgfn],cg->fgfs[gzz0->sgfn],cg->fgfs[Axx0->sgfn],cg->fgfs[Axy0->sgfn],cg->fgfs[Axz0->sgfn],cg->fgfs[Ayy0->sgfn],cg->fgfs[Ayz0->sgfn],cg->fgfs[Azz0->sgfn],cg->fgfs[Gmx0->sgfn],cg->fgfs[Gmy0->sgfn],cg->fgfs[Gmz0->sgfn],cg->fgfs[Lap0->sgfn],cg->fgfs[Sfx0->sgfn],cg->fgfs[Sfy0->sgfn],cg->fgfs[Sfz0->sgfn],cg->fgfs[dtSfx0->sgfn],cg->fgfs[dtSfy0->sgfn],cg->fgfs[dtSfz0->sgfn],cg->fgfs[phi_rhs->sgfn],cg->fgfs[trK_rhs->sgfn],cg->fgfs[gxx_rhs->sgfn],cg->fgfs[gxy_rhs->sgfn],cg->fgfs[gxz_rhs->sgfn],cg->fgfs[gyy_rhs->sgfn],cg->fgfs[gyz_rhs->sgfn],cg->fgfs[gzz_rhs->sgfn],cg->fgfs[Axx_rhs->sgfn],cg->fgfs[Axy_rhs->sgfn],cg->fgfs[Axz_rhs->sgfn],cg->fgfs[Ayy_rhs->sgfn],cg->fgfs[Ayz_rhs->sgfn],cg->fgfs[Azz_rhs->sgfn],cg->fgfs[Gmx_rhs->sgfn],cg->fgfs[Gmy_rhs->sgfn],cg->fgfs[Gmz_rhs->sgfn],cg->fgfs[Lap_rhs->sgfn],cg->fgfs[Sfx_rhs->sgfn],cg->fgfs[Sfy_rhs->sgfn],cg->fgfs[Sfz_rhs->sgfn],cg->fgfs[dtSfx_rhs->sgfn],cg->fgfs[dtSfy_rhs->sgfn],cg->fgfs[dtSfz_rhs->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,numepsh,sPp->data->sst,pre
#define RHS_PARA_CALLED_Intrp_Constraint_Out_SS cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[fngfs+ShellPatch::gx],cg->fgfs[fngfs+ShellPatch::gy],cg->fgfs[fngfs+ShellPatch::gz],cg->fgfs[fngfs+ShellPatch::drhodx],cg->fgfs[fngfs+ShellPatch::drhody],cg->fgfs[fngfs+ShellPatch::drhodz],cg->fgfs[fngfs+ShellPatch::dsigmadx],cg->fgfs[fngfs+ShellPatch::dsigmady],cg->fgfs[fngfs+ShellPatch::dsigmadz],cg->fgfs[fngfs+ShellPatch::dRdx],cg->fgfs[fngfs+ShellPatch::dRdy],cg->fgfs[fngfs+ShellPatch::dRdz],cg->fgfs[fngfs+ShellPatch::drhodxx],cg->fgfs[fngfs+ShellPatch::drhodxy],cg->fgfs[fngfs+ShellPatch::drhodxz],cg->fgfs[fngfs+ShellPatch::drhodyy],cg->fgfs[fngfs+ShellPatch::drhodyz],cg->fgfs[fngfs+ShellPatch::drhodzz],cg->fgfs[fngfs+ShellPatch::dsigmadxx],cg->fgfs[fngfs+ShellPatch::dsigmadxy],cg->fgfs[fngfs+ShellPatch::dsigmadxz],cg->fgfs[fngfs+ShellPatch::dsigmadyy],cg->fgfs[fngfs+ShellPatch::dsigmadyz],cg->fgfs[fngfs+ShellPatch::dsigmadzz],cg->fgfs[fngfs+ShellPatch::dRdxx],cg->fgfs[fngfs+ShellPatch::dRdxy],cg->fgfs[fngfs+ShellPatch::dRdxz],cg->fgfs[fngfs+ShellPatch::dRdyy],cg->fgfs[fngfs+ShellPatch::dRdyz],cg->fgfs[fngfs+ShellPatch::dRdzz],cg->fgfs[phi0->sgfn],cg->fgfs[trK0->sgfn],cg->fgfs[gxx0->sgfn],cg->fgfs[gxy0->sgfn],cg->fgfs[gxz0->sgfn],cg->fgfs[gyy0->sgfn],cg->fgfs[gyz0->sgfn],cg->fgfs[gzz0->sgfn],cg->fgfs[Axx0->sgfn],cg->fgfs[Axy0->sgfn],cg->fgfs[Axz0->sgfn],cg->fgfs[Ayy0->sgfn],cg->fgfs[Ayz0->sgfn],cg->fgfs[Azz0->sgfn],cg->fgfs[Gmx0->sgfn],cg->fgfs[Gmy0->sgfn],cg->fgfs[Gmz0->sgfn],cg->fgfs[Lap0->sgfn],cg->fgfs[Sfx0->sgfn],cg->fgfs[Sfy0->sgfn],cg->fgfs[Sfz0->sgfn],cg->fgfs[dtSfx0->sgfn],cg->fgfs[dtSfy0->sgfn],cg->fgfs[dtSfz0->sgfn],cg->fgfs[phi_rhs->sgfn],cg->fgfs[trK_rhs->sgfn],cg->fgfs[gxx_rhs->sgfn],cg->fgfs[gxy_rhs->sgfn],cg->fgfs[gxz_rhs->sgfn],cg->fgfs[gyy_rhs->sgfn],cg->fgfs[gyz_rhs->sgfn],cg->fgfs[gzz_rhs->sgfn],cg->fgfs[Axx_rhs->sgfn],cg->fgfs[Axy_rhs->sgfn],cg->fgfs[Axz_rhs->sgfn],cg->fgfs[Ayy_rhs->sgfn],cg->fgfs[Ayz_rhs->sgfn],cg->fgfs[Azz_rhs->sgfn],cg->fgfs[Gmx_rhs->sgfn],cg->fgfs[Gmy_rhs->sgfn],cg->fgfs[Gmz_rhs->sgfn],cg->fgfs[Lap_rhs->sgfn],cg->fgfs[Sfx_rhs->sgfn],cg->fgfs[Sfy_rhs->sgfn],cg->fgfs[Sfz_rhs->sgfn],cg->fgfs[dtSfx_rhs->sgfn],cg->fgfs[dtSfy_rhs->sgfn],cg->fgfs[dtSfz_rhs->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,numepsh,sPp->data->sst,pre
//4------------tool------------------------------
int compare_result(int ftag1,double * d2,int data_num);
#endif

View File

@@ -1,244 +1,231 @@
#ifndef BSSN_H
#define BSSN_H
#ifdef fortran1
#define f_compute_rhs_bssn compute_rhs_bssn
#define f_compute_rhs_bssn_ss compute_rhs_bssn_ss
#define f_compute_rhs_bssn_escalar compute_rhs_bssn_escalar
#define f_compute_rhs_bssn_escalar_ss compute_rhs_bssn_escalar_ss
#define f_compute_rhs_Z4c compute_rhs_z4c
#define f_compute_rhs_Z4cnot compute_rhs_z4cnot
#define f_compute_rhs_Z4c_ss compute_rhs_z4c_ss
#define f_compute_constraint_fr compute_constraint_fr
#endif
#ifdef fortran2
#define f_compute_rhs_bssn COMPUTE_RHS_BSSN
#define f_compute_rhs_bssn_ss COMPUTE_RHS_BSSN_SS
#define f_compute_rhs_bssn_escalar COMPUTE_RHS_BSSN_ESCALAR
#define f_compute_rhs_bssn_escalar_ss COMPUTE_RHS_BSSN_ESCALAR_SS
#define f_compute_rhs_Z4c COMPUTE_RHS_Z4C
#define f_compute_rhs_Z4cnot COMPUTE_RHS_Z4CNOT
#define f_compute_rhs_Z4c_ss COMPUTE_RHS_Z4C_SS
#define f_compute_constraint_fr COMPUTE_CONSTRAINT_FR
#endif
#ifdef fortran3
#define f_compute_rhs_bssn compute_rhs_bssn_
#define f_compute_rhs_bssn_ss compute_rhs_bssn_ss_
#define f_compute_rhs_bssn_escalar compute_rhs_bssn_escalar_
#define f_compute_rhs_bssn_escalar_ss compute_rhs_bssn_escalar_ss_
#define f_compute_rhs_Z4c compute_rhs_z4c_
#define f_compute_rhs_Z4cnot compute_rhs_z4cnot_
#define f_compute_rhs_Z4c_ss compute_rhs_z4c_ss_
#define f_compute_constraint_fr compute_constraint_fr_
#endif
#ifdef __cplusplus
extern "C"
{
#endif
void f_bssn_rhs_kernel_timing_reset();
int f_bssn_rhs_kernel_timing_bucket_count();
const double *f_bssn_rhs_kernel_timing_local_seconds();
const char *f_bssn_rhs_kernel_timing_label(int);
#ifdef __cplusplus
}
#endif
extern "C"
{
int f_compute_rhs_bssn(int *, double &, double *, double *, double *, // ex,T,X,Y,Z
double *, double *, // chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, double *, // chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, // stress-energy
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Ricci
double *, double *, double *, double *, double *, double *, double *, // constraint violation
int &, int &, double &, int &);
}
extern "C"
{
int f_compute_rhs_bssn_ss(int *, double &, double *, double *, double *, // ex,T,rho,sigma,R
double *, double *, double *, // X,Y,Z
double *, double *, double *, // drhodx,drhody,drhodz
double *, double *, double *, // dsigmadx,dsigmady,dsigmadz
double *, double *, double *, // dRdx,dRdy,dRdz
double *, double *, double *, double *, double *, double *, // drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz
double *, double *, double *, double *, double *, double *, // dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz
double *, double *, double *, double *, double *, double *, // dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz
double *, double *, // chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, double *, // chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, // stress-energy
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Ricci
double *, double *, double *, double *, double *, double *, double *, // constraint violation
int &, int &, double &, int &, int &);
}
extern "C"
{
int f_compute_rhs_bssn_escalar(int *, double &, double *, double *, double *, // ex,T,X,Y,Z
double *, double *, // chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, double *, // Sphi, Spi
double *, double *, // chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, double *, // Sphi, Spi
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, // stress-energy
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Ricci
double *, double *, double *, double *, double *, double *, double *, // constraint violation
int &, int &, double &, int &);
}
extern "C"
{
int f_compute_rhs_bssn_escalar_ss(int *, double &, double *, double *, double *, // ex,T,rho,sigma,R
double *, double *, double *, // X,Y,Z
double *, double *, double *, // drhodx,drhody,drhodz
double *, double *, double *, // dsigmadx,dsigmady,dsigmadz
double *, double *, double *, // dRdx,dRdy,dRdz
double *, double *, double *, double *, double *, double *, // drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz
double *, double *, double *, double *, double *, double *, // dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz
double *, double *, double *, double *, double *, double *, // dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz
double *, double *, // chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, double *, // Sphi,Spi
double *, double *, // chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, double *, // Sphi,Spi
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, // stress-energy
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Ricci
double *, double *, double *, double *, double *, double *, double *, // constraint violation
int &, int &, double &, int &, int &);
}
extern "C"
{
int f_compute_rhs_Z4c(int *, double &, double *, double *, double *, // ex,T,X,Y,Z
double *, double *, // chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, // Z4
double *, double *, // chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, // Z4
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *,
int &, int &, double &, int &);
}
extern "C"
{
int f_compute_rhs_Z4c_ss(int *, double &, double *, double *, double *, // ex,T,rho,sigma,R
double *, double *, double *, // X,Y,Z
double *, double *, double *, // drhodx,drhody,drhodz
double *, double *, double *, // dsigmadx,dsigmady,dsigmadz
double *, double *, double *, // dRdx,dRdy,dRdz
double *, double *, double *, double *, double *, double *, // drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz
double *, double *, double *, double *, double *, double *, // dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz
double *, double *, double *, double *, double *, double *, // dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz
double *, double *, // chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, // TZ
double *, double *, // chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, // TZ
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, // stress-energy
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Ricci
double *, double *, double *, double *, double *, double *, double *, // constraint violation
int &, int &, double &, int &, int &);
}
extern "C"
{
int f_compute_rhs_Z4cnot(int *, double &, double *, double *, double *, // ex,T,X,Y,Z
double *, double *, // chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, // Z4
double *, double *, // chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, // Z4
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *,
int &, int &, double &, int &, double &);
}
extern "C"
{
void f_compute_constraint_fr(int *, double *, double *, double *, // ex,X,Y,Z
double *, double *, double *, double *, // chi, trK,rho,Sphi
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, double *, double *, double *, // Rij
double *, double *, double *, double *, double *, double *, // Sij
double *);
} // FR_cons
#endif /* BSSN_H */
#ifndef BSSN_H
#define BSSN_H
#ifdef fortran1
#define f_compute_rhs_bssn compute_rhs_bssn
#define f_compute_rhs_bssn_ss compute_rhs_bssn_ss
#define f_compute_rhs_bssn_escalar compute_rhs_bssn_escalar
#define f_compute_rhs_bssn_escalar_ss compute_rhs_bssn_escalar_ss
#define f_compute_rhs_Z4c compute_rhs_z4c
#define f_compute_rhs_Z4cnot compute_rhs_z4cnot
#define f_compute_rhs_Z4c_ss compute_rhs_z4c_ss
#define f_compute_constraint_fr compute_constraint_fr
#endif
#ifdef fortran2
#define f_compute_rhs_bssn COMPUTE_RHS_BSSN
#define f_compute_rhs_bssn_ss COMPUTE_RHS_BSSN_SS
#define f_compute_rhs_bssn_escalar COMPUTE_RHS_BSSN_ESCALAR
#define f_compute_rhs_bssn_escalar_ss COMPUTE_RHS_BSSN_ESCALAR_SS
#define f_compute_rhs_Z4c COMPUTE_RHS_Z4C
#define f_compute_rhs_Z4cnot COMPUTE_RHS_Z4CNOT
#define f_compute_rhs_Z4c_ss COMPUTE_RHS_Z4C_SS
#define f_compute_constraint_fr COMPUTE_CONSTRAINT_FR
#endif
#ifdef fortran3
#define f_compute_rhs_bssn compute_rhs_bssn_
#define f_compute_rhs_bssn_ss compute_rhs_bssn_ss_
#define f_compute_rhs_bssn_escalar compute_rhs_bssn_escalar_
#define f_compute_rhs_bssn_escalar_ss compute_rhs_bssn_escalar_ss_
#define f_compute_rhs_Z4c compute_rhs_z4c_
#define f_compute_rhs_Z4cnot compute_rhs_z4cnot_
#define f_compute_rhs_Z4c_ss compute_rhs_z4c_ss_
#define f_compute_constraint_fr compute_constraint_fr_
#endif
extern "C"
{
int f_compute_rhs_bssn(int *, double &, double *, double *, double *, // ex,T,X,Y,Z
double *, double *, // chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, double *, // chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, // stress-energy
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Ricci
double *, double *, double *, double *, double *, double *, double *, // constraint violation
int &, int &, double &, int &);
}
extern "C"
{
int f_compute_rhs_bssn_ss(int *, double &, double *, double *, double *, // ex,T,rho,sigma,R
double *, double *, double *, // X,Y,Z
double *, double *, double *, // drhodx,drhody,drhodz
double *, double *, double *, // dsigmadx,dsigmady,dsigmadz
double *, double *, double *, // dRdx,dRdy,dRdz
double *, double *, double *, double *, double *, double *, // drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz
double *, double *, double *, double *, double *, double *, // dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz
double *, double *, double *, double *, double *, double *, // dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz
double *, double *, // chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, double *, // chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, // stress-energy
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Ricci
double *, double *, double *, double *, double *, double *, double *, // constraint violation
int &, int &, double &, int &, int &);
}
extern "C"
{
int f_compute_rhs_bssn_escalar(int *, double &, double *, double *, double *, // ex,T,X,Y,Z
double *, double *, // chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, double *, // Sphi, Spi
double *, double *, // chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, double *, // Sphi, Spi
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, // stress-energy
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Ricci
double *, double *, double *, double *, double *, double *, double *, // constraint violation
int &, int &, double &, int &);
}
extern "C"
{
int f_compute_rhs_bssn_escalar_ss(int *, double &, double *, double *, double *, // ex,T,rho,sigma,R
double *, double *, double *, // X,Y,Z
double *, double *, double *, // drhodx,drhody,drhodz
double *, double *, double *, // dsigmadx,dsigmady,dsigmadz
double *, double *, double *, // dRdx,dRdy,dRdz
double *, double *, double *, double *, double *, double *, // drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz
double *, double *, double *, double *, double *, double *, // dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz
double *, double *, double *, double *, double *, double *, // dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz
double *, double *, // chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, double *, // Sphi,Spi
double *, double *, // chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, double *, // Sphi,Spi
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, // stress-energy
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Ricci
double *, double *, double *, double *, double *, double *, double *, // constraint violation
int &, int &, double &, int &, int &);
}
extern "C"
{
int f_compute_rhs_Z4c(int *, double &, double *, double *, double *, // ex,T,X,Y,Z
double *, double *, // chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, // Z4
double *, double *, // chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, // Z4
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *,
int &, int &, double &, int &);
}
extern "C"
{
int f_compute_rhs_Z4c_ss(int *, double &, double *, double *, double *, // ex,T,rho,sigma,R
double *, double *, double *, // X,Y,Z
double *, double *, double *, // drhodx,drhody,drhodz
double *, double *, double *, // dsigmadx,dsigmady,dsigmadz
double *, double *, double *, // dRdx,dRdy,dRdz
double *, double *, double *, double *, double *, double *, // drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz
double *, double *, double *, double *, double *, double *, // dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz
double *, double *, double *, double *, double *, double *, // dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz
double *, double *, // chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, // TZ
double *, double *, // chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, // TZ
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, // stress-energy
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Ricci
double *, double *, double *, double *, double *, double *, double *, // constraint violation
int &, int &, double &, int &, int &);
}
extern "C"
{
int f_compute_rhs_Z4cnot(int *, double &, double *, double *, double *, // ex,T,X,Y,Z
double *, double *, // chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, // Z4
double *, double *, // chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, // Z4
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *,
int &, int &, double &, int &, double &);
}
extern "C"
{
void f_compute_constraint_fr(int *, double *, double *, double *, // ex,X,Y,Z
double *, double *, double *, double *, // chi, trK,rho,Sphi
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, double *, double *, double *, // Rij
double *, double *, double *, double *, double *, double *, // Sij
double *);
} // FR_cons
#endif /* BSSN_H */

View File

@@ -2,88 +2,30 @@
#include "bssn_rhs.h"
#include "share_func.h"
#include "tool.h"
#include <time.h>
#ifdef _OPENMP
#define BSSN_OMP_TASK_GROUP_BEGIN \
_Pragma("omp parallel") \
{ \
_Pragma("omp single nowait") \
{
#define BSSN_OMP_TASK_CALL(...) \
_Pragma("omp task") { __VA_ARGS__; }
#define BSSN_OMP_TASK_GROUP_END \
_Pragma("omp taskwait") \
} \
}
#else
#define BSSN_OMP_TASK_GROUP_BEGIN {
#define BSSN_OMP_TASK_CALL(...) { __VA_ARGS__; }
#define BSSN_OMP_TASK_GROUP_END }
#endif
// 0-based i,j,k
// #define IDX_F(i,j,k,nx,ny) ((i) + (j)*(nx) + (k)*(nx)*(ny))
// ex(1)=nx, ex(2)=ny, ex(3)=nz
// 用法a[ IDX_F(i,j,k,nx,ny) ]
#ifndef BSSN_KERNEL_FINE_TIMING
#define BSSN_KERNEL_FINE_TIMING 0
#endif
#if BSSN_KERNEL_FINE_TIMING
namespace rhs_kernel_timing
{
enum Bucket
{
KB_SETUP_DERIVS = 0,
KB_GEOM_GAMMA,
KB_RICCI_METRIC,
KB_CHI_LAPSE,
KB_AIJ_TRK_GAUGE,
KB_KO_CONSTRAINT,
KB_COUNT
};
static double local_bucket_seconds[KB_COUNT];
static const char *bucket_labels[KB_COUNT] =
{
"setup_derivs",
"geom_gamma",
"ricci_metric",
"chi_lapse",
"aij_trk_gauge",
"ko_constraint"
};
static inline double now_seconds()
{
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return double(ts.tv_sec) + 1.0e-9 * double(ts.tv_nsec);
}
}
extern "C" void f_bssn_rhs_kernel_timing_reset()
{
for (int i = 0; i < rhs_kernel_timing::KB_COUNT; ++i)
rhs_kernel_timing::local_bucket_seconds[i] = 0.0;
}
extern "C" int f_bssn_rhs_kernel_timing_bucket_count()
{
return rhs_kernel_timing::KB_COUNT;
}
extern "C" const double *f_bssn_rhs_kernel_timing_local_seconds()
{
return rhs_kernel_timing::local_bucket_seconds;
}
extern "C" const char *f_bssn_rhs_kernel_timing_label(int bucket_index)
{
if (bucket_index < 0 || bucket_index >= rhs_kernel_timing::KB_COUNT)
return "unknown";
return rhs_kernel_timing::bucket_labels[bucket_index];
}
#define RHS_KERNEL_TIMER_DECL(var_name) const double var_name = rhs_kernel_timing::now_seconds()
#define RHS_KERNEL_TIMER_ADD(bucket_name, var_name) \
rhs_kernel_timing::local_bucket_seconds[int(rhs_kernel_timing::bucket_name)] += \
rhs_kernel_timing::now_seconds() - (var_name)
#else
extern "C" void f_bssn_rhs_kernel_timing_reset() {}
extern "C" int f_bssn_rhs_kernel_timing_bucket_count() { return 0; }
extern "C" const double *f_bssn_rhs_kernel_timing_local_seconds() { return 0; }
extern "C" const char *f_bssn_rhs_kernel_timing_label(int) { return "disabled"; }
#define RHS_KERNEL_TIMER_DECL(var_name)
#define RHS_KERNEL_TIMER_ADD(bucket_name, var_name)
#endif
// C function that calculates the right-hand side for BSSN equations
int f_compute_rhs_bssn(int *ex, double &T,
double *X, double *Y, double *Z,
@@ -178,25 +120,26 @@ int f_compute_rhs_bssn(int *ex, double &T,
dY = Y[1] - Y[0];
dZ = Z[1] - Z[0];
RHS_KERNEL_TIMER_DECL(timer_setup_derivs);
// 1ms //
for(int i=0;i<all;i+=1){
alpn1[i] = Lap[i] + 1.0;
chin1[i] = chi[i] + 1.0;
}
// 9ms //
fderivs(ex,betax,betaxx,betaxy,betaxz,X,Y,Z,ANTI, SYM, SYM,Symmetry,Lev);
fderivs(ex,betay,betayx,betayy,betayz,X,Y,Z, SYM,ANTI, SYM,Symmetry,Lev);
fderivs(ex,betaz,betazx,betazy,betazz,X,Y,Z, SYM, SYM,ANTI,Symmetry,Lev);
fderivs(ex,chi,chix,chiy,chiz,X,Y,Z,SYM,SYM,SYM,Symmetry,Lev);
fderivs(ex,dxx,gxxx,gxxy,gxxz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,Lev);
fderivs(ex,gxy,gxyx,gxyy,gxyz,X,Y,Z,ANTI,ANTI,SYM ,Symmetry,Lev);
fderivs(ex,gxz,gxzx,gxzy,gxzz,X,Y,Z,ANTI,SYM ,ANTI,Symmetry,Lev);
fderivs(ex,dyy,gyyx,gyyy,gyyz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,Lev);
fderivs(ex,gyz,gyzx,gyzy,gyzz,X,Y,Z,SYM ,ANTI,ANTI,Symmetry,Lev);
fderivs(ex,dzz,gzzx,gzzy,gzzz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,Lev);
fderivs(ex,Lap,Lapx,Lapy,Lapz,X,Y,Z,SYM,SYM,SYM,Symmetry,Lev);
fderivs(ex,trK,Kx,Ky,Kz,X,Y,Z,SYM,SYM,SYM,Symmetry,Lev);
BSSN_OMP_TASK_GROUP_BEGIN
BSSN_OMP_TASK_CALL(fderivs(ex,betax,betaxx,betaxy,betaxz,X,Y,Z,ANTI, SYM, SYM,Symmetry,Lev))
BSSN_OMP_TASK_CALL(fderivs(ex,betay,betayx,betayy,betayz,X,Y,Z, SYM,ANTI, SYM,Symmetry,Lev))
BSSN_OMP_TASK_CALL(fderivs(ex,betaz,betazx,betazy,betazz,X,Y,Z, SYM, SYM,ANTI,Symmetry,Lev))
BSSN_OMP_TASK_CALL(fderivs(ex,chi,chix,chiy,chiz,X,Y,Z,SYM,SYM,SYM,Symmetry,Lev))
BSSN_OMP_TASK_CALL(fderivs(ex,dxx,gxxx,gxxy,gxxz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,Lev))
BSSN_OMP_TASK_CALL(fderivs(ex,gxy,gxyx,gxyy,gxyz,X,Y,Z,ANTI,ANTI,SYM ,Symmetry,Lev))
BSSN_OMP_TASK_CALL(fderivs(ex,gxz,gxzx,gxzy,gxzz,X,Y,Z,ANTI,SYM ,ANTI,Symmetry,Lev))
BSSN_OMP_TASK_CALL(fderivs(ex,dyy,gyyx,gyyy,gyyz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,Lev))
BSSN_OMP_TASK_CALL(fderivs(ex,gyz,gyzx,gyzy,gyzz,X,Y,Z,SYM ,ANTI,ANTI,Symmetry,Lev))
BSSN_OMP_TASK_CALL(fderivs(ex,dzz,gzzx,gzzy,gzzz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,Lev))
BSSN_OMP_TASK_CALL(fderivs(ex,Lap,Lapx,Lapy,Lapz,X,Y,Z,SYM,SYM,SYM,Symmetry,Lev))
BSSN_OMP_TASK_CALL(fderivs(ex,trK,Kx,Ky,Kz,X,Y,Z,SYM,SYM,SYM,Symmetry,Lev))
BSSN_OMP_TASK_GROUP_END
// 3ms //
for(int i=0;i<all;i+=1){
@@ -218,8 +161,6 @@ int f_compute_rhs_bssn(int *ex, double &T,
(dxx[i] + ONE) * betaxz[i] + gxy[i] * betayz[i] + gyz[i] * betayx[i]
+ (dzz[i] + ONE) * betazx[i] - gxz[i] * betayy[i];
}
RHS_KERNEL_TIMER_ADD(KB_SETUP_DERIVS, timer_setup_derivs);
RHS_KERNEL_TIMER_DECL(timer_geom_gamma);
// Fused: inverse metric + Gamma constraint + Christoffel (3 loops -> 1)
for(int i=0;i<all;i+=1){
double det = (dxx[i] + ONE) * (dyy[i] + ONE) * (dzz[i] + ONE) + gxy[i] * gyz[i] * gxz[i] + gxz[i] * gxy[i] * gyz[i] -
@@ -362,6 +303,9 @@ int f_compute_rhs_bssn(int *ex, double &T,
+ ( gupxy[i]*gupyz[i] + gupyy[i]*gupxz[i] ) * Axy[i]
+ ( gupxy[i]*gupzz[i] + gupyz[i]*gupxz[i] ) * Axz[i]
+ ( gupyy[i]*gupzz[i] + gupyz[i]*gupyz[i] ) * Ayz[i];
Rxx[i] = axx; Ryy[i] = ayy; Rzz[i] = azz;
Rxy[i] = axy; Rxz[i] = axz; Ryz[i] = ayz;
Gamx_rhs[i] = - TWO * ( Lapx[i]*axx + Lapy[i]*axy + Lapz[i]*axz ) +
TWO * alpn1[i] * (
-F3o2/chin1[i] * ( chix[i]*axx + chiy[i]*axy + chiz[i]*axz ) -
@@ -391,18 +335,15 @@ int f_compute_rhs_bssn(int *ex, double &T,
+ TWO * ( Gamzxy[i]*axy + Gamzxz[i]*axz + Gamzyz[i]*ayz )
);
}
RHS_KERNEL_TIMER_ADD(KB_GEOM_GAMMA, timer_geom_gamma);
RHS_KERNEL_TIMER_DECL(timer_ricci_metric);
// 22.3ms //
fdderivs(ex,betax,gxxx,gxyx,gxzx,gyyx,gyzx,gzzx,
X,Y,Z,ANTI,SYM, SYM ,Symmetry,Lev);
fdderivs(ex,betay,gxxy,gxyy,gxzy,gyyy,gyzy,gzzy,
X,Y,Z,SYM ,ANTI,SYM ,Symmetry,Lev);
fdderivs(ex,betaz,gxxz,gxyz,gxzz,gyyz,gyzz,gzzz,
X,Y,Z,SYM ,SYM, ANTI,Symmetry,Lev);
fderivs(ex,Gamx,Gamxx,Gamxy,Gamxz,X,Y,Z,ANTI,SYM ,SYM ,Symmetry,Lev);
fderivs(ex,Gamy,Gamyx,Gamyy,Gamyz,X,Y,Z,SYM ,ANTI,SYM ,Symmetry,Lev);
fderivs(ex,Gamz,Gamzx,Gamzy,Gamzz,X,Y,Z,SYM ,SYM ,ANTI,Symmetry,Lev);
BSSN_OMP_TASK_GROUP_BEGIN
BSSN_OMP_TASK_CALL(fdderivs(ex,betax,gxxx,gxyx,gxzx,gyyx,gyzx,gzzx,X,Y,Z,ANTI,SYM, SYM ,Symmetry,Lev))
BSSN_OMP_TASK_CALL(fdderivs(ex,betay,gxxy,gxyy,gxzy,gyyy,gyzy,gzzy,X,Y,Z,SYM ,ANTI,SYM ,Symmetry,Lev))
BSSN_OMP_TASK_CALL(fdderivs(ex,betaz,gxxz,gxyz,gxzz,gyyz,gyzz,gzzz,X,Y,Z,SYM ,SYM, ANTI,Symmetry,Lev))
BSSN_OMP_TASK_CALL(fderivs(ex,Gamx,Gamxx,Gamxy,Gamxz,X,Y,Z,ANTI,SYM ,SYM ,Symmetry,Lev))
BSSN_OMP_TASK_CALL(fderivs(ex,Gamy,Gamyx,Gamyy,Gamyz,X,Y,Z,SYM ,ANTI,SYM ,Symmetry,Lev))
BSSN_OMP_TASK_CALL(fderivs(ex,Gamz,Gamzx,Gamzy,Gamzz,X,Y,Z,SYM ,SYM ,ANTI,Symmetry,Lev))
BSSN_OMP_TASK_GROUP_END
// Fused: fxx/Gamxa + Gamma_rhs part 2 (2 loops -> 1)
for(int i=0;i<all;i+=1){
@@ -410,6 +351,7 @@ int f_compute_rhs_bssn(int *ex, double &T,
double lfxx = gxxx[i] + gxyy[i] + gxzz[i];
double lfxy = gxyx[i] + gyyy[i] + gyzz[i];
double lfxz = gxzx[i] + gyzy[i] + gzzz[i];
fxx[i] = lfxx; fxy[i] = lfxy; fxz[i] = lfxz;
double gxa = gupxx[i]*Gamxxx[i] + gupyy[i]*Gamxyy[i] + gupzz[i]*Gamxzz[i]
+ TWO * ( gupxy[i]*Gamxxy[i] + gupxz[i]*Gamxxz[i] + gupyz[i]*Gamxyz[i] );
@@ -763,74 +705,69 @@ int f_compute_rhs_bssn(int *ex, double &T,
+ Gamxyz[i] * gzzx[i] + Gamyyz[i] * gzzy[i] + Gamzyz[i] * gzzz[i]
);
}
RHS_KERNEL_TIMER_ADD(KB_RICCI_METRIC, timer_ricci_metric);
RHS_KERNEL_TIMER_DECL(timer_chi_lapse);
// 22.3ms //
fdderivs(ex,chi,fxx,fxy,fxz,fyy,fyz,fzz,X,Y,Z,SYM,SYM,SYM,Symmetry,Lev);
// 7ms //
for (int i=0;i<all;i+=1) {
const double inv_chin1 = ONE / chin1[i];
const double half_inv_chin1 = HALF * inv_chin1;
const double scaled_inv = F3o2 * inv_chin1;
const double cxx = fxx[i] - Gamxxx[i] * chix[i] - Gamyxx[i] * chiy[i] - Gamzxx[i] * chiz[i];
const double cxy = fxy[i] - Gamxxy[i] * chix[i] - Gamyxy[i] * chiy[i] - Gamzxy[i] * chiz[i];
const double cxz = fxz[i] - Gamxxz[i] * chix[i] - Gamyxz[i] * chiy[i] - Gamzxz[i] * chiz[i];
const double cyy = fyy[i] - Gamxyy[i] * chix[i] - Gamyyy[i] * chiy[i] - Gamzyy[i] * chiz[i];
const double cyz = fyz[i] - Gamxyz[i] * chix[i] - Gamyyz[i] * chiy[i] - Gamzyz[i] * chiz[i];
const double czz = fzz[i] - Gamxzz[i] * chix[i] - Gamyzz[i] * chiy[i] - Gamzzz[i] * chiz[i];
const double ricci_chi =
gupxx[i] * (cxx - scaled_inv * chix[i] * chix[i])
+ gupyy[i] * (cyy - scaled_inv * chiy[i] * chiy[i])
+ gupzz[i] * (czz - scaled_inv * chiz[i] * chiz[i])
+ TWO * gupxy[i] * (cxy - scaled_inv * chix[i] * chiy[i])
+ TWO * gupxz[i] * (cxz - scaled_inv * chix[i] * chiz[i])
+ TWO * gupyz[i] * (cyz - scaled_inv * chiy[i] * chiz[i]);
f[i] = ricci_chi;
Rxx[i] = Rxx[i] + ( cxx - half_inv_chin1 * chix[i] * chix[i] + (dxx[i] + ONE) * ricci_chi ) * half_inv_chin1;
Ryy[i] = Ryy[i] + ( cyy - half_inv_chin1 * chiy[i] * chiy[i] + (dyy[i] + ONE) * ricci_chi ) * half_inv_chin1;
Rzz[i] = Rzz[i] + ( czz - half_inv_chin1 * chiz[i] * chiz[i] + (dzz[i] + ONE) * ricci_chi ) * half_inv_chin1;
fxx[i] = fxx[i] - Gamxxx[i] * chix[i] - Gamyxx[i] * chiy[i] - Gamzxx[i] * chiz[i];
fxy[i] = fxy[i] - Gamxxy[i] * chix[i] - Gamyxy[i] * chiy[i] - Gamzxy[i] * chiz[i];
fxz[i] = fxz[i] - Gamxxz[i] * chix[i] - Gamyxz[i] * chiy[i] - Gamzxz[i] * chiz[i];
fyy[i] = fyy[i] - Gamxyy[i] * chix[i] - Gamyyy[i] * chiy[i] - Gamzyy[i] * chiz[i];
fyz[i] = fyz[i] - Gamxyz[i] * chix[i] - Gamyyz[i] * chiy[i] - Gamzyz[i] * chiz[i];
fzz[i] = fzz[i] - Gamxzz[i] * chix[i] - Gamyzz[i] * chiy[i] - Gamzzz[i] * chiz[i];
f[i] =
gupxx[i] * (fxx[i] - (F3o2 / chin1[i]) * chix[i] * chix[i])
+ gupyy[i] * (fyy[i] - (F3o2 / chin1[i]) * chiy[i] * chiy[i])
+ gupzz[i] * (fzz[i] - (F3o2 / chin1[i]) * chiz[i] * chiz[i])
+ TWO * gupxy[i] * (fxy[i] - (F3o2 / chin1[i]) * chix[i] * chiy[i])
+ TWO * gupxz[i] * (fxz[i] - (F3o2 / chin1[i]) * chix[i] * chiz[i])
+ TWO * gupyz[i] * (fyz[i] - (F3o2 / chin1[i]) * chiy[i] * chiz[i]);
Rxx[i] = Rxx[i] + ( fxx[i] - (chix[i] * chix[i]) / (chin1[i] * TWO) + (dxx[i] + ONE) * f[i] ) / (chin1[i] * TWO);
Ryy[i] = Ryy[i] + ( fyy[i] - (chiy[i] * chiy[i]) / (chin1[i] * TWO) + (dyy[i] + ONE) * f[i] ) / (chin1[i] * TWO);
Rzz[i] = Rzz[i] + ( fzz[i] - (chiz[i] * chiz[i]) / (chin1[i] * TWO) + (dzz[i] + ONE) * f[i] ) / (chin1[i] * TWO);
Rxy[i] = Rxy[i] + ( cxy - half_inv_chin1 * chix[i] * chiy[i] + gxy[i] * ricci_chi ) * half_inv_chin1;
Rxz[i] = Rxz[i] + ( cxz - half_inv_chin1 * chix[i] * chiz[i] + gxz[i] * ricci_chi ) * half_inv_chin1;
Ryz[i] = Ryz[i] + ( cyz - half_inv_chin1 * chiy[i] * chiz[i] + gyz[i] * ricci_chi ) * half_inv_chin1;
Rxy[i] = Rxy[i] + ( fxy[i] - (chix[i] * chiy[i]) / (chin1[i] * TWO) + gxy[i] * f[i] ) / (chin1[i] * TWO);
Rxz[i] = Rxz[i] + ( fxz[i] - (chix[i] * chiz[i]) / (chin1[i] * TWO) + gxz[i] * f[i] ) / (chin1[i] * TWO);
Ryz[i] = Ryz[i] + ( fyz[i] - (chiy[i] * chiz[i]) / (chin1[i] * TWO) + gyz[i] * f[i] ) / (chin1[i] * TWO);
}
// 24ms //
fdderivs(ex,Lap,fxx,fxy,fxz,fyy,fyz,fzz,X,Y,Z,SYM,SYM,SYM,Symmetry,Lev);
fderivs(ex,chi,dtSfx_rhs,dtSfy_rhs,dtSfz_rhs,X,Y,Z,SYM,SYM,SYM,Symmetry,Lev);
// 6ms //
for (int i=0;i<all;i+=1) {
const double inv_chin1 = ONE / chin1[i];
const double gchi_x = (gupxx[i] * chix[i] + gupxy[i] * chiy[i] + gupxz[i] * chiz[i]) * inv_chin1;
const double gchi_y = (gupxy[i] * chix[i] + gupyy[i] * chiy[i] + gupyz[i] * chiz[i]) * inv_chin1;
const double gchi_z = (gupxz[i] * chix[i] + gupyz[i] * chiy[i] + gupzz[i] * chiz[i]) * inv_chin1;
/* gxxx,gxxy,gxxz (这里是“升指标后的chi导数/chi”那类量你沿用原变量名即可) */
gxxx[i] = (gupxx[i] * chix[i] + gupxy[i] * chiy[i] + gupxz[i] * chiz[i]) / chin1[i];
gxxy[i] = (gupxy[i] * chix[i] + gupyy[i] * chiy[i] + gupyz[i] * chiz[i]) / chin1[i];
gxxz[i] = (gupxz[i] * chix[i] + gupyz[i] * chiy[i] + gupzz[i] * chiz[i]) / chin1[i];
/* Christoffel 修正项 */
Gamxxx[i] = Gamxxx[i] - ( ((chix[i] + chix[i]) * inv_chin1) - (dxx[i] + ONE) * gchi_x ) * HALF;
Gamyxx[i] = Gamyxx[i] - ( 0.0 - (dxx[i] + ONE) * gchi_y ) * HALF; /* 原式只有 -gxx*gxxy */
Gamzxx[i] = Gamzxx[i] - ( 0.0 - (dxx[i] + ONE) * gchi_z ) * HALF;
Gamxxx[i] = Gamxxx[i] - ( ((chix[i] + chix[i]) / chin1[i]) - (dxx[i] + ONE) * gxxx[i] ) * HALF;
Gamyxx[i] = Gamyxx[i] - ( 0.0 - (dxx[i] + ONE) * gxxy[i] ) * HALF; /* 原式只有 -gxx*gxxy */
Gamzxx[i] = Gamzxx[i] - ( 0.0 - (dxx[i] + ONE) * gxxz[i] ) * HALF;
Gamxyy[i] = Gamxyy[i] - ( 0.0 - (dyy[i] + ONE) * gchi_x ) * HALF;
Gamyyy[i] = Gamyyy[i] - ( ((chiy[i] + chiy[i]) * inv_chin1) - (dyy[i] + ONE) * gchi_y ) * HALF;
Gamzyy[i] = Gamzyy[i] - ( 0.0 - (dyy[i] + ONE) * gchi_z ) * HALF;
Gamxyy[i] = Gamxyy[i] - ( 0.0 - (dyy[i] + ONE) * gxxx[i] ) * HALF;
Gamyyy[i] = Gamyyy[i] - ( ((chiy[i] + chiy[i]) / chin1[i]) - (dyy[i] + ONE) * gxxy[i] ) * HALF;
Gamzyy[i] = Gamzyy[i] - ( 0.0 - (dyy[i] + ONE) * gxxz[i] ) * HALF;
Gamxzz[i] = Gamxzz[i] - ( 0.0 - (dzz[i] + ONE) * gchi_x ) * HALF;
Gamyzz[i] = Gamyzz[i] - ( 0.0 - (dzz[i] + ONE) * gchi_y ) * HALF;
Gamzzz[i] = Gamzzz[i] - ( ((chiz[i] + chiz[i]) * inv_chin1) - (dzz[i] + ONE) * gchi_z ) * HALF;
Gamxzz[i] = Gamxzz[i] - ( 0.0 - (dzz[i] + ONE) * gxxx[i] ) * HALF;
Gamyzz[i] = Gamyzz[i] - ( 0.0 - (dzz[i] + ONE) * gxxy[i] ) * HALF;
Gamzzz[i] = Gamzzz[i] - ( ((chiz[i] + chiz[i]) / chin1[i]) - (dzz[i] + ONE) * gxxz[i] ) * HALF;
Gamxxy[i] = Gamxxy[i] - ( ( chiy[i] * inv_chin1) - gxy[i] * gchi_x ) * HALF;
Gamyxy[i] = Gamyxy[i] - ( ( chix[i] * inv_chin1) - gxy[i] * gchi_y ) * HALF;
Gamzxy[i] = Gamzxy[i] - ( 0.0 - gxy[i] * gchi_z ) * HALF;
Gamxxy[i] = Gamxxy[i] - ( ( chiy[i] / chin1[i]) - gxy[i] * gxxx[i] ) * HALF;
Gamyxy[i] = Gamyxy[i] - ( ( chix[i] / chin1[i]) - gxy[i] * gxxy[i] ) * HALF;
Gamzxy[i] = Gamzxy[i] - ( 0.0 - gxy[i] * gxxz[i] ) * HALF;
Gamxxz[i] = Gamxxz[i] - ( ( chiz[i] * inv_chin1) - gxz[i] * gchi_x ) * HALF;
Gamyxz[i] = Gamyxz[i] - ( 0.0 - gxz[i] * gchi_y ) * HALF;
Gamzxz[i] = Gamzxz[i] - ( ( chix[i] * inv_chin1) - gxz[i] * gchi_z ) * HALF;
Gamxxz[i] = Gamxxz[i] - ( ( chiz[i] / chin1[i]) - gxz[i] * gxxx[i] ) * HALF;
Gamyxz[i] = Gamyxz[i] - ( 0.0 - gxz[i] * gxxy[i] ) * HALF;
Gamzxz[i] = Gamzxz[i] - ( ( chix[i] / chin1[i]) - gxz[i] * gxxz[i] ) * HALF;
Gamxyz[i] = Gamxyz[i] - ( 0.0 - gyz[i] * gchi_x ) * HALF;
Gamyyz[i] = Gamyyz[i] - ( ( chiz[i] * inv_chin1) - gyz[i] * gchi_y ) * HALF;
Gamzyz[i] = Gamzyz[i] - ( ( chiy[i] * inv_chin1) - gyz[i] * gchi_z ) * HALF;
Gamxyz[i] = Gamxyz[i] - ( 0.0 - gyz[i] * gxxx[i] ) * HALF;
Gamyyz[i] = Gamyyz[i] - ( ( chiz[i] / chin1[i]) - gyz[i] * gxxy[i] ) * HALF;
Gamzyz[i] = Gamzyz[i] - ( ( chiy[i] / chin1[i]) - gyz[i] * gxxz[i] ) * HALF;
/* fxx..fyz 修正:减去 Γ * ∂Lap */
fxx[i] = fxx[i] - Gamxxx[i] * Lapx[i] - Gamyxx[i] * Lapy[i] - Gamzxx[i] * Lapz[i];
@@ -844,8 +781,6 @@ int f_compute_rhs_bssn(int *ex, double &T,
trK_rhs[i] = gupxx[i] * fxx[i] + gupyy[i] * fyy[i] + gupzz[i] * fzz[i]
+ TWO * ( gupxy[i] * fxy[i] + gupxz[i] * fxz[i] + gupyz[i] * fyz[i] );
}
RHS_KERNEL_TIMER_ADD(KB_CHI_LAPSE, timer_chi_lapse);
RHS_KERNEL_TIMER_DECL(timer_aij_trk_gauge);
// 2.5ms //
for (int i=0;i<all;i+=1) {
const double divb = betaxx[i] + betayy[i] + betazz[i];
@@ -1146,33 +1081,33 @@ int f_compute_rhs_bssn(int *ex, double &T,
dtSfz_rhs[i] = Gamz_rhs[i] - reta[i] * dtSfz[i];
#endif
}
RHS_KERNEL_TIMER_ADD(KB_AIJ_TRK_GAUGE, timer_aij_trk_gauge);
RHS_KERNEL_TIMER_DECL(timer_ko_constraint);
// advection + KO dissipation with shared symmetry buffer
lopsided_kodis(ex,X,Y,Z,dxx,gxx_rhs,betax,betay,betaz,Symmetry,SSS,eps);
lopsided_kodis(ex,X,Y,Z,Gamz,Gamz_rhs,betax,betay,betaz,Symmetry,SSA,eps);
lopsided_kodis(ex,X,Y,Z,gxy,gxy_rhs,betax,betay,betaz,Symmetry,AAS,eps);
lopsided_kodis(ex,X,Y,Z,Lap,Lap_rhs,betax,betay,betaz,Symmetry,SSS,eps);
lopsided_kodis(ex,X,Y,Z,gxz,gxz_rhs,betax,betay,betaz,Symmetry,ASA,eps);
lopsided_kodis(ex,X,Y,Z,betax,betax_rhs,betax,betay,betaz,Symmetry,ASS,eps);
lopsided_kodis(ex,X,Y,Z,dyy,gyy_rhs,betax,betay,betaz,Symmetry,SSS,eps);
lopsided_kodis(ex,X,Y,Z,betay,betay_rhs,betax,betay,betaz,Symmetry,SAS,eps);
lopsided_kodis(ex,X,Y,Z,gyz,gyz_rhs,betax,betay,betaz,Symmetry,SAA,eps);
lopsided_kodis(ex,X,Y,Z,betaz,betaz_rhs,betax,betay,betaz,Symmetry,SSA,eps);
lopsided_kodis(ex,X,Y,Z,dzz,gzz_rhs,betax,betay,betaz,Symmetry,SSS,eps);
lopsided_kodis(ex,X,Y,Z,dtSfx,dtSfx_rhs,betax,betay,betaz,Symmetry,ASS,eps);
lopsided_kodis(ex,X,Y,Z,Axx,Axx_rhs,betax,betay,betaz,Symmetry,SSS,eps);
lopsided_kodis(ex,X,Y,Z,dtSfy,dtSfy_rhs,betax,betay,betaz,Symmetry,SAS,eps);
lopsided_kodis(ex,X,Y,Z,Axy,Axy_rhs,betax,betay,betaz,Symmetry,AAS,eps);
lopsided_kodis(ex,X,Y,Z,dtSfz,dtSfz_rhs,betax,betay,betaz,Symmetry,SSA,eps);
lopsided_kodis(ex,X,Y,Z,Axz,Axz_rhs,betax,betay,betaz,Symmetry,ASA,eps);
lopsided_kodis(ex,X,Y,Z,Ayy,Ayy_rhs,betax,betay,betaz,Symmetry,SSS,eps);
lopsided_kodis(ex,X,Y,Z,Ayz,Ayz_rhs,betax,betay,betaz,Symmetry,SAA,eps);
lopsided_kodis(ex,X,Y,Z,Azz,Azz_rhs,betax,betay,betaz,Symmetry,SSS,eps);
lopsided_kodis(ex,X,Y,Z,chi,chi_rhs,betax,betay,betaz,Symmetry,SSS,eps);
lopsided_kodis(ex,X,Y,Z,trK,trK_rhs,betax,betay,betaz,Symmetry,SSS,eps);
lopsided_kodis(ex,X,Y,Z,Gamx,Gamx_rhs,betax,betay,betaz,Symmetry,ASS,eps);
lopsided_kodis(ex,X,Y,Z,Gamy,Gamy_rhs,betax,betay,betaz,Symmetry,SAS,eps);
BSSN_OMP_TASK_GROUP_BEGIN
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,dxx,gxx_rhs,betax,betay,betaz,Symmetry,SSS,eps))
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,Gamz,Gamz_rhs,betax,betay,betaz,Symmetry,SSA,eps))
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,gxy,gxy_rhs,betax,betay,betaz,Symmetry,AAS,eps))
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,Lap,Lap_rhs,betax,betay,betaz,Symmetry,SSS,eps))
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,gxz,gxz_rhs,betax,betay,betaz,Symmetry,ASA,eps))
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,betax,betax_rhs,betax,betay,betaz,Symmetry,ASS,eps))
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,dyy,gyy_rhs,betax,betay,betaz,Symmetry,SSS,eps))
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,betay,betay_rhs,betax,betay,betaz,Symmetry,SAS,eps))
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,gyz,gyz_rhs,betax,betay,betaz,Symmetry,SAA,eps))
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,betaz,betaz_rhs,betax,betay,betaz,Symmetry,SSA,eps))
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,dzz,gzz_rhs,betax,betay,betaz,Symmetry,SSS,eps))
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,dtSfx,dtSfx_rhs,betax,betay,betaz,Symmetry,ASS,eps))
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,Axx,Axx_rhs,betax,betay,betaz,Symmetry,SSS,eps))
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,dtSfy,dtSfy_rhs,betax,betay,betaz,Symmetry,SAS,eps))
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,Axy,Axy_rhs,betax,betay,betaz,Symmetry,AAS,eps))
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,dtSfz,dtSfz_rhs,betax,betay,betaz,Symmetry,SSA,eps))
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,Axz,Axz_rhs,betax,betay,betaz,Symmetry,ASA,eps))
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,Ayy,Ayy_rhs,betax,betay,betaz,Symmetry,SSS,eps))
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,Ayz,Ayz_rhs,betax,betay,betaz,Symmetry,SAA,eps))
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,Azz,Azz_rhs,betax,betay,betaz,Symmetry,SSS,eps))
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,chi,chi_rhs,betax,betay,betaz,Symmetry,SSS,eps))
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,trK,trK_rhs,betax,betay,betaz,Symmetry,SSS,eps))
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,Gamx,Gamx_rhs,betax,betay,betaz,Symmetry,ASS,eps))
BSSN_OMP_TASK_CALL(lopsided_kodis(ex,X,Y,Z,Gamy,Gamy_rhs,betax,betay,betaz,Symmetry,SAS,eps))
BSSN_OMP_TASK_GROUP_END
// 2ms //
if(co==0){
for (int i=0;i<all;i+=1) {
@@ -1219,12 +1154,14 @@ int f_compute_rhs_bssn(int *ex, double &T,
}
// 1ms //
fderivs(ex,Axx,gxxx,gxxy,gxxz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0);
fderivs(ex,Axy,gxyx,gxyy,gxyz,X,Y,Z,ANTI,ANTI,SYM ,Symmetry,0);
fderivs(ex,Axz,gxzx,gxzy,gxzz,X,Y,Z,ANTI,SYM ,ANTI,Symmetry,0);
fderivs(ex,Ayy,gyyx,gyyy,gyyz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0);
fderivs(ex,Ayz,gyzx,gyzy,gyzz,X,Y,Z,SYM ,ANTI,ANTI,Symmetry,0);
fderivs(ex,Azz,gzzx,gzzy,gzzz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0);
BSSN_OMP_TASK_GROUP_BEGIN
BSSN_OMP_TASK_CALL(fderivs(ex,Axx,gxxx,gxxy,gxxz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0))
BSSN_OMP_TASK_CALL(fderivs(ex,Axy,gxyx,gxyy,gxyz,X,Y,Z,ANTI,ANTI,SYM ,Symmetry,0))
BSSN_OMP_TASK_CALL(fderivs(ex,Axz,gxzx,gxzy,gxzz,X,Y,Z,ANTI,SYM ,ANTI,Symmetry,0))
BSSN_OMP_TASK_CALL(fderivs(ex,Ayy,gyyx,gyyy,gyyz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0))
BSSN_OMP_TASK_CALL(fderivs(ex,Ayz,gyzx,gyzy,gyzz,X,Y,Z,SYM ,ANTI,ANTI,Symmetry,0))
BSSN_OMP_TASK_CALL(fderivs(ex,Azz,gzzx,gzzy,gzzz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0))
BSSN_OMP_TASK_GROUP_END
// 7ms //
for (int i=0;i<all;i+=1) {
gxxx[i] = gxxx[i] - ( Gamxxx[i] * Axx[i] + Gamyxx[i] * Axy[i] + Gamzxx[i] * Axz[i]
@@ -1279,7 +1216,6 @@ int f_compute_rhs_bssn(int *ex, double &T,
movz_Res[i] = movz_Res[i] - F2o3*Kz[i] - F8*PI*Sz[i];
}
}
RHS_KERNEL_TIMER_ADD(KB_KO_CONSTRAINT, timer_ko_constraint);

View File

@@ -1,58 +1,58 @@
#ifndef _CCTK_H_
#define _CCTK_H_ 1
/* Grab the main configuration info. */
#include "cctk_Config.h"
#define CCTK_THORNSTRING "AHFinderDirect"
/* Include the constants */
#include "cctk_Constants.h"
/* get the definition of ptrdiff_t */
#include <stddef.h>
int CCTK_VInfo(const char *thorn, const char *format, ...);
int CCTK_VWarn(int level,
int line,
const char *file,
const char *thorn,
const char *format,
...);
#define CCTK_ERROR_INTERP_GHOST_SIZE_TOO_SMALL (-1001)
#ifdef __cplusplus
#define HAVE_INLINE
#else
#ifndef inline
#define HAVE_INLINE
#endif
#endif
#define CCTK_PRINTSEPARATOR \
printf("--------------------------------------------------------------------------------\n");
#define _DECLARE_CCTK_ARGUMENTS _DECLARE_CCTK_CARGUMENTS
#define _DECLARE_CCTK_CARGUMENTS \
ptrdiff_t cctki_dummy_int; \
CCTK_REAL cctk_time = cctkGH->PhysTime; \
int cctk_iteration = 1; \
int cctk_dim = 3;
#define CCTK_EQUALS(a, b) (CCTK_Equals((a), (b)))
#define CCTK_PASS_CTOC cctkGH
#define CCTK_ORIGIN_SPACE(x) (cctk_origin_space[x] + cctk_delta_space[x] / cctk_levfac[x] * cctk_levoff[x] / cctk_levoffdenom[x])
#define CCTK_DELTA_SPACE(x) (cctk_delta_space[x] / cctk_levfac[x])
#define CCTK_DELTA_TIME (cctk_delta_time / cctk_timefac)
#define CCTK_LSSH(stag, dim) cctk_lssh[(stag) + CCTK_NSTAGGER * (dim)]
#define CCTK_LSSH_IDX(stag, dim) ((stag) + CCTK_NSTAGGER * (dim))
#define CCTK_WARN(a, b) CCTK_Warn(a, __LINE__, __FILE__, CCTK_THORNSTRING, b)
#define CCTK_MALLOC(s) CCTKi_Malloc(s, __LINE__, __FILE__)
#define CCTK_FREE(p) CCTKi_Free(p)
#define CCTK_INFO(a) CCTK_Info(CCTK_THORNSTRING, (a))
#define CCTK_PARAMWARN(a) CCTK_ParamWarn(CCTK_THORNSTRING, (a))
#endif
#ifndef _CCTK_H_
#define _CCTK_H_ 1
/* Grab the main configuration info. */
#include "cctk_Config.h"
#define CCTK_THORNSTRING "AHFinderDirect"
/* Include the constants */
#include "cctk_Constants.h"
/* get the definition of ptrdiff_t */
#include <stddef.h>
int CCTK_VInfo(const char *thorn, const char *format, ...);
int CCTK_VWarn(int level,
int line,
const char *file,
const char *thorn,
const char *format,
...);
#define CCTK_ERROR_INTERP_GHOST_SIZE_TOO_SMALL (-1001)
#ifdef __cplusplus
#define HAVE_INLINE
#else
#ifndef inline
#define HAVE_INLINE
#endif
#endif
#define CCTK_PRINTSEPARATOR \
printf("--------------------------------------------------------------------------------\n");
#define _DECLARE_CCTK_ARGUMENTS _DECLARE_CCTK_CARGUMENTS
#define _DECLARE_CCTK_CARGUMENTS \
ptrdiff_t cctki_dummy_int; \
CCTK_REAL cctk_time = cctkGH->PhysTime; \
int cctk_iteration = 1; \
int cctk_dim = 3;
#define CCTK_EQUALS(a, b) (CCTK_Equals((a), (b)))
#define CCTK_PASS_CTOC cctkGH
#define CCTK_ORIGIN_SPACE(x) (cctk_origin_space[x] + cctk_delta_space[x] / cctk_levfac[x] * cctk_levoff[x] / cctk_levoffdenom[x])
#define CCTK_DELTA_SPACE(x) (cctk_delta_space[x] / cctk_levfac[x])
#define CCTK_DELTA_TIME (cctk_delta_time / cctk_timefac)
#define CCTK_LSSH(stag, dim) cctk_lssh[(stag) + CCTK_NSTAGGER * (dim)]
#define CCTK_LSSH_IDX(stag, dim) ((stag) + CCTK_NSTAGGER * (dim))
#define CCTK_WARN(a, b) CCTK_Warn(a, __LINE__, __FILE__, CCTK_THORNSTRING, b)
#define CCTK_MALLOC(s) CCTKi_Malloc(s, __LINE__, __FILE__)
#define CCTK_FREE(p) CCTKi_Free(p)
#define CCTK_INFO(a) CCTK_Info(CCTK_THORNSTRING, (a))
#define CCTK_PARAMWARN(a) CCTK_ParamWarn(CCTK_THORNSTRING, (a))
#endif

View File

@@ -1,168 +1,168 @@
#ifndef _CCTK_CONFIG_H_
#define _CCTK_CONFIG_H_
#define STDC_HEADERS 1
#define CCTK_FCALL
#define HAVE_GETHOSTBYNAME 1
#define HAVE_GETOPT_LONG_ONLY 1
#define HAVE_CRYPT 1
#define HAVE_FINITE 1
#define HAVE_ISNAN 1
#define HAVE_ISINF 1
#define HAVE_MKSTEMP 1
#define HAVE_VA_COPY 1
/* Do we have mode_t ? */
#define HAVE_MODE_T 1
#define HAVE_SOCKLEN_T 1
#ifdef HAVE_SOCKLEN_T
# define CCTK_SOCKLEN_T socklen_t
#else
# define CCTK_SOCKLEN_T int
#endif
#define HAVE_TIME_H 1
#define HAVE_SYS_IOCTL_H 1
#define HAVE_SYS_SOCKET_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_UNISTD_H 1
#define HAVE_STRING_H 1
#define HAVE_ASSERT_H 1
#define HAVE_TGMATH_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_GETOPT_H 1
#define HAVE_REGEX_H 1
#define HAVE_NETINET_IN_H 1
#define HAVE_NETDB_H 1
#define HAVE_ARPA_INET_H 1
#define HAVE_CRYPT_H 1
#define HAVE_DIRENT_H 1
#define HAVE_SIGNAL_H 1
#define HAVE_MALLOC_H 1
#define HAVE_MALLINFO 1
#define HAVE_MALLOPT 1
#define HAVE_M_MMAP_THRESHOLD_VALUE 1
#define TIME_WITH_SYS_TIME 1
#define HAVE_VECTOR 1
#define HAVE_VECTOR_H 1
#define GETTIMEOFDAY_NEEDS_TIMEZONE 1
#define CCTK_CACHELINE_BYTES 64
#define CCTK_CACHE_SIZE 1024*1024
#define NULL_DEVICE "/dev/null"
#define CCTK_BUILD_OS "linux-gnu"
#define CCTK_BUILD_CPU "x86_64"
#define CCTK_BUILD_VENDOR "unknown"
#define SIZEOF_SHORT_INT 2
#define SIZEOF_INT 4
#define SIZEOF_LONG_INT 8
#define SIZEOF_LONG_LONG 8
#define SIZEOF_LONG_DOUBLE 16
#define SIZEOF_DOUBLE 8
#define SIZEOF_FLOAT 4
#define SIZEOF_CHAR_P 8
#define CCTK_REAL_PRECISION_8 1
#define CCTK_INTEGER_PRECISION_4 1
#define HAVE_CCTK_INT8 1
#define HAVE_CCTK_INT4 1
#define HAVE_CCTK_INT2 1
#define HAVE_CCTK_INT1 1
#define HAVE_CCTK_REAL16 1
#define HAVE_CCTK_REAL8 1
#define HAVE_CCTK_REAL4 1
#define CCTK_INT8 long int
#define CCTK_INT4 int
#define CCTK_INT2 short int
#define CCTK_INT1 signed char
#define CCTK_REAL16 long double
#define CCTK_REAL8 double
#define CCTK_REAL4 float
#ifndef __cplusplus
#ifdef CCTK_C_RESTRICT
#define restrict CCTK_C_RESTRICT
#endif
/* Allow the use of CCTK_RESTRICT as a qualifier always. */
#ifdef CCTK_C_RESTRICT
#define CCTK_RESTRICT CCTK_C_RESTRICT
#else
#define CCTK_RESTRICT restrict
#endif
#ifdef HAVE_CCTK_C_BOOL
#define CCTK_HAVE_C_BOOL
#endif
#endif /* ! defined __cplusplus */
/****************************************************************************/
/****************************************************************************/
/* C++ specific stuff */
/****************************************************************************/
#ifdef __cplusplus
/* Some C++ compilers don't have bool ! */
#define HAVE_CCTK_CXX_BOOL 1
#ifndef HAVE_CCTK_CXX_BOOL
typedef enum {false, true} bool;
#else
/* deprecated in beta15 */
#define CCTK_HAVE_CXX_BOOL
#endif
/* Some C++ compilers recognise the restrict keyword */
#define CCTK_CXX_RESTRICT __restrict__
/* Since this is non-standard leave commented out for the moment */
#if 0
/* Define to empty if the keyword does not work. */
#ifdef CCTK_CXX_RESTRICT
#define restrict CCTK_CXX_RESTRICT
#endif
#endif
/* Allow the use of CCTK_RESTRICT as a qualifier always. */
#ifdef CCTK_CXX_RESTRICT
#define CCTK_RESTRICT CCTK_CXX_RESTRICT
#else
#define CCTK_RESTRICT restrict
#endif
#endif /* __cplusplus */
/****************************************************************************/
#ifdef FCODE
#define HAVE_CCTK_FORTRAN_REAL4 1
#define HAVE_CCTK_FORTRAN_REAL8 1
#define HAVE_CCTK_FORTRAN_REAL16 1
#define HAVE_CCTK_FORTRAN_COMPLEX8 1
#define HAVE_CCTK_FORTRAN_COMPLEX16 1
#define HAVE_CCTK_FORTRAN_COMPLEX32 1
#endif /* FCODE */
/* Now include the code to pick an appropriate precison for reals and ints */
#include "cctk_Types.h"
#endif /* _CCTK_CONFIG_H_ */
#ifndef _CCTK_CONFIG_H_
#define _CCTK_CONFIG_H_
#define STDC_HEADERS 1
#define CCTK_FCALL
#define HAVE_GETHOSTBYNAME 1
#define HAVE_GETOPT_LONG_ONLY 1
#define HAVE_CRYPT 1
#define HAVE_FINITE 1
#define HAVE_ISNAN 1
#define HAVE_ISINF 1
#define HAVE_MKSTEMP 1
#define HAVE_VA_COPY 1
/* Do we have mode_t ? */
#define HAVE_MODE_T 1
#define HAVE_SOCKLEN_T 1
#ifdef HAVE_SOCKLEN_T
# define CCTK_SOCKLEN_T socklen_t
#else
# define CCTK_SOCKLEN_T int
#endif
#define HAVE_TIME_H 1
#define HAVE_SYS_IOCTL_H 1
#define HAVE_SYS_SOCKET_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_UNISTD_H 1
#define HAVE_STRING_H 1
#define HAVE_ASSERT_H 1
#define HAVE_TGMATH_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_GETOPT_H 1
#define HAVE_REGEX_H 1
#define HAVE_NETINET_IN_H 1
#define HAVE_NETDB_H 1
#define HAVE_ARPA_INET_H 1
#define HAVE_CRYPT_H 1
#define HAVE_DIRENT_H 1
#define HAVE_SIGNAL_H 1
#define HAVE_MALLOC_H 1
#define HAVE_MALLINFO 1
#define HAVE_MALLOPT 1
#define HAVE_M_MMAP_THRESHOLD_VALUE 1
#define TIME_WITH_SYS_TIME 1
#define HAVE_VECTOR 1
#define HAVE_VECTOR_H 1
#define GETTIMEOFDAY_NEEDS_TIMEZONE 1
#define CCTK_CACHELINE_BYTES 64
#define CCTK_CACHE_SIZE 1024*1024
#define NULL_DEVICE "/dev/null"
#define CCTK_BUILD_OS "linux-gnu"
#define CCTK_BUILD_CPU "x86_64"
#define CCTK_BUILD_VENDOR "unknown"
#define SIZEOF_SHORT_INT 2
#define SIZEOF_INT 4
#define SIZEOF_LONG_INT 8
#define SIZEOF_LONG_LONG 8
#define SIZEOF_LONG_DOUBLE 16
#define SIZEOF_DOUBLE 8
#define SIZEOF_FLOAT 4
#define SIZEOF_CHAR_P 8
#define CCTK_REAL_PRECISION_8 1
#define CCTK_INTEGER_PRECISION_4 1
#define HAVE_CCTK_INT8 1
#define HAVE_CCTK_INT4 1
#define HAVE_CCTK_INT2 1
#define HAVE_CCTK_INT1 1
#define HAVE_CCTK_REAL16 1
#define HAVE_CCTK_REAL8 1
#define HAVE_CCTK_REAL4 1
#define CCTK_INT8 long int
#define CCTK_INT4 int
#define CCTK_INT2 short int
#define CCTK_INT1 signed char
#define CCTK_REAL16 long double
#define CCTK_REAL8 double
#define CCTK_REAL4 float
#ifndef __cplusplus
#ifdef CCTK_C_RESTRICT
#define restrict CCTK_C_RESTRICT
#endif
/* Allow the use of CCTK_RESTRICT as a qualifier always. */
#ifdef CCTK_C_RESTRICT
#define CCTK_RESTRICT CCTK_C_RESTRICT
#else
#define CCTK_RESTRICT restrict
#endif
#ifdef HAVE_CCTK_C_BOOL
#define CCTK_HAVE_C_BOOL
#endif
#endif /* ! defined __cplusplus */
/****************************************************************************/
/****************************************************************************/
/* C++ specific stuff */
/****************************************************************************/
#ifdef __cplusplus
/* Some C++ compilers don't have bool ! */
#define HAVE_CCTK_CXX_BOOL 1
#ifndef HAVE_CCTK_CXX_BOOL
typedef enum {false, true} bool;
#else
/* deprecated in beta15 */
#define CCTK_HAVE_CXX_BOOL
#endif
/* Some C++ compilers recognise the restrict keyword */
#define CCTK_CXX_RESTRICT __restrict__
/* Since this is non-standard leave commented out for the moment */
#if 0
/* Define to empty if the keyword does not work. */
#ifdef CCTK_CXX_RESTRICT
#define restrict CCTK_CXX_RESTRICT
#endif
#endif
/* Allow the use of CCTK_RESTRICT as a qualifier always. */
#ifdef CCTK_CXX_RESTRICT
#define CCTK_RESTRICT CCTK_CXX_RESTRICT
#else
#define CCTK_RESTRICT restrict
#endif
#endif /* __cplusplus */
/****************************************************************************/
#ifdef FCODE
#define HAVE_CCTK_FORTRAN_REAL4 1
#define HAVE_CCTK_FORTRAN_REAL8 1
#define HAVE_CCTK_FORTRAN_REAL16 1
#define HAVE_CCTK_FORTRAN_COMPLEX8 1
#define HAVE_CCTK_FORTRAN_COMPLEX16 1
#define HAVE_CCTK_FORTRAN_COMPLEX32 1
#endif /* FCODE */
/* Now include the code to pick an appropriate precison for reals and ints */
#include "cctk_Types.h"
#endif /* _CCTK_CONFIG_H_ */

View File

@@ -1,57 +1,57 @@
#ifndef _CCTK_CONSTANTS_H_
#define _CCTK_CONSTANTS_H_
#define CCTK_VARIABLE_VOID 100
#define CCTK_VARIABLE_BYTE 101
#define CCTK_VARIABLE_INT 102
#define CCTK_VARIABLE_INT1 103
#define CCTK_VARIABLE_INT2 104
#define CCTK_VARIABLE_INT4 105
#define CCTK_VARIABLE_INT8 106
#define CCTK_VARIABLE_REAL 107
#define CCTK_VARIABLE_REAL4 108
#define CCTK_VARIABLE_REAL8 109
#define CCTK_VARIABLE_REAL16 110
#define CCTK_VARIABLE_COMPLEX 111
#define CCTK_VARIABLE_COMPLEX8 112
#define CCTK_VARIABLE_COMPLEX16 113
#define CCTK_VARIABLE_COMPLEX32 114
#define CCTK_VARIABLE_CHAR 115
#define CCTK_VARIABLE_STRING 116
#define CCTK_VARIABLE_POINTER 117
#define CCTK_VARIABLE_POINTER_TO_CONST 118
#define CCTK_VARIABLE_FPOINTER 119
/* DEPRECATED IN BETA 12 */
#define CCTK_VARIABLE_FN_POINTER CCTK_VARIABLE_FPOINTER
/* steerable status of parameters */
#define CCTK_STEERABLE_NEVER 200
#define CCTK_STEERABLE_ALWAYS 201
#define CCTK_STEERABLE_RECOVER 202
/* number of staggerings */
#define CCTK_NSTAGGER 3
/* group distributions */
#define CCTK_DISTRIB_CONSTANT 301
#define CCTK_DISTRIB_DEFAULT 302
/* group types */
#define CCTK_SCALAR 401
#define CCTK_GF 402
#define CCTK_ARRAY 403
/* group scopes */
#define CCTK_PRIVATE 501
#define CCTK_PROTECTED 502
#define CCTK_PUBLIC 503
/* constants for CCTK_TraverseString() */
#define CCTK_VAR 601
#define CCTK_GROUP 602
#define CCTK_GROUP_OR_VAR 603
#endif /* _CCTK_CONSTANTS_ */
#ifndef _CCTK_CONSTANTS_H_
#define _CCTK_CONSTANTS_H_
#define CCTK_VARIABLE_VOID 100
#define CCTK_VARIABLE_BYTE 101
#define CCTK_VARIABLE_INT 102
#define CCTK_VARIABLE_INT1 103
#define CCTK_VARIABLE_INT2 104
#define CCTK_VARIABLE_INT4 105
#define CCTK_VARIABLE_INT8 106
#define CCTK_VARIABLE_REAL 107
#define CCTK_VARIABLE_REAL4 108
#define CCTK_VARIABLE_REAL8 109
#define CCTK_VARIABLE_REAL16 110
#define CCTK_VARIABLE_COMPLEX 111
#define CCTK_VARIABLE_COMPLEX8 112
#define CCTK_VARIABLE_COMPLEX16 113
#define CCTK_VARIABLE_COMPLEX32 114
#define CCTK_VARIABLE_CHAR 115
#define CCTK_VARIABLE_STRING 116
#define CCTK_VARIABLE_POINTER 117
#define CCTK_VARIABLE_POINTER_TO_CONST 118
#define CCTK_VARIABLE_FPOINTER 119
/* DEPRECATED IN BETA 12 */
#define CCTK_VARIABLE_FN_POINTER CCTK_VARIABLE_FPOINTER
/* steerable status of parameters */
#define CCTK_STEERABLE_NEVER 200
#define CCTK_STEERABLE_ALWAYS 201
#define CCTK_STEERABLE_RECOVER 202
/* number of staggerings */
#define CCTK_NSTAGGER 3
/* group distributions */
#define CCTK_DISTRIB_CONSTANT 301
#define CCTK_DISTRIB_DEFAULT 302
/* group types */
#define CCTK_SCALAR 401
#define CCTK_GF 402
#define CCTK_ARRAY 403
/* group scopes */
#define CCTK_PRIVATE 501
#define CCTK_PROTECTED 502
#define CCTK_PUBLIC 503
/* constants for CCTK_TraverseString() */
#define CCTK_VAR 601
#define CCTK_GROUP 602
#define CCTK_GROUP_OR_VAR 603
#endif /* _CCTK_CONSTANTS_ */

View File

@@ -1,180 +1,180 @@
#ifndef _CCTK_TYPES_H_
#define _CCTK_TYPES_H_
#ifndef _CCTK_CONFIG_H_
#include "cctk_Config.h"
#endif
typedef void *CCTK_POINTER;
typedef const void *CCTK_POINTER_TO_CONST;
typedef void (*CCTK_FPOINTER)(void);
#define HAVE_CCTK_POINTER 1
#define HAVE_CCTK_POINTER_TO_CONST 1
#define HAVE_CCTK_FPOINTER 1
/* Character types */
typedef char CCTK_CHAR;
typedef const char * CCTK_STRING;
#define HAVE_CCTK_CHAR 1
#define HAVE_CCTK_STRING 1
/* Structures for complex types */
#ifdef HAVE_CCTK_REAL16
#define HAVE_CCTK_COMPLEX32 1
typedef struct CCTK_COMPLEX32
{
CCTK_REAL16 Re;
CCTK_REAL16 Im;
#ifdef __cplusplus
CCTK_REAL16 real() const { return Re; }
CCTK_REAL16 imag() const { return Im; }
#endif
} CCTK_COMPLEX32;
#endif
#ifdef HAVE_CCTK_REAL8
#define HAVE_CCTK_COMPLEX16 1
typedef struct CCTK_COMPLEX16
{
CCTK_REAL8 Re;
CCTK_REAL8 Im;
#ifdef __cplusplus
CCTK_REAL8 real() const { return Re; }
CCTK_REAL8 imag() const { return Im; }
#endif
} CCTK_COMPLEX16;
#endif
#ifdef HAVE_CCTK_REAL4
#define HAVE_CCTK_COMPLEX8 1
typedef struct CCTK_COMPLEX8
{
CCTK_REAL4 Re;
CCTK_REAL4 Im;
#ifdef __cplusplus
CCTK_REAL4 real() const { return Re; }
CCTK_REAL4 imag() const { return Im; }
#endif
} CCTK_COMPLEX8;
#endif
/* Small positive integer type */
typedef unsigned char CCTK_BYTE;
#define HAVE_CCTK_BYTE 1
/* Define stuff for fortran. */
#ifdef FCODE
#define CCTK_POINTER integer*SIZEOF_CHAR_P
#define CCTK_POINTER_TO_CONST integer*SIZEOF_CHAR_P
/* TODO: add autoconf for determining the size of function pointers */
#define CCTK_FPOINTER integer*SIZEOF_CHAR_P
#define HAVE_CCTK_POINTER 1
#define HAVE_CCTK_POINTER_TO_CONST 1
#define HAVE_CCTK_FPOINTER 1
/* Character types */
/* A single character does not exist in Fortran; in Fortran, all
character types are strings. Hence we do not define CCTK_CHAR. */
/* #define CCTK_CHAR CHARACTER */
/* #define HAVE_CCTK_CHAR 1 */
/* This is a C-string, i.e., only a pointer */
#define CCTK_STRING CCTK_POINTER_TO_CONST
#define HAVE_CCTK_STRING 1
#ifdef HAVE_CCTK_INT8
#define CCTK_INT8 INTEGER*8
#endif
#ifdef HAVE_CCTK_INT4
#define CCTK_INT4 INTEGER*4
#endif
#ifdef HAVE_CCTK_INT2
#define CCTK_INT2 INTEGER*2
#endif
#ifdef HAVE_CCTK_INT1
#define CCTK_INT1 INTEGER*1
#endif
#ifdef HAVE_CCTK_REAL16
#define CCTK_REAL16 REAL*16
#define HAVE_CCTK_COMPLEX32 1
#define CCTK_COMPLEX32 COMPLEX*32
#endif
#ifdef HAVE_CCTK_REAL8
#define CCTK_REAL8 REAL*8
#define HAVE_CCTK_COMPLEX16 1
#define CCTK_COMPLEX16 COMPLEX*16
#endif
#ifdef HAVE_CCTK_REAL4
#define CCTK_REAL4 REAL*4
#define HAVE_CCTK_COMPLEX8 1
#define CCTK_COMPLEX8 COMPLEX*8
#endif
/* Should be unsigned, but Fortran doesn't have that */
#define CCTK_BYTE INTEGER*1
#define HAVE_CCTK_BYTE 1
#endif /*FCODE */
/* Now pick the types based upon the precision variable. */
/* Floating point precision */
#ifdef CCTK_REAL_PRECISION_16
#define CCTK_REAL_PRECISION 16
#define CCTK_REAL CCTK_REAL16
#endif
#ifdef CCTK_REAL_PRECISION_8
#define CCTK_REAL_PRECISION 8
#define CCTK_REAL CCTK_REAL8
#endif
#ifdef CCTK_REAL_PRECISION_4
#define CCTK_REAL_PRECISION 4
#define CCTK_REAL CCTK_REAL4
#endif
/* Integer precision */
#ifdef CCTK_INTEGER_PRECISION_8
#define CCTK_INTEGER_PRECISION 8
#define CCTK_INT CCTK_INT8
#endif
#ifdef CCTK_INTEGER_PRECISION_4
#define CCTK_INTEGER_PRECISION 4
#define CCTK_INT CCTK_INT4
#endif
#ifdef CCTK_INTEGER_PRECISION_2
#define CCTK_INTEGER_PRECISION 2
#define CCTK_INT CCTK_INT2
#endif
#ifdef CCTK_INTEGER_PRECISION_1
#define CCTK_INTEGER_PRECISION 1
#define CCTK_INT CCTK_INT1
#endif
/* Complex precision */
#ifdef CCTK_REAL_PRECISION_16
#define CCTK_COMPLEX_PRECISION 32
#define CCTK_COMPLEX CCTK_COMPLEX32
#endif
#ifdef CCTK_REAL_PRECISION_8
#define CCTK_COMPLEX_PRECISION 16
#define CCTK_COMPLEX CCTK_COMPLEX16
#endif
#ifdef CCTK_REAL_PRECISION_4
#define CCTK_COMPLEX_PRECISION 8
#define CCTK_COMPLEX CCTK_COMPLEX8
#endif
#endif /*_CCTK_TYPES_H_ */
#ifndef _CCTK_TYPES_H_
#define _CCTK_TYPES_H_
#ifndef _CCTK_CONFIG_H_
#include "cctk_Config.h"
#endif
typedef void *CCTK_POINTER;
typedef const void *CCTK_POINTER_TO_CONST;
typedef void (*CCTK_FPOINTER)(void);
#define HAVE_CCTK_POINTER 1
#define HAVE_CCTK_POINTER_TO_CONST 1
#define HAVE_CCTK_FPOINTER 1
/* Character types */
typedef char CCTK_CHAR;
typedef const char * CCTK_STRING;
#define HAVE_CCTK_CHAR 1
#define HAVE_CCTK_STRING 1
/* Structures for complex types */
#ifdef HAVE_CCTK_REAL16
#define HAVE_CCTK_COMPLEX32 1
typedef struct CCTK_COMPLEX32
{
CCTK_REAL16 Re;
CCTK_REAL16 Im;
#ifdef __cplusplus
CCTK_REAL16 real() const { return Re; }
CCTK_REAL16 imag() const { return Im; }
#endif
} CCTK_COMPLEX32;
#endif
#ifdef HAVE_CCTK_REAL8
#define HAVE_CCTK_COMPLEX16 1
typedef struct CCTK_COMPLEX16
{
CCTK_REAL8 Re;
CCTK_REAL8 Im;
#ifdef __cplusplus
CCTK_REAL8 real() const { return Re; }
CCTK_REAL8 imag() const { return Im; }
#endif
} CCTK_COMPLEX16;
#endif
#ifdef HAVE_CCTK_REAL4
#define HAVE_CCTK_COMPLEX8 1
typedef struct CCTK_COMPLEX8
{
CCTK_REAL4 Re;
CCTK_REAL4 Im;
#ifdef __cplusplus
CCTK_REAL4 real() const { return Re; }
CCTK_REAL4 imag() const { return Im; }
#endif
} CCTK_COMPLEX8;
#endif
/* Small positive integer type */
typedef unsigned char CCTK_BYTE;
#define HAVE_CCTK_BYTE 1
/* Define stuff for fortran. */
#ifdef FCODE
#define CCTK_POINTER integer*SIZEOF_CHAR_P
#define CCTK_POINTER_TO_CONST integer*SIZEOF_CHAR_P
/* TODO: add autoconf for determining the size of function pointers */
#define CCTK_FPOINTER integer*SIZEOF_CHAR_P
#define HAVE_CCTK_POINTER 1
#define HAVE_CCTK_POINTER_TO_CONST 1
#define HAVE_CCTK_FPOINTER 1
/* Character types */
/* A single character does not exist in Fortran; in Fortran, all
character types are strings. Hence we do not define CCTK_CHAR. */
/* #define CCTK_CHAR CHARACTER */
/* #define HAVE_CCTK_CHAR 1 */
/* This is a C-string, i.e., only a pointer */
#define CCTK_STRING CCTK_POINTER_TO_CONST
#define HAVE_CCTK_STRING 1
#ifdef HAVE_CCTK_INT8
#define CCTK_INT8 INTEGER*8
#endif
#ifdef HAVE_CCTK_INT4
#define CCTK_INT4 INTEGER*4
#endif
#ifdef HAVE_CCTK_INT2
#define CCTK_INT2 INTEGER*2
#endif
#ifdef HAVE_CCTK_INT1
#define CCTK_INT1 INTEGER*1
#endif
#ifdef HAVE_CCTK_REAL16
#define CCTK_REAL16 REAL*16
#define HAVE_CCTK_COMPLEX32 1
#define CCTK_COMPLEX32 COMPLEX*32
#endif
#ifdef HAVE_CCTK_REAL8
#define CCTK_REAL8 REAL*8
#define HAVE_CCTK_COMPLEX16 1
#define CCTK_COMPLEX16 COMPLEX*16
#endif
#ifdef HAVE_CCTK_REAL4
#define CCTK_REAL4 REAL*4
#define HAVE_CCTK_COMPLEX8 1
#define CCTK_COMPLEX8 COMPLEX*8
#endif
/* Should be unsigned, but Fortran doesn't have that */
#define CCTK_BYTE INTEGER*1
#define HAVE_CCTK_BYTE 1
#endif /*FCODE */
/* Now pick the types based upon the precision variable. */
/* Floating point precision */
#ifdef CCTK_REAL_PRECISION_16
#define CCTK_REAL_PRECISION 16
#define CCTK_REAL CCTK_REAL16
#endif
#ifdef CCTK_REAL_PRECISION_8
#define CCTK_REAL_PRECISION 8
#define CCTK_REAL CCTK_REAL8
#endif
#ifdef CCTK_REAL_PRECISION_4
#define CCTK_REAL_PRECISION 4
#define CCTK_REAL CCTK_REAL4
#endif
/* Integer precision */
#ifdef CCTK_INTEGER_PRECISION_8
#define CCTK_INTEGER_PRECISION 8
#define CCTK_INT CCTK_INT8
#endif
#ifdef CCTK_INTEGER_PRECISION_4
#define CCTK_INTEGER_PRECISION 4
#define CCTK_INT CCTK_INT4
#endif
#ifdef CCTK_INTEGER_PRECISION_2
#define CCTK_INTEGER_PRECISION 2
#define CCTK_INT CCTK_INT2
#endif
#ifdef CCTK_INTEGER_PRECISION_1
#define CCTK_INTEGER_PRECISION 1
#define CCTK_INT CCTK_INT1
#endif
/* Complex precision */
#ifdef CCTK_REAL_PRECISION_16
#define CCTK_COMPLEX_PRECISION 32
#define CCTK_COMPLEX CCTK_COMPLEX32
#endif
#ifdef CCTK_REAL_PRECISION_8
#define CCTK_COMPLEX_PRECISION 16
#define CCTK_COMPLEX CCTK_COMPLEX16
#endif
#ifdef CCTK_REAL_PRECISION_4
#define CCTK_COMPLEX_PRECISION 8
#define CCTK_COMPLEX CCTK_COMPLEX8
#endif
#endif /*_CCTK_TYPES_H_ */

File diff suppressed because it is too large Load Diff

View File

@@ -1,92 +1,92 @@
#ifndef CGH_H
#define CGH_H
#include <mpi.h>
#include "MyList.h"
#include "MPatch.h"
#include "macrodef.h"
#include "monitor.h"
#include "Parallel.h"
class cgh
{
public:
int levels, movls, BH_num_in;
// information of boxes
int *grids;
double ***bbox;
int ***shape;
double ***handle;
double ***Porgls;
double *Lt;
// information of Patch list
MyList<Patch> **PatL;
// information of OutBdLow2Hi point list and Restrict point list
#if (RPB == 1)
MyList<Parallel::pointstru_bam> **bdsul, **rsul;
#endif
#if (PSTR == 1 || PSTR == 2 || PSTR == 3)
int mylev;
int *start_rank, *end_rank;
MPI_Comm *Commlev;
#endif
protected:
int ingfs, fngfs;
static constexpr double ratio = 0.75;
int trfls;
public:
cgh(int ingfsi, int fngfsi, int Symmetry, char *filename, int checkrun, monitor *ErrorMonitor);
~cgh();
void compose_cgh(int nprocs);
void sethandle(monitor *ErrorMonitor);
void checkPatchList(MyList<Patch> *PatL, bool buflog);
void Regrid(int Symmetry, int BH_num, double **Porgbr, double **Porg0,
MyList<var> *OldList, MyList<var> *StateList,
MyList<var> *FutureList, MyList<var> *tmList, bool BB,
monitor *ErrorMonitor);
void Regrid_fake(int Symmetry, int BH_num, double **Porgbr, double **Porg0,
MyList<var> *OldList, MyList<var> *StateList,
MyList<var> *FutureList, MyList<var> *tmList, bool BB,
monitor *ErrorMonitor);
void recompose_cgh(int nprocs, bool *lev_flag,
MyList<var> *OldList, MyList<var> *StateList,
MyList<var> *FutureList, MyList<var> *tmList,
int Symmetry, bool BB);
void recompose_cgh_fake(int nprocs, bool *lev_flag,
MyList<var> *OldList, MyList<var> *StateList,
MyList<var> *FutureList, MyList<var> *tmList,
int Symmetry, bool BB);
void read_bbox(int Symmetry, char *filename);
MyList<Patch> *construct_patchlist(int lev, int Symmetry);
bool Interp_One_Point(MyList<var> *VarList,
double *XX, /*input global Cartesian coordinate*/
double *Shellf, int Symmetry);
void recompose_cgh_Onelevel(int nprocs, int lev,
MyList<var> *OldList, MyList<var> *StateList,
MyList<var> *FutureList, MyList<var> *tmList,
int Symmetry, bool BB);
bool Regrid_Onelevel(int lev, int Symmetry, int BH_num, double **Porgbr, double **Porg0,
MyList<var> *OldList, MyList<var> *StateList,
MyList<var> *FutureList, MyList<var> *tmList, bool BB,
monitor *ErrorMonitor);
void Regrid_Onelevel_aux(int lev, int Symmetry, int BH_num, double **Porgbr, double **Porg0,
MyList<var> *OldList, MyList<var> *StateList,
MyList<var> *FutureList, MyList<var> *tmList, bool BB,
monitor *ErrorMonitor);
void settrfls(const int lev);
#if (PSTR == 1 || PSTR == 2 || PSTR == 3)
void construct_mylev(int nprocs);
#endif
};
#endif /* CGH_H */
#ifndef CGH_H
#define CGH_H
#include <mpi.h>
#include "MyList.h"
#include "MPatch.h"
#include "macrodef.h"
#include "monitor.h"
#include "Parallel.h"
class cgh
{
public:
int levels, movls, BH_num_in;
// information of boxes
int *grids;
double ***bbox;
int ***shape;
double ***handle;
double ***Porgls;
double *Lt;
// information of Patch list
MyList<Patch> **PatL;
// information of OutBdLow2Hi point list and Restrict point list
#if (RPB == 1)
MyList<Parallel::pointstru_bam> **bdsul, **rsul;
#endif
#if (PSTR == 1 || PSTR == 2 || PSTR == 3)
int mylev;
int *start_rank, *end_rank;
MPI_Comm *Commlev;
#endif
protected:
int ingfs, fngfs;
static constexpr double ratio = 0.75;
int trfls;
public:
cgh(int ingfsi, int fngfsi, int Symmetry, char *filename, int checkrun, monitor *ErrorMonitor);
~cgh();
void compose_cgh(int nprocs);
void sethandle(monitor *ErrorMonitor);
void checkPatchList(MyList<Patch> *PatL, bool buflog);
void Regrid(int Symmetry, int BH_num, double **Porgbr, double **Porg0,
MyList<var> *OldList, MyList<var> *StateList,
MyList<var> *FutureList, MyList<var> *tmList, bool BB,
monitor *ErrorMonitor);
void Regrid_fake(int Symmetry, int BH_num, double **Porgbr, double **Porg0,
MyList<var> *OldList, MyList<var> *StateList,
MyList<var> *FutureList, MyList<var> *tmList, bool BB,
monitor *ErrorMonitor);
void recompose_cgh(int nprocs, bool *lev_flag,
MyList<var> *OldList, MyList<var> *StateList,
MyList<var> *FutureList, MyList<var> *tmList,
int Symmetry, bool BB);
void recompose_cgh_fake(int nprocs, bool *lev_flag,
MyList<var> *OldList, MyList<var> *StateList,
MyList<var> *FutureList, MyList<var> *tmList,
int Symmetry, bool BB);
void read_bbox(int Symmetry, char *filename);
MyList<Patch> *construct_patchlist(int lev, int Symmetry);
bool Interp_One_Point(MyList<var> *VarList,
double *XX, /*input global Cartesian coordinate*/
double *Shellf, int Symmetry);
void recompose_cgh_Onelevel(int nprocs, int lev,
MyList<var> *OldList, MyList<var> *StateList,
MyList<var> *FutureList, MyList<var> *tmList,
int Symmetry, bool BB);
bool Regrid_Onelevel(int lev, int Symmetry, int BH_num, double **Porgbr, double **Porg0,
MyList<var> *OldList, MyList<var> *StateList,
MyList<var> *FutureList, MyList<var> *tmList, bool BB,
monitor *ErrorMonitor);
void Regrid_Onelevel_aux(int lev, int Symmetry, int BH_num, double **Porgbr, double **Porg0,
MyList<var> *OldList, MyList<var> *StateList,
MyList<var> *FutureList, MyList<var> *tmList, bool BB,
monitor *ErrorMonitor);
void settrfls(const int lev);
#if (PSTR == 1 || PSTR == 2 || PSTR == 3)
void construct_mylev(int nprocs);
#endif
};
#endif /* CGH_H */

View File

@@ -1,60 +1,60 @@
#ifndef CHECKPOINT_H
#define CHECKPOINT_H
#ifdef newc
#include <iostream>
#include <iomanip>
#include <strstream>
#include <fstream>
#include <string>
using namespace std;
#else
#include <iostream.h>
#include <iomanip.h>
#include <strstream>
#include <fstream.h>
#include <string.h>
#endif
#include <time.h>
#include <stdlib.h>
#include <mpi.h>
#include "var.h"
#include "MyList.h"
#include "cgh.h"
#include "macrodef.h"
#include "ShellPatch.h"
class checkpoint
{
public:
bool checkedrun;
bool I_Print;
char *filename;
MyList<var> *CheckList;
string out_dir;
public:
checkpoint(bool checked, const char fname[], int myrank);
// checkpoint(bool checked, char fname[50], int myrank);
~checkpoint();
void addvariable(var *VV);
void addvariablelist(MyList<var> *VL);
void write_Black_Hole_position(int BH_num_input, int BH_num, double **Porg0, double **Porgbr, double *Mass);
void read_Black_Hole_position(int &BH_num_input, int &BH_num, double **&Porg0, double *&Pmom,
double *&Spin, double *&Mass, double **&Porgbr, double **&Porg,
double **&Porg1, double **&Porg_rhs);
void writecheck_cgh(double time, cgh *GH);
void readcheck_cgh(double &time, cgh *GH, int myrank, int nprocs, int Symmetry);
void writecheck_sh(double time, ShellPatch *SH);
void readcheck_sh(ShellPatch *SH, int myrank);
void write_bssn(double LastDump, double Last2dDump, double LastAnas);
void read_bssn(double &LastDump, double &Last2dDump, double &LastAnas);
};
#endif /* CHECKPOINT */
#ifndef CHECKPOINT_H
#define CHECKPOINT_H
#ifdef newc
#include <iostream>
#include <iomanip>
#include <strstream>
#include <fstream>
#include <string>
using namespace std;
#else
#include <iostream.h>
#include <iomanip.h>
#include <strstream>
#include <fstream.h>
#include <string.h>
#endif
#include <time.h>
#include <stdlib.h>
#include <mpi.h>
#include "var.h"
#include "MyList.h"
#include "cgh.h"
#include "macrodef.h"
#include "ShellPatch.h"
class checkpoint
{
public:
bool checkedrun;
bool I_Print;
char *filename;
MyList<var> *CheckList;
string out_dir;
public:
checkpoint(bool checked, const char fname[], int myrank);
// checkpoint(bool checked, char fname[50], int myrank);
~checkpoint();
void addvariable(var *VV);
void addvariablelist(MyList<var> *VL);
void write_Black_Hole_position(int BH_num_input, int BH_num, double **Porg0, double **Porgbr, double *Mass);
void read_Black_Hole_position(int &BH_num_input, int &BH_num, double **&Porg0, double *&Pmom,
double *&Spin, double *&Mass, double **&Porgbr, double **&Porg,
double **&Porg1, double **&Porg_rhs);
void writecheck_cgh(double time, cgh *GH);
void readcheck_cgh(double &time, cgh *GH, int myrank, int nprocs, int Symmetry);
void writecheck_sh(double time, ShellPatch *SH);
void readcheck_sh(ShellPatch *SH, int myrank);
void write_bssn(double LastDump, double Last2dDump, double LastAnas);
void read_bssn(double &LastDump, double &Last2dDump, double &LastAnas);
};
#endif /* CHECKPOINT */

View File

@@ -1,16 +1,16 @@
#ifndef AHFINDERDIRECT__CONFIG_H
#define AHFINDERDIRECT__CONFIG_H
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
size_t Util_Strlcat(char* dst, const char* src, size_t dst_size);
size_t Util_Strlcpy(char* dst, const char* src, size_t dst_size);
typedef CCTK_REAL fp;
typedef CCTK_INT integer;
#endif /* AHFINDERDIRECT__CONFIG_H */
#ifndef AHFINDERDIRECT__CONFIG_H
#define AHFINDERDIRECT__CONFIG_H
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
size_t Util_Strlcat(char* dst, const char* src, size_t dst_size);
size_t Util_Strlcpy(char* dst, const char* src, size_t dst_size);
typedef CCTK_REAL fp;
typedef CCTK_INT integer;
#endif /* AHFINDERDIRECT__CONFIG_H */

View File

@@ -1,173 +1,173 @@
#ifndef COORDS_H
#define COORDS_H
namespace AHFinderDirect
{
namespace local_coords
{
// compare if two angles are fuzzily equal mod 2*pi radians (360 degrees)
bool fuzzy_EQ_ang(fp ang1, fp ang2); // radians
bool fuzzy_EQ_dang(fp dang1, fp dang2); // degrees
// modulo-reduce {ang,dang} to be (fuzzily) within the range
// [min,max]_{ang,dang}, or error_exit() if no such value exists
fp modulo_reduce_ang(fp ang, fp min_ang, fp max_ang);
fp modulo_reduce_dang(fp dang, fp min_dang, fp max_dang);
} // close namespace local_coords::
namespace local_coords
{
// (r,(mu,nu,phi)) <--> (x,y,z)
void xyz_of_r_mu_nu(fp r, fp mu, fp nu, fp &x, fp &y, fp &z);
void xyz_of_r_mu_phi(fp r, fp mu, fp phi, fp &x, fp &y, fp &z);
void xyz_of_r_nu_phi(fp r, fp nu, fp phi, fp &x, fp &y, fp &z);
fp r_of_xyz(fp x, fp y, fp z);
fp mu_of_yz(fp y, fp z);
fp nu_of_xz(fp x, fp z);
fp phi_of_xy(fp x, fp y);
// ((mu,nu,phi)) --> the 3rd
fp phi_of_mu_nu(fp mu, fp nu);
fp nu_of_mu_phi(fp mu, fp phi);
fp mu_of_nu_phi(fp nu, fp phi);
// partial {x,y,z} / partial {mu,nu,phi}
void partial_xyz_wrt_r_mu_nu(fp r, fp mu, fp nu,
fp &partial_x_wrt_r, fp &partial_x_wrt_mu, fp &partial_x_wrt_nu,
fp &partial_y_wrt_r, fp &partial_y_wrt_mu, fp &partial_y_wrt_nu,
fp &partial_z_wrt_r, fp &partial_z_wrt_mu, fp &partial_z_wrt_nu);
void partial_xyz_wrt_r_mu_phi(fp r, fp mu, fp phi,
fp &partial_x_wrt_r, fp &partial_x_wrt_mu, fp &partial_x_wrt_phi,
fp &partial_y_wrt_r, fp &partial_y_wrt_mu, fp &partial_y_wrt_phi,
fp &partial_z_wrt_r, fp &partial_z_wrt_mu, fp &partial_z_wrt_phi);
void partial_xyz_wrt_r_nu_phi(fp r, fp nu, fp phi,
fp &partial_x_wrt_r, fp &partial_x_wrt_nu, fp &partial_x_wrt_phi,
fp &partial_y_wrt_r, fp &partial_y_wrt_nu, fp &partial_y_wrt_phi,
fp &partial_z_wrt_r, fp &partial_z_wrt_nu, fp &partial_z_wrt_phi);
// partial {mu,nu,phi} / partial {x,y,z}
fp partial_mu_wrt_y(fp y, fp z);
fp partial_mu_wrt_z(fp y, fp z);
fp partial_nu_wrt_x(fp x, fp z);
fp partial_nu_wrt_z(fp x, fp z);
fp partial_phi_wrt_x(fp x, fp y);
fp partial_phi_wrt_y(fp x, fp y);
// partial^2 {mu,nu,phi} / partial {x,y,z}{x,y,z}
fp partial2_mu_wrt_yy(fp y, fp z);
fp partial2_mu_wrt_yz(fp y, fp z);
fp partial2_mu_wrt_zz(fp y, fp z);
fp partial2_nu_wrt_xx(fp x, fp z);
fp partial2_nu_wrt_xz(fp x, fp z);
fp partial2_nu_wrt_zz(fp x, fp z);
fp partial2_phi_wrt_xx(fp x, fp y);
fp partial2_phi_wrt_xy(fp x, fp y);
fp partial2_phi_wrt_yy(fp x, fp y);
// usual polar spherical (r,theta,phi) <--> (x,y,z)
void xyz_of_r_theta_phi(fp r, fp theta, fp phi, fp &x, fp &y, fp &z);
void r_theta_phi_of_xyz(fp x, fp y, fp z, fp &r, fp &theta, fp &phi);
// ... already have r_of_xyz()
// ... already have phi_of_xy()
fp theta_of_xyz(fp x, fp y, fp z);
// ((mu,nu,phi)) <--> usual polar spherical (theta,phi)
// ... note phi is the same coordinate in both systems
void theta_phi_of_mu_nu(fp mu, fp nu, fp &ps_theta, fp &ps_phi);
void theta_phi_of_mu_phi(fp mu, fp phi, fp &ps_theta, fp &ps_phi);
void theta_phi_of_nu_phi(fp nu, fp phi, fp &ps_theta, fp &ps_phi);
void mu_nu_of_theta_phi(fp ps_theta, fp ps_phi, fp &mu, fp &nu);
void mu_phi_of_theta_phi(fp ps_theta, fp ps_phi, fp &mu, fp &phi);
void nu_phi_of_theta_phi(fp ps_theta, fp ps_phi, fp &nu, fp &phi);
// ((mu,nu,phi)) --> direction cosines (xcos,ycos,zcos)
void xyzcos_of_mu_nu(fp mu, fp nu, fp &xcos, fp &ycos, fp &zcos);
void xyzcos_of_mu_phi(fp mu, fp phi, fp &xcos, fp &ycos, fp &zcos);
void xyzcos_of_nu_phi(fp nu, fp phi, fp &xcos, fp &ycos, fp &zcos);
} // close namespace local_coords::
//*****************************************************************************
//
// ***** bit masks for coordinates ****
//
//
// We need to manipulate coordinates to do calculations like "which
// coordinate do these two patches have in common". We do these by
// Boolean operations on integers using the following bit masks:
//
namespace local_coords
{
typedef int coords_set;
enum
{
coords_set_mu = 0x1,
coords_set_nu = 0x2,
coords_set_phi = 0x4,
coords_set_empty = 0x0,
coords_set_all = coords_set_mu | coords_set_nu | coords_set_phi // no comma
};
// human-readable coordinate names for debugging etc
const char *name_of_coords_set(coords_set S);
// set complement of coordinates
inline coords_set coords_set_not(coords_set S)
{
return coords_set_all & ~S;
}
} // close namespace local_coords::
//******************************************************************************
//
// This class stores the origin point of our local coordinates, and
// provides conversions between local and global coordinates.
//
class global_coords
{
public:
// get global (x,y,z) coordinates of local origin point
fp origin_x() const { return origin_x_; }
fp origin_y() const { return origin_y_; }
fp origin_z() const { return origin_z_; }
// constructor: specify global (x,y,z) coordinates of local origin point
global_coords(fp origin_x_in, fp origin_y_in, fp origin_z_in)
: origin_x_(origin_x_in),
origin_y_(origin_y_in),
origin_z_(origin_z_in)
{
}
// destructor: compiler-generated no-op is ok
void recentering(fp x, fp y, fp z)
{
origin_x_ = x;
origin_y_ = y;
origin_z_ = z;
}
private:
// we forbid copying and passing by value
// by declaring the copy constructor and assignment operator
// private, but never defining them
global_coords(const global_coords &rhs);
global_coords &operator=(const global_coords &rhs);
private:
// global (x,y,z) coordinates of local origin point
fp origin_x_, origin_y_, origin_z_;
};
//******************************************************************************
} // namespace AHFinderDirect
#endif /* COORDS_H */
#ifndef COORDS_H
#define COORDS_H
namespace AHFinderDirect
{
namespace local_coords
{
// compare if two angles are fuzzily equal mod 2*pi radians (360 degrees)
bool fuzzy_EQ_ang(fp ang1, fp ang2); // radians
bool fuzzy_EQ_dang(fp dang1, fp dang2); // degrees
// modulo-reduce {ang,dang} to be (fuzzily) within the range
// [min,max]_{ang,dang}, or error_exit() if no such value exists
fp modulo_reduce_ang(fp ang, fp min_ang, fp max_ang);
fp modulo_reduce_dang(fp dang, fp min_dang, fp max_dang);
} // close namespace local_coords::
namespace local_coords
{
// (r,(mu,nu,phi)) <--> (x,y,z)
void xyz_of_r_mu_nu(fp r, fp mu, fp nu, fp &x, fp &y, fp &z);
void xyz_of_r_mu_phi(fp r, fp mu, fp phi, fp &x, fp &y, fp &z);
void xyz_of_r_nu_phi(fp r, fp nu, fp phi, fp &x, fp &y, fp &z);
fp r_of_xyz(fp x, fp y, fp z);
fp mu_of_yz(fp y, fp z);
fp nu_of_xz(fp x, fp z);
fp phi_of_xy(fp x, fp y);
// ((mu,nu,phi)) --> the 3rd
fp phi_of_mu_nu(fp mu, fp nu);
fp nu_of_mu_phi(fp mu, fp phi);
fp mu_of_nu_phi(fp nu, fp phi);
// partial {x,y,z} / partial {mu,nu,phi}
void partial_xyz_wrt_r_mu_nu(fp r, fp mu, fp nu,
fp &partial_x_wrt_r, fp &partial_x_wrt_mu, fp &partial_x_wrt_nu,
fp &partial_y_wrt_r, fp &partial_y_wrt_mu, fp &partial_y_wrt_nu,
fp &partial_z_wrt_r, fp &partial_z_wrt_mu, fp &partial_z_wrt_nu);
void partial_xyz_wrt_r_mu_phi(fp r, fp mu, fp phi,
fp &partial_x_wrt_r, fp &partial_x_wrt_mu, fp &partial_x_wrt_phi,
fp &partial_y_wrt_r, fp &partial_y_wrt_mu, fp &partial_y_wrt_phi,
fp &partial_z_wrt_r, fp &partial_z_wrt_mu, fp &partial_z_wrt_phi);
void partial_xyz_wrt_r_nu_phi(fp r, fp nu, fp phi,
fp &partial_x_wrt_r, fp &partial_x_wrt_nu, fp &partial_x_wrt_phi,
fp &partial_y_wrt_r, fp &partial_y_wrt_nu, fp &partial_y_wrt_phi,
fp &partial_z_wrt_r, fp &partial_z_wrt_nu, fp &partial_z_wrt_phi);
// partial {mu,nu,phi} / partial {x,y,z}
fp partial_mu_wrt_y(fp y, fp z);
fp partial_mu_wrt_z(fp y, fp z);
fp partial_nu_wrt_x(fp x, fp z);
fp partial_nu_wrt_z(fp x, fp z);
fp partial_phi_wrt_x(fp x, fp y);
fp partial_phi_wrt_y(fp x, fp y);
// partial^2 {mu,nu,phi} / partial {x,y,z}{x,y,z}
fp partial2_mu_wrt_yy(fp y, fp z);
fp partial2_mu_wrt_yz(fp y, fp z);
fp partial2_mu_wrt_zz(fp y, fp z);
fp partial2_nu_wrt_xx(fp x, fp z);
fp partial2_nu_wrt_xz(fp x, fp z);
fp partial2_nu_wrt_zz(fp x, fp z);
fp partial2_phi_wrt_xx(fp x, fp y);
fp partial2_phi_wrt_xy(fp x, fp y);
fp partial2_phi_wrt_yy(fp x, fp y);
// usual polar spherical (r,theta,phi) <--> (x,y,z)
void xyz_of_r_theta_phi(fp r, fp theta, fp phi, fp &x, fp &y, fp &z);
void r_theta_phi_of_xyz(fp x, fp y, fp z, fp &r, fp &theta, fp &phi);
// ... already have r_of_xyz()
// ... already have phi_of_xy()
fp theta_of_xyz(fp x, fp y, fp z);
// ((mu,nu,phi)) <--> usual polar spherical (theta,phi)
// ... note phi is the same coordinate in both systems
void theta_phi_of_mu_nu(fp mu, fp nu, fp &ps_theta, fp &ps_phi);
void theta_phi_of_mu_phi(fp mu, fp phi, fp &ps_theta, fp &ps_phi);
void theta_phi_of_nu_phi(fp nu, fp phi, fp &ps_theta, fp &ps_phi);
void mu_nu_of_theta_phi(fp ps_theta, fp ps_phi, fp &mu, fp &nu);
void mu_phi_of_theta_phi(fp ps_theta, fp ps_phi, fp &mu, fp &phi);
void nu_phi_of_theta_phi(fp ps_theta, fp ps_phi, fp &nu, fp &phi);
// ((mu,nu,phi)) --> direction cosines (xcos,ycos,zcos)
void xyzcos_of_mu_nu(fp mu, fp nu, fp &xcos, fp &ycos, fp &zcos);
void xyzcos_of_mu_phi(fp mu, fp phi, fp &xcos, fp &ycos, fp &zcos);
void xyzcos_of_nu_phi(fp nu, fp phi, fp &xcos, fp &ycos, fp &zcos);
} // close namespace local_coords::
//*****************************************************************************
//
// ***** bit masks for coordinates ****
//
//
// We need to manipulate coordinates to do calculations like "which
// coordinate do these two patches have in common". We do these by
// Boolean operations on integers using the following bit masks:
//
namespace local_coords
{
typedef int coords_set;
enum
{
coords_set_mu = 0x1,
coords_set_nu = 0x2,
coords_set_phi = 0x4,
coords_set_empty = 0x0,
coords_set_all = coords_set_mu | coords_set_nu | coords_set_phi // no comma
};
// human-readable coordinate names for debugging etc
const char *name_of_coords_set(coords_set S);
// set complement of coordinates
inline coords_set coords_set_not(coords_set S)
{
return coords_set_all & ~S;
}
} // close namespace local_coords::
//******************************************************************************
//
// This class stores the origin point of our local coordinates, and
// provides conversions between local and global coordinates.
//
class global_coords
{
public:
// get global (x,y,z) coordinates of local origin point
fp origin_x() const { return origin_x_; }
fp origin_y() const { return origin_y_; }
fp origin_z() const { return origin_z_; }
// constructor: specify global (x,y,z) coordinates of local origin point
global_coords(fp origin_x_in, fp origin_y_in, fp origin_z_in)
: origin_x_(origin_x_in),
origin_y_(origin_y_in),
origin_z_(origin_z_in)
{
}
// destructor: compiler-generated no-op is ok
void recentering(fp x, fp y, fp z)
{
origin_x_ = x;
origin_y_ = y;
origin_z_ = z;
}
private:
// we forbid copying and passing by value
// by declaring the copy constructor and assignment operator
// private, but never defining them
global_coords(const global_coords &rhs);
global_coords &operator=(const global_coords &rhs);
private:
// global (x,y,z) coordinates of local origin point
fp origin_x_, origin_y_, origin_z_;
};
//******************************************************************************
} // namespace AHFinderDirect
#endif /* COORDS_H */

File diff suppressed because it is too large Load Diff

View File

@@ -1,56 +1,56 @@
#ifndef CPBC_H
#define CPBC_H
#ifdef fortran1
#define f_david_milton_extroplate_ss david_milton_extroplate_ss
#define f_david_milton_cpbc_ss david_milton_cpbc_ss
#endif
#ifdef fortran2
#define f_david_milton_extroplate_ss DAVID_MILTON_EXTROPLATE_SS
#define f_david_milton_cpbc_ss DAVID_MILTON_CPBC_SS
#endif
#ifdef fortran3
#define f_david_milton_extroplate_ss david_milton_extroplate_ss_
#define f_david_milton_cpbc_ss david_milton_cpbc_ss_
#endif
extern "C"
{
int f_david_milton_extroplate_ss(int *, double *, double *, double *, // ex,crho,sigma,R
double *, double *, double *, // TZ, chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double &, double &);
} // zmin,zmax
extern "C"
{
int f_david_milton_cpbc_ss(int *, double *, double *, double *, // ex,crho,sigma,R
double *, double *, double *, // x,y,z
double *, double *, double *, // drhodx,drhody,drhodz
double *, double *, double *, // dsigmadx,dsigmady,dsigmadz
double *, double *, double *, // dRdx,dRdy,dRdz
double *, double *, double *, double *, double *, double *, // drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz
double *, double *, double *, double *, double *, double *, // dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz
double *, double *, double *, double *, double *, double *, // dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz
double &, double &, double &, double &, double &, double &, // xmin,ymin,zmin,xmax,ymax,zmax
double *, double *, double *, // TZ,chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, double *, double *, // TZ, chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Ricci
double *, double *, double *, // Gama constraint
int &, double &, int &);
} // Symmetry, eps, sst
#endif /* CPBC_H */
#ifndef CPBC_H
#define CPBC_H
#ifdef fortran1
#define f_david_milton_extroplate_ss david_milton_extroplate_ss
#define f_david_milton_cpbc_ss david_milton_cpbc_ss
#endif
#ifdef fortran2
#define f_david_milton_extroplate_ss DAVID_MILTON_EXTROPLATE_SS
#define f_david_milton_cpbc_ss DAVID_MILTON_CPBC_SS
#endif
#ifdef fortran3
#define f_david_milton_extroplate_ss david_milton_extroplate_ss_
#define f_david_milton_cpbc_ss david_milton_cpbc_ss_
#endif
extern "C"
{
int f_david_milton_extroplate_ss(int *, double *, double *, double *, // ex,crho,sigma,R
double *, double *, double *, // TZ, chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double &, double &);
} // zmin,zmax
extern "C"
{
int f_david_milton_cpbc_ss(int *, double *, double *, double *, // ex,crho,sigma,R
double *, double *, double *, // x,y,z
double *, double *, double *, // drhodx,drhody,drhodz
double *, double *, double *, // dsigmadx,dsigmady,dsigmadz
double *, double *, double *, // dRdx,dRdy,dRdz
double *, double *, double *, double *, double *, double *, // drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz
double *, double *, double *, double *, double *, double *, // dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz
double *, double *, double *, double *, double *, double *, // dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz
double &, double &, double &, double &, double &, double &, // xmin,ymin,zmin,xmax,ymax,zmax
double *, double *, double *, // TZ,chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, double *, double *, // TZ, chi, trK
double *, double *, double *, double *, double *, double *, // gij
double *, double *, double *, double *, double *, double *, // Aij
double *, double *, double *, // Gam
double *, double *, double *, double *, double *, double *, double *, // Gauge
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Christoffel
double *, double *, double *, double *, double *, double *, // Ricci
double *, double *, double *, // Gama constraint
int &, double &, int &);
} // Symmetry, eps, sst
#endif /* CPBC_H */

View File

@@ -1,93 +1,93 @@
#include <assert.h>
#include <stdio.h>
#include "stdc.h"
#include "util.h"
#include "cpm_map.h"
namespace AHFinderDirect
{
namespace jtutil
{
template <typename fp_t>
cpm_map<fp_t>::cpm_map(int min_i_in, int max_i_in,
fp_t fixed_point)
: min_i_(min_i_in), max_i_(max_i_in),
map_is_plus_(false)
{
const fp_t d_offset = 2.0 * fixed_point;
if (!fuzzy<fp_t>::is_integer(d_offset))
then error_exit(ERROR_EXIT,
"***** cpm_map::cpm_map (mirror):\n"
" fixed_point=%g isn't (fuzzily) integral or half-integral!\n",
double(fixed_point)); /*NOTREACHED*/
offset_ = round<fp_t>::to_integer(d_offset);
assert(
map_unchecked(fuzzy<fp_t>::floor(fixed_point)) ==
fuzzy<fp_t>::ceiling(fixed_point));
}
//******************************************************************************
//
// This function constructs a generic cpm_map object, with the mapping
// specified by a sample point sample_i --> sample_j and by sign.
// The sample point need not be in the map's domain/range.
//
template <typename fp_t>
cpm_map<fp_t>::cpm_map(int min_i_in, int max_i_in,
int sample_i, int sample_j,
bool map_is_plus_in)
: min_i_(min_i_in), max_i_(max_i_in),
offset_(map_is_plus_in ? sample_j - sample_i
: sample_j + sample_i),
map_is_plus_(map_is_plus_in)
{
assert(map_unchecked(sample_i) == sample_j);
}
//******************************************************************************
//
// This function constructs a generic cpm_map object, with the mapping
// specified by a *fp* sample point sample_i --> sample_j (which
// must specify an integer --> integer mapping, i.e. 4.2 --> 4.2 is
// ok for a + map, and 4.5 --> 4.5 is ok for a minus map, but 4.2 --> 4.7
// is never ok) and by sign. The sample point need not be in the map's
// domain/range.
//
template <typename fp_t>
cpm_map<fp_t>::cpm_map(int min_i_in, int max_i_in,
fp_t sample_i, fp_t sample_j,
bool map_is_plus_in)
: min_i_(min_i_in), max_i_(max_i_in),
map_is_plus_(map_is_plus_in)
{
const fp_t fp_offset = map_is_plus_in ? sample_j - sample_i
: sample_j + sample_i;
if (!fuzzy<fp_t>::is_integer(fp_offset))
then error_exit(ERROR_EXIT,
"***** cpm_map::cpm_map (generic via fp sample point):\n"
" fp_offset=%g isn't fuzzily integral!\n"
" ==> sample_i=%g --> sample_j=%g\n"
" doesn't fuzzily specify an integer --> integer mapping!\n",
double(fp_offset),
double(sample_i), double(sample_j)); /*NOTREACHED*/
offset_ = round<fp_t>::to_integer(fp_offset);
// verify that we have setup correct
assert(
map_unchecked(fuzzy<fp_t>::floor(sample_i)) ==
(map_is_plus_in ? fuzzy<fp_t>::floor(sample_j)
: fuzzy<fp_t>::ceiling(sample_j)));
}
template class cpm_map<float>;
template class cpm_map<double>;
} // namespace jtutil
} // namespace AHFinderDirect
#include <assert.h>
#include <stdio.h>
#include "stdc.h"
#include "util.h"
#include "cpm_map.h"
namespace AHFinderDirect
{
namespace jtutil
{
template <typename fp_t>
cpm_map<fp_t>::cpm_map(int min_i_in, int max_i_in,
fp_t fixed_point)
: min_i_(min_i_in), max_i_(max_i_in),
map_is_plus_(false)
{
const fp_t d_offset = 2.0 * fixed_point;
if (!fuzzy<fp_t>::is_integer(d_offset))
then error_exit(ERROR_EXIT,
"***** cpm_map::cpm_map (mirror):\n"
" fixed_point=%g isn't (fuzzily) integral or half-integral!\n",
double(fixed_point)); /*NOTREACHED*/
offset_ = round<fp_t>::to_integer(d_offset);
assert(
map_unchecked(fuzzy<fp_t>::floor(fixed_point)) ==
fuzzy<fp_t>::ceiling(fixed_point));
}
//******************************************************************************
//
// This function constructs a generic cpm_map object, with the mapping
// specified by a sample point sample_i --> sample_j and by sign.
// The sample point need not be in the map's domain/range.
//
template <typename fp_t>
cpm_map<fp_t>::cpm_map(int min_i_in, int max_i_in,
int sample_i, int sample_j,
bool map_is_plus_in)
: min_i_(min_i_in), max_i_(max_i_in),
offset_(map_is_plus_in ? sample_j - sample_i
: sample_j + sample_i),
map_is_plus_(map_is_plus_in)
{
assert(map_unchecked(sample_i) == sample_j);
}
//******************************************************************************
//
// This function constructs a generic cpm_map object, with the mapping
// specified by a *fp* sample point sample_i --> sample_j (which
// must specify an integer --> integer mapping, i.e. 4.2 --> 4.2 is
// ok for a + map, and 4.5 --> 4.5 is ok for a minus map, but 4.2 --> 4.7
// is never ok) and by sign. The sample point need not be in the map's
// domain/range.
//
template <typename fp_t>
cpm_map<fp_t>::cpm_map(int min_i_in, int max_i_in,
fp_t sample_i, fp_t sample_j,
bool map_is_plus_in)
: min_i_(min_i_in), max_i_(max_i_in),
map_is_plus_(map_is_plus_in)
{
const fp_t fp_offset = map_is_plus_in ? sample_j - sample_i
: sample_j + sample_i;
if (!fuzzy<fp_t>::is_integer(fp_offset))
then error_exit(ERROR_EXIT,
"***** cpm_map::cpm_map (generic via fp sample point):\n"
" fp_offset=%g isn't fuzzily integral!\n"
" ==> sample_i=%g --> sample_j=%g\n"
" doesn't fuzzily specify an integer --> integer mapping!\n",
double(fp_offset),
double(sample_i), double(sample_j)); /*NOTREACHED*/
offset_ = round<fp_t>::to_integer(fp_offset);
// verify that we have setup correct
assert(
map_unchecked(fuzzy<fp_t>::floor(sample_i)) ==
(map_is_plus_in ? fuzzy<fp_t>::floor(sample_j)
: fuzzy<fp_t>::ceiling(sample_j)));
}
template class cpm_map<float>;
template class cpm_map<double>;
} // namespace jtutil
} // namespace AHFinderDirect

View File

@@ -1,120 +1,120 @@
#ifndef AHFINDERDIRECT__CPM_MAP_HH
#define AHFINDERDIRECT__CPM_MAP_HH
namespace AHFinderDirect
{
namespace jtutil
{
template <typename fp_t>
class cpm_map
{
public:
// bounds info -- domain
int min_i() const { return min_i_; }
int max_i() const { return max_i_; }
int N_points() const
{
return jtutil::how_many_in_range(min_i_, max_i_);
}
bool in_domain(int i) const { return (i >= min_i_) && (i <= max_i_); }
// is the mapping + or - ?
bool is_plus() const { return map_is_plus_; }
bool is_minus() const { return !map_is_plus_; }
int sign() const { return map_is_plus_ ? +1 : -1; }
fp_t fp_sign() const { return map_is_plus_ ? +1.0 : -1.0; }
// the mapping itself
int map_unchecked(int i) const
{
return map_is_plus_ ? offset_ + i
: offset_ - i;
}
int inv_map_unchecked(int j) const
{
return map_is_plus_ ? j - offset_
: offset_ - j;
}
int map(int i) const
{
assert(in_domain(i));
return map_unchecked(i);
}
int inv_map(int j) const
{
int i = inv_map_unchecked(j);
assert(in_domain(i));
return i;
}
// bounds info -- range
// ... we use the unchecked map here in case the domain is empty
int min_j() const
{
return map_is_plus_ ? map_unchecked(min_i_)
: map_unchecked(max_i_);
}
int max_j() const
{
return map_is_plus_ ? map_unchecked(max_i_)
: map_unchecked(min_i_);
}
bool in_range(int j) const { return in_domain(inv_map_unchecked(j)); }
//
// constructors
//
// "mirror" map: i --> const - i
// ... map specified by fixed point (must be integer or half-integer)
// ... fixed point need not be in domain/range
cpm_map(int min_i_in, int max_i_in,
fp_t fixed_point);
// "shift" map: i --> const + i
// ... map specified by shift amount
// ... default is identity map
cpm_map(int min_i_in, int max_i_in,
int shift_amount = 0)
: min_i_(min_i_in), max_i_(max_i_in),
offset_(shift_amount), map_is_plus_(true)
{
}
// generic map: i --> const +/- i
// ... map specified by sample point sample_i --> sample_j
// and by sign (one of {plus,minus}_map )
// ... sample point need not be in domain/range
cpm_map(int min_i_in, int max_i_in,
int sample_i, int sample_j,
bool map_is_plus_in);
// generic map: i --> const +/- i
// ... map specified by *fp* sample point sample_i --> sample_j
// (must specify an integer --> integer mapping)
// and by sign (one of {plus,minus}_map )
// ... hence if sign is -1, then sample_i and sample_j
// must both be half-integral
// ... sample point need *not* be in domain/range
cpm_map(int min_i_in, int max_i_in,
fp_t sample_i, fp_t sample_j,
bool map_is_plus_in);
// no need for explicit destructor, compiler-generated no-op is ok
// ditto for copy constructor and assignment operator
private:
// bounds (inclusive)
int min_i_, max_i_;
// these define the actual mapping
int offset_;
bool map_is_plus_;
};
//******************************************************************************
} // namespace jtutil
} // namespace AHFinderDirect
#endif /* AHFINDERDIRECT__CPM_MAP_HH */
#ifndef AHFINDERDIRECT__CPM_MAP_HH
#define AHFINDERDIRECT__CPM_MAP_HH
namespace AHFinderDirect
{
namespace jtutil
{
template <typename fp_t>
class cpm_map
{
public:
// bounds info -- domain
int min_i() const { return min_i_; }
int max_i() const { return max_i_; }
int N_points() const
{
return jtutil::how_many_in_range(min_i_, max_i_);
}
bool in_domain(int i) const { return (i >= min_i_) && (i <= max_i_); }
// is the mapping + or - ?
bool is_plus() const { return map_is_plus_; }
bool is_minus() const { return !map_is_plus_; }
int sign() const { return map_is_plus_ ? +1 : -1; }
fp_t fp_sign() const { return map_is_plus_ ? +1.0 : -1.0; }
// the mapping itself
int map_unchecked(int i) const
{
return map_is_plus_ ? offset_ + i
: offset_ - i;
}
int inv_map_unchecked(int j) const
{
return map_is_plus_ ? j - offset_
: offset_ - j;
}
int map(int i) const
{
assert(in_domain(i));
return map_unchecked(i);
}
int inv_map(int j) const
{
int i = inv_map_unchecked(j);
assert(in_domain(i));
return i;
}
// bounds info -- range
// ... we use the unchecked map here in case the domain is empty
int min_j() const
{
return map_is_plus_ ? map_unchecked(min_i_)
: map_unchecked(max_i_);
}
int max_j() const
{
return map_is_plus_ ? map_unchecked(max_i_)
: map_unchecked(min_i_);
}
bool in_range(int j) const { return in_domain(inv_map_unchecked(j)); }
//
// constructors
//
// "mirror" map: i --> const - i
// ... map specified by fixed point (must be integer or half-integer)
// ... fixed point need not be in domain/range
cpm_map(int min_i_in, int max_i_in,
fp_t fixed_point);
// "shift" map: i --> const + i
// ... map specified by shift amount
// ... default is identity map
cpm_map(int min_i_in, int max_i_in,
int shift_amount = 0)
: min_i_(min_i_in), max_i_(max_i_in),
offset_(shift_amount), map_is_plus_(true)
{
}
// generic map: i --> const +/- i
// ... map specified by sample point sample_i --> sample_j
// and by sign (one of {plus,minus}_map )
// ... sample point need not be in domain/range
cpm_map(int min_i_in, int max_i_in,
int sample_i, int sample_j,
bool map_is_plus_in);
// generic map: i --> const +/- i
// ... map specified by *fp* sample point sample_i --> sample_j
// (must specify an integer --> integer mapping)
// and by sign (one of {plus,minus}_map )
// ... hence if sign is -1, then sample_i and sample_j
// must both be half-integral
// ... sample point need *not* be in domain/range
cpm_map(int min_i_in, int max_i_in,
fp_t sample_i, fp_t sample_j,
bool map_is_plus_in);
// no need for explicit destructor, compiler-generated no-op is ok
// ditto for copy constructor and assignment operator
private:
// bounds (inclusive)
int min_i_, max_i_;
// these define the actual mapping
int offset_;
bool map_is_plus_;
};
//******************************************************************************
} // namespace jtutil
} // namespace AHFinderDirect
#endif /* AHFINDERDIRECT__CPM_MAP_HH */

View File

@@ -1,76 +1,76 @@
#ifndef DERIVATIVES
#define DERIVATIVES
#ifdef fortran1
#define f_fderivs fderivs
#define f_fderivs_sh fderivs_sh
#define f_fderivs_shc fderivs_shc
#define f_fdderivs_shc fdderivs_shc
#define f_fdderivs fdderivs
#endif
#ifdef fortran2
#define f_fderivs FDERIVS
#define f_fderivs_sh FDERIVS_SH
#define f_fderivs_shc FDERIVS_SHC
#define f_fdderivs_shc FDDERIVS_SHC
#define f_fdderivs FDDERIVS
#endif
#ifdef fortran3
#define f_fderivs fderivs_
#define f_fderivs_sh fderivs_sh_
#define f_fderivs_shc fderivs_shc_
#define f_fdderivs_shc fdderivs_shc_
#define f_fdderivs fdderivs_
#endif
extern "C"
{
void f_fderivs(int *, double *,
double *, double *, double *,
double *, double *, double *,
double &, double &, double &, int &, int &);
}
extern "C"
{
void f_fderivs_sh(int *, double *,
double *, double *, double *,
double *, double *, double *,
double &, double &, double &, int &, int &, int &);
}
extern "C"
{
void f_fderivs_shc(int *, double *,
double *, double *, double *,
double *, double *, double *,
double &, double &, double &, int &, int &, int &,
double *, double *, double *,
double *, double *, double *,
double *, double *, double *);
}
extern "C"
{
void f_fdderivs_shc(int *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *,
double &, double &, double &, int &, int &, int &,
double *, double *, double *,
double *, double *, double *,
double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *);
}
extern "C"
{
void f_fdderivs(int *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *,
double &, double &, double &, int &, int &);
}
#endif /* DERIVATIVES */
#ifndef DERIVATIVES
#define DERIVATIVES
#ifdef fortran1
#define f_fderivs fderivs
#define f_fderivs_sh fderivs_sh
#define f_fderivs_shc fderivs_shc
#define f_fdderivs_shc fdderivs_shc
#define f_fdderivs fdderivs
#endif
#ifdef fortran2
#define f_fderivs FDERIVS
#define f_fderivs_sh FDERIVS_SH
#define f_fderivs_shc FDERIVS_SHC
#define f_fdderivs_shc FDDERIVS_SHC
#define f_fdderivs FDDERIVS
#endif
#ifdef fortran3
#define f_fderivs fderivs_
#define f_fderivs_sh fderivs_sh_
#define f_fderivs_shc fderivs_shc_
#define f_fdderivs_shc fdderivs_shc_
#define f_fdderivs fdderivs_
#endif
extern "C"
{
void f_fderivs(int *, double *,
double *, double *, double *,
double *, double *, double *,
double &, double &, double &, int &, int &);
}
extern "C"
{
void f_fderivs_sh(int *, double *,
double *, double *, double *,
double *, double *, double *,
double &, double &, double &, int &, int &, int &);
}
extern "C"
{
void f_fderivs_shc(int *, double *,
double *, double *, double *,
double *, double *, double *,
double &, double &, double &, int &, int &, int &,
double *, double *, double *,
double *, double *, double *,
double *, double *, double *);
}
extern "C"
{
void f_fdderivs_shc(int *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *,
double &, double &, double &, int &, int &, int &,
double *, double *, double *,
double *, double *, double *,
double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *);
}
extern "C"
{
void f_fdderivs(int *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *,
double &, double &, double &, int &, int &);
}
#endif /* DERIVATIVES */

View File

@@ -1,108 +1,108 @@
#ifndef DRIVER_H
#define DRIVER_H
#include <stdio.h>
#include <assert.h>
#include <math.h>
#include <string.h>
#include "util_Table.h"
#include "cctk.h"
#include "config.h"
#include "stdc.h"
#include "util.h"
#include "array.h"
#include "cpm_map.h"
#include "linear_map.h"
#include "coords.h"
#include "tgrid.h"
#include "fd_grid.h"
#include "patch.h"
#include "patch_edge.h"
#include "patch_interp.h"
#include "ghost_zone.h"
#include "patch_system.h"
#include "Jacobian.h"
#include "gfns.h"
#include "gr.h"
#include "horizon_sequence.h"
#include "BH_diagnostics.h"
namespace AHFinderDirect
{
struct iteration_status_buffers
{
int *hn_buffer;
int *iteration_buffer;
enum expansion_status *expansion_status_buffer;
fp *mean_horizon_radius_buffer;
fp *Theta_infinity_norm_buffer;
bool *found_horizon_buffer;
jtutil::array2d<CCTK_REAL> *send_buffer_ptr;
jtutil::array2d<CCTK_REAL> *receive_buffer_ptr;
iteration_status_buffers()
: hn_buffer(NULL), iteration_buffer(NULL),
expansion_status_buffer(NULL),
mean_horizon_radius_buffer(NULL),
Theta_infinity_norm_buffer(NULL),
found_horizon_buffer(NULL),
send_buffer_ptr(NULL), receive_buffer_ptr(NULL)
{
}
};
//
// This struct holds interprocessor-communication buffers for broadcasting
// the BH diagnostics and horizon shape from the processor which finds a
// given horizon, to all processors.
//
struct horizon_buffers
{
int N_buffer;
double *send_buffer;
double *receive_buffer;
horizon_buffers()
: N_buffer(0),
send_buffer(NULL),
receive_buffer(NULL)
{
}
};
//
struct AH_data
{
patch_system *ps_ptr;
Jacobian *Jac_ptr;
double surface_expansion;
bool initial_find_flag;
bool recentering_flag, stop_finding, find_trigger;
bool found_flag; // did we find this horizon (successfully)
struct BH_diagnostics BH_diagnostics;
FILE *BH_diagnostics_fileptr;
// interprocessor-communication buffers
// for this horizon's BH diagnostics and (optionally) horizon shape
struct horizon_buffers horizon_buffers;
};
// initial_guess.cc
void setup_initial_guess(patch_system &ps,
fp x_center, fp y_center, fp z_center,
fp x_radius, fp y_radius, fp z_radius);
// Newton.cc
void Newton(int N_procs, int N_active_procs, int my_proc,
horizon_sequence &hs, struct AH_data *const AH_data_array[],
struct iteration_status_buffers &isb, int *dumpid, double *);
} // namespace AHFinderDirect
#endif /* DRIVER_H */
#ifndef DRIVER_H
#define DRIVER_H
#include <stdio.h>
#include <assert.h>
#include <math.h>
#include <string.h>
#include "util_Table.h"
#include "cctk.h"
#include "config.h"
#include "stdc.h"
#include "util.h"
#include "array.h"
#include "cpm_map.h"
#include "linear_map.h"
#include "coords.h"
#include "tgrid.h"
#include "fd_grid.h"
#include "patch.h"
#include "patch_edge.h"
#include "patch_interp.h"
#include "ghost_zone.h"
#include "patch_system.h"
#include "Jacobian.h"
#include "gfns.h"
#include "gr.h"
#include "horizon_sequence.h"
#include "BH_diagnostics.h"
namespace AHFinderDirect
{
struct iteration_status_buffers
{
int *hn_buffer;
int *iteration_buffer;
enum expansion_status *expansion_status_buffer;
fp *mean_horizon_radius_buffer;
fp *Theta_infinity_norm_buffer;
bool *found_horizon_buffer;
jtutil::array2d<CCTK_REAL> *send_buffer_ptr;
jtutil::array2d<CCTK_REAL> *receive_buffer_ptr;
iteration_status_buffers()
: hn_buffer(NULL), iteration_buffer(NULL),
expansion_status_buffer(NULL),
mean_horizon_radius_buffer(NULL),
Theta_infinity_norm_buffer(NULL),
found_horizon_buffer(NULL),
send_buffer_ptr(NULL), receive_buffer_ptr(NULL)
{
}
};
//
// This struct holds interprocessor-communication buffers for broadcasting
// the BH diagnostics and horizon shape from the processor which finds a
// given horizon, to all processors.
//
struct horizon_buffers
{
int N_buffer;
double *send_buffer;
double *receive_buffer;
horizon_buffers()
: N_buffer(0),
send_buffer(NULL),
receive_buffer(NULL)
{
}
};
//
struct AH_data
{
patch_system *ps_ptr;
Jacobian *Jac_ptr;
double surface_expansion;
bool initial_find_flag;
bool recentering_flag, stop_finding, find_trigger;
bool found_flag; // did we find this horizon (successfully)
struct BH_diagnostics BH_diagnostics;
FILE *BH_diagnostics_fileptr;
// interprocessor-communication buffers
// for this horizon's BH diagnostics and (optionally) horizon shape
struct horizon_buffers horizon_buffers;
};
// initial_guess.cc
void setup_initial_guess(patch_system &ps,
fp x_center, fp y_center, fp z_center,
fp x_radius, fp y_radius, fp z_radius);
// Newton.cc
void Newton(int N_procs, int N_active_procs, int my_proc,
horizon_sequence &hs, struct AH_data *const AH_data_array[],
struct iteration_status_buffers &isb, int *dumpid, double *);
} // namespace AHFinderDirect
#endif /* DRIVER_H */

View File

@@ -1,45 +1,45 @@
#ifndef EMPART_H
#define EMPART_H
#ifdef fortran1
#define f_compute_rhs_empart compute_rhs_empart
#define f_compute_rhs_empart_ss compute_rhs_empart_ss
#endif
#ifdef fortran2
#define f_compute_rhs_empart COMPUTE_RHS_EMPART
#define f_compute_rhs_empart_ss COMPUTE_RHS_EMPART_SS
#endif
#ifdef fortran3
#define f_compute_rhs_empart compute_rhs_empart_
#define f_compute_rhs_empart_ss compute_rhs_empart_ss_
#endif
extern "C"
{
int f_compute_rhs_empart(int *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *,
int &, int &, double &);
}
extern "C"
{
int f_compute_rhs_empart_ss(int *, double *, double *, double *, double *, double *, double *,
double *, double *, double *,
double *, double *, double *,
double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *,
int &, int &, double &, int &);
}
#endif /* EMPART_H */
#ifndef EMPART_H
#define EMPART_H
#ifdef fortran1
#define f_compute_rhs_empart compute_rhs_empart
#define f_compute_rhs_empart_ss compute_rhs_empart_ss
#endif
#ifdef fortran2
#define f_compute_rhs_empart COMPUTE_RHS_EMPART
#define f_compute_rhs_empart_ss COMPUTE_RHS_EMPART_SS
#endif
#ifdef fortran3
#define f_compute_rhs_empart compute_rhs_empart_
#define f_compute_rhs_empart_ss compute_rhs_empart_ss_
#endif
extern "C"
{
int f_compute_rhs_empart(int *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *,
int &, int &, double &);
}
extern "C"
{
int f_compute_rhs_empart_ss(int *, double *, double *, double *, double *, double *, double *,
double *, double *, double *,
double *, double *, double *,
double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *,
int &, int &, double &, int &);
}
#endif /* EMPART_H */

View File

@@ -1,230 +1,230 @@
!-----------------------------------------------------------------------------
!
! remove the trace of Aij
! trace-free Aij and enforce the determinant of bssn metric to one
!-----------------------------------------------------------------------------
subroutine enforce_ag(ex, dxx, gxy, gxz, dyy, gyz, dzz, &
Axx, Axy, Axz, Ayy, Ayz, Azz)
implicit none
!~~~~~~> Input parameters:
integer, intent(in) :: ex(1:3)
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: dxx,dyy,dzz
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: gxy,gxz,gyz
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: Axx,Axy,Axz
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: Ayy,Ayz,Azz
!~~~~~~~> Local variable:
integer :: i,j,k
real*8 :: lgxx,lgyy,lgzz,ldetg
real*8 :: lgupxx,lgupxy,lgupxz,lgupyy,lgupyz,lgupzz
real*8 :: ltrA,lscale
real*8, parameter :: F1o3 = 1.D0 / 3.D0, ONE = 1.D0, TWO = 2.D0
!~~~~~~>
do k=1,ex(3)
do j=1,ex(2)
do i=1,ex(1)
lgxx = dxx(i,j,k) + ONE
lgyy = dyy(i,j,k) + ONE
lgzz = dzz(i,j,k) + ONE
ldetg = lgxx * lgyy * lgzz &
+ gxy(i,j,k) * gyz(i,j,k) * gxz(i,j,k) &
+ gxz(i,j,k) * gxy(i,j,k) * gyz(i,j,k) &
- gxz(i,j,k) * lgyy * gxz(i,j,k) &
- gxy(i,j,k) * gxy(i,j,k) * lgzz &
- lgxx * gyz(i,j,k) * gyz(i,j,k)
lgupxx = ( lgyy * lgzz - gyz(i,j,k) * gyz(i,j,k) ) / ldetg
lgupxy = - ( gxy(i,j,k) * lgzz - gyz(i,j,k) * gxz(i,j,k) ) / ldetg
lgupxz = ( gxy(i,j,k) * gyz(i,j,k) - lgyy * gxz(i,j,k) ) / ldetg
lgupyy = ( lgxx * lgzz - gxz(i,j,k) * gxz(i,j,k) ) / ldetg
lgupyz = - ( lgxx * gyz(i,j,k) - gxy(i,j,k) * gxz(i,j,k) ) / ldetg
lgupzz = ( lgxx * lgyy - gxy(i,j,k) * gxy(i,j,k) ) / ldetg
ltrA = lgupxx * Axx(i,j,k) + lgupyy * Ayy(i,j,k) &
+ lgupzz * Azz(i,j,k) &
+ TWO * (lgupxy * Axy(i,j,k) + lgupxz * Axz(i,j,k) &
+ lgupyz * Ayz(i,j,k))
Axx(i,j,k) = Axx(i,j,k) - F1o3 * lgxx * ltrA
Axy(i,j,k) = Axy(i,j,k) - F1o3 * gxy(i,j,k) * ltrA
Axz(i,j,k) = Axz(i,j,k) - F1o3 * gxz(i,j,k) * ltrA
Ayy(i,j,k) = Ayy(i,j,k) - F1o3 * lgyy * ltrA
Ayz(i,j,k) = Ayz(i,j,k) - F1o3 * gyz(i,j,k) * ltrA
Azz(i,j,k) = Azz(i,j,k) - F1o3 * lgzz * ltrA
lscale = ONE / ( ldetg ** F1o3 )
dxx(i,j,k) = lgxx * lscale - ONE
gxy(i,j,k) = gxy(i,j,k) * lscale
gxz(i,j,k) = gxz(i,j,k) * lscale
dyy(i,j,k) = lgyy * lscale - ONE
gyz(i,j,k) = gyz(i,j,k) * lscale
dzz(i,j,k) = lgzz * lscale - ONE
enddo
enddo
enddo
return
end subroutine enforce_ag
#if 1
!----------------------------------------------------------------------------------
! swap the turn of a and g
!----------------------------------------------------------------------------------
subroutine enforce_ga(ex, dxx, gxy, gxz, dyy, gyz, dzz, &
Axx, Axy, Axz, Ayy, Ayz, Azz)
implicit none
!~~~~~~> Input parameters:
integer, intent(in) :: ex(1:3)
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: dxx,dyy,dzz
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: gxy,gxz,gyz
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: Axx,Axy,Axz
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: Ayy,Ayz,Azz
!~~~~~~~> Local variable:
integer :: i,j,k
real*8 :: lgxx,lgyy,lgzz,lscale
real*8 :: lgxy,lgxz,lgyz
real*8 :: lgupxx,lgupxy,lgupxz,lgupyy,lgupyz,lgupzz
real*8 :: ltrA
real*8, parameter :: F1o3 = 1.D0 / 3.D0, ONE = 1.D0, TWO = 2.D0
!~~~~~~>
do k=1,ex(3)
do j=1,ex(2)
do i=1,ex(1)
! for g: normalize determinant first
lgxx = dxx(i,j,k) + ONE
lgyy = dyy(i,j,k) + ONE
lgzz = dzz(i,j,k) + ONE
lgxy = gxy(i,j,k)
lgxz = gxz(i,j,k)
lgyz = gyz(i,j,k)
lscale = lgxx * lgyy * lgzz + lgxy * lgyz * lgxz &
+ lgxz * lgxy * lgyz - lgxz * lgyy * lgxz &
- lgxy * lgxy * lgzz - lgxx * lgyz * lgyz
lscale = ONE / ( lscale ** F1o3 )
lgxx = lgxx * lscale
lgxy = lgxy * lscale
lgxz = lgxz * lscale
lgyy = lgyy * lscale
lgyz = lgyz * lscale
lgzz = lgzz * lscale
dxx(i,j,k) = lgxx - ONE
gxy(i,j,k) = lgxy
gxz(i,j,k) = lgxz
dyy(i,j,k) = lgyy - ONE
gyz(i,j,k) = lgyz
dzz(i,j,k) = lgzz - ONE
! for A: trace-free using normalized metric (det=1, no division needed)
lgupxx = ( lgyy * lgzz - lgyz * lgyz )
lgupxy = - ( lgxy * lgzz - lgyz * lgxz )
lgupxz = ( lgxy * lgyz - lgyy * lgxz )
lgupyy = ( lgxx * lgzz - lgxz * lgxz )
lgupyz = - ( lgxx * lgyz - lgxy * lgxz )
lgupzz = ( lgxx * lgyy - lgxy * lgxy )
ltrA = lgupxx * Axx(i,j,k) + lgupyy * Ayy(i,j,k) &
+ lgupzz * Azz(i,j,k) &
+ TWO * (lgupxy * Axy(i,j,k) + lgupxz * Axz(i,j,k) &
+ lgupyz * Ayz(i,j,k))
Axx(i,j,k) = Axx(i,j,k) - F1o3 * lgxx * ltrA
Axy(i,j,k) = Axy(i,j,k) - F1o3 * lgxy * ltrA
Axz(i,j,k) = Axz(i,j,k) - F1o3 * lgxz * ltrA
Ayy(i,j,k) = Ayy(i,j,k) - F1o3 * lgyy * ltrA
Ayz(i,j,k) = Ayz(i,j,k) - F1o3 * lgyz * ltrA
Azz(i,j,k) = Azz(i,j,k) - F1o3 * lgzz * ltrA
enddo
enddo
enddo
return
end subroutine enforce_ga
#else
!----------------------------------------------------------------------------------
! duplicate bam
!----------------------------------------------------------------------------------
subroutine enforce_ga(ex, dxx, gxy, gxz, dyy, gyz, dzz, &
Axx, Axy, Axz, Ayy, Ayz, Azz)
implicit none
!~~~~~~> Input parameters:
integer, intent(in) :: ex(1:3)
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: dxx,dyy,dzz
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: gxy,gxz,gyz
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: Axx,Axy,Axz
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: Ayy,Ayz,Azz
!~~~~~~~> Local variable:
real*8, dimension(ex(1),ex(2),ex(3)) :: trA
real*8, dimension(ex(1),ex(2),ex(3)) :: gxx,gyy,gzz
real*8, dimension(ex(1),ex(2),ex(3)) :: aux,detginv
real*8, parameter :: oot = 1.D0 / 3.D0, ONE = 1.D0, TWO = 2.D0
!~~~~~~>
gxx = dxx + ONE
gyy = dyy + ONE
gzz = dzz + ONE
! for g
aux = (2.d0*gxy*gxz*gyz + gxx*gyy*gzz &
- gzz*gxy**2 - gyy*gxz**2 - gxx*gyz**2)**(-oot)
gxx = gxx * aux
gxy = gxy * aux
gxz = gxz * aux
gyy = gyy * aux
gyz = gyz * aux
gzz = gzz * aux
dxx = gxx - ONE
dyy = gyy - ONE
dzz = gzz - ONE
! for A
detginv = 1/(2.d0*gxy*gxz*gyz + gxx*gyy*gzz &
- gzz*gxy**2 - gyy*gxz**2 - gxx*gyz**2)
trA = detginv*(-2.d0*Ayz*gxx*gyz + Axx*gyy*gzz + &
gxx*(Azz*gyy + Ayy*gzz) + 2.d0*(gxz*(Ayz*gxy - Axz*gyy + &
Axy*gyz) + gxy*(Axz*gyz - Axy*gzz)) - Azz*gxy**2 - Ayy*gxz**2 - &
Axx*gyz**2)
aux = -(oot*trA)
Axx = Axx + aux * gxx
Axy = Axy + aux * gxy
Axz = Axz + aux * gxz
Ayy = Ayy + aux * gyy
Ayz = Ayz + aux * gyz
Azz = Azz + aux * gzz
return
end subroutine enforce_ga
#endif
!-----------------------------------------------------------------------------
!
! remove the trace of Aij
! trace-free Aij and enforce the determinant of bssn metric to one
!-----------------------------------------------------------------------------
subroutine enforce_ag(ex, dxx, gxy, gxz, dyy, gyz, dzz, &
Axx, Axy, Axz, Ayy, Ayz, Azz)
implicit none
!~~~~~~> Input parameters:
integer, intent(in) :: ex(1:3)
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: dxx,dyy,dzz
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: gxy,gxz,gyz
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: Axx,Axy,Axz
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: Ayy,Ayz,Azz
!~~~~~~~> Local variable:
integer :: i,j,k
real*8 :: lgxx,lgyy,lgzz,ldetg
real*8 :: lgupxx,lgupxy,lgupxz,lgupyy,lgupyz,lgupzz
real*8 :: ltrA,lscale
real*8, parameter :: F1o3 = 1.D0 / 3.D0, ONE = 1.D0, TWO = 2.D0
!~~~~~~>
do k=1,ex(3)
do j=1,ex(2)
do i=1,ex(1)
lgxx = dxx(i,j,k) + ONE
lgyy = dyy(i,j,k) + ONE
lgzz = dzz(i,j,k) + ONE
ldetg = lgxx * lgyy * lgzz &
+ gxy(i,j,k) * gyz(i,j,k) * gxz(i,j,k) &
+ gxz(i,j,k) * gxy(i,j,k) * gyz(i,j,k) &
- gxz(i,j,k) * lgyy * gxz(i,j,k) &
- gxy(i,j,k) * gxy(i,j,k) * lgzz &
- lgxx * gyz(i,j,k) * gyz(i,j,k)
lgupxx = ( lgyy * lgzz - gyz(i,j,k) * gyz(i,j,k) ) / ldetg
lgupxy = - ( gxy(i,j,k) * lgzz - gyz(i,j,k) * gxz(i,j,k) ) / ldetg
lgupxz = ( gxy(i,j,k) * gyz(i,j,k) - lgyy * gxz(i,j,k) ) / ldetg
lgupyy = ( lgxx * lgzz - gxz(i,j,k) * gxz(i,j,k) ) / ldetg
lgupyz = - ( lgxx * gyz(i,j,k) - gxy(i,j,k) * gxz(i,j,k) ) / ldetg
lgupzz = ( lgxx * lgyy - gxy(i,j,k) * gxy(i,j,k) ) / ldetg
ltrA = lgupxx * Axx(i,j,k) + lgupyy * Ayy(i,j,k) &
+ lgupzz * Azz(i,j,k) &
+ TWO * (lgupxy * Axy(i,j,k) + lgupxz * Axz(i,j,k) &
+ lgupyz * Ayz(i,j,k))
Axx(i,j,k) = Axx(i,j,k) - F1o3 * lgxx * ltrA
Axy(i,j,k) = Axy(i,j,k) - F1o3 * gxy(i,j,k) * ltrA
Axz(i,j,k) = Axz(i,j,k) - F1o3 * gxz(i,j,k) * ltrA
Ayy(i,j,k) = Ayy(i,j,k) - F1o3 * lgyy * ltrA
Ayz(i,j,k) = Ayz(i,j,k) - F1o3 * gyz(i,j,k) * ltrA
Azz(i,j,k) = Azz(i,j,k) - F1o3 * lgzz * ltrA
lscale = ONE / ( ldetg ** F1o3 )
dxx(i,j,k) = lgxx * lscale - ONE
gxy(i,j,k) = gxy(i,j,k) * lscale
gxz(i,j,k) = gxz(i,j,k) * lscale
dyy(i,j,k) = lgyy * lscale - ONE
gyz(i,j,k) = gyz(i,j,k) * lscale
dzz(i,j,k) = lgzz * lscale - ONE
enddo
enddo
enddo
return
end subroutine enforce_ag
#if 1
!----------------------------------------------------------------------------------
! swap the turn of a and g
!----------------------------------------------------------------------------------
subroutine enforce_ga(ex, dxx, gxy, gxz, dyy, gyz, dzz, &
Axx, Axy, Axz, Ayy, Ayz, Azz)
implicit none
!~~~~~~> Input parameters:
integer, intent(in) :: ex(1:3)
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: dxx,dyy,dzz
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: gxy,gxz,gyz
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: Axx,Axy,Axz
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: Ayy,Ayz,Azz
!~~~~~~~> Local variable:
integer :: i,j,k
real*8 :: lgxx,lgyy,lgzz,lscale
real*8 :: lgxy,lgxz,lgyz
real*8 :: lgupxx,lgupxy,lgupxz,lgupyy,lgupyz,lgupzz
real*8 :: ltrA
real*8, parameter :: F1o3 = 1.D0 / 3.D0, ONE = 1.D0, TWO = 2.D0
!~~~~~~>
do k=1,ex(3)
do j=1,ex(2)
do i=1,ex(1)
! for g: normalize determinant first
lgxx = dxx(i,j,k) + ONE
lgyy = dyy(i,j,k) + ONE
lgzz = dzz(i,j,k) + ONE
lgxy = gxy(i,j,k)
lgxz = gxz(i,j,k)
lgyz = gyz(i,j,k)
lscale = lgxx * lgyy * lgzz + lgxy * lgyz * lgxz &
+ lgxz * lgxy * lgyz - lgxz * lgyy * lgxz &
- lgxy * lgxy * lgzz - lgxx * lgyz * lgyz
lscale = ONE / ( lscale ** F1o3 )
lgxx = lgxx * lscale
lgxy = lgxy * lscale
lgxz = lgxz * lscale
lgyy = lgyy * lscale
lgyz = lgyz * lscale
lgzz = lgzz * lscale
dxx(i,j,k) = lgxx - ONE
gxy(i,j,k) = lgxy
gxz(i,j,k) = lgxz
dyy(i,j,k) = lgyy - ONE
gyz(i,j,k) = lgyz
dzz(i,j,k) = lgzz - ONE
! for A: trace-free using normalized metric (det=1, no division needed)
lgupxx = ( lgyy * lgzz - lgyz * lgyz )
lgupxy = - ( lgxy * lgzz - lgyz * lgxz )
lgupxz = ( lgxy * lgyz - lgyy * lgxz )
lgupyy = ( lgxx * lgzz - lgxz * lgxz )
lgupyz = - ( lgxx * lgyz - lgxy * lgxz )
lgupzz = ( lgxx * lgyy - lgxy * lgxy )
ltrA = lgupxx * Axx(i,j,k) + lgupyy * Ayy(i,j,k) &
+ lgupzz * Azz(i,j,k) &
+ TWO * (lgupxy * Axy(i,j,k) + lgupxz * Axz(i,j,k) &
+ lgupyz * Ayz(i,j,k))
Axx(i,j,k) = Axx(i,j,k) - F1o3 * lgxx * ltrA
Axy(i,j,k) = Axy(i,j,k) - F1o3 * lgxy * ltrA
Axz(i,j,k) = Axz(i,j,k) - F1o3 * lgxz * ltrA
Ayy(i,j,k) = Ayy(i,j,k) - F1o3 * lgyy * ltrA
Ayz(i,j,k) = Ayz(i,j,k) - F1o3 * lgyz * ltrA
Azz(i,j,k) = Azz(i,j,k) - F1o3 * lgzz * ltrA
enddo
enddo
enddo
return
end subroutine enforce_ga
#else
!----------------------------------------------------------------------------------
! duplicate bam
!----------------------------------------------------------------------------------
subroutine enforce_ga(ex, dxx, gxy, gxz, dyy, gyz, dzz, &
Axx, Axy, Axz, Ayy, Ayz, Azz)
implicit none
!~~~~~~> Input parameters:
integer, intent(in) :: ex(1:3)
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: dxx,dyy,dzz
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: gxy,gxz,gyz
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: Axx,Axy,Axz
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: Ayy,Ayz,Azz
!~~~~~~~> Local variable:
real*8, dimension(ex(1),ex(2),ex(3)) :: trA
real*8, dimension(ex(1),ex(2),ex(3)) :: gxx,gyy,gzz
real*8, dimension(ex(1),ex(2),ex(3)) :: aux,detginv
real*8, parameter :: oot = 1.D0 / 3.D0, ONE = 1.D0, TWO = 2.D0
!~~~~~~>
gxx = dxx + ONE
gyy = dyy + ONE
gzz = dzz + ONE
! for g
aux = (2.d0*gxy*gxz*gyz + gxx*gyy*gzz &
- gzz*gxy**2 - gyy*gxz**2 - gxx*gyz**2)**(-oot)
gxx = gxx * aux
gxy = gxy * aux
gxz = gxz * aux
gyy = gyy * aux
gyz = gyz * aux
gzz = gzz * aux
dxx = gxx - ONE
dyy = gyy - ONE
dzz = gzz - ONE
! for A
detginv = 1/(2.d0*gxy*gxz*gyz + gxx*gyy*gzz &
- gzz*gxy**2 - gyy*gxz**2 - gxx*gyz**2)
trA = detginv*(-2.d0*Ayz*gxx*gyz + Axx*gyy*gzz + &
gxx*(Azz*gyy + Ayy*gzz) + 2.d0*(gxz*(Ayz*gxy - Axz*gyy + &
Axy*gyz) + gxy*(Axz*gyz - Axy*gzz)) - Azz*gxy**2 - Ayy*gxz**2 - &
Axx*gyz**2)
aux = -(oot*trA)
Axx = Axx + aux * gxx
Axy = Axy + aux * gxy
Axz = Axz + aux * gxz
Ayy = Ayy + aux * gyy
Ayz = Ayz + aux * gyz
Azz = Azz + aux * gzz
return
end subroutine enforce_ga
#endif

View File

@@ -1,30 +1,30 @@
#ifndef ENFORCE_ALGEBRA_H
#define ENFORCE_ALGEBRA_H
#ifdef fortran1
#define f_enforce_ag enforce_ag
#define f_enforce_ga enforce_ga
#endif
#ifdef fortran2
#define f_enforce_ag ENFORCE_AG
#define f_enforce_ga ENFORCE_GA
#endif
#ifdef fortran3
#define f_enforce_ag enforce_ag_
#define f_enforce_ga enforce_ga_
#endif
extern "C"
{
void f_enforce_ag(int *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *);
}
extern "C"
{
void f_enforce_ga(int *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *);
}
#endif /* ENFORCE_ALGEBRA_H */
#ifndef ENFORCE_ALGEBRA_H
#define ENFORCE_ALGEBRA_H
#ifdef fortran1
#define f_enforce_ag enforce_ag
#define f_enforce_ga enforce_ga
#endif
#ifdef fortran2
#define f_enforce_ag ENFORCE_AG
#define f_enforce_ga ENFORCE_GA
#endif
#ifdef fortran3
#define f_enforce_ag enforce_ag_
#define f_enforce_ga enforce_ga_
#endif
extern "C"
{
void f_enforce_ag(int *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *);
}
extern "C"
{
void f_enforce_ga(int *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *);
}
#endif /* ENFORCE_ALGEBRA_H */

View File

@@ -1,38 +1,38 @@
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include "cctk.h"
#include "config.h"
#include "stdc.h"
namespace AHFinderDirect
{
namespace jtutil
{
int error_exit(int msg_level, const char *format, ...)
{
const int N_buffer = 2000;
char buffer[N_buffer];
va_list ap;
va_start(ap, format);
vsnprintf(buffer, N_buffer, format, ap);
va_end(ap);
const int len = strlen(buffer);
if ((len > 0) && (buffer[len - 1] == '\n'))
then buffer[len - 1] = '\0';
CCTK_VWarn(msg_level, __LINE__, __FILE__, CCTK_THORNSTRING, "%s", buffer);
// if we got here, evidently msg_level wasn't drastic enough
abort(); /*NOTREACHED*/
}
//******************************************************************************
} // namespace jtutil
} // namespace AHFinderDirect
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include "cctk.h"
#include "config.h"
#include "stdc.h"
namespace AHFinderDirect
{
namespace jtutil
{
int error_exit(int msg_level, const char *format, ...)
{
const int N_buffer = 2000;
char buffer[N_buffer];
va_list ap;
va_start(ap, format);
vsnprintf(buffer, N_buffer, format, ap);
va_end(ap);
const int len = strlen(buffer);
if ((len > 0) && (buffer[len - 1] == '\n'))
then buffer[len - 1] = '\0';
CCTK_VWarn(msg_level, __LINE__, __FILE__, CCTK_THORNSTRING, "%s", buffer);
// if we got here, evidently msg_level wasn't drastic enough
abort(); /*NOTREACHED*/
}
//******************************************************************************
} // namespace jtutil
} // namespace AHFinderDirect

View File

@@ -1,386 +1,386 @@
#include "macrodef.h"
#ifdef With_AHF
#include <stdio.h>
#include <assert.h>
#include <math.h>
#include "util_Table.h"
#include "cctk.h"
#include "config.h"
#include "stdc.h"
#include "util.h"
#include "array.h"
#include "cpm_map.h"
#include "linear_map.h"
#include "coords.h"
#include "tgrid.h"
#include "fd_grid.h"
#include "patch.h"
#include "patch_edge.h"
#include "patch_interp.h"
#include "ghost_zone.h"
#include "patch_system.h"
#include "Jacobian.h"
#include "gfns.h"
#include "gr.h"
namespace AHFinderDirect
{
using jtutil::error_exit;
namespace
{
void expansion_Jacobian_partial_SD(patch_system &ps, Jacobian &Jac,
bool print_msg_flag);
void add_ghost_zone_Jacobian(const patch_system &ps,
Jacobian &Jac,
fp mol,
const patch &xp, const ghost_zone &xmgz,
int x_II,
int xm_irho, int xm_isigma);
enum expansion_status
expansion_Jacobian_dr_FD(patch_system *ps_ptr, Jacobian *Jac_ptr, fp add_to_expansion,
bool initial_flag,
bool print_msg_flag);
}
//******************************************************************************
//
// If ps_ptr != NULL and Jac_ptr != NULL, this function computes the
// Jacobian matrix J[Theta(h)] of the expansion Theta(h). We assume
// that Theta(h) has already been computed.
//
// If ps_ptr == NULL and Jac_ptr == NULL, this function does a dummy
// computation, in which only any expansion() (and hence geometry
// interpolator) calls are done, these with the number of interpolation
// points set to 0 and all the output array pointers set to NULL.
//
// It's illegal for one but not both of ps_ptr and Jac_ptr to be NULL.
//
// Arguments:
// ps_ptr --> The patch system, or == NULL to do (only) a dummy computation.
// Jac_ptr --> The Jacobian, or == NULL to do (only) a dummy computation.
// add_to_expansion = A real number to add to the expansion.
//
// Results:
// This function returns a status code indicating whether the computation
// succeeded or failed, and if the latter, what caused the failure.
//
enum expansion_status
expansion_Jacobian(patch_system *ps_ptr, Jacobian *Jac_ptr,
fp add_to_expansion,
bool initial_flag,
bool print_msg_flag /* = false */)
{
const bool active_flag = (ps_ptr != NULL) && (Jac_ptr != NULL);
enum expansion_status status;
if (active_flag)
then expansion_Jacobian_partial_SD(*ps_ptr, *Jac_ptr,
print_msg_flag);
// this function looks at ps_ptr and Jac_ptr (non-NULL vs NULL)
// to choose a normal vs dummy computation
{
status = expansion_Jacobian_dr_FD(ps_ptr, Jac_ptr, add_to_expansion,
initial_flag,
print_msg_flag);
if (status != expansion_success)
then return status; // *** ERROR RETURN ***
}
return expansion_success; // *** NORMAL RETURN ***
}
//
// This function computes the partial derivative terms in the Jacobian
// matrix of the expansion Theta(h), by symbolic differentiation from
// the Jacobian coefficient (angular) gridfns. The Jacobian is traversed
// by rows, using equation (25) of my 1996 apparent horizon finding paper.
//
// Inputs (angular gridfns, on ghosted grid):
// h # shape of trial surface
// Theta # Theta(h) assumed to already be computed
// partial_Theta_wrt_partial_d_h # Jacobian coefficients
// partial_Theta_wrt_partial_dd_h # (also assumed to already be computed)
//
// Outputs:
// The Jacobian matrix is stored in the Jacobian object Jac.
//
namespace
{
void expansion_Jacobian_partial_SD(patch_system &ps, Jacobian &Jac,
bool print_msg_flag)
{
Jac.zero_matrix();
ps.compute_synchronize_Jacobian();
for (int xpn = 0; xpn < ps.N_patches(); ++xpn)
{
patch &xp = ps.ith_patch(xpn);
for (int x_irho = xp.min_irho(); x_irho <= xp.max_irho(); ++x_irho)
{
for (int x_isigma = xp.min_isigma(); x_isigma <= xp.max_isigma(); ++x_isigma)
{
//
// compute the main Jacobian terms for this grid point, i.e.
// partial Theta(this point x, Jacobian row II)
// ---------------------------------------------
// partial h(other points y, Jacobian column JJ)
//
// Jacobian row index
const int II = ps.gpn_of_patch_irho_isigma(xp, x_irho, x_isigma);
// Jacobian coefficients for this point
const fp Jacobian_coeff_rho = xp.gridfn(gfns::gfn__partial_Theta_wrt_partial_d_h_1,
x_irho, x_isigma);
const fp Jacobian_coeff_sigma = xp.gridfn(gfns::gfn__partial_Theta_wrt_partial_d_h_2,
x_irho, x_isigma);
const fp Jacobian_coeff_rho_rho = xp.gridfn(gfns::gfn__partial_Theta_wrt_partial_dd_h_11,
x_irho, x_isigma);
const fp Jacobian_coeff_rho_sigma = xp.gridfn(gfns::gfn__partial_Theta_wrt_partial_dd_h_12,
x_irho, x_isigma);
const fp Jacobian_coeff_sigma_sigma = xp.gridfn(gfns::gfn__partial_Theta_wrt_partial_dd_h_22,
x_irho, x_isigma);
// partial_rho, partial_rho_rho
{
for (int m_irho = xp.molecule_min_m();
m_irho <= xp.molecule_max_m();
++m_irho)
{
const int xm_irho = x_irho + m_irho;
const fp Jac_rho = Jacobian_coeff_rho * xp.partial_rho_coeff(m_irho);
const fp Jac_rho_rho = Jacobian_coeff_rho_rho * xp.partial_rho_rho_coeff(m_irho);
const fp Jac_sum = Jac_rho + Jac_rho_rho;
if (xp.is_in_nominal_grid(xm_irho, x_isigma))
then
{
const int xm_JJ = Jac.II_of_patch_irho_isigma(xp, xm_irho, x_isigma);
Jac.sum_into_element(II, xm_JJ, Jac_sum);
}
else
add_ghost_zone_Jacobian(ps, Jac,
Jac_sum,
xp, xp.minmax_rho_ghost_zone(m_irho < 0),
II, xm_irho, x_isigma);
}
}
// partial_sigma, partial_sigma_sigma
{
for (int m_isigma = xp.molecule_min_m();
m_isigma <= xp.molecule_max_m();
++m_isigma)
{
const int xm_isigma = x_isigma + m_isigma;
const fp Jac_sigma = Jacobian_coeff_sigma * xp.partial_sigma_coeff(m_isigma);
const fp Jac_sigma_sigma = Jacobian_coeff_sigma_sigma * xp.partial_sigma_sigma_coeff(m_isigma);
const fp Jac_sum = Jac_sigma + Jac_sigma_sigma;
if (xp.is_in_nominal_grid(x_irho, xm_isigma))
then
{
const int xm_JJ = Jac.II_of_patch_irho_isigma(xp, x_irho, xm_isigma);
Jac.sum_into_element(II, xm_JJ, Jac_sum);
}
else
add_ghost_zone_Jacobian(ps, Jac,
Jac_sum,
xp, xp.minmax_sigma_ghost_zone(m_isigma < 0),
II, x_irho, xm_isigma);
}
}
// partial_rho_sigma
{
for (int m_irho = xp.molecule_min_m();
m_irho <= xp.molecule_max_m();
++m_irho)
{
for (int m_isigma = xp.molecule_min_m();
m_isigma <= xp.molecule_max_m();
++m_isigma)
{
const int xm_irho = x_irho + m_irho;
const int xm_isigma = x_isigma + m_isigma;
const fp Jac_rho_sigma = Jacobian_coeff_rho_sigma * xp.partial_rho_sigma_coeff(m_irho, m_isigma);
if (xp.is_in_nominal_grid(xm_irho, xm_isigma))
then
{
const int xm_JJ = Jac.II_of_patch_irho_isigma(xp, xm_irho, xm_isigma);
Jac.sum_into_element(II, xm_JJ, Jac_rho_sigma);
}
else
{
const ghost_zone &xmgz = xp.corner_ghost_zone_containing_point(m_irho < 0, m_isigma < 0,
xm_irho, xm_isigma);
add_ghost_zone_Jacobian(ps, Jac,
Jac_rho_sigma,
xp, xmgz,
II, xm_irho, xm_isigma);
}
}
}
}
}
}
}
}
}
//******************************************************************************
//
// This function adds the ghost-zone Jacobian dependency contributions
// for a single ghost-zone point, to a Jacobian matrix.
//
// Arguments:
// ps = The patch system.
// Jac = (out) The Jacobian matrix.
// mol = The molecule coefficient.
// xp = The patch containing the center point of the molecule.
// xmgz = If the x+m point is in a ghost zone, this must be that ghost zone.
// If the x+m point is not in a ghost zone, this argument is ignored.
// x_II = The Jacobian row of the x point.
// xm_(irho,isigma) = The coordinates (in xp) of the x+m point of the molecule.
namespace
{
void add_ghost_zone_Jacobian(const patch_system &ps,
Jacobian &Jac,
fp mol,
const patch &xp, const ghost_zone &xmgz,
int x_II,
int xm_irho, int xm_isigma)
{
const patch_edge &xme = xmgz.my_edge();
const int xm_iperp = xme.iperp_of_irho_isigma(xm_irho, xm_isigma);
const int xm_ipar = xme.ipar_of_irho_isigma(xm_irho, xm_isigma);
// FIXME: this won't change from one call to another
// ==> it would be more efficient to reuse the same buffer
// across multiple calls on this function
int global_min_ym, global_max_ym;
ps.synchronize_Jacobian_global_minmax_ym(global_min_ym, global_max_ym);
jtutil::array1d<fp> Jacobian_buffer(global_min_ym, global_max_ym);
// on what other points y does this molecule point xm depend
// via the patch_system::synchronize() operation?
int y_iperp;
int y_posn, min_ym, max_ym;
const patch_edge &ye = ps.synchronize_Jacobian(xmgz,
xm_iperp, xm_ipar,
y_iperp,
y_posn, min_ym, max_ym,
Jacobian_buffer);
patch &yp = ye.my_patch();
// add the Jacobian contributions from the ym points
for (int ym = min_ym; ym <= max_ym; ++ym)
{
const int y_ipar = y_posn + ym;
const int y_irho = ye.irho_of_iperp_ipar(y_iperp, y_ipar);
const int y_isigma = ye.isigma_of_iperp_ipar(y_iperp, y_ipar);
const int y_JJ = Jac.II_of_patch_irho_isigma(yp, y_irho, y_isigma);
Jac.sum_into_element(x_II, y_JJ, mol * Jacobian_buffer(ym));
}
}
}
//******************************************************************************
//
// If ps_ptr != NULL and Jac_ptr != NULL, this function sums the d/dr
// terms into the Jacobian matrix of the expansion Theta(h), computing
// those terms by finite differencing.
//
// If ps_ptr == NULL and Jac_ptr == NULL, this function does a dummy
// computation, in which only any expansion() (and hence geometry
// interpolator) calls are done, these with the number of interpolation
// points set to 0 and all the output array pointers set to NULL.
//
// It's illegal for one but not both of ps_ptr and Jac_ptr to be NULL.
//
// The basic algorithm is that
// Jac += diag[ (Theta(h+epsilon) - Theta(h)) / epsilon ]
//
// Inputs (angular gridfns, on ghosted grid):
// h # shape of trial surface
// Theta # Theta(h) assumed to already be computed
//
// Outputs:
// Jac += d/dr terms
//
// Results:
// This function returns a status code indicating whether the computation
// succeeded or failed, and if the latter, what caused the failure.
//
namespace
{
enum expansion_status
expansion_Jacobian_dr_FD(patch_system *ps_ptr, Jacobian *Jac_ptr, fp add_to_expansion,
bool initial_flag,
bool print_msg_flag)
{
const bool active_flag = (ps_ptr != NULL) && (Jac_ptr != NULL);
const double epsilon = 1e-6;
// compute Theta(h+epsilon)
if (active_flag)
then
{
ps_ptr->gridfn_copy(gfns::gfn__Theta, gfns::gfn__save_Theta);
ps_ptr->add_to_ghosted_gridfn(epsilon, gfns::gfn__h);
}
const enum expansion_status status = expansion(ps_ptr, add_to_expansion,
initial_flag);
if (status != expansion_success)
then return status; // *** ERROR RETURN ***
if (active_flag)
then
{
for (int pn = 0; pn < ps_ptr->N_patches(); ++pn)
{
patch &p = ps_ptr->ith_patch(pn);
for (int irho = p.min_irho(); irho <= p.max_irho(); ++irho)
{
for (int isigma = p.min_isigma();
isigma <= p.max_isigma();
++isigma)
{
const int II = ps_ptr->gpn_of_patch_irho_isigma(p, irho, isigma);
const fp old_Theta = p.gridfn(gfns::gfn__save_Theta,
irho, isigma);
const fp new_Theta = p.gridfn(gfns::gfn__Theta,
irho, isigma);
const fp d_dr_term = (new_Theta - old_Theta) / epsilon;
Jac_ptr->sum_into_element(II, II, d_dr_term);
}
}
}
// restore h and Theta
ps_ptr->add_to_ghosted_gridfn(-epsilon, gfns::gfn__h);
ps_ptr->gridfn_copy(gfns::gfn__save_Theta, gfns::gfn__Theta);
}
return expansion_success; // *** NORMAL RETURN ***
}
}
//******************************************************************************
} // namespace AHFinderDirect
#endif
#include "macrodef.h"
#ifdef With_AHF
#include <stdio.h>
#include <assert.h>
#include <math.h>
#include "util_Table.h"
#include "cctk.h"
#include "config.h"
#include "stdc.h"
#include "util.h"
#include "array.h"
#include "cpm_map.h"
#include "linear_map.h"
#include "coords.h"
#include "tgrid.h"
#include "fd_grid.h"
#include "patch.h"
#include "patch_edge.h"
#include "patch_interp.h"
#include "ghost_zone.h"
#include "patch_system.h"
#include "Jacobian.h"
#include "gfns.h"
#include "gr.h"
namespace AHFinderDirect
{
using jtutil::error_exit;
namespace
{
void expansion_Jacobian_partial_SD(patch_system &ps, Jacobian &Jac,
bool print_msg_flag);
void add_ghost_zone_Jacobian(const patch_system &ps,
Jacobian &Jac,
fp mol,
const patch &xp, const ghost_zone &xmgz,
int x_II,
int xm_irho, int xm_isigma);
enum expansion_status
expansion_Jacobian_dr_FD(patch_system *ps_ptr, Jacobian *Jac_ptr, fp add_to_expansion,
bool initial_flag,
bool print_msg_flag);
}
//******************************************************************************
//
// If ps_ptr != NULL and Jac_ptr != NULL, this function computes the
// Jacobian matrix J[Theta(h)] of the expansion Theta(h). We assume
// that Theta(h) has already been computed.
//
// If ps_ptr == NULL and Jac_ptr == NULL, this function does a dummy
// computation, in which only any expansion() (and hence geometry
// interpolator) calls are done, these with the number of interpolation
// points set to 0 and all the output array pointers set to NULL.
//
// It's illegal for one but not both of ps_ptr and Jac_ptr to be NULL.
//
// Arguments:
// ps_ptr --> The patch system, or == NULL to do (only) a dummy computation.
// Jac_ptr --> The Jacobian, or == NULL to do (only) a dummy computation.
// add_to_expansion = A real number to add to the expansion.
//
// Results:
// This function returns a status code indicating whether the computation
// succeeded or failed, and if the latter, what caused the failure.
//
enum expansion_status
expansion_Jacobian(patch_system *ps_ptr, Jacobian *Jac_ptr,
fp add_to_expansion,
bool initial_flag,
bool print_msg_flag /* = false */)
{
const bool active_flag = (ps_ptr != NULL) && (Jac_ptr != NULL);
enum expansion_status status;
if (active_flag)
then expansion_Jacobian_partial_SD(*ps_ptr, *Jac_ptr,
print_msg_flag);
// this function looks at ps_ptr and Jac_ptr (non-NULL vs NULL)
// to choose a normal vs dummy computation
{
status = expansion_Jacobian_dr_FD(ps_ptr, Jac_ptr, add_to_expansion,
initial_flag,
print_msg_flag);
if (status != expansion_success)
then return status; // *** ERROR RETURN ***
}
return expansion_success; // *** NORMAL RETURN ***
}
//
// This function computes the partial derivative terms in the Jacobian
// matrix of the expansion Theta(h), by symbolic differentiation from
// the Jacobian coefficient (angular) gridfns. The Jacobian is traversed
// by rows, using equation (25) of my 1996 apparent horizon finding paper.
//
// Inputs (angular gridfns, on ghosted grid):
// h # shape of trial surface
// Theta # Theta(h) assumed to already be computed
// partial_Theta_wrt_partial_d_h # Jacobian coefficients
// partial_Theta_wrt_partial_dd_h # (also assumed to already be computed)
//
// Outputs:
// The Jacobian matrix is stored in the Jacobian object Jac.
//
namespace
{
void expansion_Jacobian_partial_SD(patch_system &ps, Jacobian &Jac,
bool print_msg_flag)
{
Jac.zero_matrix();
ps.compute_synchronize_Jacobian();
for (int xpn = 0; xpn < ps.N_patches(); ++xpn)
{
patch &xp = ps.ith_patch(xpn);
for (int x_irho = xp.min_irho(); x_irho <= xp.max_irho(); ++x_irho)
{
for (int x_isigma = xp.min_isigma(); x_isigma <= xp.max_isigma(); ++x_isigma)
{
//
// compute the main Jacobian terms for this grid point, i.e.
// partial Theta(this point x, Jacobian row II)
// ---------------------------------------------
// partial h(other points y, Jacobian column JJ)
//
// Jacobian row index
const int II = ps.gpn_of_patch_irho_isigma(xp, x_irho, x_isigma);
// Jacobian coefficients for this point
const fp Jacobian_coeff_rho = xp.gridfn(gfns::gfn__partial_Theta_wrt_partial_d_h_1,
x_irho, x_isigma);
const fp Jacobian_coeff_sigma = xp.gridfn(gfns::gfn__partial_Theta_wrt_partial_d_h_2,
x_irho, x_isigma);
const fp Jacobian_coeff_rho_rho = xp.gridfn(gfns::gfn__partial_Theta_wrt_partial_dd_h_11,
x_irho, x_isigma);
const fp Jacobian_coeff_rho_sigma = xp.gridfn(gfns::gfn__partial_Theta_wrt_partial_dd_h_12,
x_irho, x_isigma);
const fp Jacobian_coeff_sigma_sigma = xp.gridfn(gfns::gfn__partial_Theta_wrt_partial_dd_h_22,
x_irho, x_isigma);
// partial_rho, partial_rho_rho
{
for (int m_irho = xp.molecule_min_m();
m_irho <= xp.molecule_max_m();
++m_irho)
{
const int xm_irho = x_irho + m_irho;
const fp Jac_rho = Jacobian_coeff_rho * xp.partial_rho_coeff(m_irho);
const fp Jac_rho_rho = Jacobian_coeff_rho_rho * xp.partial_rho_rho_coeff(m_irho);
const fp Jac_sum = Jac_rho + Jac_rho_rho;
if (xp.is_in_nominal_grid(xm_irho, x_isigma))
then
{
const int xm_JJ = Jac.II_of_patch_irho_isigma(xp, xm_irho, x_isigma);
Jac.sum_into_element(II, xm_JJ, Jac_sum);
}
else
add_ghost_zone_Jacobian(ps, Jac,
Jac_sum,
xp, xp.minmax_rho_ghost_zone(m_irho < 0),
II, xm_irho, x_isigma);
}
}
// partial_sigma, partial_sigma_sigma
{
for (int m_isigma = xp.molecule_min_m();
m_isigma <= xp.molecule_max_m();
++m_isigma)
{
const int xm_isigma = x_isigma + m_isigma;
const fp Jac_sigma = Jacobian_coeff_sigma * xp.partial_sigma_coeff(m_isigma);
const fp Jac_sigma_sigma = Jacobian_coeff_sigma_sigma * xp.partial_sigma_sigma_coeff(m_isigma);
const fp Jac_sum = Jac_sigma + Jac_sigma_sigma;
if (xp.is_in_nominal_grid(x_irho, xm_isigma))
then
{
const int xm_JJ = Jac.II_of_patch_irho_isigma(xp, x_irho, xm_isigma);
Jac.sum_into_element(II, xm_JJ, Jac_sum);
}
else
add_ghost_zone_Jacobian(ps, Jac,
Jac_sum,
xp, xp.minmax_sigma_ghost_zone(m_isigma < 0),
II, x_irho, xm_isigma);
}
}
// partial_rho_sigma
{
for (int m_irho = xp.molecule_min_m();
m_irho <= xp.molecule_max_m();
++m_irho)
{
for (int m_isigma = xp.molecule_min_m();
m_isigma <= xp.molecule_max_m();
++m_isigma)
{
const int xm_irho = x_irho + m_irho;
const int xm_isigma = x_isigma + m_isigma;
const fp Jac_rho_sigma = Jacobian_coeff_rho_sigma * xp.partial_rho_sigma_coeff(m_irho, m_isigma);
if (xp.is_in_nominal_grid(xm_irho, xm_isigma))
then
{
const int xm_JJ = Jac.II_of_patch_irho_isigma(xp, xm_irho, xm_isigma);
Jac.sum_into_element(II, xm_JJ, Jac_rho_sigma);
}
else
{
const ghost_zone &xmgz = xp.corner_ghost_zone_containing_point(m_irho < 0, m_isigma < 0,
xm_irho, xm_isigma);
add_ghost_zone_Jacobian(ps, Jac,
Jac_rho_sigma,
xp, xmgz,
II, xm_irho, xm_isigma);
}
}
}
}
}
}
}
}
}
//******************************************************************************
//
// This function adds the ghost-zone Jacobian dependency contributions
// for a single ghost-zone point, to a Jacobian matrix.
//
// Arguments:
// ps = The patch system.
// Jac = (out) The Jacobian matrix.
// mol = The molecule coefficient.
// xp = The patch containing the center point of the molecule.
// xmgz = If the x+m point is in a ghost zone, this must be that ghost zone.
// If the x+m point is not in a ghost zone, this argument is ignored.
// x_II = The Jacobian row of the x point.
// xm_(irho,isigma) = The coordinates (in xp) of the x+m point of the molecule.
namespace
{
void add_ghost_zone_Jacobian(const patch_system &ps,
Jacobian &Jac,
fp mol,
const patch &xp, const ghost_zone &xmgz,
int x_II,
int xm_irho, int xm_isigma)
{
const patch_edge &xme = xmgz.my_edge();
const int xm_iperp = xme.iperp_of_irho_isigma(xm_irho, xm_isigma);
const int xm_ipar = xme.ipar_of_irho_isigma(xm_irho, xm_isigma);
// FIXME: this won't change from one call to another
// ==> it would be more efficient to reuse the same buffer
// across multiple calls on this function
int global_min_ym, global_max_ym;
ps.synchronize_Jacobian_global_minmax_ym(global_min_ym, global_max_ym);
jtutil::array1d<fp> Jacobian_buffer(global_min_ym, global_max_ym);
// on what other points y does this molecule point xm depend
// via the patch_system::synchronize() operation?
int y_iperp;
int y_posn, min_ym, max_ym;
const patch_edge &ye = ps.synchronize_Jacobian(xmgz,
xm_iperp, xm_ipar,
y_iperp,
y_posn, min_ym, max_ym,
Jacobian_buffer);
patch &yp = ye.my_patch();
// add the Jacobian contributions from the ym points
for (int ym = min_ym; ym <= max_ym; ++ym)
{
const int y_ipar = y_posn + ym;
const int y_irho = ye.irho_of_iperp_ipar(y_iperp, y_ipar);
const int y_isigma = ye.isigma_of_iperp_ipar(y_iperp, y_ipar);
const int y_JJ = Jac.II_of_patch_irho_isigma(yp, y_irho, y_isigma);
Jac.sum_into_element(x_II, y_JJ, mol * Jacobian_buffer(ym));
}
}
}
//******************************************************************************
//
// If ps_ptr != NULL and Jac_ptr != NULL, this function sums the d/dr
// terms into the Jacobian matrix of the expansion Theta(h), computing
// those terms by finite differencing.
//
// If ps_ptr == NULL and Jac_ptr == NULL, this function does a dummy
// computation, in which only any expansion() (and hence geometry
// interpolator) calls are done, these with the number of interpolation
// points set to 0 and all the output array pointers set to NULL.
//
// It's illegal for one but not both of ps_ptr and Jac_ptr to be NULL.
//
// The basic algorithm is that
// Jac += diag[ (Theta(h+epsilon) - Theta(h)) / epsilon ]
//
// Inputs (angular gridfns, on ghosted grid):
// h # shape of trial surface
// Theta # Theta(h) assumed to already be computed
//
// Outputs:
// Jac += d/dr terms
//
// Results:
// This function returns a status code indicating whether the computation
// succeeded or failed, and if the latter, what caused the failure.
//
namespace
{
enum expansion_status
expansion_Jacobian_dr_FD(patch_system *ps_ptr, Jacobian *Jac_ptr, fp add_to_expansion,
bool initial_flag,
bool print_msg_flag)
{
const bool active_flag = (ps_ptr != NULL) && (Jac_ptr != NULL);
const double epsilon = 1e-6;
// compute Theta(h+epsilon)
if (active_flag)
then
{
ps_ptr->gridfn_copy(gfns::gfn__Theta, gfns::gfn__save_Theta);
ps_ptr->add_to_ghosted_gridfn(epsilon, gfns::gfn__h);
}
const enum expansion_status status = expansion(ps_ptr, add_to_expansion,
initial_flag);
if (status != expansion_success)
then return status; // *** ERROR RETURN ***
if (active_flag)
then
{
for (int pn = 0; pn < ps_ptr->N_patches(); ++pn)
{
patch &p = ps_ptr->ith_patch(pn);
for (int irho = p.min_irho(); irho <= p.max_irho(); ++irho)
{
for (int isigma = p.min_isigma();
isigma <= p.max_isigma();
++isigma)
{
const int II = ps_ptr->gpn_of_patch_irho_isigma(p, irho, isigma);
const fp old_Theta = p.gridfn(gfns::gfn__save_Theta,
irho, isigma);
const fp new_Theta = p.gridfn(gfns::gfn__Theta,
irho, isigma);
const fp d_dr_term = (new_Theta - old_Theta) / epsilon;
Jac_ptr->sum_into_element(II, II, d_dr_term);
}
}
}
// restore h and Theta
ps_ptr->add_to_ghosted_gridfn(-epsilon, gfns::gfn__h);
ps_ptr->gridfn_copy(gfns::gfn__save_Theta, gfns::gfn__Theta);
}
return expansion_success; // *** NORMAL RETURN ***
}
}
//******************************************************************************
} // namespace AHFinderDirect
#endif

View File

@@ -1,245 +1,245 @@
!-----------------------------------------------------------------------------
! ADM quantites for surface intergral
!-----------------------------------------------------------------------------
subroutine admmass_bssn(ex, X, Y, Z, &
chi , trK, &
dxx , gxy , gxz , dyy , gyz , dzz , &
Axx , Axy , Axz , Ayy , Ayz , Azz , &
Gamx , Gamy , Gamz , &
massx,massy,massz, symmetry)
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 ) :: dxx,gxy,gxz,dyy,gyz,dzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Axx,Axy,Axz,Ayy,Ayz,Azz
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: chi,trK
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Gamx,Gamy,Gamz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: massx,massy,massz
! local variables
real*8, dimension(ex(1),ex(2),ex(3)) :: gxx,gyy,gzz
! inverse metric
real*8, dimension(ex(1),ex(2),ex(3)) :: gupxx,gupxy,gupxz
real*8, dimension(ex(1),ex(2),ex(3)) :: gupyy,gupyz,gupzz
! partial derivative of chi, chi_i
real*8, dimension(ex(1),ex(2),ex(3)) :: chix,chiy,chiz
real*8, dimension(ex(1),ex(2),ex(3)) :: f
real*8 :: PI, F1o2pi
real*8, parameter :: ONE = 1.d0, F1o8 = 1.d0/8.d0
real*8, parameter :: SYM = 1.D0, ANTI= - 1.D0
real*8 :: dX, dY, dZ
dX = X(2) - X(1)
dY = Y(2) - Y(1)
dZ = Z(2) - Z(1)
PI = dacos( - ONE )
F1o2pi = ONE / ( 2.d0 * PI )
gxx = dxx + ONE
gyy = dyy + ONE
gzz = dzz + ONE
gupzz = gxx * gyy * gzz + gxy * gyz * gxz + gxz * gxy * gyz - &
gxz * gyy * gxz - gxy * gxy * gzz - gxx * gyz * gyz
gupxx = ( gyy * gzz - gyz * gyz ) / gupzz
gupxy = - ( gxy * gzz - gyz * gxz ) / gupzz
gupxz = ( gxy * gyz - gyy * gxz ) / gupzz
gupyy = ( gxx * gzz - gxz * gxz ) / gupzz
gupyz = - ( gxx * gyz - gxy * gxz ) / gupzz
gupzz = ( gxx * gyy - gxy * gxy ) / gupzz
call fderivs(ex,chi,chix,chiy,chiz,X,Y,Z,SYM,SYM,SYM,Symmetry,0)
f=1/4.d0/(chi+ONE)**1.25d0
! mass_i = (Gami/8 + gupij*phi_j/(4*chi^1.25))/(2*Pi)
massx = (F1o8*Gamx + f*(gupxx*chix+gupxy*chiy+gupxz*chiz))*F1o2pi
massy = (F1o8*Gamy + f*(gupxy*chix+gupyy*chiy+gupyz*chiz))*F1o2pi
massz = (F1o8*Gamz + f*(gupxz*chix+gupyz*chiy+gupzz*chiz))*F1o2pi
return
end subroutine admmass_bssn
!-----------------------------------------------------------------------------------------------
! P^i = int r^j p_ji
!-----------------------------------------------------------------------------------------------
subroutine admmomentum_bssn(ex, &
chi, trK, &
dxx , gxy , gxz , dyy , gyz , dzz , &
Axx , Axy , Axz , Ayy , Ayz , Azz , &
Gamx , Gamy , Gamz , &
pxx,pxy,pxz,pyy,pyz,pzz)
implicit none
!~~~~~~= Input parameters:
integer,intent(in) :: ex(1:3)
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: dxx,gxy,gxz,dyy,gyz,dzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Axx,Axy,Axz,Ayy,Ayz,Azz
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: chi,trK
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Gamx,Gamy,Gamz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: pxx,pxy,pxz,pyy,pyz,pzz
! local variables
real*8, dimension(ex(1),ex(2),ex(3)) :: Kxx,Kxy,Kxz,Kyy,Kyz,Kzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gxx,gyy,gzz,chim4
real*8 :: PI, F1o8pi
real*8, parameter :: ONE = 1.d0, F1o3 = 1.d0/3.d0
PI = acos( - ONE )
F1o8pi = ONE / ( 8.d0 * PI )
gxx = dxx + ONE
gyy = dyy + ONE
gzz = dzz + ONE
chim4=1.d0/(chi+ONE)**4
Kxx = chim4*(Axx+F1o3*gxx*trK)
Kxy = chim4*(Axy+F1o3*gxy*trK)
Kxz = chim4*(Axz+F1o3*gxz*trK)
Kyy = chim4*(Ayy+F1o3*gyy*trK)
Kyz = chim4*(Ayz+F1o3*gyz*trK)
Kzz = chim4*(Azz+F1o3*gzz*trK)
pxx = (Kxx-trK)*F1o8pi
pxy = (Kxy )*F1o8pi
pxz = (Kxz )*F1o8pi
pyy = (Kyy-trK)*F1o8pi
pyz = (Kyz )*F1o8pi
pzz = (Kzz-trK)*F1o8pi
return
end subroutine admmomentum_bssn
!-----------------------------------------------------------------------------------------------
! S^i = int r^j s_ji
!-----------------------------------------------------------------------------------------------
subroutine admangularmomentum_bssn(ex,X,Y,Z,&
pxx,pxy,pxz,pyy,pyz,pzz, &
sxx,sxy,sxz,syx,syy,syz,szx,szy,szz)
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))
real*8, dimension(ex(1),ex(2),ex(3)),intent(in) :: pxx,pxy,pxz,pyy,pyz,pzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: sxx,sxy,sxz,syx,syy,syz,szx,szy,szz
!local variable
real*8, dimension(ex(1),ex(2),ex(3))::XX,YY,ZZ
integer::i,j,k
do j = 1,ex(2)
do k = 1,ex(3)
XX(:,j,k) = X
enddo
enddo
do i = 1,ex(1)
do k = 1,ex(3)
YY(i,:,k) = Y
enddo
enddo
do i = 1,ex(1)
do j = 1,ex(2)
ZZ(i,j,:) = Z
enddo
enddo
sxx = YY*pxy - ZZ*pxz
sxy = YY*pyy - ZZ*pyz
sxz = YY*pyz - ZZ*pzz
syx = ZZ*pxy - YY*pxz
syy = ZZ*pyy - YY*pyz
syz = ZZ*pyz - YY*pzz
szx = XX*pxy - YY*pxx
szy = XX*pyy - YY*pxy
szz = XX*pyz - YY*pxz
return
end subroutine admangularmomentum_bssn
! for shell
subroutine admmass_bssn_ss(ex,crho,sigma,R, X, Y, Z, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz, &
drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz, &
dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz, &
dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz, &
chi , trK, &
dxx , gxy , gxz , dyy , gyz , dzz , &
Axx , Axy , Axz , Ayy , Ayz , Azz , &
Gamx , Gamy , Gamz , &
massx,massy,massz, symmetry,sst)
implicit none
!~~~~~~= Input parameters:
integer,intent(in) :: ex(1:3),symmetry,sst
double precision,intent(in),dimension(ex(1))::crho
double precision,intent(in),dimension(ex(2))::sigma
double precision,intent(in),dimension(ex(3))::R
real*8, intent(in ):: X(1:ex(1)),Y(1:ex(2)),Z(1:ex(3))
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::drhodx, drhody, drhodz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dsigmadx,dsigmady,dsigmadz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dRdx,dRdy,dRdz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: dxx,gxy,gxz,dyy,gyz,dzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Axx,Axy,Axz,Ayy,Ayz,Azz
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: chi,trK
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Gamx,Gamy,Gamz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: massx,massy,massz
! local variables
real*8, dimension(ex(1),ex(2),ex(3)) :: gxx,gyy,gzz
! inverse metric
real*8, dimension(ex(1),ex(2),ex(3)) :: gupxx,gupxy,gupxz
real*8, dimension(ex(1),ex(2),ex(3)) :: gupyy,gupyz,gupzz
! partial derivative of chi, chi_i
real*8, dimension(ex(1),ex(2),ex(3)) :: chix,chiy,chiz
real*8, dimension(ex(1),ex(2),ex(3)) :: f
real*8 :: PI, F1o2pi
real*8, parameter :: ONE = 1.d0, F1o8 = 1.d0/8.d0
real*8, parameter :: SYM = 1.D0, ANTI= - 1.D0
real*8 :: dX, dY, dZ
dX = X(2) - X(1)
dY = Y(2) - Y(1)
dZ = Z(2) - Z(1)
PI = dacos( - ONE )
F1o2pi = ONE / ( 2.d0 * PI )
gxx = dxx + ONE
gyy = dyy + ONE
gzz = dzz + ONE
gupzz = gxx * gyy * gzz + gxy * gyz * gxz + gxz * gxy * gyz - &
gxz * gyy * gxz - gxy * gxy * gzz - gxx * gyz * gyz
gupxx = ( gyy * gzz - gyz * gyz ) / gupzz
gupxy = - ( gxy * gzz - gyz * gxz ) / gupzz
gupxz = ( gxy * gyz - gyy * gxz ) / gupzz
gupyy = ( gxx * gzz - gxz * gxz ) / gupzz
gupyz = - ( gxx * gyz - gxy * gxz ) / gupzz
gupzz = ( gxx * gyy - gxy * gxy ) / gupzz
call fderivs_shc(ex,chi,chix,chiy,chiz,crho,sigma,R, SYM, SYM,SYM,Symmetry,0,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz)
f=1/4.d0/(chi+ONE)**1.25d0
! mass_i = (Gami/8 + gupij*phi_j/(4*chi^1.25))/(2*Pi)
massx = (F1o8*Gamx + f*(gupxx*chix+gupxy*chiy+gupxz*chiz))*F1o2pi
massy = (F1o8*Gamy + f*(gupxy*chix+gupyy*chiy+gupyz*chiz))*F1o2pi
massz = (F1o8*Gamz + f*(gupxz*chix+gupyz*chiy+gupzz*chiz))*F1o2pi
return
end subroutine admmass_bssn_ss
!-----------------------------------------------------------------------------
! ADM quantites for surface intergral
!-----------------------------------------------------------------------------
subroutine admmass_bssn(ex, X, Y, Z, &
chi , trK, &
dxx , gxy , gxz , dyy , gyz , dzz , &
Axx , Axy , Axz , Ayy , Ayz , Azz , &
Gamx , Gamy , Gamz , &
massx,massy,massz, symmetry)
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 ) :: dxx,gxy,gxz,dyy,gyz,dzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Axx,Axy,Axz,Ayy,Ayz,Azz
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: chi,trK
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Gamx,Gamy,Gamz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: massx,massy,massz
! local variables
real*8, dimension(ex(1),ex(2),ex(3)) :: gxx,gyy,gzz
! inverse metric
real*8, dimension(ex(1),ex(2),ex(3)) :: gupxx,gupxy,gupxz
real*8, dimension(ex(1),ex(2),ex(3)) :: gupyy,gupyz,gupzz
! partial derivative of chi, chi_i
real*8, dimension(ex(1),ex(2),ex(3)) :: chix,chiy,chiz
real*8, dimension(ex(1),ex(2),ex(3)) :: f
real*8 :: PI, F1o2pi
real*8, parameter :: ONE = 1.d0, F1o8 = 1.d0/8.d0
real*8, parameter :: SYM = 1.D0, ANTI= - 1.D0
real*8 :: dX, dY, dZ
dX = X(2) - X(1)
dY = Y(2) - Y(1)
dZ = Z(2) - Z(1)
PI = dacos( - ONE )
F1o2pi = ONE / ( 2.d0 * PI )
gxx = dxx + ONE
gyy = dyy + ONE
gzz = dzz + ONE
gupzz = gxx * gyy * gzz + gxy * gyz * gxz + gxz * gxy * gyz - &
gxz * gyy * gxz - gxy * gxy * gzz - gxx * gyz * gyz
gupxx = ( gyy * gzz - gyz * gyz ) / gupzz
gupxy = - ( gxy * gzz - gyz * gxz ) / gupzz
gupxz = ( gxy * gyz - gyy * gxz ) / gupzz
gupyy = ( gxx * gzz - gxz * gxz ) / gupzz
gupyz = - ( gxx * gyz - gxy * gxz ) / gupzz
gupzz = ( gxx * gyy - gxy * gxy ) / gupzz
call fderivs(ex,chi,chix,chiy,chiz,X,Y,Z,SYM,SYM,SYM,Symmetry,0)
f=1/4.d0/(chi+ONE)**1.25d0
! mass_i = (Gami/8 + gupij*phi_j/(4*chi^1.25))/(2*Pi)
massx = (F1o8*Gamx + f*(gupxx*chix+gupxy*chiy+gupxz*chiz))*F1o2pi
massy = (F1o8*Gamy + f*(gupxy*chix+gupyy*chiy+gupyz*chiz))*F1o2pi
massz = (F1o8*Gamz + f*(gupxz*chix+gupyz*chiy+gupzz*chiz))*F1o2pi
return
end subroutine admmass_bssn
!-----------------------------------------------------------------------------------------------
! P^i = int r^j p_ji
!-----------------------------------------------------------------------------------------------
subroutine admmomentum_bssn(ex, &
chi, trK, &
dxx , gxy , gxz , dyy , gyz , dzz , &
Axx , Axy , Axz , Ayy , Ayz , Azz , &
Gamx , Gamy , Gamz , &
pxx,pxy,pxz,pyy,pyz,pzz)
implicit none
!~~~~~~= Input parameters:
integer,intent(in) :: ex(1:3)
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: dxx,gxy,gxz,dyy,gyz,dzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Axx,Axy,Axz,Ayy,Ayz,Azz
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: chi,trK
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Gamx,Gamy,Gamz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: pxx,pxy,pxz,pyy,pyz,pzz
! local variables
real*8, dimension(ex(1),ex(2),ex(3)) :: Kxx,Kxy,Kxz,Kyy,Kyz,Kzz
real*8, dimension(ex(1),ex(2),ex(3)) :: gxx,gyy,gzz,chim4
real*8 :: PI, F1o8pi
real*8, parameter :: ONE = 1.d0, F1o3 = 1.d0/3.d0
PI = acos( - ONE )
F1o8pi = ONE / ( 8.d0 * PI )
gxx = dxx + ONE
gyy = dyy + ONE
gzz = dzz + ONE
chim4=1.d0/(chi+ONE)**4
Kxx = chim4*(Axx+F1o3*gxx*trK)
Kxy = chim4*(Axy+F1o3*gxy*trK)
Kxz = chim4*(Axz+F1o3*gxz*trK)
Kyy = chim4*(Ayy+F1o3*gyy*trK)
Kyz = chim4*(Ayz+F1o3*gyz*trK)
Kzz = chim4*(Azz+F1o3*gzz*trK)
pxx = (Kxx-trK)*F1o8pi
pxy = (Kxy )*F1o8pi
pxz = (Kxz )*F1o8pi
pyy = (Kyy-trK)*F1o8pi
pyz = (Kyz )*F1o8pi
pzz = (Kzz-trK)*F1o8pi
return
end subroutine admmomentum_bssn
!-----------------------------------------------------------------------------------------------
! S^i = int r^j s_ji
!-----------------------------------------------------------------------------------------------
subroutine admangularmomentum_bssn(ex,X,Y,Z,&
pxx,pxy,pxz,pyy,pyz,pzz, &
sxx,sxy,sxz,syx,syy,syz,szx,szy,szz)
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))
real*8, dimension(ex(1),ex(2),ex(3)),intent(in) :: pxx,pxy,pxz,pyy,pyz,pzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: sxx,sxy,sxz,syx,syy,syz,szx,szy,szz
!local variable
real*8, dimension(ex(1),ex(2),ex(3))::XX,YY,ZZ
integer::i,j,k
do j = 1,ex(2)
do k = 1,ex(3)
XX(:,j,k) = X
enddo
enddo
do i = 1,ex(1)
do k = 1,ex(3)
YY(i,:,k) = Y
enddo
enddo
do i = 1,ex(1)
do j = 1,ex(2)
ZZ(i,j,:) = Z
enddo
enddo
sxx = YY*pxy - ZZ*pxz
sxy = YY*pyy - ZZ*pyz
sxz = YY*pyz - ZZ*pzz
syx = ZZ*pxy - YY*pxz
syy = ZZ*pyy - YY*pyz
syz = ZZ*pyz - YY*pzz
szx = XX*pxy - YY*pxx
szy = XX*pyy - YY*pxy
szz = XX*pyz - YY*pxz
return
end subroutine admangularmomentum_bssn
! for shell
subroutine admmass_bssn_ss(ex,crho,sigma,R, X, Y, Z, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz, &
drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz, &
dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz, &
dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz, &
chi , trK, &
dxx , gxy , gxz , dyy , gyz , dzz , &
Axx , Axy , Axz , Ayy , Ayz , Azz , &
Gamx , Gamy , Gamz , &
massx,massy,massz, symmetry,sst)
implicit none
!~~~~~~= Input parameters:
integer,intent(in) :: ex(1:3),symmetry,sst
double precision,intent(in),dimension(ex(1))::crho
double precision,intent(in),dimension(ex(2))::sigma
double precision,intent(in),dimension(ex(3))::R
real*8, intent(in ):: X(1:ex(1)),Y(1:ex(2)),Z(1:ex(3))
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::drhodx, drhody, drhodz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dsigmadx,dsigmady,dsigmadz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dRdx,dRdy,dRdz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: dxx,gxy,gxz,dyy,gyz,dzz
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Axx,Axy,Axz,Ayy,Ayz,Azz
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: chi,trK
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Gamx,Gamy,Gamz
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: massx,massy,massz
! local variables
real*8, dimension(ex(1),ex(2),ex(3)) :: gxx,gyy,gzz
! inverse metric
real*8, dimension(ex(1),ex(2),ex(3)) :: gupxx,gupxy,gupxz
real*8, dimension(ex(1),ex(2),ex(3)) :: gupyy,gupyz,gupzz
! partial derivative of chi, chi_i
real*8, dimension(ex(1),ex(2),ex(3)) :: chix,chiy,chiz
real*8, dimension(ex(1),ex(2),ex(3)) :: f
real*8 :: PI, F1o2pi
real*8, parameter :: ONE = 1.d0, F1o8 = 1.d0/8.d0
real*8, parameter :: SYM = 1.D0, ANTI= - 1.D0
real*8 :: dX, dY, dZ
dX = X(2) - X(1)
dY = Y(2) - Y(1)
dZ = Z(2) - Z(1)
PI = dacos( - ONE )
F1o2pi = ONE / ( 2.d0 * PI )
gxx = dxx + ONE
gyy = dyy + ONE
gzz = dzz + ONE
gupzz = gxx * gyy * gzz + gxy * gyz * gxz + gxz * gxy * gyz - &
gxz * gyy * gxz - gxy * gxy * gzz - gxx * gyz * gyz
gupxx = ( gyy * gzz - gyz * gyz ) / gupzz
gupxy = - ( gxy * gzz - gyz * gxz ) / gupzz
gupxz = ( gxy * gyz - gyy * gxz ) / gupzz
gupyy = ( gxx * gzz - gxz * gxz ) / gupzz
gupyz = - ( gxx * gyz - gxy * gxz ) / gupzz
gupzz = ( gxx * gyy - gxy * gxy ) / gupzz
call fderivs_shc(ex,chi,chix,chiy,chiz,crho,sigma,R, SYM, SYM,SYM,Symmetry,0,sst, &
drhodx, drhody, drhodz, &
dsigmadx,dsigmady,dsigmadz, &
dRdx,dRdy,dRdz)
f=1/4.d0/(chi+ONE)**1.25d0
! mass_i = (Gami/8 + gupij*phi_j/(4*chi^1.25))/(2*Pi)
massx = (F1o8*Gamx + f*(gupxx*chix+gupxy*chiy+gupxz*chiz))*F1o2pi
massy = (F1o8*Gamy + f*(gupxy*chix+gupyy*chiy+gupyz*chiz))*F1o2pi
massz = (F1o8*Gamz + f*(gupxz*chix+gupyz*chiy+gupzz*chiz))*F1o2pi
return
end subroutine admmass_bssn_ss

View File

@@ -1,60 +1,60 @@
#ifndef FADMQUANTITES_H
#define FADMQUANTITES_H
#ifdef fortran1
#define f_admmass_bssn admmass_bssn
#define f_admmass_bssn_ss admmass_bssn_ss
#define f_admmomentum_bssn admmomentum_bssn
#endif
#ifdef fortran2
#define f_admmass_bssn ADMMASS_BSSN
#define f_admmass_bssn_ss ADMMASS_BSSN_SS
#define f_admmomentum_bssn ADMMOMENTUM_BSSN
#endif
#ifdef fortran3
#define f_admmass_bssn admmass_bssn_
#define f_admmass_bssn_ss admmass_bssn_ss_
#define f_admmomentum_bssn admmomentum_bssn_
#endif
extern "C"
{
void f_admmass_bssn(int *, double *, double *, double *,
double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *,
double *, double *, double *,
int &);
}
extern "C"
{
void f_admmass_bssn_ss(int *, double *, double *, double *,
double *, double *, double *,
double *, double *, double *,
double *, double *, double *,
double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *,
double *, double *, double *,
int &, int &);
}
extern "C"
{
void f_admmomentum_bssn(int *, double *, double *, double *,
double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *,
double *, double *, double *,
double *, double *, double *, double *, double *, double *);
}
#endif /* FADMQUANTITES_H */
#ifndef FADMQUANTITES_H
#define FADMQUANTITES_H
#ifdef fortran1
#define f_admmass_bssn admmass_bssn
#define f_admmass_bssn_ss admmass_bssn_ss
#define f_admmomentum_bssn admmomentum_bssn
#endif
#ifdef fortran2
#define f_admmass_bssn ADMMASS_BSSN
#define f_admmass_bssn_ss ADMMASS_BSSN_SS
#define f_admmomentum_bssn ADMMOMENTUM_BSSN
#endif
#ifdef fortran3
#define f_admmass_bssn admmass_bssn_
#define f_admmass_bssn_ss admmass_bssn_ss_
#define f_admmomentum_bssn admmomentum_bssn_
#endif
extern "C"
{
void f_admmass_bssn(int *, double *, double *, double *,
double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *,
double *, double *, double *,
int &);
}
extern "C"
{
void f_admmass_bssn_ss(int *, double *, double *, double *,
double *, double *, double *,
double *, double *, double *,
double *, double *, double *,
double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *,
double *, double *, double *,
int &, int &);
}
extern "C"
{
void f_admmomentum_bssn(int *, double *, double *, double *,
double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, double *,
double *, double *, double *,
double *, double *, double *, double *, double *, double *);
}
#endif /* FADMQUANTITES_H */

Some files were not shown because too many files have changed in this diff Show More