28 PetscReal ***diff_arr = NULL;
29 const Cmpnts ***cent = NULL;
30 DMDALocalInfo info = user->
info;
31 PetscReal min_gamma = PETSC_MAX_REAL;
33 PetscFunctionBeginUser;
37 ierr = DMDAVecGetArray(user->
da, user->
Diffusivity, &diff_arr); CHKERRQ(ierr);
38 ierr = DMDAVecGetArrayRead(user->
fda, user->
Cent, ¢); CHKERRQ(ierr);
40 for (PetscInt k = info.zs; k < info.zs + info.zm; ++k) {
41 for (PetscInt j = info.ys; j < info.ys + info.ym; ++j) {
42 for (PetscInt i = info.xs; i < info.xs + info.xm; ++i) {
43 const PetscReal gamma =
46 diff_arr[k][j][i] = gamma;
47 min_gamma = PetscMin(min_gamma, gamma);
52 ierr = DMDAVecRestoreArrayRead(user->
fda, user->
Cent, ¢); CHKERRQ(ierr);
53 ierr = DMDAVecRestoreArray(user->
da, user->
Diffusivity, &diff_arr); CHKERRQ(ierr);
56 PetscReal global_min_gamma = 0.0;
57 ierr = MPI_Allreduce(&min_gamma, &global_min_gamma, 1, MPIU_REAL, MPI_MIN, PETSC_COMM_WORLD); CHKERRMPI(ierr);
58 if (global_min_gamma <= 0.0) {
59 SETERRQ(PETSC_COMM_WORLD, PETSC_ERR_ARG_WRONG,
60 "verification diffusivity override produced non-positive Gamma values (min=%g).",
61 (
double)global_min_gamma);
67 "Applied verification diffusivity override profile '%s' (gamma0=%g, slope_x=%g).\n",
72 PetscFunctionReturn(0);
#define LOG_ALLOW(scope, level, fmt,...)
Logging macro that checks both the log level and whether the calling function is in the allowed-funct...