Batch constraint norm reductions
This commit is contained in:
@@ -5253,10 +5253,10 @@ void Parallel::PeriodicBD(Patch *Pat, MyList<var> *VarList, int Symmetry)
|
||||
delete[] transfer_src;
|
||||
delete[] transfer_dst;
|
||||
}
|
||||
double Parallel::L2Norm(Patch *Pat, var *vf)
|
||||
{
|
||||
int myrank;
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
|
||||
double Parallel::L2Norm(Patch *Pat, var *vf)
|
||||
{
|
||||
int myrank;
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
|
||||
|
||||
double tvf, dtvf = 0;
|
||||
int BDW = ghost_width;
|
||||
@@ -5281,13 +5281,48 @@ double Parallel::L2Norm(Patch *Pat, var *vf)
|
||||
MPI_Allreduce(&dtvf, &tvf, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
|
||||
|
||||
tvf = sqrt(tvf);
|
||||
|
||||
return tvf;
|
||||
}
|
||||
double Parallel::L2Norm(Patch *Pat, var *vf, MPI_Comm Comm_here)
|
||||
{
|
||||
int myrank;
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
|
||||
|
||||
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)
|
||||
{
|
||||
int myrank;
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
|
||||
|
||||
double tvf, dtvf = 0;
|
||||
int BDW = ghost_width;
|
||||
@@ -5312,12 +5347,47 @@ double Parallel::L2Norm(Patch *Pat, var *vf, MPI_Comm Comm_here)
|
||||
MPI_Allreduce(&dtvf, &tvf, 1, MPI_DOUBLE, MPI_SUM, Comm_here);
|
||||
|
||||
tvf = sqrt(tvf);
|
||||
|
||||
return tvf;
|
||||
}
|
||||
void Parallel::checkgsl(MyList<Parallel::gridseg> *pp, bool first_only)
|
||||
{
|
||||
int myrank = 0;
|
||||
|
||||
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)
|
||||
{
|
||||
int myrank = 0;
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
|
||||
if (myrank == 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user