1 // Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors. 2 // All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3 // 4 // SPDX-License-Identifier: BSD-2-Clause 5 // 6 // This file is part of CEED: http://github.com/ceed 7 8 /// @file 9 /// Implementation of the Synthetic Turbulence Generation (STG) algorithm 10 /// presented in Shur et al. 2014 11 12 #include <stdlib.h> 13 #include <math.h> 14 #include <petsc.h> 15 #include "../navierstokes.h" 16 #include "stg_shur14.h" 17 #include "../qfunctions/stg_shur14.h" 18 19 #ifndef M_PI 20 #define M_PI 3.14159265358979323846 21 #endif 22 23 /* 24 * @brief Perform Cholesky decomposition on array of symmetric 3x3 matrices 25 * 26 * This assumes the input matrices are in order [11,22,33,12,13,23]. This 27 * format is also used for the output. 28 * 29 * @param[in] comm MPI_Comm 30 * @param[in] nprofs Number of matrices in Rij 31 * @param[in] Rij Array of the symmetric matrices [6,nprofs] 32 * @param[out] Cij Array of the Cholesky Decomposition matrices, [6,nprofs] 33 */ 34 PetscErrorCode CalcCholeskyDecomp(MPI_Comm comm, PetscInt nprofs, 35 const CeedScalar Rij[6][nprofs], CeedScalar Cij[6][nprofs]) { 36 37 PetscFunctionBeginUser; 38 for (PetscInt i=0; i<nprofs; i++) { 39 Cij[0][i] = sqrt(Rij[0][i]); 40 Cij[3][i] = Rij[3][i] / Cij[0][i]; 41 Cij[1][i] = sqrt(Rij[1][i] - pow(Cij[3][i], 2) ); 42 Cij[4][i] = Rij[4][i] / Cij[0][i]; 43 Cij[5][i] = (Rij[5][i] - Cij[3][i]*Cij[4][i]) / Cij[1][i]; 44 Cij[2][i] = sqrt(Rij[2][i] - pow(Cij[4][i], 2) - pow(Cij[5][i], 2)); 45 46 if (isnan(Cij[0][i]) || isnan(Cij[1][i]) || isnan(Cij[2][i])) 47 SETERRQ(comm, -1, "Cholesky decomposition failed at profile point %d. " 48 "Either STGInflow has non-SPD matrix or contains nan.", i+1); 49 } 50 PetscFunctionReturn(0); 51 } 52 53 54 /* 55 * @brief Open a PHASTA *.dat file, grabbing dimensions and file pointer 56 * 57 * This function opens the file specified by `path` using `PetscFOpen` and 58 * passes the file pointer in `fp`. It is not closed in this function, thus 59 * `fp` must be closed sometime after this function has been called (using 60 * `PetscFClose` for example). 61 * 62 * Assumes that the first line of the file has the number of rows and columns 63 * as the only two entries, separated by a single space 64 * 65 * @param[in] comm MPI_Comm for the program 66 * @param[in] path Path to the file 67 * @param[in] char_array_len Length of the character array that should contain each line 68 * @param[out] dims Dimensions of the file, taken from the first line of the file 69 * @param[out] fp File pointer to the opened file 70 */ 71 static PetscErrorCode OpenPHASTADatFile(const MPI_Comm comm, 72 const char path[PETSC_MAX_PATH_LEN], const PetscInt char_array_len, 73 PetscInt dims[2], FILE **fp) { 74 PetscErrorCode ierr; 75 PetscInt ndims; 76 char line[char_array_len]; 77 char **array; 78 79 PetscFunctionBeginUser; 80 ierr = PetscFOpen(comm, path, "r", fp); CHKERRQ(ierr); 81 ierr = PetscSynchronizedFGets(comm, *fp, char_array_len, line); CHKERRQ(ierr); 82 ierr = PetscStrToArray(line, ' ', &ndims, &array); CHKERRQ(ierr); 83 if (ndims != 2) SETERRQ(comm, -1, 84 "Found %d dimensions instead of 2 on the first line of %s", 85 ndims, path); 86 87 for (PetscInt i=0; i<ndims; i++) dims[i] = atoi(array[i]); 88 ierr = PetscStrToArrayDestroy(ndims, array); CHKERRQ(ierr); 89 PetscFunctionReturn(0); 90 } 91 92 /* 93 * @brief Get the number of rows for the PHASTA file at path 94 * 95 * Assumes that the first line of the file has the number of rows and columns 96 * as the only two entries, separated by a single space 97 * 98 * @param[in] comm MPI_Comm for the program 99 * @param[in] path Path to the file 100 * @param[out] nrows Number of rows 101 */ 102 static PetscErrorCode GetNRows(const MPI_Comm comm, 103 const char path[PETSC_MAX_PATH_LEN], PetscInt *nrows) { 104 PetscErrorCode ierr; 105 const PetscInt char_array_len = 512; 106 PetscInt dims[2]; 107 FILE *fp; 108 109 PetscFunctionBeginUser; 110 ierr = OpenPHASTADatFile(comm, path, char_array_len, dims, &fp); CHKERRQ(ierr); 111 *nrows = dims[0]; 112 ierr = PetscFClose(comm, fp); CHKERRQ(ierr); 113 PetscFunctionReturn(0); 114 } 115 116 /* 117 * @brief Read the STGInflow file and load the contents into stg_ctx 118 * 119 * Assumes that the first line of the file has the number of rows and columns 120 * as the only two entries, separated by a single space. 121 * Assumes there are 14 columns in the file 122 * 123 * Function calculates the Cholesky decomposition from the Reynolds stress 124 * profile found in the file 125 * 126 * @param[in] comm MPI_Comm for the program 127 * @param[in] path Path to the STGInflow.dat file 128 * @param[inout] stg_ctx STGShur14Context where the data will be loaded into 129 */ 130 static PetscErrorCode ReadSTGInflow(const MPI_Comm comm, 131 const char path[PETSC_MAX_PATH_LEN], STGShur14Context stg_ctx) { 132 PetscErrorCode ierr; 133 PetscInt ndims, dims[2]; 134 FILE *fp; 135 const PetscInt char_array_len=512; 136 char line[char_array_len]; 137 char **array; 138 139 PetscFunctionBeginUser; 140 141 ierr = OpenPHASTADatFile(comm, path, char_array_len, dims, &fp); CHKERRQ(ierr); 142 143 CeedScalar rij[6][stg_ctx->nprofs]; 144 CeedScalar *prof_dw = &stg_ctx->data[stg_ctx->offsets.prof_dw]; 145 CeedScalar *eps = &stg_ctx->data[stg_ctx->offsets.eps]; 146 CeedScalar *lt = &stg_ctx->data[stg_ctx->offsets.lt]; 147 CeedScalar (*ubar)[stg_ctx->nprofs] = (CeedScalar (*)[stg_ctx->nprofs]) 148 &stg_ctx->data[stg_ctx->offsets.ubar]; 149 150 for (PetscInt i=0; i<stg_ctx->nprofs; i++) { 151 ierr = PetscSynchronizedFGets(comm, fp, char_array_len, line); CHKERRQ(ierr); 152 ierr = PetscStrToArray(line, ' ', &ndims, &array); CHKERRQ(ierr); 153 if (ndims < dims[1]) SETERRQ(comm, -1, 154 "Line %d of %s does not contain enough columns (%d instead of %d)", i, 155 path, ndims, dims[1]); 156 157 prof_dw[i] = (CeedScalar) atof(array[0]); 158 ubar[0][i] = (CeedScalar) atof(array[1]); 159 ubar[1][i] = (CeedScalar) atof(array[2]); 160 ubar[2][i] = (CeedScalar) atof(array[3]); 161 rij[0][i] = (CeedScalar) atof(array[4]); 162 rij[1][i] = (CeedScalar) atof(array[5]); 163 rij[2][i] = (CeedScalar) atof(array[6]); 164 rij[3][i] = (CeedScalar) atof(array[7]); 165 rij[4][i] = (CeedScalar) atof(array[8]); 166 rij[5][i] = (CeedScalar) atof(array[9]); 167 lt[i] = (CeedScalar) atof(array[12]); 168 eps[i] = (CeedScalar) atof(array[13]); 169 170 if (prof_dw[i] < 0) SETERRQ(comm, -1, 171 "Distance to wall in %s cannot be negative", path); 172 if (lt[i] < 0) SETERRQ(comm, -1, 173 "Turbulent length scale in %s cannot be negative", path); 174 if (eps[i] < 0) SETERRQ(comm, -1, 175 "Turbulent dissipation in %s cannot be negative", path); 176 177 } 178 CeedScalar (*cij)[stg_ctx->nprofs] = (CeedScalar (*)[stg_ctx->nprofs]) 179 &stg_ctx->data[stg_ctx->offsets.cij]; 180 ierr = CalcCholeskyDecomp(comm, stg_ctx->nprofs, rij, cij); CHKERRQ(ierr); 181 ierr = PetscFClose(comm, fp); CHKERRQ(ierr); 182 PetscFunctionReturn(0); 183 } 184 185 /* 186 * @brief Read the STGRand file and load the contents into stg_ctx 187 * 188 * Assumes that the first line of the file has the number of rows and columns 189 * as the only two entries, separated by a single space. 190 * Assumes there are 7 columns in the file 191 * 192 * @param[in] comm MPI_Comm for the program 193 * @param[in] path Path to the STGRand.dat file 194 * @param[inout] stg_ctx STGShur14Context where the data will be loaded into 195 */ 196 static PetscErrorCode ReadSTGRand(const MPI_Comm comm, 197 const char path[PETSC_MAX_PATH_LEN], 198 STGShur14Context stg_ctx) { 199 200 PetscErrorCode ierr; 201 PetscInt ndims, dims[2]; 202 FILE *fp; 203 const PetscInt char_array_len = 512; 204 char line[char_array_len]; 205 char **array; 206 207 PetscFunctionBeginUser; 208 ierr = OpenPHASTADatFile(comm, path, char_array_len, dims, &fp); CHKERRQ(ierr); 209 210 CeedScalar *phi = &stg_ctx->data[stg_ctx->offsets.phi]; 211 CeedScalar (*d)[stg_ctx->nmodes] = (CeedScalar (*)[stg_ctx->nmodes]) 212 &stg_ctx->data[stg_ctx->offsets.d]; 213 CeedScalar (*sigma)[stg_ctx->nmodes] = (CeedScalar (*)[stg_ctx->nmodes]) 214 &stg_ctx->data[stg_ctx->offsets.sigma]; 215 216 for (PetscInt i=0; i<stg_ctx->nmodes; i++) { 217 ierr = PetscSynchronizedFGets(comm, fp, char_array_len, line); CHKERRQ(ierr); 218 ierr = PetscStrToArray(line, ' ', &ndims, &array); CHKERRQ(ierr); 219 if (ndims < dims[1]) SETERRQ(comm, -1, 220 "Line %d of %s does not contain enough columns (%d instead of %d)", i, 221 path, ndims, dims[1]); 222 223 d[0][i] = (CeedScalar) atof(array[0]); 224 d[1][i] = (CeedScalar) atof(array[1]); 225 d[2][i] = (CeedScalar) atof(array[2]); 226 phi[i] = (CeedScalar) atof(array[3]); 227 sigma[0][i] = (CeedScalar) atof(array[4]); 228 sigma[1][i] = (CeedScalar) atof(array[5]); 229 sigma[2][i] = (CeedScalar) atof(array[6]); 230 } 231 ierr = PetscFClose(comm, fp); CHKERRQ(ierr); 232 PetscFunctionReturn(0); 233 } 234 235 /* 236 * @brief Read STG data from input paths and put in STGShur14Context 237 * 238 * Reads data from input paths and puts them into a STGShur14Context object. 239 * Data stored initially in `*pstg_ctx` will be copied over to the new 240 * STGShur14Context instance. 241 * 242 * @param[in] comm MPI_Comm for the program 243 * @param[in] dm DM for the program 244 * @param[in] stg_inflow_path Path to STGInflow.dat file 245 * @param[in] stg_rand_path Path to STGRand.dat file 246 * @param[inout] pstg_ctx Pointer to STGShur14Context where the data will be loaded into 247 */ 248 PetscErrorCode GetSTGContextData(const MPI_Comm comm, const DM dm, 249 char stg_inflow_path[PETSC_MAX_PATH_LEN], 250 char stg_rand_path[PETSC_MAX_PATH_LEN], 251 STGShur14Context *pstg_ctx, 252 const CeedScalar ynodes[]) { 253 PetscErrorCode ierr; 254 PetscInt nmodes, nprofs; 255 STGShur14Context stg_ctx; 256 PetscFunctionBeginUser; 257 258 // Get options 259 ierr = GetNRows(comm, stg_rand_path, &nmodes); CHKERRQ(ierr); 260 ierr = GetNRows(comm, stg_inflow_path, &nprofs); CHKERRQ(ierr); 261 if (nmodes > STG_NMODES_MAX) 262 SETERRQ(comm, 1, "Number of wavemodes in %s (%d) exceeds STG_NMODES_MAX (%d). " 263 "Change size of STG_NMODES_MAX and recompile", stg_rand_path, nmodes, 264 STG_NMODES_MAX); 265 266 { 267 STGShur14Context s; 268 ierr = PetscCalloc1(1, &s); CHKERRQ(ierr); 269 *s = **pstg_ctx; 270 s->nmodes = nmodes; 271 s->nprofs = nprofs; 272 s->offsets.sigma = 0; 273 s->offsets.d = nmodes*3; 274 s->offsets.phi = s->offsets.d + nmodes*3; 275 s->offsets.kappa = s->offsets.phi + nmodes; 276 s->offsets.prof_dw = s->offsets.kappa + nmodes; 277 s->offsets.ubar = s->offsets.prof_dw + nprofs; 278 s->offsets.cij = s->offsets.ubar + nprofs*3; 279 s->offsets.eps = s->offsets.cij + nprofs*6; 280 s->offsets.lt = s->offsets.eps + nprofs; 281 s->offsets.ynodes = s->offsets.lt + nprofs; 282 PetscInt total_num_scalars = s->offsets.ynodes + s->nynodes; 283 s->total_bytes = sizeof(*stg_ctx) + total_num_scalars*sizeof(stg_ctx->data[0]); 284 ierr = PetscMalloc(s->total_bytes, &stg_ctx); CHKERRQ(ierr); 285 *stg_ctx = *s; 286 ierr = PetscFree(s); CHKERRQ(ierr); 287 } 288 289 ierr = ReadSTGInflow(comm, stg_inflow_path, stg_ctx); CHKERRQ(ierr); 290 ierr = ReadSTGRand(comm, stg_rand_path, stg_ctx); CHKERRQ(ierr); 291 292 if (stg_ctx->nynodes > 0) { 293 CeedScalar *ynodes_ctx = &stg_ctx->data[stg_ctx->offsets.ynodes]; 294 for (PetscInt i=0; i<stg_ctx->nynodes; i++) ynodes_ctx[i] = ynodes[i]; 295 } 296 297 // -- Calculate kappa 298 { 299 CeedScalar *kappa = &stg_ctx->data[stg_ctx->offsets.kappa]; 300 CeedScalar *prof_dw = &stg_ctx->data[stg_ctx->offsets.prof_dw]; 301 CeedScalar *lt = &stg_ctx->data[stg_ctx->offsets.lt]; 302 CeedScalar le, le_max=0; 303 304 CeedPragmaSIMD 305 for (PetscInt i=0; i<stg_ctx->nprofs; i++) { 306 le = PetscMin(2*prof_dw[i], 3*lt[i]); 307 if (le_max < le) le_max = le; 308 } 309 CeedScalar kmin = M_PI/le_max; 310 311 CeedPragmaSIMD 312 for (PetscInt i=0; i<stg_ctx->nmodes; i++) { 313 kappa[i] = kmin*pow(stg_ctx->alpha, i); 314 } 315 } //end calculate kappa 316 317 ierr = PetscFree(*pstg_ctx); CHKERRQ(ierr); 318 *pstg_ctx = stg_ctx; 319 PetscFunctionReturn(0); 320 } 321 322 PetscErrorCode SetupSTG(const MPI_Comm comm, const DM dm, ProblemData *problem, 323 User user, const bool prescribe_T, 324 const CeedScalar theta0, const CeedScalar P0, 325 const CeedScalar ynodes[], const CeedInt nynodes) { 326 PetscErrorCode ierr; 327 char stg_inflow_path[PETSC_MAX_PATH_LEN] = "./STGInflow.dat"; 328 char stg_rand_path[PETSC_MAX_PATH_LEN] = "./STGRand.dat"; 329 PetscBool mean_only = PETSC_FALSE, 330 use_stgstrong = PETSC_FALSE; 331 CeedScalar u0 = 0.0, 332 alpha = 1.01; 333 STGShur14Context stg_ctx; 334 CeedQFunctionContext stg_context; 335 NewtonianIdealGasContext newtonian_ig_ctx; 336 PetscFunctionBeginUser; 337 338 // Get options 339 PetscOptionsBegin(comm, NULL, "STG Boundary Condition Options", NULL); 340 ierr = PetscOptionsString("-stg_inflow_path", "Path to STGInflow.dat", NULL, 341 stg_inflow_path, stg_inflow_path, 342 sizeof(stg_inflow_path), NULL); CHKERRQ(ierr); 343 ierr = PetscOptionsString("-stg_rand_path", "Path to STGInflow.dat", NULL, 344 stg_rand_path,stg_rand_path, 345 sizeof(stg_rand_path), NULL); CHKERRQ(ierr); 346 ierr = PetscOptionsReal("-stg_alpha", "Growth rate of the wavemodes", NULL, 347 alpha, &alpha, NULL); CHKERRQ(ierr); 348 ierr = PetscOptionsReal("-stg_u0", "Advective velocity for the fluctuations", 349 NULL, u0, &u0, NULL); CHKERRQ(ierr); 350 ierr = PetscOptionsBool("-stg_mean_only", "Only apply mean profile", 351 NULL, mean_only, &mean_only, NULL); CHKERRQ(ierr); 352 ierr = PetscOptionsBool("-stg_strong", "Enforce STG inflow strongly", 353 NULL, use_stgstrong, &use_stgstrong, NULL); CHKERRQ(ierr); 354 PetscOptionsEnd(); 355 356 ierr = PetscCalloc1(1, &stg_ctx); CHKERRQ(ierr); 357 stg_ctx->alpha = alpha; 358 stg_ctx->u0 = u0; 359 stg_ctx->is_implicit = user->phys->implicit; 360 stg_ctx->prescribe_T = prescribe_T; 361 stg_ctx->mean_only = mean_only; 362 stg_ctx->theta0 = theta0; 363 stg_ctx->P0 = P0; 364 stg_ctx->nynodes = nynodes; 365 366 { 367 // Calculate dx assuming constant spacing 368 PetscReal domain_min[3], domain_max[3], domain_size[3]; 369 ierr = DMGetBoundingBox(dm, domain_min, domain_max); CHKERRQ(ierr); 370 for (PetscInt i=0; i<3; i++) domain_size[i] = domain_max[i] - domain_min[i]; 371 372 PetscInt nmax = 3, faces[3]; 373 ierr = PetscOptionsGetIntArray(NULL, NULL, "-dm_plex_box_faces", faces, &nmax, 374 NULL); CHKERRQ(ierr); 375 stg_ctx->dx = domain_size[0]/faces[0]; 376 stg_ctx->dz = domain_size[2]/faces[2]; 377 } 378 379 CeedQFunctionContextGetData(problem->apply_vol_rhs.qfunction_context, 380 CEED_MEM_HOST, &newtonian_ig_ctx); 381 stg_ctx->newtonian_ctx = *newtonian_ig_ctx; 382 CeedQFunctionContextRestoreData(problem->apply_vol_rhs.qfunction_context, 383 &newtonian_ig_ctx); 384 385 ierr = GetSTGContextData(comm, dm, stg_inflow_path, stg_rand_path, &stg_ctx, 386 ynodes); CHKERRQ(ierr); 387 388 CeedQFunctionContextDestroy(&problem->apply_inflow.qfunction_context); 389 CeedQFunctionContextCreate(user->ceed, &stg_context); 390 CeedQFunctionContextSetData(stg_context, CEED_MEM_HOST, 391 CEED_USE_POINTER, stg_ctx->total_bytes, stg_ctx); 392 CeedQFunctionContextSetDataDestroy(stg_context, CEED_MEM_HOST, 393 FreeContextPetsc); 394 CeedQFunctionContextRegisterDouble(stg_context, "solution time", 395 offsetof(struct STGShur14Context_, time), 1, 396 "Phyiscal time of the solution"); 397 398 if (use_stgstrong) { 399 problem->apply_inflow.qfunction = STGShur14_Inflow_Strong; 400 problem->apply_inflow.qfunction_loc = STGShur14_Inflow_Strong_loc; 401 problem->bc_from_ics = PETSC_FALSE; 402 } else { 403 problem->apply_inflow.qfunction = STGShur14_Inflow; 404 problem->apply_inflow.qfunction_loc = STGShur14_Inflow_loc; 405 problem->bc_from_ics = PETSC_TRUE; 406 } 407 problem->apply_inflow.qfunction_context = stg_context; 408 409 PetscFunctionReturn(0); 410 } 411 412 static inline PetscScalar FindDy(const PetscScalar ynodes[], 413 const PetscInt nynodes, const PetscScalar y) { 414 const PetscScalar half_mindy = 0.5 * (ynodes[1] - ynodes[0]); 415 // ^^assuming min(dy) is first element off the wall 416 PetscInt idx = -1; // Index 417 418 for (PetscInt i=0; i<nynodes; i++) { 419 if (y < ynodes[i] + half_mindy) { 420 idx = i; break; 421 } 422 } 423 if (idx == 0) return ynodes[1] - ynodes[0]; 424 else if (idx == nynodes-1) return ynodes[nynodes-2] - ynodes[nynodes-1]; 425 else return 0.5 * (ynodes[idx+1] - ynodes[idx-1]); 426 } 427 428 // Function passed to DMAddBoundary 429 PetscErrorCode StrongSTGbcFunc(PetscInt dim, PetscReal time, 430 const PetscReal x[], PetscInt Nc, PetscScalar bcval[], void *ctx) { 431 PetscFunctionBeginUser; 432 433 const STGShur14Context stg_ctx = (STGShur14Context) ctx; 434 PetscScalar qn[stg_ctx->nmodes], u[3], ubar[3], cij[6], eps, lt; 435 const bool mean_only = stg_ctx->mean_only; 436 const PetscScalar dx = stg_ctx->dx; 437 const PetscScalar dz = stg_ctx->dz; 438 const PetscScalar mu = stg_ctx->newtonian_ctx.mu; 439 const PetscScalar theta0 = stg_ctx->theta0; 440 const PetscScalar P0 = stg_ctx->P0; 441 const PetscScalar cv = stg_ctx->newtonian_ctx.cv; 442 const PetscScalar cp = stg_ctx->newtonian_ctx.cp; 443 const PetscScalar Rd = cp - cv; 444 445 const CeedScalar rho = P0 / (Rd * theta0); 446 InterpolateProfile(x[1], ubar, cij, &eps, <, stg_ctx); 447 if (!mean_only) { 448 const PetscInt nynodes = stg_ctx->nynodes; 449 const PetscScalar *ynodes = &stg_ctx->data[stg_ctx->offsets.ynodes]; 450 const PetscScalar h[3] = {dx, FindDy(ynodes, nynodes, x[1]), dz}; 451 CalcSpectrum(x[1], eps, lt, h, mu/rho, qn, stg_ctx); 452 STGShur14_Calc(x, time, ubar, cij, qn, u, stg_ctx); 453 } else { 454 for (CeedInt j=0; j<3; j++) u[j] = ubar[j]; 455 } 456 457 bcval[0] = rho; 458 bcval[1] = rho * u[0]; 459 bcval[2] = rho * u[1]; 460 bcval[3] = rho * u[2]; 461 PetscFunctionReturn(0); 462 } 463 464 PetscErrorCode SetupStrongSTG(DM dm, SimpleBC bc, ProblemData *problem, 465 STGShur14Context stg_ctx) { 466 467 PetscErrorCode ierr; 468 DMLabel label; 469 const PetscInt comps[] = {0, 1, 2, 3}; 470 const PetscInt num_comps = 4; 471 PetscFunctionBeginUser; 472 473 ierr = DMGetLabel(dm, "Face Sets", &label); CHKERRQ(ierr); 474 // Set wall BCs 475 if (bc->num_inflow > 0) { 476 ierr = DMAddBoundary(dm, DM_BC_ESSENTIAL, "STG", label, 477 bc->num_inflow, bc->inflows, 0, num_comps, 478 comps, (void(*)(void))StrongSTGbcFunc, 479 NULL, stg_ctx, NULL); CHKERRQ(ierr); 480 } 481 482 PetscFunctionReturn(0); 483 } 484