35 PetscReal ***diff_arr = NULL;
36 const Cmpnts ***cent = NULL;
37 DMDALocalInfo info = user->
info;
38 PetscReal min_gamma = PETSC_MAX_REAL;
40 PetscFunctionBeginUser;
44 ierr = DMDAVecGetArray(user->
da, user->
Diffusivity, &diff_arr); CHKERRQ(ierr);
45 ierr = DMDAVecGetArrayRead(user->
fda, user->
Cent, ¢); CHKERRQ(ierr);
47 for (PetscInt k = info.zs; k < info.zs + info.zm; ++k) {
48 for (PetscInt j = info.ys; j < info.ys + info.ym; ++j) {
49 for (PetscInt i = info.xs; i < info.xs + info.xm; ++i) {
50 const PetscReal gamma =
53 diff_arr[k][j][i] = gamma;
54 min_gamma = PetscMin(min_gamma, gamma);
59 ierr = DMDAVecRestoreArrayRead(user->
fda, user->
Cent, ¢); CHKERRQ(ierr);
60 ierr = DMDAVecRestoreArray(user->
da, user->
Diffusivity, &diff_arr); CHKERRQ(ierr);
63 PetscReal global_min_gamma = 0.0;
64 ierr = MPI_Allreduce(&min_gamma, &global_min_gamma, 1, MPIU_REAL, MPI_MIN, PETSC_COMM_WORLD); CHKERRMPI(ierr);
65 if (global_min_gamma <= 0.0) {
66 SETERRQ(PETSC_COMM_WORLD, PETSC_ERR_ARG_WRONG,
67 "verification diffusivity override produced non-positive Gamma values (min=%g).",
68 (
double)global_min_gamma);
74 "Applied verification diffusivity override profile '%s' (gamma0=%g, slope_x=%g).\n",
79 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...