Compare commits
6 Commits
cjy-goldst
...
cjy-dystop
| Author | SHA1 | Date | |
|---|---|---|---|
| f1fe9fd443 | |||
| 7bb9042b18 | |||
| 9991b7f41e | |||
| 57abf12bbd | |||
| 51efc47c1b | |||
| 234c4f7344 |
@@ -5284,41 +5284,6 @@ double Parallel::L2Norm(Patch *Pat, var *vf)
|
|||||||
|
|
||||||
return tvf;
|
return tvf;
|
||||||
}
|
}
|
||||||
void Parallel::L2Norm7(Patch *Pat, var **vf, double *norms)
|
|
||||||
{
|
|
||||||
int myrank;
|
|
||||||
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
|
|
||||||
|
|
||||||
double tvf[7], dtvf[7];
|
|
||||||
int BDW = ghost_width;
|
|
||||||
for (int i = 0; i < 7; i++)
|
|
||||||
dtvf[i] = 0;
|
|
||||||
|
|
||||||
MyList<Block> *BP = Pat->blb;
|
|
||||||
while (BP)
|
|
||||||
{
|
|
||||||
Block *cg = BP->data;
|
|
||||||
if (myrank == cg->rank)
|
|
||||||
{
|
|
||||||
f_l2normhelper7(cg->shape, cg->X[0], cg->X[1], cg->X[2],
|
|
||||||
Pat->bbox[0], Pat->bbox[1], Pat->bbox[2],
|
|
||||||
Pat->bbox[3], Pat->bbox[4], Pat->bbox[5],
|
|
||||||
cg->fgfs[vf[0]->sgfn], cg->fgfs[vf[1]->sgfn], cg->fgfs[vf[2]->sgfn],
|
|
||||||
cg->fgfs[vf[3]->sgfn], cg->fgfs[vf[4]->sgfn], cg->fgfs[vf[5]->sgfn],
|
|
||||||
cg->fgfs[vf[6]->sgfn], tvf, BDW);
|
|
||||||
for (int i = 0; i < 7; i++)
|
|
||||||
dtvf[i] += tvf[i];
|
|
||||||
}
|
|
||||||
if (BP == Pat->ble)
|
|
||||||
break;
|
|
||||||
BP = BP->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
MPI_Allreduce(dtvf, tvf, 7, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
|
|
||||||
|
|
||||||
for (int i = 0; i < 7; i++)
|
|
||||||
norms[i] = sqrt(tvf[i]);
|
|
||||||
}
|
|
||||||
double Parallel::L2Norm(Patch *Pat, var *vf, MPI_Comm Comm_here)
|
double Parallel::L2Norm(Patch *Pat, var *vf, MPI_Comm Comm_here)
|
||||||
{
|
{
|
||||||
int myrank;
|
int myrank;
|
||||||
@@ -5350,41 +5315,6 @@ double Parallel::L2Norm(Patch *Pat, var *vf, MPI_Comm Comm_here)
|
|||||||
|
|
||||||
return tvf;
|
return tvf;
|
||||||
}
|
}
|
||||||
void Parallel::L2Norm7(Patch *Pat, var **vf, double *norms, MPI_Comm Comm_here)
|
|
||||||
{
|
|
||||||
int myrank;
|
|
||||||
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
|
|
||||||
|
|
||||||
double tvf[7], dtvf[7];
|
|
||||||
int BDW = ghost_width;
|
|
||||||
for (int i = 0; i < 7; i++)
|
|
||||||
dtvf[i] = 0;
|
|
||||||
|
|
||||||
MyList<Block> *BP = Pat->blb;
|
|
||||||
while (BP)
|
|
||||||
{
|
|
||||||
Block *cg = BP->data;
|
|
||||||
if (myrank == cg->rank)
|
|
||||||
{
|
|
||||||
f_l2normhelper7(cg->shape, cg->X[0], cg->X[1], cg->X[2],
|
|
||||||
Pat->bbox[0], Pat->bbox[1], Pat->bbox[2],
|
|
||||||
Pat->bbox[3], Pat->bbox[4], Pat->bbox[5],
|
|
||||||
cg->fgfs[vf[0]->sgfn], cg->fgfs[vf[1]->sgfn], cg->fgfs[vf[2]->sgfn],
|
|
||||||
cg->fgfs[vf[3]->sgfn], cg->fgfs[vf[4]->sgfn], cg->fgfs[vf[5]->sgfn],
|
|
||||||
cg->fgfs[vf[6]->sgfn], tvf, BDW);
|
|
||||||
for (int i = 0; i < 7; i++)
|
|
||||||
dtvf[i] += tvf[i];
|
|
||||||
}
|
|
||||||
if (BP == Pat->ble)
|
|
||||||
break;
|
|
||||||
BP = BP->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
MPI_Allreduce(dtvf, tvf, 7, MPI_DOUBLE, MPI_SUM, Comm_here);
|
|
||||||
|
|
||||||
for (int i = 0; i < 7; i++)
|
|
||||||
norms[i] = sqrt(tvf[i]);
|
|
||||||
}
|
|
||||||
void Parallel::checkgsl(MyList<Parallel::gridseg> *pp, bool first_only)
|
void Parallel::checkgsl(MyList<Parallel::gridseg> *pp, bool first_only)
|
||||||
{
|
{
|
||||||
int myrank = 0;
|
int myrank = 0;
|
||||||
|
|||||||
@@ -183,7 +183,6 @@ namespace Parallel
|
|||||||
MyList<Parallel::gridseg> **out_src, MyList<Parallel::gridseg> **out_dst);
|
MyList<Parallel::gridseg> **out_src, MyList<Parallel::gridseg> **out_dst);
|
||||||
void PeriodicBD(Patch *Pat, MyList<var> *VarList, int Symmetry);
|
void PeriodicBD(Patch *Pat, MyList<var> *VarList, int Symmetry);
|
||||||
double L2Norm(Patch *Pat, var *vf);
|
double L2Norm(Patch *Pat, var *vf);
|
||||||
void L2Norm7(Patch *Pat, var **vf, double *norms);
|
|
||||||
void checkgsl(MyList<Parallel::gridseg> *pp, bool first_only);
|
void checkgsl(MyList<Parallel::gridseg> *pp, bool first_only);
|
||||||
void checkvarl(MyList<var> *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_gsl(MyList<Parallel::gridseg> *p, Patch *Pat);
|
||||||
@@ -219,7 +218,6 @@ namespace Parallel
|
|||||||
void checkpatchlist(MyList<Patch> *PatL, bool buflog);
|
void checkpatchlist(MyList<Patch> *PatL, bool buflog);
|
||||||
|
|
||||||
double L2Norm(Patch *Pat, var *vf, MPI_Comm Comm_here);
|
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,
|
bool PatList_Interp_Points(MyList<Patch> *PatL, MyList<var> *VarList,
|
||||||
int NN, double **XX,
|
int NN, double **XX,
|
||||||
double *Shellf, int Symmetry, MPI_Comm Comm_here);
|
double *Shellf, int Symmetry, MPI_Comm Comm_here);
|
||||||
|
|||||||
@@ -3472,43 +3472,6 @@ double ShellPatch::L2Norm(var *vf)
|
|||||||
|
|
||||||
return tvf;
|
return tvf;
|
||||||
}
|
}
|
||||||
void ShellPatch::L2Norm7(var **vf, double *norms)
|
|
||||||
{
|
|
||||||
double tvf[7], dtvf[7];
|
|
||||||
int BDW = overghost;
|
|
||||||
for (int i = 0; i < 7; i++)
|
|
||||||
dtvf[i] = 0;
|
|
||||||
|
|
||||||
MyList<ss_patch> *sPp = PatL;
|
|
||||||
while (sPp)
|
|
||||||
{
|
|
||||||
MyList<Block> *Bp = sPp->data->blb;
|
|
||||||
while (Bp)
|
|
||||||
{
|
|
||||||
Block *cg = Bp->data;
|
|
||||||
if (myrank == cg->rank)
|
|
||||||
{
|
|
||||||
f_l2normhelper7(cg->shape, cg->X[0], cg->X[1], cg->X[2],
|
|
||||||
sPp->data->bbox[0], sPp->data->bbox[1], sPp->data->bbox[2],
|
|
||||||
sPp->data->bbox[3], sPp->data->bbox[4], sPp->data->bbox[5],
|
|
||||||
cg->fgfs[vf[0]->sgfn], cg->fgfs[vf[1]->sgfn], cg->fgfs[vf[2]->sgfn],
|
|
||||||
cg->fgfs[vf[3]->sgfn], cg->fgfs[vf[4]->sgfn], cg->fgfs[vf[5]->sgfn],
|
|
||||||
cg->fgfs[vf[6]->sgfn], tvf, BDW);
|
|
||||||
for (int i = 0; i < 7; i++)
|
|
||||||
dtvf[i] += tvf[i];
|
|
||||||
}
|
|
||||||
if (Bp == sPp->data->ble)
|
|
||||||
break;
|
|
||||||
Bp = Bp->next;
|
|
||||||
}
|
|
||||||
sPp = sPp->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
MPI_Allreduce(dtvf, tvf, 7, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
|
|
||||||
|
|
||||||
for (int i = 0; i < 7; i++)
|
|
||||||
norms[i] = sqrt(tvf[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// find maximum of abstract value, XX store position for maximum, Shellf store maximum themselvs
|
// find maximum of abstract value, XX store position for maximum, Shellf store maximum themselvs
|
||||||
void ShellPatch::Find_Maximum(MyList<var> *VarList, double *XX,
|
void ShellPatch::Find_Maximum(MyList<var> *VarList, double *XX,
|
||||||
|
|||||||
@@ -198,7 +198,6 @@ public:
|
|||||||
void write_Pablo_file_ss(int *ext, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax,
|
void write_Pablo_file_ss(int *ext, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax,
|
||||||
char *filename, int sst);
|
char *filename, int sst);
|
||||||
double L2Norm(var *vf);
|
double L2Norm(var *vf);
|
||||||
void L2Norm7(var **vf, double *norms);
|
|
||||||
void Find_Maximum(MyList<var> *VarList, double *XX, double *Shellf);
|
void Find_Maximum(MyList<var> *VarList, double *XX, double *Shellf);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -47,233 +47,6 @@ using namespace std;
|
|||||||
#define BSSN_ENABLE_MEM_USAGE_LOG 0
|
#define BSSN_ENABLE_MEM_USAGE_LOG 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef BSSN_FINE_TIMING
|
|
||||||
#define BSSN_FINE_TIMING 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef BSSN_FINE_TIMING_EVERY
|
|
||||||
#define BSSN_FINE_TIMING_EVERY 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef BSSN_FINE_TIMING_TOPN
|
|
||||||
#define BSSN_FINE_TIMING_TOPN 8
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef BSSN_KERNEL_FINE_TIMING
|
|
||||||
#define BSSN_KERNEL_FINE_TIMING 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef BSSN_ENABLE_STDIN_ABORT_POLL
|
|
||||||
#define BSSN_ENABLE_STDIN_ABORT_POLL 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if BSSN_FINE_TIMING
|
|
||||||
namespace step_timing
|
|
||||||
{
|
|
||||||
enum Bucket
|
|
||||||
{
|
|
||||||
TB_ANALYSIS_PSI4 = 0,
|
|
||||||
TB_ANALYSIS_SURFACE,
|
|
||||||
TB_ANALYSIS_IO,
|
|
||||||
TB_BH_PREDICTOR,
|
|
||||||
TB_PREDICTOR_RHS,
|
|
||||||
TB_PREDICTOR_SYNC,
|
|
||||||
TB_BH_CORRECTOR,
|
|
||||||
TB_CORRECTOR_RHS,
|
|
||||||
TB_CORRECTOR_SYNC,
|
|
||||||
TB_STATE_SWAP,
|
|
||||||
TB_RESTRICT_PROLONG,
|
|
||||||
TB_CONSTRAINT_OUT,
|
|
||||||
TB_DUMP_3D,
|
|
||||||
TB_DUMP_2D,
|
|
||||||
TB_CHECKPOINT,
|
|
||||||
TB_REGRID,
|
|
||||||
TB_COUNT
|
|
||||||
};
|
|
||||||
|
|
||||||
static double local_bucket_seconds[TB_COUNT];
|
|
||||||
|
|
||||||
static const char *bucket_labels[TB_COUNT] =
|
|
||||||
{
|
|
||||||
"analysis_psi4",
|
|
||||||
"analysis_surface",
|
|
||||||
"analysis_io",
|
|
||||||
"bh_predictor",
|
|
||||||
"predictor_rhs",
|
|
||||||
"predictor_sync",
|
|
||||||
"bh_corrector",
|
|
||||||
"corrector_rhs",
|
|
||||||
"corrector_sync",
|
|
||||||
"state_swap",
|
|
||||||
"restrict_prolong",
|
|
||||||
"constraint_out",
|
|
||||||
"dump_3d",
|
|
||||||
"dump_2d",
|
|
||||||
"checkpoint",
|
|
||||||
"regrid"
|
|
||||||
};
|
|
||||||
|
|
||||||
void reset()
|
|
||||||
{
|
|
||||||
for (int i = 0; i < TB_COUNT; i++)
|
|
||||||
local_bucket_seconds[i] = 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void add(Bucket bucket, double seconds)
|
|
||||||
{
|
|
||||||
local_bucket_seconds[int(bucket)] += seconds;
|
|
||||||
}
|
|
||||||
|
|
||||||
void report(int myrank, int nprocs, monitor *TimingMonitor,
|
|
||||||
int step_index, double phys_time, double step_wall_seconds)
|
|
||||||
{
|
|
||||||
double max_bucket_seconds[TB_COUNT];
|
|
||||||
double avg_bucket_seconds[TB_COUNT];
|
|
||||||
|
|
||||||
MPI_Reduce(local_bucket_seconds, max_bucket_seconds, TB_COUNT, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD);
|
|
||||||
MPI_Reduce(local_bucket_seconds, avg_bucket_seconds, TB_COUNT, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);
|
|
||||||
|
|
||||||
if (myrank != 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (int i = 0; i < TB_COUNT; i++)
|
|
||||||
avg_bucket_seconds[i] /= Mymax(1, nprocs);
|
|
||||||
|
|
||||||
if (TimingMonitor)
|
|
||||||
{
|
|
||||||
double row[2 + 2 * TB_COUNT];
|
|
||||||
row[0] = double(step_index);
|
|
||||||
row[1] = step_wall_seconds;
|
|
||||||
for (int i = 0; i < TB_COUNT; i++)
|
|
||||||
{
|
|
||||||
row[2 + i] = max_bucket_seconds[i];
|
|
||||||
row[2 + TB_COUNT + i] = avg_bucket_seconds[i];
|
|
||||||
}
|
|
||||||
TimingMonitor->writefile(phys_time, 2 + 2 * TB_COUNT, row);
|
|
||||||
}
|
|
||||||
|
|
||||||
double residual = step_wall_seconds;
|
|
||||||
for (int i = 0; i < TB_COUNT; i++)
|
|
||||||
residual -= max_bucket_seconds[i];
|
|
||||||
if (residual < 0.0)
|
|
||||||
residual = 0.0;
|
|
||||||
|
|
||||||
int order[TB_COUNT];
|
|
||||||
for (int i = 0; i < TB_COUNT; i++)
|
|
||||||
order[i] = i;
|
|
||||||
|
|
||||||
for (int i = 0; i < TB_COUNT - 1; i++)
|
|
||||||
for (int j = i + 1; j < TB_COUNT; j++)
|
|
||||||
if (max_bucket_seconds[order[j]] > max_bucket_seconds[order[i]])
|
|
||||||
{
|
|
||||||
int tmp = order[i];
|
|
||||||
order[i] = order[j];
|
|
||||||
order[j] = tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
ios::fmtflags old_flags = cout.flags();
|
|
||||||
streamsize old_precision = cout.precision();
|
|
||||||
|
|
||||||
cout << " Fine timing hot spots (max rank wall estimate):" << endl;
|
|
||||||
const int topn = Mymin(BSSN_FINE_TIMING_TOPN, TB_COUNT);
|
|
||||||
for (int i = 0; i < topn; i++)
|
|
||||||
{
|
|
||||||
const int ib = order[i];
|
|
||||||
const double frac = (step_wall_seconds > 0.0) ? (100.0 * max_bucket_seconds[ib] / step_wall_seconds) : 0.0;
|
|
||||||
cout << " "
|
|
||||||
<< setw(20) << left << bucket_labels[ib]
|
|
||||||
<< " = " << setw(10) << right << setprecision(6) << max_bucket_seconds[ib]
|
|
||||||
<< " s (" << setw(6) << setprecision(4) << frac << "%)" << endl;
|
|
||||||
}
|
|
||||||
if (residual > 1.0e-6)
|
|
||||||
{
|
|
||||||
const double frac = (step_wall_seconds > 0.0) ? (100.0 * residual / step_wall_seconds) : 0.0;
|
|
||||||
cout << " "
|
|
||||||
<< setw(20) << left << "unprofiled_residual"
|
|
||||||
<< " = " << setw(10) << right << setprecision(6) << residual
|
|
||||||
<< " s (" << setw(6) << setprecision(4) << frac << "%)" << endl;
|
|
||||||
}
|
|
||||||
cout << endl;
|
|
||||||
cout.flags(old_flags);
|
|
||||||
cout.precision(old_precision);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#define STEP_TIMER_DECL(var_name) const double var_name = MPI_Wtime()
|
|
||||||
#define STEP_TIMER_ADD(bucket_name, var_name) step_timing::add(step_timing::bucket_name, MPI_Wtime() - (var_name))
|
|
||||||
#else
|
|
||||||
#define STEP_TIMER_DECL(var_name)
|
|
||||||
#define STEP_TIMER_ADD(bucket_name, var_name)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if BSSN_KERNEL_FINE_TIMING
|
|
||||||
namespace rhs_kernel_timing_report
|
|
||||||
{
|
|
||||||
void report(int myrank, int nprocs, int step_index, double step_wall_seconds)
|
|
||||||
{
|
|
||||||
const int bucket_count = f_bssn_rhs_kernel_timing_bucket_count();
|
|
||||||
const double *local_bucket_seconds = f_bssn_rhs_kernel_timing_local_seconds();
|
|
||||||
|
|
||||||
if (bucket_count <= 0 || !local_bucket_seconds)
|
|
||||||
return;
|
|
||||||
|
|
||||||
double *max_bucket_seconds = new double[bucket_count];
|
|
||||||
double *avg_bucket_seconds = new double[bucket_count];
|
|
||||||
int *order = new int[bucket_count];
|
|
||||||
|
|
||||||
MPI_Reduce((void *)local_bucket_seconds, max_bucket_seconds, bucket_count, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD);
|
|
||||||
MPI_Reduce((void *)local_bucket_seconds, avg_bucket_seconds, bucket_count, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);
|
|
||||||
|
|
||||||
if (myrank == 0)
|
|
||||||
{
|
|
||||||
double kernel_total = 0.0;
|
|
||||||
for (int i = 0; i < bucket_count; ++i)
|
|
||||||
{
|
|
||||||
avg_bucket_seconds[i] /= Mymax(1, nprocs);
|
|
||||||
order[i] = i;
|
|
||||||
kernel_total += max_bucket_seconds[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < bucket_count - 1; ++i)
|
|
||||||
for (int j = i + 1; j < bucket_count; ++j)
|
|
||||||
if (max_bucket_seconds[order[j]] > max_bucket_seconds[order[i]])
|
|
||||||
{
|
|
||||||
int tmp = order[i];
|
|
||||||
order[i] = order[j];
|
|
||||||
order[j] = tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
ios::fmtflags old_flags = cout.flags();
|
|
||||||
streamsize old_precision = cout.precision();
|
|
||||||
|
|
||||||
const double kernel_frac = (step_wall_seconds > 0.0) ? (100.0 * kernel_total / step_wall_seconds) : 0.0;
|
|
||||||
cout << " RHS kernel split (max-rank accumulated over step " << step_index << "): total "
|
|
||||||
<< setprecision(6) << kernel_total << " s (" << setprecision(4)
|
|
||||||
<< kernel_frac << "% of coarse step)" << endl;
|
|
||||||
|
|
||||||
const int topn = Mymin(BSSN_FINE_TIMING_TOPN, bucket_count);
|
|
||||||
for (int i = 0; i < topn; ++i)
|
|
||||||
{
|
|
||||||
const int ib = order[i];
|
|
||||||
const double frac = (kernel_total > 0.0) ? (100.0 * max_bucket_seconds[ib] / kernel_total) : 0.0;
|
|
||||||
cout << " "
|
|
||||||
<< setw(20) << left << f_bssn_rhs_kernel_timing_label(ib)
|
|
||||||
<< " = " << setw(10) << right << setprecision(6) << max_bucket_seconds[ib]
|
|
||||||
<< " s (" << setw(6) << setprecision(4) << frac << "% of kernel)" << endl;
|
|
||||||
}
|
|
||||||
cout << endl;
|
|
||||||
|
|
||||||
cout.flags(old_flags);
|
|
||||||
cout.precision(old_precision);
|
|
||||||
}
|
|
||||||
|
|
||||||
delete[] max_bucket_seconds;
|
|
||||||
delete[] avg_bucket_seconds;
|
|
||||||
delete[] order;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//================================================================================================
|
//================================================================================================
|
||||||
|
|
||||||
// define bssn_class
|
// define bssn_class
|
||||||
@@ -292,7 +65,6 @@ bssn_class::bssn_class(double Couranti, double StartTimei, double TotalTimei,
|
|||||||
xc(0), yc(0), zc(0), xr(0), yr(0), zr(0), trigger(0), dTT(0), dumpid(0),
|
xc(0), yc(0), zc(0), xr(0), yr(0), zr(0), trigger(0), dTT(0), dumpid(0),
|
||||||
#endif
|
#endif
|
||||||
a_lev(a_levi), maxl(maxli), decn(decni), maxrex(maxrexi), drex(drexi),
|
a_lev(a_levi), maxl(maxli), decn(decni), maxrex(maxrexi), drex(drexi),
|
||||||
ConstraintRefreshLevels(0),
|
|
||||||
CheckPoint(0)
|
CheckPoint(0)
|
||||||
// CheckPoint(0)
|
// CheckPoint(0)
|
||||||
{
|
{
|
||||||
@@ -335,24 +107,6 @@ bssn_class::bssn_class(double Couranti, double StartTimei, double TotalTimei,
|
|||||||
a_stream.str("");
|
a_stream.str("");
|
||||||
a_stream << setw(15) << "# time Ham Px Py Pz Gx Gy Gz";
|
a_stream << setw(15) << "# time Ham Px Py Pz Gx Gy Gz";
|
||||||
ConVMonitor = new monitor("bssn_constraint.dat", myrank, a_stream.str());
|
ConVMonitor = new monitor("bssn_constraint.dat", myrank, a_stream.str());
|
||||||
|
|
||||||
#if BSSN_FINE_TIMING
|
|
||||||
a_stream.clear();
|
|
||||||
a_stream.str("");
|
|
||||||
a_stream << setw(8) << "# step";
|
|
||||||
a_stream << setw(14) << "wall";
|
|
||||||
for (int ib = 0; ib < step_timing::TB_COUNT; ib++)
|
|
||||||
a_stream << setw(18) << step_timing::bucket_labels[ib];
|
|
||||||
for (int ib = 0; ib < step_timing::TB_COUNT; ib++)
|
|
||||||
{
|
|
||||||
char str_avg[64];
|
|
||||||
sprintf(str_avg, "avg_%s", step_timing::bucket_labels[ib]);
|
|
||||||
a_stream << setw(18) << str_avg;
|
|
||||||
}
|
|
||||||
TimingMonitor = new monitor("bssn_step_timing.dat", myrank, a_stream.str());
|
|
||||||
#else
|
|
||||||
TimingMonitor = 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
// setup sphere integration engine
|
// setup sphere integration engine
|
||||||
Waveshell = new surface_integral(Symmetry);
|
Waveshell = new surface_integral(Symmetry);
|
||||||
@@ -948,9 +702,6 @@ void bssn_class::Initialize()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
GH = new cgh(0, ngfs, Symmetry, pname, checkrun, ErrorMonitor);
|
GH = new cgh(0, ngfs, Symmetry, pname, checkrun, ErrorMonitor);
|
||||||
ConstraintRefreshLevels = new int[GH->levels];
|
|
||||||
for (int il = 0; il < GH->levels; il++)
|
|
||||||
ConstraintRefreshLevels[il] = 0;
|
|
||||||
if (checkrun)
|
if (checkrun)
|
||||||
CheckPoint->readcheck_cgh(PhysTime, GH, myrank, nprocs, Symmetry);
|
CheckPoint->readcheck_cgh(PhysTime, GH, myrank, nprocs, Symmetry);
|
||||||
else
|
else
|
||||||
@@ -1040,8 +791,6 @@ bssn_class::~bssn_class()
|
|||||||
DumpList->clearList();
|
DumpList->clearList();
|
||||||
ConstraintList->clearList();
|
ConstraintList->clearList();
|
||||||
|
|
||||||
delete[] ConstraintRefreshLevels;
|
|
||||||
|
|
||||||
delete phio;
|
delete phio;
|
||||||
delete trKo;
|
delete trKo;
|
||||||
delete gxxo;
|
delete gxxo;
|
||||||
@@ -1301,7 +1050,6 @@ bssn_class::~bssn_class()
|
|||||||
delete BHMonitor;
|
delete BHMonitor;
|
||||||
delete MAPMonitor;
|
delete MAPMonitor;
|
||||||
delete ConVMonitor;
|
delete ConVMonitor;
|
||||||
delete TimingMonitor;
|
|
||||||
delete Waveshell;
|
delete Waveshell;
|
||||||
|
|
||||||
delete CheckPoint;
|
delete CheckPoint;
|
||||||
@@ -2399,15 +2147,6 @@ void bssn_class::Evolve(int Steps)
|
|||||||
|
|
||||||
for (int ncount = 1; ncount < Steps + 1; ncount++)
|
for (int ncount = 1; ncount < Steps + 1; ncount++)
|
||||||
{
|
{
|
||||||
#if BSSN_FINE_TIMING
|
|
||||||
step_timing::reset();
|
|
||||||
#endif
|
|
||||||
#if BSSN_KERNEL_FINE_TIMING
|
|
||||||
f_bssn_rhs_kernel_timing_reset();
|
|
||||||
#endif
|
|
||||||
#if (BSSN_FINE_TIMING || BSSN_KERNEL_FINE_TIMING)
|
|
||||||
const double step_wall_start = MPI_Wtime();
|
|
||||||
#endif
|
|
||||||
// special for large mass ratio consideration
|
// special for large mass ratio consideration
|
||||||
// if(fabs(Porg0[0][0]-Porg0[1][0])+fabs(Porg0[0][1]-Porg0[1][1])+fabs(Porg0[0][2]-Porg0[1][2])<1e-6)
|
// if(fabs(Porg0[0][0]-Porg0[1][0])+fabs(Porg0[0][1]-Porg0[1][1])+fabs(Porg0[0][2]-Porg0[1][2])<1e-6)
|
||||||
// { GH->levels=GH->movls; }
|
// { GH->levels=GH->movls; }
|
||||||
@@ -2434,7 +2173,6 @@ void bssn_class::Evolve(int Steps)
|
|||||||
// When LastDump >= DumpTime, output corresponding binary data
|
// When LastDump >= DumpTime, output corresponding binary data
|
||||||
if (LastDump >= DumpTime)
|
if (LastDump >= DumpTime)
|
||||||
{
|
{
|
||||||
STEP_TIMER_DECL(timer_dump3d);
|
|
||||||
// misc::tillherecheck("before Dump_Data");
|
// misc::tillherecheck("before Dump_Data");
|
||||||
|
|
||||||
for (int lev = 0; lev < GH->levels; lev++)
|
for (int lev = 0; lev < GH->levels; lev++)
|
||||||
@@ -2442,7 +2180,6 @@ void bssn_class::Evolve(int Steps)
|
|||||||
#ifdef WithShell
|
#ifdef WithShell
|
||||||
SH->Dump_Data(DumpList, 0, PhysTime, dT_mon);
|
SH->Dump_Data(DumpList, 0, PhysTime, dT_mon);
|
||||||
#endif
|
#endif
|
||||||
STEP_TIMER_ADD(TB_DUMP_3D, timer_dump3d);
|
|
||||||
|
|
||||||
LastDump = 0;
|
LastDump = 0;
|
||||||
|
|
||||||
@@ -2455,12 +2192,10 @@ void bssn_class::Evolve(int Steps)
|
|||||||
// When Last2dDump >= d2DumpTime, output corresponding 2D data
|
// When Last2dDump >= d2DumpTime, output corresponding 2D data
|
||||||
if (Last2dDump >= d2DumpTime)
|
if (Last2dDump >= d2DumpTime)
|
||||||
{
|
{
|
||||||
STEP_TIMER_DECL(timer_dump2d);
|
|
||||||
// misc::tillherecheck("before 2dDump_Data");
|
// misc::tillherecheck("before 2dDump_Data");
|
||||||
|
|
||||||
for (int lev = 0; lev < GH->levels; lev++)
|
for (int lev = 0; lev < GH->levels; lev++)
|
||||||
Parallel::d2Dump_Data(GH->PatL[lev], DumpList, 0, PhysTime, dT_mon);
|
Parallel::d2Dump_Data(GH->PatL[lev], DumpList, 0, PhysTime, dT_mon);
|
||||||
STEP_TIMER_ADD(TB_DUMP_2D, timer_dump2d);
|
|
||||||
|
|
||||||
Last2dDump = 0;
|
Last2dDump = 0;
|
||||||
|
|
||||||
@@ -2485,12 +2220,10 @@ void bssn_class::Evolve(int Steps)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
#if (REGLEV == 1)
|
#if (REGLEV == 1)
|
||||||
STEP_TIMER_DECL(timer_regrid);
|
|
||||||
GH->Regrid(Symmetry, BH_num, Porgbr, Porg0,
|
GH->Regrid(Symmetry, BH_num, Porgbr, Porg0,
|
||||||
SynchList_cor, OldStateList, StateList, SynchList_pre,
|
SynchList_cor, OldStateList, StateList, SynchList_pre,
|
||||||
fgt(PhysTime - dT_mon, StartTime, dT_mon / 2), ErrorMonitor);
|
fgt(PhysTime - dT_mon, StartTime, dT_mon / 2), ErrorMonitor);
|
||||||
for (int il = 0; il < GH->levels; il++) { sync_cache_pre[il].invalidate(); sync_cache_cor[il].invalidate(); sync_cache_rp_coarse[il].invalidate(); sync_cache_rp_fine[il].invalidate(); sync_cache_restrict[il].invalidate(); sync_cache_outbd[il].invalidate(); }
|
for (int il = 0; il < GH->levels; il++) { sync_cache_pre[il].invalidate(); sync_cache_cor[il].invalidate(); sync_cache_rp_coarse[il].invalidate(); sync_cache_rp_fine[il].invalidate(); sync_cache_restrict[il].invalidate(); sync_cache_outbd[il].invalidate(); }
|
||||||
STEP_TIMER_ADD(TB_REGRID, timer_regrid);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (REGLEV == 0 && (PSTR == 1 || PSTR == 2))
|
#if (REGLEV == 0 && (PSTR == 1 || PSTR == 2))
|
||||||
@@ -2530,13 +2263,10 @@ void bssn_class::Evolve(int Steps)
|
|||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
cout << endl;
|
cout << endl;
|
||||||
#if BSSN_ENABLE_STDIN_ABORT_POLL
|
|
||||||
cout << " If you think the physical evolution time is enough for this simulation, please input 'stop' in the terminal to stop the MPI processes in the next evolution step ! " << endl;
|
cout << " If you think the physical evolution time is enough for this simulation, please input 'stop' in the terminal to stop the MPI processes in the next evolution step ! " << endl;
|
||||||
#endif
|
|
||||||
// cout << endl;
|
// cout << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BSSN_ENABLE_STDIN_ABORT_POLL
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// If an "abort" command is detected on stdin, terminate MPI processes
|
// If an "abort" command is detected on stdin, terminate MPI processes
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@@ -2564,12 +2294,10 @@ void bssn_class::Evolve(int Steps)
|
|||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#endif
|
|
||||||
|
|
||||||
// When LastCheck >= CheckTime, perform runtime checks and output status data
|
// When LastCheck >= CheckTime, perform runtime checks and output status data
|
||||||
if (LastCheck >= CheckTime)
|
if (LastCheck >= CheckTime)
|
||||||
{
|
{
|
||||||
STEP_TIMER_DECL(timer_checkpoint);
|
|
||||||
LastCheck = 0;
|
LastCheck = 0;
|
||||||
|
|
||||||
CheckPoint->write_Black_Hole_position(BH_num_input, BH_num, Porg0, Porgbr, Mass);
|
CheckPoint->write_Black_Hole_position(BH_num_input, BH_num, Porg0, Porgbr, Mass);
|
||||||
@@ -2578,20 +2306,7 @@ void bssn_class::Evolve(int Steps)
|
|||||||
CheckPoint->writecheck_sh(PhysTime, SH);
|
CheckPoint->writecheck_sh(PhysTime, SH);
|
||||||
#endif
|
#endif
|
||||||
CheckPoint->write_bssn(LastDump, Last2dDump, LastAnas);
|
CheckPoint->write_bssn(LastDump, Last2dDump, LastAnas);
|
||||||
STEP_TIMER_ADD(TB_CHECKPOINT, timer_checkpoint);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (BSSN_FINE_TIMING || BSSN_KERNEL_FINE_TIMING)
|
|
||||||
const double step_wall_seconds = MPI_Wtime() - step_wall_start;
|
|
||||||
#endif
|
|
||||||
#if BSSN_FINE_TIMING
|
|
||||||
if (ncount % BSSN_FINE_TIMING_EVERY == 0)
|
|
||||||
step_timing::report(myrank, nprocs, TimingMonitor, ncount, PhysTime, step_wall_seconds);
|
|
||||||
#endif
|
|
||||||
#if BSSN_KERNEL_FINE_TIMING
|
|
||||||
if (ncount % BSSN_FINE_TIMING_EVERY == 0)
|
|
||||||
rhs_kernel_timing_report::report(myrank, nprocs, ncount, step_wall_seconds);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
#ifdef With_AHF
|
#ifdef With_AHF
|
||||||
@@ -2723,16 +2438,10 @@ void bssn_class::RecursiveStep(int lev)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (REGLEV == 0)
|
#if (REGLEV == 0)
|
||||||
STEP_TIMER_DECL(timer_regrid_onelevel);
|
|
||||||
if (GH->Regrid_Onelevel(lev, Symmetry, BH_num, Porgbr, Porg0,
|
if (GH->Regrid_Onelevel(lev, Symmetry, BH_num, Porgbr, Porg0,
|
||||||
SynchList_cor, OldStateList, StateList, SynchList_pre,
|
SynchList_cor, OldStateList, StateList, SynchList_pre,
|
||||||
fgt(PhysTime - dT_lev, StartTime, dT_lev / 2), ErrorMonitor))
|
fgt(PhysTime - dT_lev, StartTime, dT_lev / 2), ErrorMonitor))
|
||||||
{
|
|
||||||
if (ConstraintRefreshLevels)
|
|
||||||
ConstraintRefreshLevels[lev] = 1;
|
|
||||||
for (int il = 0; il < GH->levels; il++) { sync_cache_pre[il].invalidate(); sync_cache_cor[il].invalidate(); sync_cache_rp_coarse[il].invalidate(); sync_cache_rp_fine[il].invalidate(); sync_cache_restrict[il].invalidate(); sync_cache_outbd[il].invalidate(); }
|
for (int il = 0; il < GH->levels; il++) { sync_cache_pre[il].invalidate(); sync_cache_cor[il].invalidate(); sync_cache_rp_coarse[il].invalidate(); sync_cache_rp_fine[il].invalidate(); sync_cache_restrict[il].invalidate(); sync_cache_outbd[il].invalidate(); }
|
||||||
}
|
|
||||||
STEP_TIMER_ADD(TB_REGRID, timer_regrid_onelevel);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3325,7 +3034,6 @@ void bssn_class::Step(int lev, int YN)
|
|||||||
|
|
||||||
// new code 2013-2-15, zjcao
|
// new code 2013-2-15, zjcao
|
||||||
#if (MAPBH == 1)
|
#if (MAPBH == 1)
|
||||||
STEP_TIMER_DECL(timer_bh_predictor);
|
|
||||||
// for black hole position
|
// for black hole position
|
||||||
if (BH_num > 0 && lev == GH->levels - 1)
|
if (BH_num > 0 && lev == GH->levels - 1)
|
||||||
{
|
{
|
||||||
@@ -3356,7 +3064,6 @@ void bssn_class::Step(int lev, int YN)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
STEP_TIMER_ADD(TB_BH_PREDICTOR, timer_bh_predictor);
|
|
||||||
|
|
||||||
// data analysis part
|
// data analysis part
|
||||||
// Warning NOTE: the variables1 are used as temp storege room
|
// Warning NOTE: the variables1 are used as temp storege room
|
||||||
@@ -3379,7 +3086,6 @@ void bssn_class::Step(int lev, int YN)
|
|||||||
int ERROR = 0;
|
int ERROR = 0;
|
||||||
|
|
||||||
MyList<ss_patch> *sPp;
|
MyList<ss_patch> *sPp;
|
||||||
STEP_TIMER_DECL(timer_predictor_rhs);
|
|
||||||
// Predictor
|
// Predictor
|
||||||
MyList<Patch> *Pp = GH->PatL[lev];
|
MyList<Patch> *Pp = GH->PatL[lev];
|
||||||
while (Pp)
|
while (Pp)
|
||||||
@@ -3655,9 +3361,6 @@ void bssn_class::Step(int lev, int YN)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
STEP_TIMER_ADD(TB_PREDICTOR_RHS, timer_predictor_rhs);
|
|
||||||
|
|
||||||
STEP_TIMER_DECL(timer_predictor_sync);
|
|
||||||
Parallel::AsyncSyncState async_pre;
|
Parallel::AsyncSyncState async_pre;
|
||||||
Parallel::Sync_start(GH->PatL[lev], SynchList_pre, Symmetry, sync_cache_pre[lev], async_pre);
|
Parallel::Sync_start(GH->PatL[lev], SynchList_pre, Symmetry, sync_cache_pre[lev], async_pre);
|
||||||
|
|
||||||
@@ -3695,7 +3398,6 @@ void bssn_class::Step(int lev, int YN)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
STEP_TIMER_ADD(TB_PREDICTOR_SYNC, timer_predictor_sync);
|
|
||||||
|
|
||||||
#if (MAPBH == 0)
|
#if (MAPBH == 0)
|
||||||
// for black hole position
|
// for black hole position
|
||||||
@@ -3740,7 +3442,6 @@ void bssn_class::Step(int lev, int YN)
|
|||||||
// corrector
|
// corrector
|
||||||
for (iter_count = 1; iter_count < 4; iter_count++)
|
for (iter_count = 1; iter_count < 4; iter_count++)
|
||||||
{
|
{
|
||||||
STEP_TIMER_DECL(timer_corrector_rhs);
|
|
||||||
// for RK4: t0, t0+dt/2, t0+dt/2, t0+dt;
|
// for RK4: t0, t0+dt/2, t0+dt/2, t0+dt;
|
||||||
if (iter_count == 1 || iter_count == 3)
|
if (iter_count == 1 || iter_count == 3)
|
||||||
TRK4 += dT_lev / 2;
|
TRK4 += dT_lev / 2;
|
||||||
@@ -4020,9 +3721,6 @@ void bssn_class::Step(int lev, int YN)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
STEP_TIMER_ADD(TB_CORRECTOR_RHS, timer_corrector_rhs);
|
|
||||||
|
|
||||||
STEP_TIMER_DECL(timer_corrector_sync);
|
|
||||||
Parallel::AsyncSyncState async_cor;
|
Parallel::AsyncSyncState async_cor;
|
||||||
Parallel::Sync_start(GH->PatL[lev], SynchList_cor, Symmetry, sync_cache_cor[lev], async_cor);
|
Parallel::Sync_start(GH->PatL[lev], SynchList_cor, Symmetry, sync_cache_cor[lev], async_cor);
|
||||||
|
|
||||||
@@ -4062,10 +3760,8 @@ void bssn_class::Step(int lev, int YN)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
STEP_TIMER_ADD(TB_CORRECTOR_SYNC, timer_corrector_sync);
|
|
||||||
|
|
||||||
#if (MAPBH == 0)
|
#if (MAPBH == 0)
|
||||||
STEP_TIMER_DECL(timer_bh_corrector);
|
|
||||||
// for black hole position
|
// for black hole position
|
||||||
if (BH_num > 0 && lev == GH->levels - 1)
|
if (BH_num > 0 && lev == GH->levels - 1)
|
||||||
{
|
{
|
||||||
@@ -4098,13 +3794,11 @@ void bssn_class::Step(int lev, int YN)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
STEP_TIMER_ADD(TB_BH_CORRECTOR, timer_bh_corrector);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// swap time level
|
// swap time level
|
||||||
if (iter_count < 3)
|
if (iter_count < 3)
|
||||||
{
|
{
|
||||||
STEP_TIMER_DECL(timer_state_swap);
|
|
||||||
Pp = GH->PatL[lev];
|
Pp = GH->PatL[lev];
|
||||||
while (Pp)
|
while (Pp)
|
||||||
{
|
{
|
||||||
@@ -4151,11 +3845,9 @@ void bssn_class::Step(int lev, int YN)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
STEP_TIMER_ADD(TB_STATE_SWAP, timer_state_swap);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if (RPS == 0)
|
#if (RPS == 0)
|
||||||
STEP_TIMER_DECL(timer_restrict_prolong);
|
|
||||||
// mesh refinement boundary part
|
// mesh refinement boundary part
|
||||||
RestrictProlong(lev, YN, BB);
|
RestrictProlong(lev, YN, BB);
|
||||||
|
|
||||||
@@ -4176,7 +3868,6 @@ void bssn_class::Step(int lev, int YN)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
STEP_TIMER_ADD(TB_RESTRICT_PROLONG, timer_restrict_prolong);
|
|
||||||
#endif
|
#endif
|
||||||
// note the data structure before update
|
// note the data structure before update
|
||||||
// SynchList_cor 1 -----------
|
// SynchList_cor 1 -----------
|
||||||
@@ -4185,7 +3876,6 @@ void bssn_class::Step(int lev, int YN)
|
|||||||
//
|
//
|
||||||
// OldStateList old -----------
|
// OldStateList old -----------
|
||||||
// update
|
// update
|
||||||
STEP_TIMER_DECL(timer_state_commit);
|
|
||||||
Pp = GH->PatL[lev];
|
Pp = GH->PatL[lev];
|
||||||
while (Pp)
|
while (Pp)
|
||||||
{
|
{
|
||||||
@@ -4242,7 +3932,6 @@ void bssn_class::Step(int lev, int YN)
|
|||||||
Porg0[ithBH][2] = Porg1[ithBH][2];
|
Porg0[ithBH][2] = Porg1[ithBH][2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
STEP_TIMER_ADD(TB_STATE_SWAP, timer_state_commit);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================================
|
//================================================================================================
|
||||||
@@ -4569,9 +4258,7 @@ void bssn_class::Step(int lev, int YN)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
STEP_TIMER_ADD(TB_PREDICTOR_SYNC, timer_predictor_sync);
|
|
||||||
|
|
||||||
STEP_TIMER_DECL(timer_bh_predictor);
|
|
||||||
// for black hole position
|
// for black hole position
|
||||||
if (BH_num > 0 && lev == GH->levels - 1)
|
if (BH_num > 0 && lev == GH->levels - 1)
|
||||||
{
|
{
|
||||||
@@ -4610,7 +4297,6 @@ void bssn_class::Step(int lev, int YN)
|
|||||||
{
|
{
|
||||||
AnalysisStuff(lev, dT_lev);
|
AnalysisStuff(lev, dT_lev);
|
||||||
}
|
}
|
||||||
STEP_TIMER_ADD(TB_BH_PREDICTOR, timer_bh_predictor);
|
|
||||||
// corrector
|
// corrector
|
||||||
for (iter_count = 1; iter_count < 3; iter_count++)
|
for (iter_count = 1; iter_count < 3; iter_count++)
|
||||||
{
|
{
|
||||||
@@ -6081,7 +5767,6 @@ void bssn_class::RestrictProlong(int lev, int YN, bool BB,
|
|||||||
//
|
//
|
||||||
// SynchList_cor old -----------
|
// SynchList_cor old -----------
|
||||||
{
|
{
|
||||||
STEP_TIMER_DECL(timer_restrict_prolong);
|
|
||||||
#if (PSTR == 1 || PSTR == 2)
|
#if (PSTR == 1 || PSTR == 2)
|
||||||
// stringstream a_stream;
|
// stringstream a_stream;
|
||||||
// a_stream.setf(ios::left);
|
// a_stream.setf(ios::left);
|
||||||
@@ -6224,7 +5909,6 @@ void bssn_class::RestrictProlong(int lev, int YN, bool BB,
|
|||||||
// misc::tillherecheck(GH->Commlev[GH->mylev],GH->start_rank[GH->mylev],a_stream.str());
|
// misc::tillherecheck(GH->Commlev[GH->mylev],GH->start_rank[GH->mylev],a_stream.str());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
STEP_TIMER_ADD(TB_RESTRICT_PROLONG, timer_restrict_prolong);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================================
|
//================================================================================================
|
||||||
@@ -6244,7 +5928,6 @@ void bssn_class::RestrictProlong_aux(int lev, int YN, bool BB,
|
|||||||
//
|
//
|
||||||
// SynchList_cor old -----------
|
// SynchList_cor old -----------
|
||||||
{
|
{
|
||||||
STEP_TIMER_DECL(timer_restrict_prolong);
|
|
||||||
// misc::tillherecheck(GH->Commlev[lev],GH->start_rank[lev],"starting RestrictProlong_aux");
|
// misc::tillherecheck(GH->Commlev[lev],GH->start_rank[lev],"starting RestrictProlong_aux");
|
||||||
|
|
||||||
if (lev >= GH->levels - 1)
|
if (lev >= GH->levels - 1)
|
||||||
@@ -6313,7 +5996,6 @@ void bssn_class::RestrictProlong_aux(int lev, int YN, bool BB,
|
|||||||
|
|
||||||
Parallel::Sync_cached(GH->PatL[lev], SL, Symmetry, sync_cache_rp_fine[lev]);
|
Parallel::Sync_cached(GH->PatL[lev], SL, Symmetry, sync_cache_rp_fine[lev]);
|
||||||
}
|
}
|
||||||
STEP_TIMER_ADD(TB_RESTRICT_PROLONG, timer_restrict_prolong);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================================
|
//================================================================================================
|
||||||
@@ -6324,7 +6006,6 @@ void bssn_class::RestrictProlong_aux(int lev, int YN, bool BB,
|
|||||||
|
|
||||||
void bssn_class::RestrictProlong(int lev, int YN, bool BB)
|
void bssn_class::RestrictProlong(int lev, int YN, bool BB)
|
||||||
{
|
{
|
||||||
STEP_TIMER_DECL(timer_restrict_prolong);
|
|
||||||
double dT_lev = dT * pow(0.5, Mymax(lev, trfls));
|
double dT_lev = dT * pow(0.5, Mymax(lev, trfls));
|
||||||
// we assume for fine
|
// we assume for fine
|
||||||
// SynchList_cor 1 -----------
|
// SynchList_cor 1 -----------
|
||||||
@@ -6404,7 +6085,6 @@ void bssn_class::RestrictProlong(int lev, int YN, bool BB)
|
|||||||
|
|
||||||
Parallel::Sync_cached(GH->PatL[lev], SynchList_cor, Symmetry, sync_cache_rp_fine[lev]);
|
Parallel::Sync_cached(GH->PatL[lev], SynchList_cor, Symmetry, sync_cache_rp_fine[lev]);
|
||||||
}
|
}
|
||||||
STEP_TIMER_ADD(TB_RESTRICT_PROLONG, timer_restrict_prolong);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================================
|
//================================================================================================
|
||||||
@@ -7155,15 +6835,18 @@ void bssn_class::compute_Porg_rhs(double **BH_PS,double **BH_RHS,var *forx,var *
|
|||||||
|
|
||||||
void bssn_class::compute_Porg_rhs(double **BH_PS, double **BH_RHS, var *forx, var *fory, var *forz, int ilev)
|
void bssn_class::compute_Porg_rhs(double **BH_PS, double **BH_RHS, var *forx, var *fory, var *forz, int ilev)
|
||||||
{
|
{
|
||||||
MyList<var> DG_List_x(forx);
|
const int InList = 3;
|
||||||
MyList<var> DG_List_y(fory);
|
|
||||||
MyList<var> DG_List_z(forz);
|
|
||||||
DG_List_x.next = &DG_List_y;
|
|
||||||
DG_List_y.next = &DG_List_z;
|
|
||||||
|
|
||||||
double shellf[3];
|
MyList<var> *DG_List = new MyList<var>(forx);
|
||||||
double pox_buf[3][1];
|
DG_List->insert(fory);
|
||||||
double *pox[3] = {pox_buf[0], pox_buf[1], pox_buf[2]};
|
DG_List->insert(forz);
|
||||||
|
|
||||||
|
double *x1, *y1, *z1;
|
||||||
|
double *shellf;
|
||||||
|
shellf = new double[3];
|
||||||
|
double *pox[3];
|
||||||
|
for (int i = 0; i < 3; i++)
|
||||||
|
pox[i] = new double[1];
|
||||||
|
|
||||||
for (int n = 0; n < BH_num; n++)
|
for (int n = 0; n < BH_num; n++)
|
||||||
{
|
{
|
||||||
@@ -7174,9 +6857,9 @@ void bssn_class::compute_Porg_rhs(double **BH_PS, double **BH_RHS, var *forx, va
|
|||||||
int lev = ilev;
|
int lev = ilev;
|
||||||
|
|
||||||
#if (PSTR == 0)
|
#if (PSTR == 0)
|
||||||
while (!Parallel::PatList_Interp_Points(GH->PatL[lev], &DG_List_x, 1, pox, shellf, Symmetry))
|
while (!Parallel::PatList_Interp_Points(GH->PatL[lev], DG_List, 1, pox, shellf, Symmetry))
|
||||||
#elif (PSTR == 1 || PSTR == 2 || PSTR == 3)
|
#elif (PSTR == 1 || PSTR == 2 || PSTR == 3)
|
||||||
while (!Parallel::PatList_Interp_Points(GH->PatL[lev], &DG_List_x, 1, pox, shellf, Symmetry, GH->Commlev[lev]))
|
while (!Parallel::PatList_Interp_Points(GH->PatL[lev], DG_List, 1, pox, shellf, Symmetry, GH->Commlev[lev]))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
lev--;
|
lev--;
|
||||||
@@ -7185,7 +6868,7 @@ void bssn_class::compute_Porg_rhs(double **BH_PS, double **BH_RHS, var *forx, va
|
|||||||
ErrorMonitor->outfile << "fail to find black holes at t = " << PhysTime << endl;
|
ErrorMonitor->outfile << "fail to find black holes at t = " << PhysTime << endl;
|
||||||
for (n = 0; n < BH_num; n++)
|
for (n = 0; n < BH_num; n++)
|
||||||
ErrorMonitor->outfile << "(x,y,z) = ("
|
ErrorMonitor->outfile << "(x,y,z) = ("
|
||||||
<< BH_PS[n][0] << "," << BH_PS[n][1] << "," << BH_PS[n][2]
|
<< pox[0][n] << "," << pox[1][n] << "," << pox[2][n]
|
||||||
<< ")" << endl;
|
<< ")" << endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -7198,6 +6881,11 @@ void bssn_class::compute_Porg_rhs(double **BH_PS, double **BH_RHS, var *forx, va
|
|||||||
BH_RHS[n][2] = -shellf[2];
|
BH_RHS[n][2] = -shellf[2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DG_List->clearList();
|
||||||
|
delete[] shellf;
|
||||||
|
for (int i = 0; i < 3; i++)
|
||||||
|
delete[] pox[i];
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -7420,10 +7108,6 @@ void bssn_class::AnalysisStuff(int lev, double dT_lev)
|
|||||||
IP = new double[NN];
|
IP = new double[NN];
|
||||||
RoutMAP = new double[7];
|
RoutMAP = new double[7];
|
||||||
double Rex = maxrex;
|
double Rex = maxrex;
|
||||||
bool patch_mass_prepared = false;
|
|
||||||
#ifdef WithShell
|
|
||||||
bool shell_mass_prepared = false;
|
|
||||||
#endif
|
|
||||||
for (int i = 0; i < decn; i++)
|
for (int i = 0; i < decn; i++)
|
||||||
{
|
{
|
||||||
#ifdef Point_Psi4
|
#ifdef Point_Psi4
|
||||||
@@ -7451,8 +7135,7 @@ void bssn_class::AnalysisStuff(int lev, double dT_lev)
|
|||||||
gxx0, gxy0, gxz0, gyy0, gyz0, gzz0,
|
gxx0, gxy0, gxz0, gyy0, gyz0, gzz0,
|
||||||
Axx0, Axy0, Axz0, Ayy0, Ayz0, Azz0,
|
Axx0, Axy0, Axz0, Ayy0, Ayz0, Azz0,
|
||||||
Gmx0, Gmy0, Gmz0, Sfx1, Sfy1, Sfz1, // here we can not touch rhs variables, but 1 variables
|
Gmx0, Gmy0, Gmz0, Sfx1, Sfy1, Sfz1, // here we can not touch rhs variables, but 1 variables
|
||||||
RoutMAP, ErrorMonitor, !patch_mass_prepared);
|
RoutMAP, ErrorMonitor);
|
||||||
patch_mass_prepared = true;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -7460,52 +7143,44 @@ void bssn_class::AnalysisStuff(int lev, double dT_lev)
|
|||||||
gxx0, gxy0, gxz0, gyy0, gyz0, gzz0,
|
gxx0, gxy0, gxz0, gyy0, gyz0, gzz0,
|
||||||
Axx0, Axy0, Axz0, Ayy0, Ayz0, Azz0,
|
Axx0, Axy0, Axz0, Ayy0, Ayz0, Azz0,
|
||||||
Gmx0, Gmy0, Gmz0, Sfx1, Sfy1, Sfz1, // here we can not touch rhs variables, but 1 variables
|
Gmx0, Gmy0, Gmz0, Sfx1, Sfy1, Sfz1, // here we can not touch rhs variables, but 1 variables
|
||||||
RoutMAP, ErrorMonitor, !shell_mass_prepared);
|
RoutMAP, ErrorMonitor);
|
||||||
shell_mass_prepared = true;
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
Waveshell->surf_MassPAng(Rex, lev, GH, phi0, trK0,
|
Waveshell->surf_MassPAng(Rex, lev, GH, phi0, trK0,
|
||||||
gxx0, gxy0, gxz0, gyy0, gyz0, gzz0,
|
gxx0, gxy0, gxz0, gyy0, gyz0, gzz0,
|
||||||
Axx0, Axy0, Axz0, Ayy0, Ayz0, Azz0,
|
Axx0, Axy0, Axz0, Ayy0, Ayz0, Azz0,
|
||||||
Gmx0, Gmy0, Gmz0, Sfx1, Sfy1, Sfz1, // here we can not touch rhs variables, but 1 variables
|
Gmx0, Gmy0, Gmz0, Sfx1, Sfy1, Sfz1, // here we can not touch rhs variables, but 1 variables
|
||||||
RoutMAP, ErrorMonitor, !patch_mass_prepared);
|
RoutMAP, ErrorMonitor);
|
||||||
patch_mass_prepared = true;
|
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
// misc::tillherecheck(GH->Commlev[lev],GH->start_rank[lev],"before surface integral");
|
// misc::tillherecheck(GH->Commlev[lev],GH->start_rank[lev],"before surface integral");
|
||||||
#ifdef WithShell
|
#ifdef WithShell
|
||||||
if (lev > 0 || Rex < GH->bbox[0][0][3])
|
if (lev > 0 || Rex < GH->bbox[0][0][3])
|
||||||
{
|
{
|
||||||
Waveshell->surf_WaveMassPAng(Rex, lev, GH,
|
Waveshell->surf_Wave(Rex, lev, GH, Rpsi4, Ipsi4, 2, maxl, NN, RP, IP, ErrorMonitor);
|
||||||
Rpsi4, Ipsi4, 2, maxl, NN, RP, IP,
|
Waveshell->surf_MassPAng(Rex, lev, GH, phi0, trK0,
|
||||||
phi0, trK0,
|
gxx0, gxy0, gxz0, gyy0, gyz0, gzz0,
|
||||||
gxx0, gxy0, gxz0, gyy0, gyz0, gzz0,
|
Axx0, Axy0, Axz0, Ayy0, Ayz0, Azz0,
|
||||||
Axx0, Axy0, Axz0, Ayy0, Ayz0, Azz0,
|
Gmx0, Gmy0, Gmz0, Sfx1, Sfy1, Sfz1, // here we can not touch rhs variables, but 1 variables
|
||||||
Gmx0, Gmy0, Gmz0, Sfx1, Sfy1, Sfz1,
|
RoutMAP, ErrorMonitor);
|
||||||
RoutMAP, ErrorMonitor, !patch_mass_prepared);
|
|
||||||
patch_mass_prepared = true;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Waveshell->surf_WaveMassPAng(Rex, lev, SH,
|
Waveshell->surf_Wave(Rex, lev, SH, Rpsi4, Ipsi4, 2, maxl, NN, RP, IP, ErrorMonitor);
|
||||||
Rpsi4, Ipsi4, 2, maxl, NN, RP, IP,
|
Waveshell->surf_MassPAng(Rex, lev, SH, phi0, trK0,
|
||||||
phi0, trK0,
|
gxx0, gxy0, gxz0, gyy0, gyz0, gzz0,
|
||||||
gxx0, gxy0, gxz0, gyy0, gyz0, gzz0,
|
Axx0, Axy0, Axz0, Ayy0, Ayz0, Azz0,
|
||||||
Axx0, Axy0, Axz0, Ayy0, Ayz0, Azz0,
|
Gmx0, Gmy0, Gmz0, Sfx1, Sfy1, Sfz1, // here we can not touch rhs variables, but 1 variables
|
||||||
Gmx0, Gmy0, Gmz0, Sfx1, Sfy1, Sfz1,
|
RoutMAP, ErrorMonitor);
|
||||||
RoutMAP, ErrorMonitor, !shell_mass_prepared);
|
|
||||||
shell_mass_prepared = true;
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#if (PSTR == 0)
|
#if (PSTR == 0)
|
||||||
Waveshell->surf_WaveMassPAng(Rex, lev, GH,
|
Waveshell->surf_Wave(Rex, lev, GH, Rpsi4, Ipsi4, 2, maxl, NN, RP, IP, ErrorMonitor);
|
||||||
Rpsi4, Ipsi4, 2, maxl, NN, RP, IP,
|
Waveshell->surf_MassPAng(Rex, lev, GH, phi0, trK0,
|
||||||
phi0, trK0,
|
gxx0, gxy0, gxz0, gyy0, gyz0, gzz0,
|
||||||
gxx0, gxy0, gxz0, gyy0, gyz0, gzz0,
|
Axx0, Axy0, Axz0, Ayy0, Ayz0, Azz0,
|
||||||
Axx0, Axy0, Axz0, Ayy0, Ayz0, Azz0,
|
Gmx0, Gmy0, Gmz0, Sfx1, Sfy1, Sfz1, // here we can not touch rhs variables, but 1 variables
|
||||||
Gmx0, Gmy0, Gmz0, Sfx1, Sfy1, Sfz1,
|
RoutMAP, ErrorMonitor);
|
||||||
RoutMAP, ErrorMonitor, !patch_mass_prepared);
|
|
||||||
patch_mass_prepared = true;
|
|
||||||
#elif (PSTR == 1 || PSTR == 2)
|
#elif (PSTR == 1 || PSTR == 2)
|
||||||
Waveshell->surf_Wave(Rex, lev, GH, Rpsi4, Ipsi4, 2, maxl, NN, RP, IP, ErrorMonitor, GH->Commlev[lev]);
|
Waveshell->surf_Wave(Rex, lev, GH, Rpsi4, Ipsi4, 2, maxl, NN, RP, IP, ErrorMonitor, GH->Commlev[lev]);
|
||||||
// misc::tillherecheck(GH->Commlev[lev],GH->start_rank[lev],"after surf_Wave");
|
// misc::tillherecheck(GH->Commlev[lev],GH->start_rank[lev],"after surf_Wave");
|
||||||
@@ -7513,8 +7188,7 @@ void bssn_class::AnalysisStuff(int lev, double dT_lev)
|
|||||||
gxx0, gxy0, gxz0, gyy0, gyz0, gzz0,
|
gxx0, gxy0, gxz0, gyy0, gyz0, gzz0,
|
||||||
Axx0, Axy0, Axz0, Ayy0, Ayz0, Azz0,
|
Axx0, Axy0, Axz0, Ayy0, Ayz0, Azz0,
|
||||||
Gmx0, Gmy0, Gmz0, Sfx1, Sfy1, Sfz1, // here we can not touch rhs variables, but 1 variables
|
Gmx0, Gmy0, Gmz0, Sfx1, Sfy1, Sfz1, // here we can not touch rhs variables, but 1 variables
|
||||||
RoutMAP, ErrorMonitor, GH->Commlev[lev], !patch_mass_prepared);
|
RoutMAP, ErrorMonitor, GH->Commlev[lev]);
|
||||||
patch_mass_prepared = true;
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
// misc::tillherecheck(GH->Commlev[lev],GH->start_rank[lev],"end surface integral");
|
// misc::tillherecheck(GH->Commlev[lev],GH->start_rank[lev],"end surface integral");
|
||||||
@@ -7587,7 +7261,7 @@ void bssn_class::Constraint_Out()
|
|||||||
for (int lev = 0; lev < GH->levels; lev++)
|
for (int lev = 0; lev < GH->levels; lev++)
|
||||||
{
|
{
|
||||||
// make sure the data consistent for higher levels
|
// make sure the data consistent for higher levels
|
||||||
if (lev > 0 && ConstraintRefreshLevels && ConstraintRefreshLevels[lev]) // only refresh levels whose grid layout changed after evolution
|
if (lev > 0) // if the constrait quantities can be reused from the step rhs calculation
|
||||||
{
|
{
|
||||||
double TRK4 = PhysTime;
|
double TRK4 = PhysTime;
|
||||||
double ndeps = numepsb;
|
double ndeps = numepsb;
|
||||||
@@ -7741,18 +7415,35 @@ void bssn_class::Constraint_Out()
|
|||||||
#if (PSTR == 1 || PSTR == 2)
|
#if (PSTR == 1 || PSTR == 2)
|
||||||
double ConV_h[7];
|
double ConV_h[7];
|
||||||
#endif
|
#endif
|
||||||
var *ConstraintVars[7] = {Cons_Ham, Cons_Px, Cons_Py, Cons_Pz, Cons_Gx, Cons_Gy, Cons_Gz};
|
|
||||||
|
|
||||||
#ifdef WithShell
|
#ifdef WithShell
|
||||||
SH->L2Norm7(ConstraintVars, ConV);
|
ConV[0] = SH->L2Norm(Cons_Ham);
|
||||||
|
ConV[1] = SH->L2Norm(Cons_Px);
|
||||||
|
ConV[2] = SH->L2Norm(Cons_Py);
|
||||||
|
ConV[3] = SH->L2Norm(Cons_Pz);
|
||||||
|
ConV[4] = SH->L2Norm(Cons_Gx);
|
||||||
|
ConV[5] = SH->L2Norm(Cons_Gy);
|
||||||
|
ConV[6] = SH->L2Norm(Cons_Gz);
|
||||||
ConVMonitor->writefile(PhysTime, 7, ConV);
|
ConVMonitor->writefile(PhysTime, 7, ConV);
|
||||||
#endif
|
#endif
|
||||||
for (int levi = 0; levi < GH->levels; levi++)
|
for (int levi = 0; levi < GH->levels; levi++)
|
||||||
{
|
{
|
||||||
#if (PSTR == 0)
|
#if (PSTR == 0)
|
||||||
Parallel::L2Norm7(GH->PatL[levi]->data, ConstraintVars, ConV);
|
ConV[0] = Parallel::L2Norm(GH->PatL[levi]->data, Cons_Ham);
|
||||||
|
ConV[1] = Parallel::L2Norm(GH->PatL[levi]->data, Cons_Px);
|
||||||
|
ConV[2] = Parallel::L2Norm(GH->PatL[levi]->data, Cons_Py);
|
||||||
|
ConV[3] = Parallel::L2Norm(GH->PatL[levi]->data, Cons_Pz);
|
||||||
|
ConV[4] = Parallel::L2Norm(GH->PatL[levi]->data, Cons_Gx);
|
||||||
|
ConV[5] = Parallel::L2Norm(GH->PatL[levi]->data, Cons_Gy);
|
||||||
|
ConV[6] = Parallel::L2Norm(GH->PatL[levi]->data, Cons_Gz);
|
||||||
#elif (PSTR == 1 || PSTR == 2)
|
#elif (PSTR == 1 || PSTR == 2)
|
||||||
Parallel::L2Norm7(GH->PatL[levi]->data, ConstraintVars, ConV, GH->Commlev[levi]);
|
ConV[0] = Parallel::L2Norm(GH->PatL[levi]->data, Cons_Ham, GH->Commlev[levi]);
|
||||||
|
ConV[1] = Parallel::L2Norm(GH->PatL[levi]->data, Cons_Px, GH->Commlev[levi]);
|
||||||
|
ConV[2] = Parallel::L2Norm(GH->PatL[levi]->data, Cons_Py, GH->Commlev[levi]);
|
||||||
|
ConV[3] = Parallel::L2Norm(GH->PatL[levi]->data, Cons_Pz, GH->Commlev[levi]);
|
||||||
|
ConV[4] = Parallel::L2Norm(GH->PatL[levi]->data, Cons_Gx, GH->Commlev[levi]);
|
||||||
|
ConV[5] = Parallel::L2Norm(GH->PatL[levi]->data, Cons_Gy, GH->Commlev[levi]);
|
||||||
|
ConV[6] = Parallel::L2Norm(GH->PatL[levi]->data, Cons_Gz, GH->Commlev[levi]);
|
||||||
// misc::tillherecheck("before collect data to cpu0");
|
// misc::tillherecheck("before collect data to cpu0");
|
||||||
// MPI_ALLREDUCE( sendbuf, recvbuf, count, datatype, op, comm), sendbu and recvbuf must be different
|
// MPI_ALLREDUCE( sendbuf, recvbuf, count, datatype, op, comm), sendbu and recvbuf must be different
|
||||||
if (levi > 0)
|
if (levi > 0)
|
||||||
@@ -7783,9 +7474,6 @@ void bssn_class::Constraint_Out()
|
|||||||
Interp_Constraint(false);
|
Interp_Constraint(false);
|
||||||
|
|
||||||
LastConsOut = 0;
|
LastConsOut = 0;
|
||||||
if (ConstraintRefreshLevels)
|
|
||||||
for (int lev = 0; lev < GH->levels; lev++)
|
|
||||||
ConstraintRefreshLevels[lev] = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ public:
|
|||||||
double StartTime, TotalTime;
|
double StartTime, TotalTime;
|
||||||
double AnasTime, DumpTime, d2DumpTime, CheckTime;
|
double AnasTime, DumpTime, d2DumpTime, CheckTime;
|
||||||
double LastAnas, LastConsOut;
|
double LastAnas, LastConsOut;
|
||||||
int *ConstraintRefreshLevels;
|
|
||||||
double Courant;
|
double Courant;
|
||||||
double numepss, numepsb, numepsh;
|
double numepss, numepsb, numepsh;
|
||||||
int Symmetry;
|
int Symmetry;
|
||||||
@@ -135,7 +134,7 @@ public:
|
|||||||
Parallel::SyncCache *sync_cache_outbd; // cached OutBdLow2Hi in RestrictProlong
|
Parallel::SyncCache *sync_cache_outbd; // cached OutBdLow2Hi in RestrictProlong
|
||||||
|
|
||||||
monitor *ErrorMonitor, *Psi4Monitor, *BHMonitor, *MAPMonitor;
|
monitor *ErrorMonitor, *Psi4Monitor, *BHMonitor, *MAPMonitor;
|
||||||
monitor *ConVMonitor, *TimingMonitor;
|
monitor *ConVMonitor;
|
||||||
surface_integral *Waveshell;
|
surface_integral *Waveshell;
|
||||||
checkpoint *CheckPoint;
|
checkpoint *CheckPoint;
|
||||||
|
|
||||||
|
|||||||
@@ -32,19 +32,6 @@
|
|||||||
#define f_compute_rhs_Z4c_ss compute_rhs_z4c_ss_
|
#define f_compute_rhs_Z4c_ss compute_rhs_z4c_ss_
|
||||||
#define f_compute_constraint_fr compute_constraint_fr_
|
#define f_compute_constraint_fr compute_constraint_fr_
|
||||||
#endif
|
#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"
|
extern "C"
|
||||||
{
|
{
|
||||||
int f_compute_rhs_bssn(int *, double &, double *, double *, double *, // ex,T,X,Y,Z
|
int f_compute_rhs_bssn(int *, double &, double *, double *, double *, // ex,T,X,Y,Z
|
||||||
|
|||||||
@@ -2,88 +2,12 @@
|
|||||||
#include "bssn_rhs.h"
|
#include "bssn_rhs.h"
|
||||||
#include "share_func.h"
|
#include "share_func.h"
|
||||||
#include "tool.h"
|
#include "tool.h"
|
||||||
#include <time.h>
|
|
||||||
// 0-based i,j,k
|
// 0-based i,j,k
|
||||||
// #define IDX_F(i,j,k,nx,ny) ((i) + (j)*(nx) + (k)*(nx)*(ny))
|
// #define IDX_F(i,j,k,nx,ny) ((i) + (j)*(nx) + (k)*(nx)*(ny))
|
||||||
// ex(1)=nx, ex(2)=ny, ex(3)=nz
|
// ex(1)=nx, ex(2)=ny, ex(3)=nz
|
||||||
|
|
||||||
// 用法:a[ IDX_F(i,j,k,nx,ny) ]
|
// 用法: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
|
// C function that calculates the right-hand side for BSSN equations
|
||||||
int f_compute_rhs_bssn(int *ex, double &T,
|
int f_compute_rhs_bssn(int *ex, double &T,
|
||||||
double *X, double *Y, double *Z,
|
double *X, double *Y, double *Z,
|
||||||
@@ -178,7 +102,6 @@ int f_compute_rhs_bssn(int *ex, double &T,
|
|||||||
dY = Y[1] - Y[0];
|
dY = Y[1] - Y[0];
|
||||||
dZ = Z[1] - Z[0];
|
dZ = Z[1] - Z[0];
|
||||||
|
|
||||||
RHS_KERNEL_TIMER_DECL(timer_setup_derivs);
|
|
||||||
// 1ms //
|
// 1ms //
|
||||||
for(int i=0;i<all;i+=1){
|
for(int i=0;i<all;i+=1){
|
||||||
alpn1[i] = Lap[i] + 1.0;
|
alpn1[i] = Lap[i] + 1.0;
|
||||||
@@ -218,8 +141,6 @@ int f_compute_rhs_bssn(int *ex, double &T,
|
|||||||
(dxx[i] + ONE) * betaxz[i] + gxy[i] * betayz[i] + gyz[i] * betayx[i]
|
(dxx[i] + ONE) * betaxz[i] + gxy[i] * betayz[i] + gyz[i] * betayx[i]
|
||||||
+ (dzz[i] + ONE) * betazx[i] - gxz[i] * betayy[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)
|
// Fused: inverse metric + Gamma constraint + Christoffel (3 loops -> 1)
|
||||||
for(int i=0;i<all;i+=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] -
|
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 +283,9 @@ int f_compute_rhs_bssn(int *ex, double &T,
|
|||||||
+ ( gupxy[i]*gupyz[i] + gupyy[i]*gupxz[i] ) * Axy[i]
|
+ ( gupxy[i]*gupyz[i] + gupyy[i]*gupxz[i] ) * Axy[i]
|
||||||
+ ( gupxy[i]*gupzz[i] + gupyz[i]*gupxz[i] ) * Axz[i]
|
+ ( gupxy[i]*gupzz[i] + gupyz[i]*gupxz[i] ) * Axz[i]
|
||||||
+ ( gupyy[i]*gupzz[i] + gupyz[i]*gupyz[i] ) * Ayz[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 ) +
|
Gamx_rhs[i] = - TWO * ( Lapx[i]*axx + Lapy[i]*axy + Lapz[i]*axz ) +
|
||||||
TWO * alpn1[i] * (
|
TWO * alpn1[i] * (
|
||||||
-F3o2/chin1[i] * ( chix[i]*axx + chiy[i]*axy + chiz[i]*axz ) -
|
-F3o2/chin1[i] * ( chix[i]*axx + chiy[i]*axy + chiz[i]*axz ) -
|
||||||
@@ -391,8 +315,6 @@ int f_compute_rhs_bssn(int *ex, double &T,
|
|||||||
+ TWO * ( Gamzxy[i]*axy + Gamzxz[i]*axz + Gamzyz[i]*ayz )
|
+ 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 //
|
// 22.3ms //
|
||||||
fdderivs(ex,betax,gxxx,gxyx,gxzx,gyyx,gyzx,gzzx,
|
fdderivs(ex,betax,gxxx,gxyx,gxzx,gyyx,gyzx,gzzx,
|
||||||
X,Y,Z,ANTI,SYM, SYM ,Symmetry,Lev);
|
X,Y,Z,ANTI,SYM, SYM ,Symmetry,Lev);
|
||||||
@@ -410,6 +332,7 @@ int f_compute_rhs_bssn(int *ex, double &T,
|
|||||||
double lfxx = gxxx[i] + gxyy[i] + gxzz[i];
|
double lfxx = gxxx[i] + gxyy[i] + gxzz[i];
|
||||||
double lfxy = gxyx[i] + gyyy[i] + gyzz[i];
|
double lfxy = gxyx[i] + gyyy[i] + gyzz[i];
|
||||||
double lfxz = gxzx[i] + gyzy[i] + gzzz[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]
|
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] );
|
+ TWO * ( gupxy[i]*Gamxxy[i] + gupxz[i]*Gamxxz[i] + gupyz[i]*Gamxyz[i] );
|
||||||
@@ -763,74 +686,69 @@ int f_compute_rhs_bssn(int *ex, double &T,
|
|||||||
+ Gamxyz[i] * gzzx[i] + Gamyyz[i] * gzzy[i] + Gamzyz[i] * gzzz[i]
|
+ 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 //
|
// 22.3ms //
|
||||||
fdderivs(ex,chi,fxx,fxy,fxz,fyy,fyz,fzz,X,Y,Z,SYM,SYM,SYM,Symmetry,Lev);
|
fdderivs(ex,chi,fxx,fxy,fxz,fyy,fyz,fzz,X,Y,Z,SYM,SYM,SYM,Symmetry,Lev);
|
||||||
|
|
||||||
// 7ms //
|
// 7ms //
|
||||||
for (int i=0;i<all;i+=1) {
|
for (int i=0;i<all;i+=1) {
|
||||||
const double inv_chin1 = ONE / chin1[i];
|
fxx[i] = fxx[i] - Gamxxx[i] * chix[i] - Gamyxx[i] * chiy[i] - Gamzxx[i] * chiz[i];
|
||||||
const double half_inv_chin1 = HALF * inv_chin1;
|
fxy[i] = fxy[i] - Gamxxy[i] * chix[i] - Gamyxy[i] * chiy[i] - Gamzxy[i] * chiz[i];
|
||||||
const double scaled_inv = F3o2 * inv_chin1;
|
fxz[i] = fxz[i] - Gamxxz[i] * chix[i] - Gamyxz[i] * chiy[i] - Gamzxz[i] * chiz[i];
|
||||||
const double cxx = fxx[i] - Gamxxx[i] * chix[i] - Gamyxx[i] * chiy[i] - Gamzxx[i] * chiz[i];
|
fyy[i] = fyy[i] - Gamxyy[i] * chix[i] - Gamyyy[i] * chiy[i] - Gamzyy[i] * chiz[i];
|
||||||
const double cxy = fxy[i] - Gamxxy[i] * chix[i] - Gamyxy[i] * chiy[i] - Gamzxy[i] * chiz[i];
|
fyz[i] = fyz[i] - Gamxyz[i] * chix[i] - Gamyyz[i] * chiy[i] - Gamzyz[i] * chiz[i];
|
||||||
const double cxz = fxz[i] - Gamxxz[i] * chix[i] - Gamyxz[i] * chiy[i] - Gamzxz[i] * chiz[i];
|
fzz[i] = fzz[i] - Gamxzz[i] * chix[i] - Gamyzz[i] * chiy[i] - Gamzzz[i] * chiz[i];
|
||||||
const double cyy = fyy[i] - Gamxyy[i] * chix[i] - Gamyyy[i] * chiy[i] - Gamzyy[i] * chiz[i];
|
f[i] =
|
||||||
const double cyz = fyz[i] - Gamxyz[i] * chix[i] - Gamyyz[i] * chiy[i] - Gamzyz[i] * chiz[i];
|
gupxx[i] * (fxx[i] - (F3o2 / chin1[i]) * chix[i] * chix[i])
|
||||||
const double czz = fzz[i] - Gamxzz[i] * chix[i] - Gamyzz[i] * chiy[i] - Gamzzz[i] * chiz[i];
|
+ gupyy[i] * (fyy[i] - (F3o2 / chin1[i]) * chiy[i] * chiy[i])
|
||||||
const double ricci_chi =
|
+ gupzz[i] * (fzz[i] - (F3o2 / chin1[i]) * chiz[i] * chiz[i])
|
||||||
gupxx[i] * (cxx - scaled_inv * chix[i] * chix[i])
|
+ TWO * gupxy[i] * (fxy[i] - (F3o2 / chin1[i]) * chix[i] * chiy[i])
|
||||||
+ gupyy[i] * (cyy - scaled_inv * chiy[i] * chiy[i])
|
+ TWO * gupxz[i] * (fxz[i] - (F3o2 / chin1[i]) * chix[i] * chiz[i])
|
||||||
+ gupzz[i] * (czz - scaled_inv * chiz[i] * chiz[i])
|
+ TWO * gupyz[i] * (fyz[i] - (F3o2 / chin1[i]) * chiy[i] * chiz[i]);
|
||||||
+ TWO * gupxy[i] * (cxy - scaled_inv * chix[i] * chiy[i])
|
Rxx[i] = Rxx[i] + ( fxx[i] - (chix[i] * chix[i]) / (chin1[i] * TWO) + (dxx[i] + ONE) * f[i] ) / (chin1[i] * TWO);
|
||||||
+ TWO * gupxz[i] * (cxz - scaled_inv * chix[i] * chiz[i])
|
Ryy[i] = Ryy[i] + ( fyy[i] - (chiy[i] * chiy[i]) / (chin1[i] * TWO) + (dyy[i] + ONE) * f[i] ) / (chin1[i] * TWO);
|
||||||
+ TWO * gupyz[i] * (cyz - scaled_inv * chiy[i] * chiz[i]);
|
Rzz[i] = Rzz[i] + ( fzz[i] - (chiz[i] * chiz[i]) / (chin1[i] * TWO) + (dzz[i] + ONE) * f[i] ) / (chin1[i] * TWO);
|
||||||
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;
|
|
||||||
|
|
||||||
Rxy[i] = Rxy[i] + ( cxy - half_inv_chin1 * chix[i] * chiy[i] + gxy[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] + ( cxz - half_inv_chin1 * chix[i] * chiz[i] + gxz[i] * ricci_chi ) * half_inv_chin1;
|
Rxz[i] = Rxz[i] + ( fxz[i] - (chix[i] * chiz[i]) / (chin1[i] * TWO) + gxz[i] * f[i] ) / (chin1[i] * TWO);
|
||||||
Ryz[i] = Ryz[i] + ( cyz - half_inv_chin1 * chiy[i] * chiz[i] + gyz[i] * ricci_chi ) * half_inv_chin1;
|
Ryz[i] = Ryz[i] + ( fyz[i] - (chiy[i] * chiz[i]) / (chin1[i] * TWO) + gyz[i] * f[i] ) / (chin1[i] * TWO);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 24ms //
|
// 24ms //
|
||||||
fdderivs(ex,Lap,fxx,fxy,fxz,fyy,fyz,fzz,X,Y,Z,SYM,SYM,SYM,Symmetry,Lev);
|
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 //
|
// 6ms //
|
||||||
for (int i=0;i<all;i+=1) {
|
for (int i=0;i<all;i+=1) {
|
||||||
const double inv_chin1 = ONE / chin1[i];
|
/* gxxx,gxxy,gxxz (这里是“升指标后的chi导数/chi”那类量,你沿用原变量名即可) */
|
||||||
const double gchi_x = (gupxx[i] * chix[i] + gupxy[i] * chiy[i] + gupxz[i] * chiz[i]) * inv_chin1;
|
gxxx[i] = (gupxx[i] * chix[i] + gupxy[i] * chiy[i] + gupxz[i] * chiz[i]) / chin1[i];
|
||||||
const double gchi_y = (gupxy[i] * chix[i] + gupyy[i] * chiy[i] + gupyz[i] * chiz[i]) * inv_chin1;
|
gxxy[i] = (gupxy[i] * chix[i] + gupyy[i] * chiy[i] + gupyz[i] * chiz[i]) / chin1[i];
|
||||||
const double gchi_z = (gupxz[i] * chix[i] + gupyz[i] * chiy[i] + gupzz[i] * chiz[i]) * inv_chin1;
|
gxxz[i] = (gupxz[i] * chix[i] + gupyz[i] * chiy[i] + gupzz[i] * chiz[i]) / chin1[i];
|
||||||
|
|
||||||
/* Christoffel 修正项 */
|
/* Christoffel 修正项 */
|
||||||
Gamxxx[i] = Gamxxx[i] - ( ((chix[i] + chix[i]) * inv_chin1) - (dxx[i] + ONE) * gchi_x ) * 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) * gchi_y ) * HALF; /* 原式只有 -gxx*gxxy */
|
Gamyxx[i] = Gamyxx[i] - ( 0.0 - (dxx[i] + ONE) * gxxy[i] ) * HALF; /* 原式只有 -gxx*gxxy */
|
||||||
Gamzxx[i] = Gamzxx[i] - ( 0.0 - (dxx[i] + ONE) * gchi_z ) * HALF;
|
Gamzxx[i] = Gamzxx[i] - ( 0.0 - (dxx[i] + ONE) * gxxz[i] ) * HALF;
|
||||||
|
|
||||||
Gamxyy[i] = Gamxyy[i] - ( 0.0 - (dyy[i] + ONE) * gchi_x ) * HALF;
|
Gamxyy[i] = Gamxyy[i] - ( 0.0 - (dyy[i] + ONE) * gxxx[i] ) * HALF;
|
||||||
Gamyyy[i] = Gamyyy[i] - ( ((chiy[i] + chiy[i]) * inv_chin1) - (dyy[i] + ONE) * gchi_y ) * 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) * gchi_z ) * 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;
|
Gamxzz[i] = Gamxzz[i] - ( 0.0 - (dzz[i] + ONE) * gxxx[i] ) * HALF;
|
||||||
Gamyzz[i] = Gamyzz[i] - ( 0.0 - (dzz[i] + ONE) * gchi_y ) * HALF;
|
Gamyzz[i] = Gamyzz[i] - ( 0.0 - (dzz[i] + ONE) * gxxy[i] ) * HALF;
|
||||||
Gamzzz[i] = Gamzzz[i] - ( ((chiz[i] + chiz[i]) * inv_chin1) - (dzz[i] + ONE) * gchi_z ) * 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;
|
Gamxxy[i] = Gamxxy[i] - ( ( chiy[i] / chin1[i]) - gxy[i] * gxxx[i] ) * HALF;
|
||||||
Gamyxy[i] = Gamyxy[i] - ( ( chix[i] * inv_chin1) - gxy[i] * gchi_y ) * HALF;
|
Gamyxy[i] = Gamyxy[i] - ( ( chix[i] / chin1[i]) - gxy[i] * gxxy[i] ) * HALF;
|
||||||
Gamzxy[i] = Gamzxy[i] - ( 0.0 - gxy[i] * gchi_z ) * 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;
|
Gamxxz[i] = Gamxxz[i] - ( ( chiz[i] / chin1[i]) - gxz[i] * gxxx[i] ) * HALF;
|
||||||
Gamyxz[i] = Gamyxz[i] - ( 0.0 - gxz[i] * gchi_y ) * HALF;
|
Gamyxz[i] = Gamyxz[i] - ( 0.0 - gxz[i] * gxxy[i] ) * HALF;
|
||||||
Gamzxz[i] = Gamzxz[i] - ( ( chix[i] * inv_chin1) - gxz[i] * gchi_z ) * 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;
|
Gamxyz[i] = Gamxyz[i] - ( 0.0 - gyz[i] * gxxx[i] ) * HALF;
|
||||||
Gamyyz[i] = Gamyyz[i] - ( ( chiz[i] * inv_chin1) - gyz[i] * gchi_y ) * HALF;
|
Gamyyz[i] = Gamyyz[i] - ( ( chiz[i] / chin1[i]) - gyz[i] * gxxy[i] ) * HALF;
|
||||||
Gamzyz[i] = Gamzyz[i] - ( ( chiy[i] * inv_chin1) - gyz[i] * gchi_z ) * HALF;
|
Gamzyz[i] = Gamzyz[i] - ( ( chiy[i] / chin1[i]) - gyz[i] * gxxz[i] ) * HALF;
|
||||||
|
|
||||||
/* fxx..fyz 修正:减去 Γ * ∂Lap */
|
/* fxx..fyz 修正:减去 Γ * ∂Lap */
|
||||||
fxx[i] = fxx[i] - Gamxxx[i] * Lapx[i] - Gamyxx[i] * Lapy[i] - Gamzxx[i] * Lapz[i];
|
fxx[i] = fxx[i] - Gamxxx[i] * Lapx[i] - Gamyxx[i] * Lapy[i] - Gamzxx[i] * Lapz[i];
|
||||||
@@ -844,8 +762,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]
|
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] );
|
+ 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 //
|
// 2.5ms //
|
||||||
for (int i=0;i<all;i+=1) {
|
for (int i=0;i<all;i+=1) {
|
||||||
const double divb = betaxx[i] + betayy[i] + betazz[i];
|
const double divb = betaxx[i] + betayy[i] + betazz[i];
|
||||||
@@ -1146,8 +1062,6 @@ int f_compute_rhs_bssn(int *ex, double &T,
|
|||||||
dtSfz_rhs[i] = Gamz_rhs[i] - reta[i] * dtSfz[i];
|
dtSfz_rhs[i] = Gamz_rhs[i] - reta[i] * dtSfz[i];
|
||||||
#endif
|
#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
|
// 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,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,Gamz,Gamz_rhs,betax,betay,betaz,Symmetry,SSA,eps);
|
||||||
@@ -1225,61 +1139,60 @@ int f_compute_rhs_bssn(int *ex, double &T,
|
|||||||
fderivs(ex,Ayy,gyyx,gyyy,gyyz,X,Y,Z,SYM ,SYM ,SYM ,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,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);
|
fderivs(ex,Azz,gzzx,gzzy,gzzz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0);
|
||||||
// 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]
|
|
||||||
+ Gamxxx[i] * Axx[i] + Gamyxx[i] * Axy[i] + Gamzxx[i] * Axz[i]) - chix[i]*Axx[i]/chin1[i];
|
|
||||||
gxyx[i] = gxyx[i] - ( Gamxxy[i] * Axx[i] + Gamyxy[i] * Axy[i] + Gamzxy[i] * Axz[i]
|
|
||||||
+ Gamxxx[i] * Axy[i] + Gamyxx[i] * Ayy[i] + Gamzxx[i] * Ayz[i]) - chix[i]*Axy[i]/chin1[i];
|
|
||||||
gxzx[i] = gxzx[i] - ( Gamxxz[i] * Axx[i] + Gamyxz[i] * Axy[i] + Gamzxz[i] * Axz[i]
|
|
||||||
+ Gamxxx[i] * Axz[i] + Gamyxx[i] * Ayz[i] + Gamzxx[i] * Azz[i]) - chix[i]*Axz[i]/chin1[i];
|
|
||||||
gyyx[i] = gyyx[i] - ( Gamxxy[i] * Axy[i] + Gamyxy[i] * Ayy[i] + Gamzxy[i] * Ayz[i]
|
|
||||||
+ Gamxxy[i] * Axy[i] + Gamyxy[i] * Ayy[i] + Gamzxy[i] * Ayz[i]) - chix[i]*Ayy[i]/chin1[i];
|
|
||||||
gyzx[i] = gyzx[i] - ( Gamxxz[i] * Axy[i] + Gamyxz[i] * Ayy[i] + Gamzxz[i] * Ayz[i]
|
|
||||||
+ Gamxxy[i] * Axz[i] + Gamyxy[i] * Ayz[i] + Gamzxy[i] * Azz[i]) - chix[i]*Ayz[i]/chin1[i];
|
|
||||||
gzzx[i] = gzzx[i] - ( Gamxxz[i] * Axz[i] + Gamyxz[i] * Ayz[i] + Gamzxz[i] * Azz[i]
|
|
||||||
+ Gamxxz[i] * Axz[i] + Gamyxz[i] * Ayz[i] + Gamzxz[i] * Azz[i]) - chix[i]*Azz[i]/chin1[i];
|
|
||||||
gxxy[i] = gxxy[i] - ( Gamxxy[i] * Axx[i] + Gamyxy[i] * Axy[i] + Gamzxy[i] * Axz[i]
|
|
||||||
+ Gamxxy[i] * Axx[i] + Gamyxy[i] * Axy[i] + Gamzxy[i] * Axz[i]) - chiy[i]*Axx[i]/chin1[i];
|
|
||||||
gxyy[i] = gxyy[i] - ( Gamxyy[i] * Axx[i] + Gamyyy[i] * Axy[i] + Gamzyy[i] * Axz[i]
|
|
||||||
+ Gamxxy[i] * Axy[i] + Gamyxy[i] * Ayy[i] + Gamzxy[i] * Ayz[i]) - chiy[i]*Axy[i]/chin1[i];
|
|
||||||
gxzy[i] = gxzy[i] - ( Gamxyz[i] * Axx[i] + Gamyyz[i] * Axy[i] + Gamzyz[i] * Axz[i]
|
|
||||||
+ Gamxxy[i] * Axz[i] + Gamyxy[i] * Ayz[i] + Gamzxy[i] * Azz[i]) - chiy[i]*Axz[i]/chin1[i];
|
|
||||||
gyyy[i] = gyyy[i] - ( Gamxyy[i] * Axy[i] + Gamyyy[i] * Ayy[i] + Gamzyy[i] * Ayz[i]
|
|
||||||
+ Gamxyy[i] * Axy[i] + Gamyyy[i] * Ayy[i] + Gamzyy[i] * Ayz[i]) - chiy[i]*Ayy[i]/chin1[i];
|
|
||||||
gyzy[i] = gyzy[i] - ( Gamxyz[i] * Axy[i] + Gamyyz[i] * Ayy[i] + Gamzyz[i] * Ayz[i]
|
|
||||||
+ Gamxyy[i] * Axz[i] + Gamyyy[i] * Ayz[i] + Gamzyy[i] * Azz[i]) - chiy[i]*Ayz[i]/chin1[i];
|
|
||||||
gzzy[i] = gzzy[i] - ( Gamxyz[i] * Axz[i] + Gamyyz[i] * Ayz[i] + Gamzyz[i] * Azz[i]
|
|
||||||
+ Gamxyz[i] * Axz[i] + Gamyyz[i] * Ayz[i] + Gamzyz[i] * Azz[i]) - chiy[i]*Azz[i]/chin1[i];
|
|
||||||
gxxz[i] = gxxz[i] - ( Gamxxz[i] * Axx[i] + Gamyxz[i] * Axy[i] + Gamzxz[i] * Axz[i]
|
|
||||||
+ Gamxxz[i] * Axx[i] + Gamyxz[i] * Axy[i] + Gamzxz[i] * Axz[i]) - chiz[i]*Axx[i]/chin1[i];
|
|
||||||
gxyz[i] = gxyz[i] - ( Gamxyz[i] * Axx[i] + Gamyyz[i] * Axy[i] + Gamzyz[i] * Axz[i]
|
|
||||||
+ Gamxxz[i] * Axy[i] + Gamyxz[i] * Ayy[i] + Gamzxz[i] * Ayz[i]) - chiz[i]*Axy[i]/chin1[i];
|
|
||||||
gxzz[i] = gxzz[i] - ( Gamxzz[i] * Axx[i] + Gamyzz[i] * Axy[i] + Gamzzz[i] * Axz[i]
|
|
||||||
+ Gamxxz[i] * Axz[i] + Gamyxz[i] * Ayz[i] + Gamzxz[i] * Azz[i]) - chiz[i]*Axz[i]/chin1[i];
|
|
||||||
gyyz[i] = gyyz[i] - ( Gamxyz[i] * Axy[i] + Gamyyz[i] * Ayy[i] + Gamzyz[i] * Ayz[i]
|
|
||||||
+ Gamxyz[i] * Axy[i] + Gamyyz[i] * Ayy[i] + Gamzyz[i] * Ayz[i]) - chiz[i]*Ayy[i]/chin1[i];
|
|
||||||
gyzz[i] = gyzz[i] - ( Gamxzz[i] * Axy[i] + Gamyzz[i] * Ayy[i] + Gamzzz[i] * Ayz[i]
|
|
||||||
+ Gamxyz[i] * Axz[i] + Gamyyz[i] * Ayz[i] + Gamzyz[i] * Azz[i]) - chiz[i]*Ayz[i]/chin1[i];
|
|
||||||
gzzz[i] = gzzz[i] - ( Gamxzz[i] * Axz[i] + Gamyzz[i] * Ayz[i] + Gamzzz[i] * Azz[i]
|
|
||||||
+ Gamxzz[i] * Axz[i] + Gamyzz[i] * Ayz[i] + Gamzzz[i] * Azz[i]) - chiz[i]*Azz[i]/chin1[i];
|
|
||||||
|
|
||||||
movx_Res[i] = gupxx[i]*gxxx[i] + gupyy[i]*gxyy[i] + gupzz[i]*gxzz[i]
|
|
||||||
+ gupxy[i]*gxyx[i] + gupxz[i]*gxzx[i] + gupyz[i]*gxzy[i]
|
|
||||||
+ gupxy[i]*gxxy[i] + gupxz[i]*gxxz[i] + gupyz[i]*gxyz[i];
|
|
||||||
movy_Res[i] = gupxx[i]*gxyx[i] + gupyy[i]*gyyy[i] + gupzz[i]*gyzz[i]
|
|
||||||
+ gupxy[i]*gyyx[i] + gupxz[i]*gyzx[i] + gupyz[i]*gyzy[i]
|
|
||||||
+ gupxy[i]*gxyy[i] + gupxz[i]*gxyz[i] + gupyz[i]*gyyz[i];
|
|
||||||
movz_Res[i] = gupxx[i]*gxzx[i] + gupyy[i]*gyzy[i] + gupzz[i]*gzzz[i]
|
|
||||||
+ gupxy[i]*gyzx[i] + gupxz[i]*gzzx[i] + gupyz[i]*gzzy[i]
|
|
||||||
+ gupxy[i]*gxzy[i] + gupxz[i]*gxzz[i] + gupyz[i]*gyzz[i];
|
|
||||||
|
|
||||||
movx_Res[i] = movx_Res[i] - F2o3*Kx[i] - F8*PI*Sx[i];
|
|
||||||
movy_Res[i] = movy_Res[i] - F2o3*Ky[i] - F8*PI*Sy[i];
|
|
||||||
movz_Res[i] = movz_Res[i] - F2o3*Kz[i] - F8*PI*Sz[i];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
RHS_KERNEL_TIMER_ADD(KB_KO_CONSTRAINT, timer_ko_constraint);
|
// 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]
|
||||||
|
+ Gamxxx[i] * Axx[i] + Gamyxx[i] * Axy[i] + Gamzxx[i] * Axz[i]) - chix[i]*Axx[i]/chin1[i];
|
||||||
|
gxyx[i] = gxyx[i] - ( Gamxxy[i] * Axx[i] + Gamyxy[i] * Axy[i] + Gamzxy[i] * Axz[i]
|
||||||
|
+ Gamxxx[i] * Axy[i] + Gamyxx[i] * Ayy[i] + Gamzxx[i] * Ayz[i]) - chix[i]*Axy[i]/chin1[i];
|
||||||
|
gxzx[i] = gxzx[i] - ( Gamxxz[i] * Axx[i] + Gamyxz[i] * Axy[i] + Gamzxz[i] * Axz[i]
|
||||||
|
+ Gamxxx[i] * Axz[i] + Gamyxx[i] * Ayz[i] + Gamzxx[i] * Azz[i]) - chix[i]*Axz[i]/chin1[i];
|
||||||
|
gyyx[i] = gyyx[i] - ( Gamxxy[i] * Axy[i] + Gamyxy[i] * Ayy[i] + Gamzxy[i] * Ayz[i]
|
||||||
|
+ Gamxxy[i] * Axy[i] + Gamyxy[i] * Ayy[i] + Gamzxy[i] * Ayz[i]) - chix[i]*Ayy[i]/chin1[i];
|
||||||
|
gyzx[i] = gyzx[i] - ( Gamxxz[i] * Axy[i] + Gamyxz[i] * Ayy[i] + Gamzxz[i] * Ayz[i]
|
||||||
|
+ Gamxxy[i] * Axz[i] + Gamyxy[i] * Ayz[i] + Gamzxy[i] * Azz[i]) - chix[i]*Ayz[i]/chin1[i];
|
||||||
|
gzzx[i] = gzzx[i] - ( Gamxxz[i] * Axz[i] + Gamyxz[i] * Ayz[i] + Gamzxz[i] * Azz[i]
|
||||||
|
+ Gamxxz[i] * Axz[i] + Gamyxz[i] * Ayz[i] + Gamzxz[i] * Azz[i]) - chix[i]*Azz[i]/chin1[i];
|
||||||
|
gxxy[i] = gxxy[i] - ( Gamxxy[i] * Axx[i] + Gamyxy[i] * Axy[i] + Gamzxy[i] * Axz[i]
|
||||||
|
+ Gamxxy[i] * Axx[i] + Gamyxy[i] * Axy[i] + Gamzxy[i] * Axz[i]) - chiy[i]*Axx[i]/chin1[i];
|
||||||
|
gxyy[i] = gxyy[i] - ( Gamxyy[i] * Axx[i] + Gamyyy[i] * Axy[i] + Gamzyy[i] * Axz[i]
|
||||||
|
+ Gamxxy[i] * Axy[i] + Gamyxy[i] * Ayy[i] + Gamzxy[i] * Ayz[i]) - chiy[i]*Axy[i]/chin1[i];
|
||||||
|
gxzy[i] = gxzy[i] - ( Gamxyz[i] * Axx[i] + Gamyyz[i] * Axy[i] + Gamzyz[i] * Axz[i]
|
||||||
|
+ Gamxxy[i] * Axz[i] + Gamyxy[i] * Ayz[i] + Gamzxy[i] * Azz[i]) - chiy[i]*Axz[i]/chin1[i];
|
||||||
|
gyyy[i] = gyyy[i] - ( Gamxyy[i] * Axy[i] + Gamyyy[i] * Ayy[i] + Gamzyy[i] * Ayz[i]
|
||||||
|
+ Gamxyy[i] * Axy[i] + Gamyyy[i] * Ayy[i] + Gamzyy[i] * Ayz[i]) - chiy[i]*Ayy[i]/chin1[i];
|
||||||
|
gyzy[i] = gyzy[i] - ( Gamxyz[i] * Axy[i] + Gamyyz[i] * Ayy[i] + Gamzyz[i] * Ayz[i]
|
||||||
|
+ Gamxyy[i] * Axz[i] + Gamyyy[i] * Ayz[i] + Gamzyy[i] * Azz[i]) - chiy[i]*Ayz[i]/chin1[i];
|
||||||
|
gzzy[i] = gzzy[i] - ( Gamxyz[i] * Axz[i] + Gamyyz[i] * Ayz[i] + Gamzyz[i] * Azz[i]
|
||||||
|
+ Gamxyz[i] * Axz[i] + Gamyyz[i] * Ayz[i] + Gamzyz[i] * Azz[i]) - chiy[i]*Azz[i]/chin1[i];
|
||||||
|
gxxz[i] = gxxz[i] - ( Gamxxz[i] * Axx[i] + Gamyxz[i] * Axy[i] + Gamzxz[i] * Axz[i]
|
||||||
|
+ Gamxxz[i] * Axx[i] + Gamyxz[i] * Axy[i] + Gamzxz[i] * Axz[i]) - chiz[i]*Axx[i]/chin1[i];
|
||||||
|
gxyz[i] = gxyz[i] - ( Gamxyz[i] * Axx[i] + Gamyyz[i] * Axy[i] + Gamzyz[i] * Axz[i]
|
||||||
|
+ Gamxxz[i] * Axy[i] + Gamyxz[i] * Ayy[i] + Gamzxz[i] * Ayz[i]) - chiz[i]*Axy[i]/chin1[i];
|
||||||
|
gxzz[i] = gxzz[i] - ( Gamxzz[i] * Axx[i] + Gamyzz[i] * Axy[i] + Gamzzz[i] * Axz[i]
|
||||||
|
+ Gamxxz[i] * Axz[i] + Gamyxz[i] * Ayz[i] + Gamzxz[i] * Azz[i]) - chiz[i]*Axz[i]/chin1[i];
|
||||||
|
gyyz[i] = gyyz[i] - ( Gamxyz[i] * Axy[i] + Gamyyz[i] * Ayy[i] + Gamzyz[i] * Ayz[i]
|
||||||
|
+ Gamxyz[i] * Axy[i] + Gamyyz[i] * Ayy[i] + Gamzyz[i] * Ayz[i]) - chiz[i]*Ayy[i]/chin1[i];
|
||||||
|
gyzz[i] = gyzz[i] - ( Gamxzz[i] * Axy[i] + Gamyzz[i] * Ayy[i] + Gamzzz[i] * Ayz[i]
|
||||||
|
+ Gamxyz[i] * Axz[i] + Gamyyz[i] * Ayz[i] + Gamzyz[i] * Azz[i]) - chiz[i]*Ayz[i]/chin1[i];
|
||||||
|
gzzz[i] = gzzz[i] - ( Gamxzz[i] * Axz[i] + Gamyzz[i] * Ayz[i] + Gamzzz[i] * Azz[i]
|
||||||
|
+ Gamxzz[i] * Axz[i] + Gamyzz[i] * Ayz[i] + Gamzzz[i] * Azz[i]) - chiz[i]*Azz[i]/chin1[i];
|
||||||
|
|
||||||
|
movx_Res[i] = gupxx[i]*gxxx[i] + gupyy[i]*gxyy[i] + gupzz[i]*gxzz[i]
|
||||||
|
+ gupxy[i]*gxyx[i] + gupxz[i]*gxzx[i] + gupyz[i]*gxzy[i]
|
||||||
|
+ gupxy[i]*gxxy[i] + gupxz[i]*gxxz[i] + gupyz[i]*gxyz[i];
|
||||||
|
movy_Res[i] = gupxx[i]*gxyx[i] + gupyy[i]*gyyy[i] + gupzz[i]*gyzz[i]
|
||||||
|
+ gupxy[i]*gyyx[i] + gupxz[i]*gyzx[i] + gupyz[i]*gyzy[i]
|
||||||
|
+ gupxy[i]*gxyy[i] + gupxz[i]*gxyz[i] + gupyz[i]*gyyz[i];
|
||||||
|
movz_Res[i] = gupxx[i]*gxzx[i] + gupyy[i]*gyzy[i] + gupzz[i]*gzzz[i]
|
||||||
|
+ gupxy[i]*gyzx[i] + gupxz[i]*gzzx[i] + gupyz[i]*gzzy[i]
|
||||||
|
+ gupxy[i]*gxzy[i] + gupxz[i]*gxzz[i] + gupyz[i]*gyzz[i];
|
||||||
|
|
||||||
|
movx_Res[i] = movx_Res[i] - F2o3*Kx[i] - F8*PI*Sx[i];
|
||||||
|
movy_Res[i] = movy_Res[i] - F2o3*Ky[i] - F8*PI*Sy[i];
|
||||||
|
movz_Res[i] = movz_Res[i] - F2o3*Kz[i] - F8*PI*Sz[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -71,131 +71,106 @@ void fdderivs(const int ex[3],
|
|||||||
const double Fdxdz = F1o144 / (dX * dZ);
|
const double Fdxdz = F1o144 / (dX * dZ);
|
||||||
const double Fdydz = F1o144 / (dY * dZ);
|
const double Fdydz = F1o144 / (dY * dZ);
|
||||||
|
|
||||||
/* 只清零不被主循环覆盖的边界面 */
|
const size_t all = (size_t)ex1 * (size_t)ex2 * (size_t)ex3;
|
||||||
{
|
for (size_t p = 0; p < all; ++p) {
|
||||||
/* 高边界:k0=ex3-1 */
|
fxx[p] = ZEO; fxy[p] = ZEO; fxz[p] = ZEO;
|
||||||
for (int j0 = 0; j0 < ex2; ++j0)
|
fyy[p] = ZEO; fyz[p] = ZEO; fzz[p] = ZEO;
|
||||||
for (int i0 = 0; i0 < ex1; ++i0) {
|
|
||||||
const size_t p = idx_ex(i0, j0, ex3 - 1, ex);
|
|
||||||
fxx[p]=ZEO; fyy[p]=ZEO; fzz[p]=ZEO;
|
|
||||||
fxy[p]=ZEO; fxz[p]=ZEO; fyz[p]=ZEO;
|
|
||||||
}
|
|
||||||
/* 高边界:j0=ex2-1 */
|
|
||||||
for (int k0 = 0; k0 < ex3 - 1; ++k0)
|
|
||||||
for (int i0 = 0; i0 < ex1; ++i0) {
|
|
||||||
const size_t p = idx_ex(i0, ex2 - 1, k0, ex);
|
|
||||||
fxx[p]=ZEO; fyy[p]=ZEO; fzz[p]=ZEO;
|
|
||||||
fxy[p]=ZEO; fxz[p]=ZEO; fyz[p]=ZEO;
|
|
||||||
}
|
|
||||||
/* 高边界:i0=ex1-1 */
|
|
||||||
for (int k0 = 0; k0 < ex3 - 1; ++k0)
|
|
||||||
for (int j0 = 0; j0 < ex2 - 1; ++j0) {
|
|
||||||
const size_t p = idx_ex(ex1 - 1, j0, k0, ex);
|
|
||||||
fxx[p]=ZEO; fyy[p]=ZEO; fzz[p]=ZEO;
|
|
||||||
fxy[p]=ZEO; fxz[p]=ZEO; fyz[p]=ZEO;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 低边界:当二阶模板也不可用时,对应 i0/j0/k0=0 面 */
|
|
||||||
if (kminF == 1) {
|
|
||||||
for (int j0 = 0; j0 < ex2; ++j0)
|
|
||||||
for (int i0 = 0; i0 < ex1; ++i0) {
|
|
||||||
const size_t p = idx_ex(i0, j0, 0, ex);
|
|
||||||
fxx[p]=ZEO; fyy[p]=ZEO; fzz[p]=ZEO;
|
|
||||||
fxy[p]=ZEO; fxz[p]=ZEO; fyz[p]=ZEO;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (jminF == 1) {
|
|
||||||
for (int k0 = 0; k0 < ex3; ++k0)
|
|
||||||
for (int i0 = 0; i0 < ex1; ++i0) {
|
|
||||||
const size_t p = idx_ex(i0, 0, k0, ex);
|
|
||||||
fxx[p]=ZEO; fyy[p]=ZEO; fzz[p]=ZEO;
|
|
||||||
fxy[p]=ZEO; fxz[p]=ZEO; fyz[p]=ZEO;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (iminF == 1) {
|
|
||||||
for (int k0 = 0; k0 < ex3; ++k0)
|
|
||||||
for (int j0 = 0; j0 < ex2; ++j0) {
|
|
||||||
const size_t p = idx_ex(0, j0, k0, ex);
|
|
||||||
fxx[p]=ZEO; fyy[p]=ZEO; fzz[p]=ZEO;
|
|
||||||
fxy[p]=ZEO; fxz[p]=ZEO; fyz[p]=ZEO;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// Match Fortran (ghost_width=3, "for bam comparison") exactly:
|
||||||
* 两段式:
|
// only compute when x/y/z all satisfy the same-order stencil at this point.
|
||||||
* 1) 二阶可用区域先计算二阶模板
|
for (int k0 = 0; k0 <= ex3 - 2; ++k0) {
|
||||||
* 2) 高阶可用区域再覆盖四阶模板
|
const int kF = k0 + 1;
|
||||||
*/
|
for (int j0 = 0; j0 <= ex2 - 2; ++j0) {
|
||||||
const int i2_lo = (iminF > 0) ? iminF : 0;
|
const int jF = j0 + 1;
|
||||||
const int j2_lo = (jminF > 0) ? jminF : 0;
|
for (int i0 = 0; i0 <= ex1 - 2; ++i0) {
|
||||||
const int k2_lo = (kminF > 0) ? kminF : 0;
|
const int iF = i0 + 1;
|
||||||
const int i2_hi = ex1 - 2;
|
const size_t p = idx_ex(i0, j0, k0, ex);
|
||||||
const int j2_hi = ex2 - 2;
|
|
||||||
const int k2_hi = ex3 - 2;
|
|
||||||
|
|
||||||
const int i4_lo = (iminF + 1 > 0) ? (iminF + 1) : 0;
|
|
||||||
const int j4_lo = (jminF + 1 > 0) ? (jminF + 1) : 0;
|
|
||||||
const int k4_lo = (kminF + 1 > 0) ? (kminF + 1) : 0;
|
|
||||||
const int i4_hi = ex1 - 3;
|
|
||||||
const int j4_hi = ex2 - 3;
|
|
||||||
const int k4_hi = ex3 - 3;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Strategy A:
|
|
||||||
* Avoid redundant work in overlap of 2nd/4th-order regions.
|
|
||||||
* Only compute 2nd-order on shell points that are NOT overwritten by
|
|
||||||
* the 4th-order pass.
|
|
||||||
*/
|
|
||||||
const int has4 = (i4_lo <= i4_hi && j4_lo <= j4_hi && k4_lo <= k4_hi);
|
|
||||||
|
|
||||||
if (i2_lo <= i2_hi && j2_lo <= j2_hi && k2_lo <= k2_hi) {
|
|
||||||
for (int k0 = k2_lo; k0 <= k2_hi; ++k0) {
|
|
||||||
const int kF = k0 + 1;
|
|
||||||
for (int j0 = j2_lo; j0 <= j2_hi; ++j0) {
|
|
||||||
const int jF = j0 + 1;
|
|
||||||
for (int i0 = i2_lo; i0 <= i2_hi; ++i0) {
|
|
||||||
if (has4 &&
|
|
||||||
i0 >= i4_lo && i0 <= i4_hi &&
|
|
||||||
j0 >= j4_lo && j0 <= j4_hi &&
|
|
||||||
k0 >= k4_lo && k0 <= k4_hi) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const int iF = i0 + 1;
|
|
||||||
const size_t p = idx_ex(i0, j0, k0, ex);
|
|
||||||
|
|
||||||
|
if ((iF + 2 <= imaxF && iF - 2 >= iminF) &&
|
||||||
|
(jF + 2 <= jmaxF && jF - 2 >= jminF) &&
|
||||||
|
(kF + 2 <= kmaxF && kF - 2 >= kminF)) {
|
||||||
|
fxx[p] = Fdxdx * (
|
||||||
|
-fh[idx_fh_F_ord2(iF - 2, jF, kF, ex)] +
|
||||||
|
F16 * fh[idx_fh_F_ord2(iF - 1, jF, kF, ex)] -
|
||||||
|
F30 * fh[idx_fh_F_ord2(iF, jF, kF, ex)] -
|
||||||
|
fh[idx_fh_F_ord2(iF + 2, jF, kF, ex)] +
|
||||||
|
F16 * fh[idx_fh_F_ord2(iF + 1, jF, kF, ex)]
|
||||||
|
);
|
||||||
|
fyy[p] = Fdydy * (
|
||||||
|
-fh[idx_fh_F_ord2(iF, jF - 2, kF, ex)] +
|
||||||
|
F16 * fh[idx_fh_F_ord2(iF, jF - 1, kF, ex)] -
|
||||||
|
F30 * fh[idx_fh_F_ord2(iF, jF, kF, ex)] -
|
||||||
|
fh[idx_fh_F_ord2(iF, jF + 2, kF, ex)] +
|
||||||
|
F16 * fh[idx_fh_F_ord2(iF, jF + 1, kF, ex)]
|
||||||
|
);
|
||||||
|
fzz[p] = Fdzdz * (
|
||||||
|
-fh[idx_fh_F_ord2(iF, jF, kF - 2, ex)] +
|
||||||
|
F16 * fh[idx_fh_F_ord2(iF, jF, kF - 1, ex)] -
|
||||||
|
F30 * fh[idx_fh_F_ord2(iF, jF, kF, ex)] -
|
||||||
|
fh[idx_fh_F_ord2(iF, jF, kF + 2, ex)] +
|
||||||
|
F16 * fh[idx_fh_F_ord2(iF, jF, kF + 1, ex)]
|
||||||
|
);
|
||||||
|
fxy[p] = Fdxdy * (
|
||||||
|
(fh[idx_fh_F_ord2(iF - 2, jF - 2, kF, ex)] - F8 * fh[idx_fh_F_ord2(iF - 1, jF - 2, kF, ex)] +
|
||||||
|
F8 * fh[idx_fh_F_ord2(iF + 1, jF - 2, kF, ex)] - fh[idx_fh_F_ord2(iF + 2, jF - 2, kF, ex)])
|
||||||
|
- F8 * (fh[idx_fh_F_ord2(iF - 2, jF - 1, kF, ex)] - F8 * fh[idx_fh_F_ord2(iF - 1, jF - 1, kF, ex)] +
|
||||||
|
F8 * fh[idx_fh_F_ord2(iF + 1, jF - 1, kF, ex)] - fh[idx_fh_F_ord2(iF + 2, jF - 1, kF, ex)])
|
||||||
|
+ F8 * (fh[idx_fh_F_ord2(iF - 2, jF + 1, kF, ex)] - F8 * fh[idx_fh_F_ord2(iF - 1, jF + 1, kF, ex)] +
|
||||||
|
F8 * fh[idx_fh_F_ord2(iF + 1, jF + 1, kF, ex)] - fh[idx_fh_F_ord2(iF + 2, jF + 1, kF, ex)])
|
||||||
|
- (fh[idx_fh_F_ord2(iF - 2, jF + 2, kF, ex)] - F8 * fh[idx_fh_F_ord2(iF - 1, jF + 2, kF, ex)] +
|
||||||
|
F8 * fh[idx_fh_F_ord2(iF + 1, jF + 2, kF, ex)] - fh[idx_fh_F_ord2(iF + 2, jF + 2, kF, ex)])
|
||||||
|
);
|
||||||
|
fxz[p] = Fdxdz * (
|
||||||
|
(fh[idx_fh_F_ord2(iF - 2, jF, kF - 2, ex)] - F8 * fh[idx_fh_F_ord2(iF - 1, jF, kF - 2, ex)] +
|
||||||
|
F8 * fh[idx_fh_F_ord2(iF + 1, jF, kF - 2, ex)] - fh[idx_fh_F_ord2(iF + 2, jF, kF - 2, ex)])
|
||||||
|
- F8 * (fh[idx_fh_F_ord2(iF - 2, jF, kF - 1, ex)] - F8 * fh[idx_fh_F_ord2(iF - 1, jF, kF - 1, ex)] +
|
||||||
|
F8 * fh[idx_fh_F_ord2(iF + 1, jF, kF - 1, ex)] - fh[idx_fh_F_ord2(iF + 2, jF, kF - 1, ex)])
|
||||||
|
+ F8 * (fh[idx_fh_F_ord2(iF - 2, jF, kF + 1, ex)] - F8 * fh[idx_fh_F_ord2(iF - 1, jF, kF + 1, ex)] +
|
||||||
|
F8 * fh[idx_fh_F_ord2(iF + 1, jF, kF + 1, ex)] - fh[idx_fh_F_ord2(iF + 2, jF, kF + 1, ex)])
|
||||||
|
- (fh[idx_fh_F_ord2(iF - 2, jF, kF + 2, ex)] - F8 * fh[idx_fh_F_ord2(iF - 1, jF, kF + 2, ex)] +
|
||||||
|
F8 * fh[idx_fh_F_ord2(iF + 1, jF, kF + 2, ex)] - fh[idx_fh_F_ord2(iF + 2, jF, kF + 2, ex)])
|
||||||
|
);
|
||||||
|
fyz[p] = Fdydz * (
|
||||||
|
(fh[idx_fh_F_ord2(iF, jF - 2, kF - 2, ex)] - F8 * fh[idx_fh_F_ord2(iF, jF - 1, kF - 2, ex)] +
|
||||||
|
F8 * fh[idx_fh_F_ord2(iF, jF + 1, kF - 2, ex)] - fh[idx_fh_F_ord2(iF, jF + 2, kF - 2, ex)])
|
||||||
|
- F8 * (fh[idx_fh_F_ord2(iF, jF - 2, kF - 1, ex)] - F8 * fh[idx_fh_F_ord2(iF, jF - 1, kF - 1, ex)] +
|
||||||
|
F8 * fh[idx_fh_F_ord2(iF, jF + 1, kF - 1, ex)] - fh[idx_fh_F_ord2(iF, jF + 2, kF - 1, ex)])
|
||||||
|
+ F8 * (fh[idx_fh_F_ord2(iF, jF - 2, kF + 1, ex)] - F8 * fh[idx_fh_F_ord2(iF, jF - 1, kF + 1, ex)] +
|
||||||
|
F8 * fh[idx_fh_F_ord2(iF, jF + 1, kF + 1, ex)] - fh[idx_fh_F_ord2(iF, jF + 2, kF + 1, ex)])
|
||||||
|
- (fh[idx_fh_F_ord2(iF, jF - 2, kF + 2, ex)] - F8 * fh[idx_fh_F_ord2(iF, jF - 1, kF + 2, ex)] +
|
||||||
|
F8 * fh[idx_fh_F_ord2(iF, jF + 1, kF + 2, ex)] - fh[idx_fh_F_ord2(iF, jF + 2, kF + 2, ex)])
|
||||||
|
);
|
||||||
|
} else if ((iF + 1 <= imaxF && iF - 1 >= iminF) &&
|
||||||
|
(jF + 1 <= jmaxF && jF - 1 >= jminF) &&
|
||||||
|
(kF + 1 <= kmaxF && kF - 1 >= kminF)) {
|
||||||
fxx[p] = Sdxdx * (
|
fxx[p] = Sdxdx * (
|
||||||
fh[idx_fh_F_ord2(iF - 1, jF, kF, ex)] -
|
fh[idx_fh_F_ord2(iF - 1, jF, kF, ex)] -
|
||||||
TWO * fh[idx_fh_F_ord2(iF, jF, kF, ex)] +
|
TWO * fh[idx_fh_F_ord2(iF, jF, kF, ex)] +
|
||||||
fh[idx_fh_F_ord2(iF + 1, jF, kF, ex)]
|
fh[idx_fh_F_ord2(iF + 1, jF, kF, ex)]
|
||||||
);
|
);
|
||||||
|
|
||||||
fyy[p] = Sdydy * (
|
fyy[p] = Sdydy * (
|
||||||
fh[idx_fh_F_ord2(iF, jF - 1, kF, ex)] -
|
fh[idx_fh_F_ord2(iF, jF - 1, kF, ex)] -
|
||||||
TWO * fh[idx_fh_F_ord2(iF, jF, kF, ex)] +
|
TWO * fh[idx_fh_F_ord2(iF, jF, kF, ex)] +
|
||||||
fh[idx_fh_F_ord2(iF, jF + 1, kF, ex)]
|
fh[idx_fh_F_ord2(iF, jF + 1, kF, ex)]
|
||||||
);
|
);
|
||||||
|
|
||||||
fzz[p] = Sdzdz * (
|
fzz[p] = Sdzdz * (
|
||||||
fh[idx_fh_F_ord2(iF, jF, kF - 1, ex)] -
|
fh[idx_fh_F_ord2(iF, jF, kF - 1, ex)] -
|
||||||
TWO * fh[idx_fh_F_ord2(iF, jF, kF, ex)] +
|
TWO * fh[idx_fh_F_ord2(iF, jF, kF, ex)] +
|
||||||
fh[idx_fh_F_ord2(iF, jF, kF + 1, ex)]
|
fh[idx_fh_F_ord2(iF, jF, kF + 1, ex)]
|
||||||
);
|
);
|
||||||
|
|
||||||
fxy[p] = Sdxdy * (
|
fxy[p] = Sdxdy * (
|
||||||
fh[idx_fh_F_ord2(iF - 1, jF - 1, kF, ex)] -
|
fh[idx_fh_F_ord2(iF - 1, jF - 1, kF, ex)] -
|
||||||
fh[idx_fh_F_ord2(iF + 1, jF - 1, kF, ex)] -
|
fh[idx_fh_F_ord2(iF + 1, jF - 1, kF, ex)] -
|
||||||
fh[idx_fh_F_ord2(iF - 1, jF + 1, kF, ex)] +
|
fh[idx_fh_F_ord2(iF - 1, jF + 1, kF, ex)] +
|
||||||
fh[idx_fh_F_ord2(iF + 1, jF + 1, kF, ex)]
|
fh[idx_fh_F_ord2(iF + 1, jF + 1, kF, ex)]
|
||||||
);
|
);
|
||||||
|
|
||||||
fxz[p] = Sdxdz * (
|
fxz[p] = Sdxdz * (
|
||||||
fh[idx_fh_F_ord2(iF - 1, jF, kF - 1, ex)] -
|
fh[idx_fh_F_ord2(iF - 1, jF, kF - 1, ex)] -
|
||||||
fh[idx_fh_F_ord2(iF + 1, jF, kF - 1, ex)] -
|
fh[idx_fh_F_ord2(iF + 1, jF, kF - 1, ex)] -
|
||||||
fh[idx_fh_F_ord2(iF - 1, jF, kF + 1, ex)] +
|
fh[idx_fh_F_ord2(iF - 1, jF, kF + 1, ex)] +
|
||||||
fh[idx_fh_F_ord2(iF + 1, jF, kF + 1, ex)]
|
fh[idx_fh_F_ord2(iF + 1, jF, kF + 1, ex)]
|
||||||
);
|
);
|
||||||
|
|
||||||
fyz[p] = Sdydz * (
|
fyz[p] = Sdydz * (
|
||||||
fh[idx_fh_F_ord2(iF, jF - 1, kF - 1, ex)] -
|
fh[idx_fh_F_ord2(iF, jF - 1, kF - 1, ex)] -
|
||||||
fh[idx_fh_F_ord2(iF, jF + 1, kF - 1, ex)] -
|
fh[idx_fh_F_ord2(iF, jF + 1, kF - 1, ex)] -
|
||||||
@@ -207,126 +182,5 @@ void fdderivs(const int ex[3],
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has4) {
|
|
||||||
for (int k0 = k4_lo; k0 <= k4_hi; ++k0) {
|
|
||||||
const int kF = k0 + 1;
|
|
||||||
for (int j0 = j4_lo; j0 <= j4_hi; ++j0) {
|
|
||||||
const int jF = j0 + 1;
|
|
||||||
for (int i0 = i4_lo; i0 <= i4_hi; ++i0) {
|
|
||||||
const int iF = i0 + 1;
|
|
||||||
const size_t p = idx_ex(i0, j0, k0, ex);
|
|
||||||
|
|
||||||
fxx[p] = Fdxdx * (
|
|
||||||
-fh[idx_fh_F_ord2(iF - 2, jF, kF, ex)] +
|
|
||||||
F16 * fh[idx_fh_F_ord2(iF - 1, jF, kF, ex)] -
|
|
||||||
F30 * fh[idx_fh_F_ord2(iF, jF, kF, ex)] -
|
|
||||||
fh[idx_fh_F_ord2(iF + 2, jF, kF, ex)] +
|
|
||||||
F16 * fh[idx_fh_F_ord2(iF + 1, jF, kF, ex)]
|
|
||||||
);
|
|
||||||
|
|
||||||
fyy[p] = Fdydy * (
|
|
||||||
-fh[idx_fh_F_ord2(iF, jF - 2, kF, ex)] +
|
|
||||||
F16 * fh[idx_fh_F_ord2(iF, jF - 1, kF, ex)] -
|
|
||||||
F30 * fh[idx_fh_F_ord2(iF, jF, kF, ex)] -
|
|
||||||
fh[idx_fh_F_ord2(iF, jF + 2, kF, ex)] +
|
|
||||||
F16 * fh[idx_fh_F_ord2(iF, jF + 1, kF, ex)]
|
|
||||||
);
|
|
||||||
|
|
||||||
fzz[p] = Fdzdz * (
|
|
||||||
-fh[idx_fh_F_ord2(iF, jF, kF - 2, ex)] +
|
|
||||||
F16 * fh[idx_fh_F_ord2(iF, jF, kF - 1, ex)] -
|
|
||||||
F30 * fh[idx_fh_F_ord2(iF, jF, kF, ex)] -
|
|
||||||
fh[idx_fh_F_ord2(iF, jF, kF + 2, ex)] +
|
|
||||||
F16 * fh[idx_fh_F_ord2(iF, jF, kF + 1, ex)]
|
|
||||||
);
|
|
||||||
|
|
||||||
{
|
|
||||||
const double t_jm2 =
|
|
||||||
( fh[idx_fh_F_ord2(iF - 2, jF - 2, kF, ex)]
|
|
||||||
-F8*fh[idx_fh_F_ord2(iF - 1, jF - 2, kF, ex)]
|
|
||||||
+F8*fh[idx_fh_F_ord2(iF + 1, jF - 2, kF, ex)]
|
|
||||||
- fh[idx_fh_F_ord2(iF + 2, jF - 2, kF, ex)] );
|
|
||||||
|
|
||||||
const double t_jm1 =
|
|
||||||
( fh[idx_fh_F_ord2(iF - 2, jF - 1, kF, ex)]
|
|
||||||
-F8*fh[idx_fh_F_ord2(iF - 1, jF - 1, kF, ex)]
|
|
||||||
+F8*fh[idx_fh_F_ord2(iF + 1, jF - 1, kF, ex)]
|
|
||||||
- fh[idx_fh_F_ord2(iF + 2, jF - 1, kF, ex)] );
|
|
||||||
|
|
||||||
const double t_jp1 =
|
|
||||||
( fh[idx_fh_F_ord2(iF - 2, jF + 1, kF, ex)]
|
|
||||||
-F8*fh[idx_fh_F_ord2(iF - 1, jF + 1, kF, ex)]
|
|
||||||
+F8*fh[idx_fh_F_ord2(iF + 1, jF + 1, kF, ex)]
|
|
||||||
- fh[idx_fh_F_ord2(iF + 2, jF + 1, kF, ex)] );
|
|
||||||
|
|
||||||
const double t_jp2 =
|
|
||||||
( fh[idx_fh_F_ord2(iF - 2, jF + 2, kF, ex)]
|
|
||||||
-F8*fh[idx_fh_F_ord2(iF - 1, jF + 2, kF, ex)]
|
|
||||||
+F8*fh[idx_fh_F_ord2(iF + 1, jF + 2, kF, ex)]
|
|
||||||
- fh[idx_fh_F_ord2(iF + 2, jF + 2, kF, ex)] );
|
|
||||||
|
|
||||||
fxy[p] = Fdxdy * ( t_jm2 - F8 * t_jm1 + F8 * t_jp1 - t_jp2 );
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
const double t_km2 =
|
|
||||||
( fh[idx_fh_F_ord2(iF - 2, jF, kF - 2, ex)]
|
|
||||||
-F8*fh[idx_fh_F_ord2(iF - 1, jF, kF - 2, ex)]
|
|
||||||
+F8*fh[idx_fh_F_ord2(iF + 1, jF, kF - 2, ex)]
|
|
||||||
- fh[idx_fh_F_ord2(iF + 2, jF, kF - 2, ex)] );
|
|
||||||
|
|
||||||
const double t_km1 =
|
|
||||||
( fh[idx_fh_F_ord2(iF - 2, jF, kF - 1, ex)]
|
|
||||||
-F8*fh[idx_fh_F_ord2(iF - 1, jF, kF - 1, ex)]
|
|
||||||
+F8*fh[idx_fh_F_ord2(iF + 1, jF, kF - 1, ex)]
|
|
||||||
- fh[idx_fh_F_ord2(iF + 2, jF, kF - 1, ex)] );
|
|
||||||
|
|
||||||
const double t_kp1 =
|
|
||||||
( fh[idx_fh_F_ord2(iF - 2, jF, kF + 1, ex)]
|
|
||||||
-F8*fh[idx_fh_F_ord2(iF - 1, jF, kF + 1, ex)]
|
|
||||||
+F8*fh[idx_fh_F_ord2(iF + 1, jF, kF + 1, ex)]
|
|
||||||
- fh[idx_fh_F_ord2(iF + 2, jF, kF + 1, ex)] );
|
|
||||||
|
|
||||||
const double t_kp2 =
|
|
||||||
( fh[idx_fh_F_ord2(iF - 2, jF, kF + 2, ex)]
|
|
||||||
-F8*fh[idx_fh_F_ord2(iF - 1, jF, kF + 2, ex)]
|
|
||||||
+F8*fh[idx_fh_F_ord2(iF + 1, jF, kF + 2, ex)]
|
|
||||||
- fh[idx_fh_F_ord2(iF + 2, jF, kF + 2, ex)] );
|
|
||||||
|
|
||||||
fxz[p] = Fdxdz * ( t_km2 - F8 * t_km1 + F8 * t_kp1 - t_kp2 );
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
const double t_km2 =
|
|
||||||
( fh[idx_fh_F_ord2(iF, jF - 2, kF - 2, ex)]
|
|
||||||
-F8*fh[idx_fh_F_ord2(iF, jF - 1, kF - 2, ex)]
|
|
||||||
+F8*fh[idx_fh_F_ord2(iF, jF + 1, kF - 2, ex)]
|
|
||||||
- fh[idx_fh_F_ord2(iF, jF + 2, kF - 2, ex)] );
|
|
||||||
|
|
||||||
const double t_km1 =
|
|
||||||
( fh[idx_fh_F_ord2(iF, jF - 2, kF - 1, ex)]
|
|
||||||
-F8*fh[idx_fh_F_ord2(iF, jF - 1, kF - 1, ex)]
|
|
||||||
+F8*fh[idx_fh_F_ord2(iF, jF + 1, kF - 1, ex)]
|
|
||||||
- fh[idx_fh_F_ord2(iF, jF + 2, kF - 1, ex)] );
|
|
||||||
|
|
||||||
const double t_kp1 =
|
|
||||||
( fh[idx_fh_F_ord2(iF, jF - 2, kF + 1, ex)]
|
|
||||||
-F8*fh[idx_fh_F_ord2(iF, jF - 1, kF + 1, ex)]
|
|
||||||
+F8*fh[idx_fh_F_ord2(iF, jF + 1, kF + 1, ex)]
|
|
||||||
- fh[idx_fh_F_ord2(iF, jF + 2, kF + 1, ex)] );
|
|
||||||
|
|
||||||
const double t_kp2 =
|
|
||||||
( fh[idx_fh_F_ord2(iF, jF - 2, kF + 2, ex)]
|
|
||||||
-F8*fh[idx_fh_F_ord2(iF, jF - 1, kF + 2, ex)]
|
|
||||||
+F8*fh[idx_fh_F_ord2(iF, jF + 1, kF + 2, ex)]
|
|
||||||
- fh[idx_fh_F_ord2(iF, jF + 2, kF + 2, ex)] );
|
|
||||||
|
|
||||||
fyz[p] = Fdydz * ( t_km2 - F8 * t_km1 + F8 * t_kp1 - t_kp2 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// free(fh);
|
// free(fh);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,46 +80,48 @@ void fderivs(const int ex[3],
|
|||||||
fz[p] = ZEO;
|
fz[p] = ZEO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// Match Fortran (ghost_width=3, "for bam comparison") exactly:
|
||||||
* 两段式:
|
// only compute when x/y/z all satisfy the same-order stencil at this point.
|
||||||
* 1) 先在二阶可用区域计算二阶模板
|
for (int k0 = 0; k0 <= ex3 - 2; ++k0) {
|
||||||
* 2) 再在高阶可用区域覆盖为四阶模板
|
const int kF = k0 + 1;
|
||||||
*
|
for (int j0 = 0; j0 <= ex2 - 2; ++j0) {
|
||||||
* 与原 if/elseif 逻辑等价,但减少逐点分支判断。
|
const int jF = j0 + 1;
|
||||||
*/
|
for (int i0 = 0; i0 <= ex1 - 2; ++i0) {
|
||||||
const int i2_lo = (iminF > 0) ? iminF : 0;
|
const int iF = i0 + 1;
|
||||||
const int j2_lo = (jminF > 0) ? jminF : 0;
|
const size_t p = idx_ex(i0, j0, k0, ex);
|
||||||
const int k2_lo = (kminF > 0) ? kminF : 0;
|
|
||||||
const int i2_hi = ex1 - 2;
|
|
||||||
const int j2_hi = ex2 - 2;
|
|
||||||
const int k2_hi = ex3 - 2;
|
|
||||||
|
|
||||||
const int i4_lo = (iminF + 1 > 0) ? (iminF + 1) : 0;
|
|
||||||
const int j4_lo = (jminF + 1 > 0) ? (jminF + 1) : 0;
|
|
||||||
const int k4_lo = (kminF + 1 > 0) ? (kminF + 1) : 0;
|
|
||||||
const int i4_hi = ex1 - 3;
|
|
||||||
const int j4_hi = ex2 - 3;
|
|
||||||
const int k4_hi = ex3 - 3;
|
|
||||||
|
|
||||||
if (i2_lo <= i2_hi && j2_lo <= j2_hi && k2_lo <= k2_hi) {
|
|
||||||
for (int k0 = k2_lo; k0 <= k2_hi; ++k0) {
|
|
||||||
const int kF = k0 + 1;
|
|
||||||
for (int j0 = j2_lo; j0 <= j2_hi; ++j0) {
|
|
||||||
const int jF = j0 + 1;
|
|
||||||
for (int i0 = i2_lo; i0 <= i2_hi; ++i0) {
|
|
||||||
const int iF = i0 + 1;
|
|
||||||
const size_t p = idx_ex(i0, j0, k0, ex);
|
|
||||||
|
|
||||||
|
if ((iF + 2 <= imaxF && iF - 2 >= iminF) &&
|
||||||
|
(jF + 2 <= jmaxF && jF - 2 >= jminF) &&
|
||||||
|
(kF + 2 <= kmaxF && kF - 2 >= kminF)) {
|
||||||
|
fx[p] = d12dx * (
|
||||||
|
fh[idx_fh_F_ord2(iF - 2, jF, kF, ex)] -
|
||||||
|
EIT * fh[idx_fh_F_ord2(iF - 1, jF, kF, ex)] +
|
||||||
|
EIT * fh[idx_fh_F_ord2(iF + 1, jF, kF, ex)] -
|
||||||
|
fh[idx_fh_F_ord2(iF + 2, jF, kF, ex)]
|
||||||
|
);
|
||||||
|
fy[p] = d12dy * (
|
||||||
|
fh[idx_fh_F_ord2(iF, jF - 2, kF, ex)] -
|
||||||
|
EIT * fh[idx_fh_F_ord2(iF, jF - 1, kF, ex)] +
|
||||||
|
EIT * fh[idx_fh_F_ord2(iF, jF + 1, kF, ex)] -
|
||||||
|
fh[idx_fh_F_ord2(iF, jF + 2, kF, ex)]
|
||||||
|
);
|
||||||
|
fz[p] = d12dz * (
|
||||||
|
fh[idx_fh_F_ord2(iF, jF, kF - 2, ex)] -
|
||||||
|
EIT * fh[idx_fh_F_ord2(iF, jF, kF - 1, ex)] +
|
||||||
|
EIT * fh[idx_fh_F_ord2(iF, jF, kF + 1, ex)] -
|
||||||
|
fh[idx_fh_F_ord2(iF, jF, kF + 2, ex)]
|
||||||
|
);
|
||||||
|
} else if ((iF + 1 <= imaxF && iF - 1 >= iminF) &&
|
||||||
|
(jF + 1 <= jmaxF && jF - 1 >= jminF) &&
|
||||||
|
(kF + 1 <= kmaxF && kF - 1 >= kminF)) {
|
||||||
fx[p] = d2dx * (
|
fx[p] = d2dx * (
|
||||||
-fh[idx_fh_F_ord2(iF - 1, jF, kF, ex)] +
|
-fh[idx_fh_F_ord2(iF - 1, jF, kF, ex)] +
|
||||||
fh[idx_fh_F_ord2(iF + 1, jF, kF, ex)]
|
fh[idx_fh_F_ord2(iF + 1, jF, kF, ex)]
|
||||||
);
|
);
|
||||||
|
|
||||||
fy[p] = d2dy * (
|
fy[p] = d2dy * (
|
||||||
-fh[idx_fh_F_ord2(iF, jF - 1, kF, ex)] +
|
-fh[idx_fh_F_ord2(iF, jF - 1, kF, ex)] +
|
||||||
fh[idx_fh_F_ord2(iF, jF + 1, kF, ex)]
|
fh[idx_fh_F_ord2(iF, jF + 1, kF, ex)]
|
||||||
);
|
);
|
||||||
|
|
||||||
fz[p] = d2dz * (
|
fz[p] = d2dz * (
|
||||||
-fh[idx_fh_F_ord2(iF, jF, kF - 1, ex)] +
|
-fh[idx_fh_F_ord2(iF, jF, kF - 1, ex)] +
|
||||||
fh[idx_fh_F_ord2(iF, jF, kF + 1, ex)]
|
fh[idx_fh_F_ord2(iF, jF, kF + 1, ex)]
|
||||||
@@ -129,39 +131,5 @@ void fderivs(const int ex[3],
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i4_lo <= i4_hi && j4_lo <= j4_hi && k4_lo <= k4_hi) {
|
|
||||||
for (int k0 = k4_lo; k0 <= k4_hi; ++k0) {
|
|
||||||
const int kF = k0 + 1;
|
|
||||||
for (int j0 = j4_lo; j0 <= j4_hi; ++j0) {
|
|
||||||
const int jF = j0 + 1;
|
|
||||||
for (int i0 = i4_lo; i0 <= i4_hi; ++i0) {
|
|
||||||
const int iF = i0 + 1;
|
|
||||||
const size_t p = idx_ex(i0, j0, k0, ex);
|
|
||||||
|
|
||||||
fx[p] = d12dx * (
|
|
||||||
fh[idx_fh_F_ord2(iF - 2, jF, kF, ex)] -
|
|
||||||
EIT * fh[idx_fh_F_ord2(iF - 1, jF, kF, ex)] +
|
|
||||||
EIT * fh[idx_fh_F_ord2(iF + 1, jF, kF, ex)] -
|
|
||||||
fh[idx_fh_F_ord2(iF + 2, jF, kF, ex)]
|
|
||||||
);
|
|
||||||
|
|
||||||
fy[p] = d12dy * (
|
|
||||||
fh[idx_fh_F_ord2(iF, jF - 2, kF, ex)] -
|
|
||||||
EIT * fh[idx_fh_F_ord2(iF, jF - 1, kF, ex)] +
|
|
||||||
EIT * fh[idx_fh_F_ord2(iF, jF + 1, kF, ex)] -
|
|
||||||
fh[idx_fh_F_ord2(iF, jF + 2, kF, ex)]
|
|
||||||
);
|
|
||||||
|
|
||||||
fz[p] = d12dz * (
|
|
||||||
fh[idx_fh_F_ord2(iF, jF, kF - 2, ex)] -
|
|
||||||
EIT * fh[idx_fh_F_ord2(iF, jF, kF - 1, ex)] +
|
|
||||||
EIT * fh[idx_fh_F_ord2(iF, jF, kF + 1, ex)] -
|
|
||||||
fh[idx_fh_F_ord2(iF, jF, kF + 2, ex)]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// free(fh);
|
// free(fh);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1514,81 +1514,6 @@ f_out = f_out*dX*dY*dZ
|
|||||||
return
|
return
|
||||||
|
|
||||||
end subroutine l2normhelper
|
end subroutine l2normhelper
|
||||||
!--------------------------------------------------------------------------------------
|
|
||||||
subroutine l2normhelper7(ex, X, Y, Z,xmin,ymin,zmin,xmax,ymax,zmax,&
|
|
||||||
f1,f2,f3,f4,f5,f6,f7,f_out,gw)
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
!~~~~~~> Input parameters:
|
|
||||||
integer,intent(in ):: ex(1:3)
|
|
||||||
real*8, intent(in ):: X(1:ex(1)),Y(1:ex(2)),Z(1:ex(3)),xmin,ymin,zmin,xmax,ymax,zmax
|
|
||||||
integer,intent(in)::gw
|
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(in) :: f1,f2,f3,f4,f5,f6,f7
|
|
||||||
real*8, intent(out) :: f_out(7)
|
|
||||||
!~~~~~~> Other variables:
|
|
||||||
|
|
||||||
real*8 :: dX, dY, dZ
|
|
||||||
integer::imin,jmin,kmin
|
|
||||||
integer::imax,jmax,kmax
|
|
||||||
integer::i,j,k
|
|
||||||
real*8 :: s1,s2,s3,s4,s5,s6,s7
|
|
||||||
|
|
||||||
dX = X(2) - X(1)
|
|
||||||
dY = Y(2) - Y(1)
|
|
||||||
dZ = Z(2) - Z(1)
|
|
||||||
|
|
||||||
! for ghost zone
|
|
||||||
imin = gw+1
|
|
||||||
jmin = gw+1
|
|
||||||
kmin = gw+1
|
|
||||||
|
|
||||||
imax = ex(1) - gw
|
|
||||||
jmax = ex(2) - gw
|
|
||||||
kmax = ex(3) - gw
|
|
||||||
|
|
||||||
!for patch boundary (i.e., not ghost boundary)
|
|
||||||
|
|
||||||
if(dabs(X(ex(1))-xmax) < dX) imax = ex(1)
|
|
||||||
if(dabs(Y(ex(2))-ymax) < dY) jmax = ex(2)
|
|
||||||
if(dabs(Z(ex(3))-zmax) < dZ) kmax = ex(3)
|
|
||||||
if(dabs(X(1)-xmin) < dX) imin = 1
|
|
||||||
if(dabs(Y(1)-ymin) < dY) jmin = 1
|
|
||||||
if(dabs(Z(1)-zmin) < dZ) kmin = 1
|
|
||||||
|
|
||||||
s1 = 0.d0
|
|
||||||
s2 = 0.d0
|
|
||||||
s3 = 0.d0
|
|
||||||
s4 = 0.d0
|
|
||||||
s5 = 0.d0
|
|
||||||
s6 = 0.d0
|
|
||||||
s7 = 0.d0
|
|
||||||
|
|
||||||
do k=kmin,kmax
|
|
||||||
do j=jmin,jmax
|
|
||||||
!DIR$ SIMD REDUCTION(+:s1,s2,s3,s4,s5,s6,s7)
|
|
||||||
do i=imin,imax
|
|
||||||
s1 = s1 + f1(i,j,k)*f1(i,j,k)
|
|
||||||
s2 = s2 + f2(i,j,k)*f2(i,j,k)
|
|
||||||
s3 = s3 + f3(i,j,k)*f3(i,j,k)
|
|
||||||
s4 = s4 + f4(i,j,k)*f4(i,j,k)
|
|
||||||
s5 = s5 + f5(i,j,k)*f5(i,j,k)
|
|
||||||
s6 = s6 + f6(i,j,k)*f6(i,j,k)
|
|
||||||
s7 = s7 + f7(i,j,k)*f7(i,j,k)
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
|
|
||||||
f_out(1) = s1*dX*dY*dZ
|
|
||||||
f_out(2) = s2*dX*dY*dZ
|
|
||||||
f_out(3) = s3*dX*dY*dZ
|
|
||||||
f_out(4) = s4*dX*dY*dZ
|
|
||||||
f_out(5) = s5*dX*dY*dZ
|
|
||||||
f_out(6) = s6*dX*dY*dZ
|
|
||||||
f_out(7) = s7*dX*dY*dZ
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
end subroutine l2normhelper7
|
|
||||||
!--------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------
|
||||||
! calculate L2norm especially for shell Blocks
|
! calculate L2norm especially for shell Blocks
|
||||||
subroutine l2normhelper_sh(ex, X, Y, Z,xmin,ymin,zmin,xmax,ymax,zmax,&
|
subroutine l2normhelper_sh(ex, X, Y, Z,xmin,ymin,zmin,xmax,ymax,zmax,&
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
#define f_global_interpind2d global_interpind2d
|
#define f_global_interpind2d global_interpind2d
|
||||||
#define f_global_interpind1d global_interpind1d
|
#define f_global_interpind1d global_interpind1d
|
||||||
#define f_l2normhelper l2normhelper
|
#define f_l2normhelper l2normhelper
|
||||||
#define f_l2normhelper7 l2normhelper7
|
|
||||||
#define f_l2normhelper_sh l2normhelper_sh
|
#define f_l2normhelper_sh l2normhelper_sh
|
||||||
#define f_l2normhelper_sh_rms l2normhelper_sh_rms
|
#define f_l2normhelper_sh_rms l2normhelper_sh_rms
|
||||||
#define f_average average
|
#define f_average average
|
||||||
@@ -43,7 +42,6 @@
|
|||||||
#define f_global_interpind2d GLOBAL_INTERPIND2D
|
#define f_global_interpind2d GLOBAL_INTERPIND2D
|
||||||
#define f_global_interpind1d GLOBAL_INTERPIND1D
|
#define f_global_interpind1d GLOBAL_INTERPIND1D
|
||||||
#define f_l2normhelper L2NORMHELPER
|
#define f_l2normhelper L2NORMHELPER
|
||||||
#define f_l2normhelper7 L2NORMHELPER7
|
|
||||||
#define f_l2normhelper_sh L2NORMHELPER_SH
|
#define f_l2normhelper_sh L2NORMHELPER_SH
|
||||||
#define f_l2normhelper_sh_rms L2NORMHELPER_SH_RMS
|
#define f_l2normhelper_sh_rms L2NORMHELPER_SH_RMS
|
||||||
#define f_average AVERAGE
|
#define f_average AVERAGE
|
||||||
@@ -73,7 +71,6 @@
|
|||||||
#define f_global_interpind2d global_interpind2d_
|
#define f_global_interpind2d global_interpind2d_
|
||||||
#define f_global_interpind1d global_interpind1d_
|
#define f_global_interpind1d global_interpind1d_
|
||||||
#define f_l2normhelper l2normhelper_
|
#define f_l2normhelper l2normhelper_
|
||||||
#define f_l2normhelper7 l2normhelper7_
|
|
||||||
#define f_l2normhelper_sh l2normhelper_sh_
|
#define f_l2normhelper_sh l2normhelper_sh_
|
||||||
#define f_l2normhelper_sh_rms l2normhelper_sh_rms_
|
#define f_l2normhelper_sh_rms l2normhelper_sh_rms_
|
||||||
#define f_average average_
|
#define f_average average_
|
||||||
@@ -167,15 +164,6 @@ extern "C"
|
|||||||
double *, double &, int &);
|
double *, double &, int &);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
void f_l2normhelper7(int *, double *, double *, double *,
|
|
||||||
double &, double &, double &,
|
|
||||||
double &, double &, double &,
|
|
||||||
double *, double *, double *, double *,
|
|
||||||
double *, double *, double *, double *, int &);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
void f_l2normhelper_sh(int *, double *, double *, double *,
|
void f_l2normhelper_sh(int *, double *, double *, double *,
|
||||||
|
|||||||
@@ -29,16 +29,6 @@
|
|||||||
|
|
||||||
#define REGLEV 0
|
#define REGLEV 0
|
||||||
|
|
||||||
#define BSSN_FINE_TIMING 0
|
|
||||||
|
|
||||||
#define BSSN_FINE_TIMING_EVERY 1
|
|
||||||
|
|
||||||
#define BSSN_FINE_TIMING_TOPN 8
|
|
||||||
|
|
||||||
#define BSSN_KERNEL_FINE_TIMING 0
|
|
||||||
|
|
||||||
#define BSSN_ENABLE_STDIN_ABORT_POLL 0
|
|
||||||
|
|
||||||
//#define USE_GPU
|
//#define USE_GPU
|
||||||
|
|
||||||
//#define CHECKDETAIL
|
//#define CHECKDETAIL
|
||||||
@@ -98,21 +88,6 @@
|
|||||||
// 0: for every level;
|
// 0: for every level;
|
||||||
// 1: for all
|
// 1: for all
|
||||||
//
|
//
|
||||||
// define BSSN_FINE_TIMING
|
|
||||||
// enable fine-grained per-timestep timing monitor
|
|
||||||
//
|
|
||||||
// define BSSN_FINE_TIMING_EVERY
|
|
||||||
// report timing every N coarse timesteps
|
|
||||||
//
|
|
||||||
// define BSSN_FINE_TIMING_TOPN
|
|
||||||
// number of hottest timing buckets shown in stdout
|
|
||||||
//
|
|
||||||
// define BSSN_KERNEL_FINE_TIMING
|
|
||||||
// enable split timing inside compute_rhs_bssn
|
|
||||||
//
|
|
||||||
// define BSSN_ENABLE_STDIN_ABORT_POLL
|
|
||||||
// poll stdin and broadcast abort flag every coarse step
|
|
||||||
//
|
|
||||||
// define USE_GPU
|
// define USE_GPU
|
||||||
// use gpu or not
|
// use gpu or not
|
||||||
//
|
//
|
||||||
@@ -167,3 +142,4 @@
|
|||||||
#define TINY 1e-10
|
#define TINY 1e-10
|
||||||
|
|
||||||
#endif /* MICRODEF_H */
|
#endif /* MICRODEF_H */
|
||||||
|
|
||||||
|
|||||||
@@ -46,12 +46,12 @@ endif
|
|||||||
## Kernel implementation switch
|
## Kernel implementation switch
|
||||||
## 1 (default) : use C++ rewrite of bssn_rhs and helper kernels (faster)
|
## 1 (default) : use C++ rewrite of bssn_rhs and helper kernels (faster)
|
||||||
## 0 : fall back to original Fortran kernels
|
## 0 : fall back to original Fortran kernels
|
||||||
USE_CXX_KERNELS ?= 1
|
USE_CXX_KERNELS ?= 0
|
||||||
|
|
||||||
## RK4 kernel implementation switch
|
## RK4 kernel implementation switch
|
||||||
## 1 (default) : use C/C++ rewrite of rungekutta4_rout (for optimization experiments)
|
## 1 (default) : use C/C++ rewrite of rungekutta4_rout (for optimization experiments)
|
||||||
## 0 : use original Fortran rungekutta4_rout.o
|
## 0 : use original Fortran rungekutta4_rout.o
|
||||||
USE_CXX_RK4 ?= 1
|
USE_CXX_RK4 ?= 0
|
||||||
|
|
||||||
f90 = ifx
|
f90 = ifx
|
||||||
f77 = ifx
|
f77 = ifx
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -36,11 +36,6 @@ private:
|
|||||||
|
|
||||||
double *nx_g, *ny_g, *nz_g; // global list of unit normals
|
double *nx_g, *ny_g, *nz_g; // global list of unit normals
|
||||||
int myrank, cpusize;
|
int myrank, cpusize;
|
||||||
int wave_cache_spinw, wave_cache_maxl, wave_cache_modes;
|
|
||||||
double *wave_theta_pos, *wave_theta_neg;
|
|
||||||
double *wave_phi_cos, *wave_phi_sin;
|
|
||||||
void clear_wave_cache();
|
|
||||||
void build_wave_cache(int spinw, int maxl);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
surface_integral(int iSymmetry);
|
surface_integral(int iSymmetry);
|
||||||
@@ -87,29 +82,13 @@ public:
|
|||||||
var *Axx, var *Axy, var *Axz, var *Ayy, var *Ayz, var *Azz,
|
var *Axx, var *Axy, var *Axz, var *Ayy, var *Ayz, var *Azz,
|
||||||
var *Gmx, var *Gmy, var *Gmz,
|
var *Gmx, var *Gmy, var *Gmz,
|
||||||
var *Sfx_rhs, var *Sfy_rhs, var *Sfz_rhs,
|
var *Sfx_rhs, var *Sfy_rhs, var *Sfz_rhs,
|
||||||
double *Rout, monitor *Monitor, bool refresh_mass_fields = true);
|
double *Rout, monitor *Monitor);
|
||||||
void surf_MassPAng(double rex, int lev, ShellPatch *GH, var *chi, var *trK,
|
void surf_MassPAng(double rex, int lev, ShellPatch *GH, var *chi, var *trK,
|
||||||
var *gxx, var *gxy, var *gxz, var *gyy, var *gyz, var *gzz,
|
var *gxx, var *gxy, var *gxz, var *gyy, var *gyz, var *gzz,
|
||||||
var *Axx, var *Axy, var *Axz, var *Ayy, var *Ayz, var *Azz,
|
var *Axx, var *Axy, var *Axz, var *Ayy, var *Ayz, var *Azz,
|
||||||
var *Gmx, var *Gmy, var *Gmz,
|
var *Gmx, var *Gmy, var *Gmz,
|
||||||
var *Sfx_rhs, var *Sfy_rhs, var *Sfz_rhs,
|
var *Sfx_rhs, var *Sfy_rhs, var *Sfz_rhs,
|
||||||
double *Rout, monitor *Monitor, bool refresh_mass_fields = true);
|
double *Rout, monitor *Monitor);
|
||||||
void surf_WaveMassPAng(double rex, int lev, cgh *GH,
|
|
||||||
var *Rpsi4, var *Ipsi4, int spinw, int maxl, int NN, double *RP, double *IP,
|
|
||||||
var *chi, var *trK,
|
|
||||||
var *gxx, var *gxy, var *gxz, var *gyy, var *gyz, var *gzz,
|
|
||||||
var *Axx, var *Axy, var *Axz, var *Ayy, var *Ayz, var *Azz,
|
|
||||||
var *Gmx, var *Gmy, var *Gmz,
|
|
||||||
var *Sfx_rhs, var *Sfy_rhs, var *Sfz_rhs,
|
|
||||||
double *Rout, monitor *Monitor, bool refresh_mass_fields = true);
|
|
||||||
void surf_WaveMassPAng(double rex, int lev, ShellPatch *GH,
|
|
||||||
var *Rpsi4, var *Ipsi4, int spinw, int maxl, int NN, double *RP, double *IP,
|
|
||||||
var *chi, var *trK,
|
|
||||||
var *gxx, var *gxy, var *gxz, var *gyy, var *gyz, var *gzz,
|
|
||||||
var *Axx, var *Axy, var *Axz, var *Ayy, var *Ayz, var *Azz,
|
|
||||||
var *Gmx, var *Gmy, var *Gmz,
|
|
||||||
var *Sfx_rhs, var *Sfy_rhs, var *Sfz_rhs,
|
|
||||||
double *Rout, monitor *Monitor, bool refresh_mass_fields = true);
|
|
||||||
void surf_Wave(double rex, cgh *GH, ShellPatch *SH,
|
void surf_Wave(double rex, cgh *GH, ShellPatch *SH,
|
||||||
var *chi, var *trK,
|
var *chi, var *trK,
|
||||||
var *gxx, var *gxy, var *gxz, var *gyy, var *gyz, var *gzz,
|
var *gxx, var *gxy, var *gxz, var *gyy, var *gyz, var *gzz,
|
||||||
@@ -136,7 +115,7 @@ public:
|
|||||||
var *Axx, var *Axy, var *Axz, var *Ayy, var *Ayz, var *Azz,
|
var *Axx, var *Axy, var *Axz, var *Ayy, var *Ayz, var *Azz,
|
||||||
var *Gmx, var *Gmy, var *Gmz,
|
var *Gmx, var *Gmy, var *Gmz,
|
||||||
var *Sfx_rhs, var *Sfy_rhs, var *Sfz_rhs, // temparay memory for mass^i
|
var *Sfx_rhs, var *Sfy_rhs, var *Sfz_rhs, // temparay memory for mass^i
|
||||||
double *Rout, monitor *Monitor, MPI_Comm Comm_here, bool refresh_mass_fields = true);
|
double *Rout, monitor *Monitor, MPI_Comm Comm_here);
|
||||||
void surf_Wave(double rex, int lev, cgh *GH, var *Rpsi4, var *Ipsi4,
|
void surf_Wave(double rex, int lev, cgh *GH, var *Rpsi4, var *Ipsi4,
|
||||||
int spinw, int maxl, int NN, double *RP, double *IP,
|
int spinw, int maxl, int NN, double *RP, double *IP,
|
||||||
monitor *Monitor, MPI_Comm Comm_here);
|
monitor *Monitor, MPI_Comm Comm_here);
|
||||||
|
|||||||
@@ -144,62 +144,6 @@ def generate_macrodef_h():
|
|||||||
print( "#define REGLEV 0", file=file1 )
|
print( "#define REGLEV 0", file=file1 )
|
||||||
print( file=file1 )
|
print( file=file1 )
|
||||||
|
|
||||||
# Define fine-grained timing/debug macros.
|
|
||||||
# All of them default to OFF so production builds do not pay profiling overhead.
|
|
||||||
|
|
||||||
fine_timing = getattr(input_data, "Fine_Timing",
|
|
||||||
getattr(input_data, "Finegrained_Timing", "no"))
|
|
||||||
kernel_fine_timing = getattr(input_data, "Kernel_Fine_Timing",
|
|
||||||
getattr(input_data, "BSSN_Kernel_Fine_Timing", "no"))
|
|
||||||
stdin_abort_poll = getattr(input_data, "Enable_Stdin_Abort_Poll",
|
|
||||||
getattr(input_data, "Stdin_Abort_Poll", "no"))
|
|
||||||
timing_report_every = max(1, int(getattr(
|
|
||||||
input_data, "Timing_Every_Steps",
|
|
||||||
getattr(input_data, "Timing_Report_Every", 1))))
|
|
||||||
timing_top_hotspots = max(1, int(getattr(
|
|
||||||
input_data, "Timing_Top_Hotspots", 8)))
|
|
||||||
|
|
||||||
if ( fine_timing == "yes" ):
|
|
||||||
print( "#define BSSN_FINE_TIMING 1", file=file1 )
|
|
||||||
print( file=file1 )
|
|
||||||
elif ( fine_timing == "no" ):
|
|
||||||
print( "#define BSSN_FINE_TIMING 0", file=file1 )
|
|
||||||
print( file=file1 )
|
|
||||||
else:
|
|
||||||
print( "Fine_Timing setting error!!!" )
|
|
||||||
print()
|
|
||||||
print( "# Fine_Timing setting error!!!", file=file1 )
|
|
||||||
print( file=file1 )
|
|
||||||
|
|
||||||
print( f"#define BSSN_FINE_TIMING_EVERY {timing_report_every}", file=file1 )
|
|
||||||
print( file=file1 )
|
|
||||||
print( f"#define BSSN_FINE_TIMING_TOPN {timing_top_hotspots}", file=file1 )
|
|
||||||
print( file=file1 )
|
|
||||||
|
|
||||||
if ( kernel_fine_timing == "yes" ):
|
|
||||||
print( "#define BSSN_KERNEL_FINE_TIMING 1", file=file1 )
|
|
||||||
print( file=file1 )
|
|
||||||
elif ( kernel_fine_timing == "no" ):
|
|
||||||
print( "#define BSSN_KERNEL_FINE_TIMING 0", file=file1 )
|
|
||||||
print( file=file1 )
|
|
||||||
else:
|
|
||||||
print( "Kernel_Fine_Timing setting error!!!" )
|
|
||||||
print()
|
|
||||||
print( "# Kernel_Fine_Timing setting error!!!", file=file1 )
|
|
||||||
print( file=file1 )
|
|
||||||
|
|
||||||
if ( stdin_abort_poll == "yes" ):
|
|
||||||
print( "#define BSSN_ENABLE_STDIN_ABORT_POLL 1", file=file1 )
|
|
||||||
print( file=file1 )
|
|
||||||
elif ( stdin_abort_poll == "no" ):
|
|
||||||
print( "#define BSSN_ENABLE_STDIN_ABORT_POLL 0", file=file1 )
|
|
||||||
print( file=file1 )
|
|
||||||
else:
|
|
||||||
print( "Enable_Stdin_Abort_Poll setting error!!!" )
|
|
||||||
print()
|
|
||||||
print( "# Enable_Stdin_Abort_Poll setting error!!!", file=file1 )
|
|
||||||
print( file=file1 )
|
|
||||||
|
|
||||||
# Define macro USE_GPU
|
# Define macro USE_GPU
|
||||||
# use GPU or not
|
# use GPU or not
|
||||||
|
|
||||||
@@ -280,21 +224,6 @@ def generate_macrodef_h():
|
|||||||
print( "// 0: for every level;", file=file1 )
|
print( "// 0: for every level;", file=file1 )
|
||||||
print( "// 1: for all", file=file1 )
|
print( "// 1: for all", file=file1 )
|
||||||
print( "//", file=file1 )
|
print( "//", file=file1 )
|
||||||
print( "// define BSSN_FINE_TIMING", file=file1 )
|
|
||||||
print( "// enable fine-grained per-timestep timing monitor", file=file1 )
|
|
||||||
print( "//", file=file1 )
|
|
||||||
print( "// define BSSN_FINE_TIMING_EVERY", file=file1 )
|
|
||||||
print( "// report timing every N coarse timesteps", file=file1 )
|
|
||||||
print( "//", file=file1 )
|
|
||||||
print( "// define BSSN_FINE_TIMING_TOPN", file=file1 )
|
|
||||||
print( "// number of hottest timing buckets shown in stdout", file=file1 )
|
|
||||||
print( "//", file=file1 )
|
|
||||||
print( "// define BSSN_KERNEL_FINE_TIMING", file=file1 )
|
|
||||||
print( "// enable split timing inside compute_rhs_bssn", file=file1 )
|
|
||||||
print( "//", file=file1 )
|
|
||||||
print( "// define BSSN_ENABLE_STDIN_ABORT_POLL", file=file1 )
|
|
||||||
print( "// poll stdin and broadcast abort flag every coarse step", file=file1 )
|
|
||||||
print( "//", file=file1 )
|
|
||||||
print( "// define USE_GPU", file=file1 )
|
print( "// define USE_GPU", file=file1 )
|
||||||
print( "// use gpu or not", file=file1 )
|
print( "// use gpu or not", file=file1 )
|
||||||
print( "//", file=file1 )
|
print( "//", file=file1 )
|
||||||
|
|||||||
Reference in New Issue
Block a user