Lines Matching refs:ctx

40   AdvectCtx *ctx = (AdvectCtx *)vctx;  in PhysicsRiemann_Advect()  local
44 speed = ctx->a; in PhysicsRiemann_Advect()
52 AdvectCtx *ctx = (AdvectCtx *)vctx; in PhysicsCharacteristic_Advect() local
57 speeds[0] = ctx->a; in PhysicsCharacteristic_Advect()
63 AdvectCtx *ctx = (AdvectCtx *)vctx; in PhysicsSample_Advect() local
64 PetscReal a = ctx->a, x0; in PhysicsSample_Advect()
108 static PetscErrorCode PhysicsCreate_Advect(FVCtx *ctx) in PhysicsCreate_Advect() argument
114 ctx->physics2.sample2 = PhysicsSample_Advect; in PhysicsCreate_Advect()
115 ctx->physics2.riemann2 = PhysicsRiemann_Advect; in PhysicsCreate_Advect()
116 ctx->physics2.characteristic2 = PhysicsCharacteristic_Advect; in PhysicsCreate_Advect()
117 ctx->physics2.destroy = PhysicsDestroy_SimpleFree; in PhysicsCreate_Advect()
118 ctx->physics2.user = user; in PhysicsCreate_Advect()
119 ctx->physics2.dof = 1; in PhysicsCreate_Advect()
120 PetscCall(PetscStrallocpy("u", &ctx->physics2.fieldname[0])); in PhysicsCreate_Advect()
122 PetscOptionsBegin(ctx->comm, ctx->prefix, "Options for advection", ""); in PhysicsCreate_Advect()
130 PetscErrorCode FVSample_2WaySplit(FVCtx *ctx, DM da, PetscReal time, Vec U) in FVSample_2WaySplit() argument
138 …PetscCheck(ctx->physics2.sample2, PETSC_COMM_SELF, PETSC_ERR_SUP, "Physics has not provided a samp… in FVSample_2WaySplit()
143 hs = (ctx->xmax - ctx->xmin) * 3.0 / 8.0 / ctx->sf; in FVSample_2WaySplit()
144 hf = (ctx->xmax - ctx->xmin) / 4.0 / (ctx->fs - ctx->sf); in FVSample_2WaySplit()
146 if (i < ctx->sf) { in FVSample_2WaySplit()
147 xi = ctx->xmin + 0.5 * hs + i * hs; in FVSample_2WaySplit()
152 …PetscCall((*ctx->physics2.sample2)(ctx->physics2.user, ctx->initial, ctx->bctype, ctx->xmin, ctx->… in FVSample_2WaySplit()
155 } else if (i < ctx->fs) { in FVSample_2WaySplit()
156 xi = ctx->xmin + ctx->sf * hs + 0.5 * hf + (i - ctx->sf) * hf; in FVSample_2WaySplit()
161 …PetscCall((*ctx->physics2.sample2)(ctx->physics2.user, ctx->initial, ctx->bctype, ctx->xmin, ctx->… in FVSample_2WaySplit()
165 xi = ctx->xmin + ctx->sf * hs + (ctx->fs - ctx->sf) * hf + 0.5 * hs + (i - ctx->fs) * hs; in FVSample_2WaySplit()
170 …PetscCall((*ctx->physics2.sample2)(ctx->physics2.user, ctx->initial, ctx->bctype, ctx->xmin, ctx->… in FVSample_2WaySplit()
180 static PetscErrorCode SolutionErrorNorms_2WaySplit(FVCtx *ctx, DM da, PetscReal t, Vec X, PetscReal… in SolutionErrorNorms_2WaySplit() argument
190 PetscCall(FVSample_2WaySplit(ctx, da, t, Y)); in SolutionErrorNorms_2WaySplit()
191 hs = (ctx->xmax - ctx->xmin) * 3.0 / 8.0 / ctx->sf; in SolutionErrorNorms_2WaySplit()
192 hf = (ctx->xmax - ctx->xmin) / 4.0 / (ctx->fs - ctx->sf); in SolutionErrorNorms_2WaySplit()
196 if (i < ctx->sf || i > ctx->fs - 1) *nrm1 += hs * PetscAbs(ptr_X[i] - ptr_Y[i]); in SolutionErrorNorms_2WaySplit()
207 FVCtx *ctx = (FVCtx *)vctx; in FVRHSFunction_2WaySplit() local
208 PetscInt i, j, k, Mx, dof, xs, xm, sf = ctx->sf, fs = ctx->fs; in FVRHSFunction_2WaySplit()
218 hxs = (ctx->xmax - ctx->xmin) * 3.0 / 8.0 / ctx->sf; in FVRHSFunction_2WaySplit()
219 hxf = (ctx->xmax - ctx->xmin) / 4.0 / (ctx->fs - ctx->sf); in FVRHSFunction_2WaySplit()
231 if (ctx->bctype == FVBC_OUTFLOW) { in FVRHSFunction_2WaySplit()
243 …PetscCall((*ctx->physics2.characteristic2)(ctx->physics2.user, dof, &x[i * dof], ctx->R, ctx->Rinv… in FVRHSFunction_2WaySplit()
245 PetscCall(PetscArrayzero(ctx->cjmpLR, 2 * dof)); in FVRHSFunction_2WaySplit()
246 cjmpL = &ctx->cjmpLR[0]; in FVRHSFunction_2WaySplit()
247 cjmpR = &ctx->cjmpLR[dof]; in FVRHSFunction_2WaySplit()
253 cjmpL[k] += ctx->Rinv[k + j * dof] * jmpL; in FVRHSFunction_2WaySplit()
254 cjmpR[k] += ctx->Rinv[k + j * dof] * jmpR; in FVRHSFunction_2WaySplit()
261 (*ctx->limit2)(&info, cjmpL, cjmpR, ctx->sf, ctx->fs, i, ctx->cslope); in FVRHSFunction_2WaySplit()
264 for (k = 0; k < dof; k++) tmp += ctx->R[j + k * dof] * ctx->cslope[k]; in FVRHSFunction_2WaySplit()
272 uL = &ctx->uLR[0]; in FVRHSFunction_2WaySplit()
273 uR = &ctx->uLR[dof]; in FVRHSFunction_2WaySplit()
279 PetscCall((*ctx->physics2.riemann2)(ctx->physics2.user, dof, uL, uR, ctx->flux, &maxspeed)); in FVRHSFunction_2WaySplit()
281 for (j = 0; j < dof; j++) f[(i - 1) * dof + j] -= ctx->flux[j] / hxs; in FVRHSFunction_2WaySplit()
284 for (j = 0; j < dof; j++) f[i * dof + j] += ctx->flux[j] / hxs; in FVRHSFunction_2WaySplit()
291 PetscCall((*ctx->physics2.riemann2)(ctx->physics2.user, dof, uL, uR, ctx->flux, &maxspeed)); in FVRHSFunction_2WaySplit()
293 for (j = 0; j < dof; j++) f[(i - 1) * dof + j] -= ctx->flux[j] / hxs; in FVRHSFunction_2WaySplit()
296 for (j = 0; j < dof; j++) f[i * dof + j] += ctx->flux[j] / hxf; in FVRHSFunction_2WaySplit()
303 PetscCall((*ctx->physics2.riemann2)(ctx->physics2.user, dof, uL, uR, ctx->flux, &maxspeed)); in FVRHSFunction_2WaySplit()
305 for (j = 0; j < dof; j++) f[(i - 1) * dof + j] -= ctx->flux[j] / hxf; in FVRHSFunction_2WaySplit()
308 for (j = 0; j < dof; j++) f[i * dof + j] += ctx->flux[j] / hxf; in FVRHSFunction_2WaySplit()
315 PetscCall((*ctx->physics2.riemann2)(ctx->physics2.user, dof, uL, uR, ctx->flux, &maxspeed)); in FVRHSFunction_2WaySplit()
317 for (j = 0; j < dof; j++) f[(i - 1) * dof + j] -= ctx->flux[j] / hxf; in FVRHSFunction_2WaySplit()
320 for (j = 0; j < dof; j++) f[i * dof + j] += ctx->flux[j] / hxs; in FVRHSFunction_2WaySplit()
327 PetscCall((*ctx->physics2.riemann2)(ctx->physics2.user, dof, uL, uR, ctx->flux, &maxspeed)); in FVRHSFunction_2WaySplit()
330 for (j = 0; j < dof; j++) f[(i - 1) * dof + j] -= ctx->flux[j] / hxs; in FVRHSFunction_2WaySplit()
333 for (j = 0; j < dof; j++) f[i * dof + j] += ctx->flux[j] / hxs; in FVRHSFunction_2WaySplit()
341 …PetscCallMPI(MPIU_Allreduce(&cfl_idt, &ctx->cfl_idt, 1, MPIU_SCALAR, MPIU_MAX, PetscObjectComm((Pe… in FVRHSFunction_2WaySplit()
347 if (dt > 0.5 / ctx->cfl_idt) { in FVRHSFunction_2WaySplit()
348 …tscCall(PetscPrintf(ctx->comm, "Stability constraint exceeded at t=%g, dt %g > %g\n", (double)tnow… in FVRHSFunction_2WaySplit()
349 …OWN_TYPE, "Stability constraint exceeded, %g > %g", (double)dt, (double)(ctx->cfl / ctx->cfl_idt)); in FVRHSFunction_2WaySplit()
358 FVCtx *ctx = (FVCtx *)vctx; in FVRHSFunctionslow_2WaySplit() local
359 … i, j, k, Mx, dof, xs, xm, islow = 0, sf = ctx->sf, fs = ctx->fs, lsbwidth = ctx->lsbwidth, rsbw… in FVRHSFunctionslow_2WaySplit()
369 hxs = (ctx->xmax - ctx->xmin) * 3.0 / 8.0 / ctx->sf; in FVRHSFunctionslow_2WaySplit()
370 hxf = (ctx->xmax - ctx->xmin) / 4.0 / (ctx->fs - ctx->sf); in FVRHSFunctionslow_2WaySplit()
379 if (ctx->bctype == FVBC_OUTFLOW) { in FVRHSFunctionslow_2WaySplit()
392 …PetscCall((*ctx->physics2.characteristic2)(ctx->physics2.user, dof, &x[i * dof], ctx->R, ctx->Rinv… in FVRHSFunctionslow_2WaySplit()
394 PetscCall(PetscArrayzero(ctx->cjmpLR, 2 * dof)); in FVRHSFunctionslow_2WaySplit()
395 cjmpL = &ctx->cjmpLR[0]; in FVRHSFunctionslow_2WaySplit()
396 cjmpR = &ctx->cjmpLR[dof]; in FVRHSFunctionslow_2WaySplit()
402 cjmpL[k] += ctx->Rinv[k + j * dof] * jmpL; in FVRHSFunctionslow_2WaySplit()
403 cjmpR[k] += ctx->Rinv[k + j * dof] * jmpR; in FVRHSFunctionslow_2WaySplit()
410 (*ctx->limit2)(&info, cjmpL, cjmpR, ctx->sf, ctx->fs, i, ctx->cslope); in FVRHSFunctionslow_2WaySplit()
413 for (k = 0; k < dof; k++) tmp += ctx->R[j + k * dof] * ctx->cslope[k]; in FVRHSFunctionslow_2WaySplit()
422 uL = &ctx->uLR[0]; in FVRHSFunctionslow_2WaySplit()
423 uR = &ctx->uLR[dof]; in FVRHSFunctionslow_2WaySplit()
429 PetscCall((*ctx->physics2.riemann2)(ctx->physics2.user, dof, uL, uR, ctx->flux, &maxspeed)); in FVRHSFunctionslow_2WaySplit()
432 for (j = 0; j < dof; j++) f[(islow - 1) * dof + j] -= ctx->flux[j] / hxs; in FVRHSFunctionslow_2WaySplit()
435 for (j = 0; j < dof; j++) f[islow * dof + j] += ctx->flux[j] / hxs; in FVRHSFunctionslow_2WaySplit()
444 PetscCall((*ctx->physics2.riemann2)(ctx->physics2.user, dof, uL, uR, ctx->flux, &maxspeed)); in FVRHSFunctionslow_2WaySplit()
446 for (j = 0; j < dof; j++) f[(islow - 1) * dof + j] -= ctx->flux[j] / hxs; in FVRHSFunctionslow_2WaySplit()
454 PetscCall((*ctx->physics2.riemann2)(ctx->physics2.user, dof, uL, uR, ctx->flux, &maxspeed)); in FVRHSFunctionslow_2WaySplit()
456 for (j = 0; j < dof; j++) f[islow * dof + j] += ctx->flux[j] / hxs; in FVRHSFunctionslow_2WaySplit()
465 PetscCall((*ctx->physics2.riemann2)(ctx->physics2.user, dof, uL, uR, ctx->flux, &maxspeed)); in FVRHSFunctionslow_2WaySplit()
467 for (j = 0; j < dof; j++) f[(islow - 1) * dof + j] -= ctx->flux[j] / hxs; in FVRHSFunctionslow_2WaySplit()
470 for (j = 0; j < dof; j++) f[islow * dof + j] += ctx->flux[j] / hxs; in FVRHSFunctionslow_2WaySplit()
479 …PetscCallMPI(MPIU_Allreduce(&cfl_idt, &ctx->cfl_idt, 1, MPIU_SCALAR, MPIU_MAX, PetscObjectComm((Pe… in FVRHSFunctionslow_2WaySplit()
485 FVCtx *ctx = (FVCtx *)vctx; in FVRHSFunctionslowbuffer_2WaySplit() local
486 … i, j, k, Mx, dof, xs, xm, islow = 0, sf = ctx->sf, fs = ctx->fs, lsbwidth = ctx->lsbwidth, rsbw… in FVRHSFunctionslowbuffer_2WaySplit()
496 hxs = (ctx->xmax - ctx->xmin) * 3.0 / 8.0 / ctx->sf; in FVRHSFunctionslowbuffer_2WaySplit()
497 hxf = (ctx->xmax - ctx->xmin) / 4.0 / (ctx->fs - ctx->sf); in FVRHSFunctionslowbuffer_2WaySplit()
506 if (ctx->bctype == FVBC_OUTFLOW) { in FVRHSFunctionslowbuffer_2WaySplit()
519 …PetscCall((*ctx->physics2.characteristic2)(ctx->physics2.user, dof, &x[i * dof], ctx->R, ctx->Rinv… in FVRHSFunctionslowbuffer_2WaySplit()
521 PetscCall(PetscArrayzero(ctx->cjmpLR, 2 * dof)); in FVRHSFunctionslowbuffer_2WaySplit()
522 cjmpL = &ctx->cjmpLR[0]; in FVRHSFunctionslowbuffer_2WaySplit()
523 cjmpR = &ctx->cjmpLR[dof]; in FVRHSFunctionslowbuffer_2WaySplit()
529 cjmpL[k] += ctx->Rinv[k + j * dof] * jmpL; in FVRHSFunctionslowbuffer_2WaySplit()
530 cjmpR[k] += ctx->Rinv[k + j * dof] * jmpR; in FVRHSFunctionslowbuffer_2WaySplit()
537 (*ctx->limit2)(&info, cjmpL, cjmpR, ctx->sf, ctx->fs, i, ctx->cslope); in FVRHSFunctionslowbuffer_2WaySplit()
540 for (k = 0; k < dof; k++) tmp += ctx->R[j + k * dof] * ctx->cslope[k]; in FVRHSFunctionslowbuffer_2WaySplit()
549 uL = &ctx->uLR[0]; in FVRHSFunctionslowbuffer_2WaySplit()
550 uR = &ctx->uLR[dof]; in FVRHSFunctionslowbuffer_2WaySplit()
556 PetscCall((*ctx->physics2.riemann2)(ctx->physics2.user, dof, uL, uR, ctx->flux, &maxspeed)); in FVRHSFunctionslowbuffer_2WaySplit()
558 for (j = 0; j < dof; j++) f[islow * dof + j] += ctx->flux[j] / hxs; in FVRHSFunctionslowbuffer_2WaySplit()
567 PetscCall((*ctx->physics2.riemann2)(ctx->physics2.user, dof, uL, uR, ctx->flux, &maxspeed)); in FVRHSFunctionslowbuffer_2WaySplit()
569 for (j = 0; j < dof; j++) f[(islow - 1) * dof + j] -= ctx->flux[j] / hxs; in FVRHSFunctionslowbuffer_2WaySplit()
572 for (j = 0; j < dof; j++) f[islow * dof + j] += ctx->flux[j] / hxs; in FVRHSFunctionslowbuffer_2WaySplit()
581 PetscCall((*ctx->physics2.riemann2)(ctx->physics2.user, dof, uL, uR, ctx->flux, &maxspeed)); in FVRHSFunctionslowbuffer_2WaySplit()
583 for (j = 0; j < dof; j++) f[(islow - 1) * dof + j] -= ctx->flux[j] / hxs; in FVRHSFunctionslowbuffer_2WaySplit()
591 PetscCall((*ctx->physics2.riemann2)(ctx->physics2.user, dof, uL, uR, ctx->flux, &maxspeed)); in FVRHSFunctionslowbuffer_2WaySplit()
593 for (j = 0; j < dof; j++) f[islow * dof + j] += ctx->flux[j] / hxs; in FVRHSFunctionslowbuffer_2WaySplit()
602 PetscCall((*ctx->physics2.riemann2)(ctx->physics2.user, dof, uL, uR, ctx->flux, &maxspeed)); in FVRHSFunctionslowbuffer_2WaySplit()
604 for (j = 0; j < dof; j++) f[(islow - 1) * dof + j] -= ctx->flux[j] / hxs; in FVRHSFunctionslowbuffer_2WaySplit()
607 for (j = 0; j < dof; j++) f[islow * dof + j] += ctx->flux[j] / hxs; in FVRHSFunctionslowbuffer_2WaySplit()
616 PetscCall((*ctx->physics2.riemann2)(ctx->physics2.user, dof, uL, uR, ctx->flux, &maxspeed)); in FVRHSFunctionslowbuffer_2WaySplit()
618 for (j = 0; j < dof; j++) f[(islow - 1) * dof + j] -= ctx->flux[j] / hxs; in FVRHSFunctionslowbuffer_2WaySplit()
632 FVCtx *ctx = (FVCtx *)vctx; in FVRHSFunctionfast_2WaySplit() local
633 PetscInt i, j, k, Mx, dof, xs, xm, ifast = 0, sf = ctx->sf, fs = ctx->fs; in FVRHSFunctionfast_2WaySplit()
643 hxs = (ctx->xmax - ctx->xmin) * 3.0 / 8.0 / ctx->sf; in FVRHSFunctionfast_2WaySplit()
644 hxf = (ctx->xmax - ctx->xmin) / 4.0 / (ctx->fs - ctx->sf); in FVRHSFunctionfast_2WaySplit()
653 if (ctx->bctype == FVBC_OUTFLOW) { in FVRHSFunctionfast_2WaySplit()
665 …PetscCall((*ctx->physics2.characteristic2)(ctx->physics2.user, dof, &x[i * dof], ctx->R, ctx->Rinv… in FVRHSFunctionfast_2WaySplit()
666 PetscCall(PetscArrayzero(ctx->cjmpLR, 2 * dof)); in FVRHSFunctionfast_2WaySplit()
667 cjmpL = &ctx->cjmpLR[0]; in FVRHSFunctionfast_2WaySplit()
668 cjmpR = &ctx->cjmpLR[dof]; in FVRHSFunctionfast_2WaySplit()
674 cjmpL[k] += ctx->Rinv[k + j * dof] * jmpL; in FVRHSFunctionfast_2WaySplit()
675 cjmpR[k] += ctx->Rinv[k + j * dof] * jmpR; in FVRHSFunctionfast_2WaySplit()
682 (*ctx->limit2)(&info, cjmpL, cjmpR, ctx->sf, ctx->fs, i, ctx->cslope); in FVRHSFunctionfast_2WaySplit()
685 for (k = 0; k < dof; k++) tmp += ctx->R[j + k * dof] * ctx->cslope[k]; in FVRHSFunctionfast_2WaySplit()
694 uL = &ctx->uLR[0]; in FVRHSFunctionfast_2WaySplit()
695 uR = &ctx->uLR[dof]; in FVRHSFunctionfast_2WaySplit()
701 PetscCall((*ctx->physics2.riemann2)(ctx->physics2.user, dof, uL, uR, ctx->flux, &maxspeed)); in FVRHSFunctionfast_2WaySplit()
703 for (j = 0; j < dof; j++) f[ifast * dof + j] += ctx->flux[j] / hxf; in FVRHSFunctionfast_2WaySplit()
712 PetscCall((*ctx->physics2.riemann2)(ctx->physics2.user, dof, uL, uR, ctx->flux, &maxspeed)); in FVRHSFunctionfast_2WaySplit()
714 for (j = 0; j < dof; j++) f[(ifast - 1) * dof + j] -= ctx->flux[j] / hxf; in FVRHSFunctionfast_2WaySplit()
717 for (j = 0; j < dof; j++) f[ifast * dof + j] += ctx->flux[j] / hxf; in FVRHSFunctionfast_2WaySplit()
726 PetscCall((*ctx->physics2.riemann2)(ctx->physics2.user, dof, uL, uR, ctx->flux, &maxspeed)); in FVRHSFunctionfast_2WaySplit()
728 for (j = 0; j < dof; j++) f[(ifast - 1) * dof + j] -= ctx->flux[j] / hxf; in FVRHSFunctionfast_2WaySplit()
747 FVCtx ctx; in main() local
755 PetscCall(PetscMemzero(&ctx, sizeof(ctx))); in main()
770 ctx.comm = comm; in main()
771 ctx.cfl = 0.9; in main()
772 ctx.bctype = FVBC_PERIODIC; in main()
773 ctx.xmin = -1.0; in main()
774 ctx.xmax = 1.0; in main()
776 PetscCall(PetscOptionsReal("-xmin", "X min", "", ctx.xmin, &ctx.xmin, NULL)); in main()
777 PetscCall(PetscOptionsReal("-xmax", "X max", "", ctx.xmax, &ctx.xmax, NULL)); in main()
781 …nsInt("-initial", "Initial condition (depends on the physics)", "", ctx.initial, &ctx.initial, NUL… in main()
782 …PetscCall(PetscOptionsBool("-exact", "Compare errors with exact solution", "", ctx.exact, &ctx.exa… in main()
783 …Bool("-simulation", "Compare errors with reference solution", "", ctx.simulation, &ctx.simulation,… in main()
784 PetscCall(PetscOptionsReal("-cfl", "CFL number to time step at", "", ctx.cfl, &ctx.cfl, NULL)); in main()
785 …m("-bc_type", "Boundary condition", "", FVBCTypes, (PetscEnum)ctx.bctype, (PetscEnum *)&ctx.bctype… in main()
786 PetscCall(PetscOptionsInt("-hratio", "Spacing ratio", "", ctx.hratio, &ctx.hratio, NULL)); in main()
790 PetscCall(PetscFunctionListFind(limiters, lname, &ctx.limit2)); in main()
791 …PetscCheck(ctx.limit2, PETSC_COMM_SELF, PETSC_ERR_ARG_UNKNOWN_TYPE, "Limiter '%s' not found", lnam… in main()
799 PetscCall((*r)(&ctx)); in main()
803 PetscCall(DMDACreate1d(comm, DM_BOUNDARY_PERIODIC, 50, ctx.physics2.dof, 2, NULL, &da)); in main()
808 …for (i = 0; i < ctx.physics2.dof; i++) PetscCall(DMDASetFieldName(da, i, ctx.physics2.fieldname[i]… in main()
813 …tscCall(DMDASetUniformCoordinates(da, ctx.xmin + 0.5 * (ctx.xmax - ctx.xmin) / Mx, ctx.xmax + 0.5 … in main()
816 …PetscCall(PetscMalloc4(dof * dof, &ctx.R, dof * dof, &ctx.Rinv, 2 * dof, &ctx.cjmpLR, 1 * dof, &ct… in main()
817 PetscCall(PetscMalloc3(2 * dof, &ctx.uLR, dof, &ctx.flux, dof, &ctx.speeds)); in main()
826 count_slow = Mx / (1.0 + ctx.hratio / 3.0); in main()
829 ctx.sf = count_slow / 2; in main()
830 ctx.fs = ctx.sf + count_fast; in main()
834 if (((AdvectCtx *)ctx.physics2.user)->a > 0) { in main()
835 ctx.lsbwidth = 2; in main()
836 ctx.rsbwidth = 4; in main()
838 ctx.lsbwidth = 4; in main()
839 ctx.rsbwidth = 2; in main()
842 if (i < ctx.sf - ctx.lsbwidth || i > ctx.fs + ctx.rsbwidth - 1) in main()
844 …else if ((i >= ctx.sf - ctx.lsbwidth && i < ctx.sf) || (i > ctx.fs - 1 && i <= ctx.fs + ctx.rsbwid… in main()
849 PetscCall(ISCreateGeneral(PETSC_COMM_WORLD, islow, index_slow, PETSC_COPY_VALUES, &ctx.iss)); in main()
850 PetscCall(ISCreateGeneral(PETSC_COMM_WORLD, ifast, index_fast, PETSC_COPY_VALUES, &ctx.isf)); in main()
851 …ll(ISCreateGeneral(PETSC_COMM_WORLD, islowbuffer, index_slowbuffer, PETSC_COPY_VALUES, &ctx.issb)); in main()
856 PetscCall(TSSetRHSFunction(ts, R, FVRHSFunction_2WaySplit, &ctx)); in main()
857 PetscCall(TSRHSSplitSetIS(ts, "slow", ctx.iss)); in main()
858 PetscCall(TSRHSSplitSetIS(ts, "slowbuffer", ctx.issb)); in main()
859 PetscCall(TSRHSSplitSetIS(ts, "fast", ctx.isf)); in main()
860 PetscCall(TSRHSSplitSetRHSFunction(ts, "slow", NULL, FVRHSFunctionslow_2WaySplit, &ctx)); in main()
861 PetscCall(TSRHSSplitSetRHSFunction(ts, "fast", NULL, FVRHSFunctionfast_2WaySplit, &ctx)); in main()
862 …tscCall(TSRHSSplitSetRHSFunction(ts, "slowbuffer", NULL, FVRHSFunctionslowbuffer_2WaySplit, &ctx)); in main()
870 PetscCall(FVSample_2WaySplit(&ctx, da, 0, X0)); in main()
871 …PetscCall(FVRHSFunction_2WaySplit(ts, 0, X0, X, (void *)&ctx)); /* Initial function evaluation, on… in main()
873 PetscCall(TSSetTimeStep(ts, ctx.cfl / ctx.cfl_idt)); in main()
880 const PetscReal hs = (ctx.xmax - ctx.xmin) * 3.0 / 4.0 / count_slow; in main()
881 const PetscReal hf = (ctx.xmax - ctx.xmin) / 4.0 / count_fast; in main()
892 if (i < ctx.sf || i > ctx.fs - 1) { in main()
910 …(PetscPrintf(comm, "Maximum allowable stepsize according to CFL %g\n", (double)(1 / ctx.cfl_idt))); in main()
911 if (ctx.exact) { in main()
913 PetscCall(SolutionErrorNorms_2WaySplit(&ctx, da, ptime, X, &nrm1)); in main()
916 if (ctx.simulation) { in main()
932 if (i < ctx.sf || i > ctx.fs - 1) in main()
950 PetscCall(FVSample_2WaySplit(&ctx, da, ptime, Y)); in main()
966 PetscCall((*ctx.physics2.destroy)(ctx.physics2.user)); in main()
967 for (i = 0; i < ctx.physics2.dof; i++) PetscCall(PetscFree(ctx.physics2.fieldname[i])); in main()
968 PetscCall(PetscFree4(ctx.R, ctx.Rinv, ctx.cjmpLR, ctx.cslope)); in main()
969 PetscCall(PetscFree3(ctx.uLR, ctx.flux, ctx.speeds)); in main()
975 PetscCall(ISDestroy(&ctx.iss)); in main()
976 PetscCall(ISDestroy(&ctx.isf)); in main()
977 PetscCall(ISDestroy(&ctx.issb)); in main()