diff options
Diffstat (limited to 'mg2d.c')
-rw-r--r-- | mg2d.c | 38 |
1 files changed, 19 insertions, 19 deletions
@@ -778,21 +778,6 @@ static int mg_levels_init(MG2DContext *ctx) double diff0_max, diff2_max, tmp; int ret; - diff0_max = findmax(ctx->diff_coeffs[MG2D_DIFF_COEFF_00]->data, priv->root->solver->domain_size, - ctx->diff_coeffs[MG2D_DIFF_COEFF_00]->stride); - diff2_max = findmax(ctx->diff_coeffs[MG2D_DIFF_COEFF_20]->data, priv->root->solver->domain_size, - ctx->diff_coeffs[MG2D_DIFF_COEFF_20]->stride); - tmp = findmax(ctx->diff_coeffs[MG2D_DIFF_COEFF_02]->data, priv->root->solver->domain_size, - ctx->diff_coeffs[MG2D_DIFF_COEFF_02]->stride); - diff2_max = MAX(diff2_max, tmp); - - if (priv->dg->nb_components > 1) { - MPI_Allreduce(MPI_IN_PLACE, &diff0_max, 1, - MPI_DOUBLE, MPI_MAX, priv->mpi_comm); - MPI_Allreduce(MPI_IN_PLACE, &diff2_max, 1, - MPI_DOUBLE, MPI_MAX, priv->mpi_comm); - } - cur = priv->root; prev = NULL; @@ -854,10 +839,6 @@ static int mg_levels_init(MG2DContext *ctx) cur->solver->fd_stencil = ctx->fd_stencil; - cur->solver->relax->relax_factor = ctx->cfl_factor; - cur->solver->relax->relax_multiplier = 1.0 / (diff2_max + cur->solver->step[0] * cur->solver->step[1] * - diff0_max / 8.0); - prev = cur; cur = cur->child; } @@ -902,8 +883,27 @@ static int mg_levels_init(MG2DContext *ctx) cur = cur->child; } + diff0_max = findmax(priv->diff_coeffs_tmp[MG2D_DIFF_COEFF_00]->data, priv->root->solver->domain_size, + ctx->diff_coeffs[MG2D_DIFF_COEFF_00]->stride); + diff2_max = findmax(priv->diff_coeffs_tmp[MG2D_DIFF_COEFF_20]->data, priv->root->solver->domain_size, + ctx->diff_coeffs[MG2D_DIFF_COEFF_20]->stride); + tmp = findmax(priv->diff_coeffs_tmp[MG2D_DIFF_COEFF_02]->data, priv->root->solver->domain_size, + ctx->diff_coeffs[MG2D_DIFF_COEFF_02]->stride); + diff2_max = MAX(diff2_max, tmp); + + if (priv->dg->nb_components > 1) { + MPI_Allreduce(MPI_IN_PLACE, &diff0_max, 1, + MPI_DOUBLE, MPI_MAX, priv->mpi_comm); + MPI_Allreduce(MPI_IN_PLACE, &diff2_max, 1, + MPI_DOUBLE, MPI_MAX, priv->mpi_comm); + } + cur = priv->root; while (cur) { + cur->solver->relax->relax_factor = ctx->cfl_factor; + cur->solver->relax->relax_multiplier = 1.0 / (diff2_max + cur->solver->step[0] * cur->solver->step[1] * + diff0_max / 8.0); + if (cur->depth > 0) { ret = diff_coeffs_fixup(ctx, cur); if (ret < 0) |