Actual source code: ex4.c
1: static char help[] = "Testing integrators on the simple harmonic oscillator\n";
3: /*
4: In order to check long time behavior, you can give
6: -ts_max_steps 10000 -ts_max_time 10.0 -output_step 1000
8: To look at the long time behavior for different integrators, we can use the nergy monitor. Below we see that Euler is almost 100 times worse at conserving energy than the symplectic integrator of the same order.
10: make -f ./gmakefile test search="dm_impls_swarm_tests-ex4_bsi_1"
11: EXTRA_OPTIONS="-ts_max_steps 10000 -ts_max_time 10.0 -output_step 1000 -ts_type euler" | grep error
13: energy/exact energy 398.236 / 396.608 (0.4104399231)
14: energy/exact energy 1579.52 / 1573.06 (0.4104399231)
15: energy/exact energy 397.421 / 396.608 (0.2050098479)
16: energy/exact energy 1576.29 / 1573.06 (0.2050098479)
17: energy/exact energy 397.014 / 396.608 (0.1024524454)
18: energy/exact energy 1574.68 / 1573.06 (0.1024524454)
20: make -f ./gmakefile test search="dm_impls_swarm_tests-ex4_bsi_1"
21: EXTRA_OPTIONS="-ts_max_steps 10000 -ts_max_time 10.0 -output_step 1000" | grep error
23: energy/exact energy 396.579 / 396.608 (0.0074080434)
24: energy/exact energy 1572.95 / 1573.06 (0.0074080434)
25: energy/exact energy 396.593 / 396.608 (0.0037040885)
26: energy/exact energy 1573.01 / 1573.06 (0.0037040886)
27: energy/exact energy 396.601 / 396.608 (0.0018520613)
28: energy/exact energy 1573.04 / 1573.06 (0.0018520613)
30: We can look at third order integrators in the same way, but we need to use more steps.
32: make -f ./gmakefile test search="dm_impls_swarm_tests-ex4_bsi_1"
33: EXTRA_OPTIONS="-ts_max_steps 1000000 -ts_max_time 1000.0 -output_step 100000 -ts_type rk -ts_adapt_type none" | grep error
35: energy/exact energy 396.608 / 396.608 (0.0000013981)
36: energy/exact energy 1573.06 / 1573.06 (0.0000013981)
37: energy/exact energy 396.608 / 396.608 (0.0000001747)
38: energy/exact energy 1573.06 / 1573.06 (0.0000001748)
39: energy/exact energy 396.608 / 396.608 (0.0000000218)
40: energy/exact energy 1573.06 / 1573.06 (0.0000000218)
42: make -f ./gmakefile test search="dm_impls_swarm_tests-ex4_bsi_3"
43: EXTRA_OPTIONS="-ts_max_steps 1000000 -ts_max_time 1000.0 -output_step 100000 -ts_adapt_type none" | grep error
45: energy/exact energy 396.608 / 396.608 (0.0000000007)
46: energy/exact energy 1573.06 / 1573.06 (0.0000000007)
47: energy/exact energy 396.608 / 396.608 (0.0000000001)
48: energy/exact energy 1573.06 / 1573.06 (0.0000000001)
49: energy/exact energy 396.608 / 396.608 (0.0000000000)
50: energy/exact energy 1573.06 / 1573.06 (0.0000000000)
51: */
53: #include <petscts.h>
54: #include <petscdmplex.h>
55: #include <petscdmswarm.h>
56: #include <petsc/private/dmpleximpl.h>
58: typedef struct {
59: PetscReal omega; /* Oscillation frequency omega */
60: PetscBool error; /* Flag for printing the error */
61: PetscInt ostep; /* print the energy at each ostep time steps */
62: } AppCtx;
64: static PetscErrorCode ProcessOptions(MPI_Comm comm, AppCtx *options)
65: {
67: options->omega = 64.0;
68: options->error = PETSC_FALSE;
69: options->ostep = 100;
71: PetscOptionsBegin(comm, "", "Harmonic Oscillator Options", "DMSWARM");
72: PetscOptionsReal("-omega", "Oscillator frequency", "ex4.c", options->omega, &options->omega, PETSC_NULL);
73: PetscOptionsBool("-error", "Flag to print the error", "ex4.c", options->error, &options->error, NULL);
74: PetscOptionsInt("-output_step", "Number of time steps between output", "ex4.c", options->ostep, &options->ostep, PETSC_NULL);
75: PetscOptionsEnd();
76: return 0;
77: }
79: static PetscErrorCode CreateMesh(MPI_Comm comm, AppCtx *user, DM *dm)
80: {
82: DMCreate(comm, dm);
83: DMSetType(*dm, DMPLEX);
84: DMSetFromOptions(*dm);
85: DMViewFromOptions(*dm, NULL, "-dm_view");
86: return 0;
87: }
89: static PetscErrorCode CreateSwarm(DM dm, AppCtx *user, DM *sw)
90: {
91: PetscReal v0[1] = {0.}; // Initialize velocities to 0
92: PetscInt dim;
95: DMGetDimension(dm, &dim);
96: DMCreate(PetscObjectComm((PetscObject)dm), sw);
97: DMSetType(*sw, DMSWARM);
98: DMSetDimension(*sw, dim);
99: DMSwarmSetType(*sw, DMSWARM_PIC);
100: DMSwarmSetCellDM(*sw, dm);
101: DMSwarmRegisterPetscDatatypeField(*sw, "w_q", 1, PETSC_SCALAR);
102: DMSwarmRegisterPetscDatatypeField(*sw, "velocity", dim, PETSC_REAL);
103: DMSwarmRegisterPetscDatatypeField(*sw, "species", 1, PETSC_INT);
104: DMSwarmRegisterPetscDatatypeField(*sw, "initCoordinates", dim, PETSC_REAL);
105: DMSwarmFinalizeFieldRegister(*sw);
106: DMSwarmComputeLocalSizeFromOptions(*sw);
107: DMSwarmInitializeCoordinates(*sw);
108: DMSwarmInitializeVelocitiesFromOptions(*sw, v0);
109: DMSetFromOptions(*sw);
110: DMSetApplicationContext(*sw, user);
111: PetscObjectSetName((PetscObject)*sw, "Particles");
112: DMViewFromOptions(*sw, NULL, "-sw_view");
113: {
114: Vec gc, gc0;
116: DMSwarmCreateGlobalVectorFromField(*sw, DMSwarmPICField_coor, &gc);
117: DMSwarmCreateGlobalVectorFromField(*sw, "initCoordinates", &gc0);
118: VecCopy(gc, gc0);
119: DMSwarmDestroyGlobalVectorFromField(*sw, DMSwarmPICField_coor, &gc);
120: DMSwarmDestroyGlobalVectorFromField(*sw, "initCoordinates", &gc0);
121: }
122: return 0;
123: }
125: static PetscErrorCode RHSFunction(TS ts, PetscReal t, Vec U, Vec G, void *ctx)
126: {
127: const PetscReal omega = ((AppCtx *)ctx)->omega;
128: DM sw;
129: const PetscScalar *u;
130: PetscScalar *g;
131: PetscInt dim, d, Np, p;
134: TSGetDM(ts, &sw);
135: DMGetDimension(sw, &dim);
136: VecGetLocalSize(U, &Np);
137: VecGetArray(G, &g);
138: VecGetArrayRead(U, &u);
139: Np /= 2 * dim;
140: for (p = 0; p < Np; ++p) {
141: for (d = 0; d < dim; ++d) {
142: g[(p * 2 + 0) * dim + d] = u[(p * 2 + 1) * dim + d];
143: g[(p * 2 + 1) * dim + d] = -PetscSqr(omega) * u[(p * 2 + 0) * dim + d];
144: }
145: }
146: VecRestoreArrayRead(U, &u);
147: VecRestoreArray(G, &g);
148: return 0;
149: }
151: /* J_{ij} = dF_i/dx_j
152: J_p = ( 0 1)
153: (-w^2 0)
154: */
155: static PetscErrorCode RHSJacobian(TS ts, PetscReal t, Vec U, Mat J, Mat P, void *ctx)
156: {
157: PetscScalar vals[4] = {0., 1., -PetscSqr(((AppCtx *)ctx)->omega), 0.};
158: DM sw;
159: PetscInt dim, d, Np, p, rStart;
162: TSGetDM(ts, &sw);
163: DMGetDimension(sw, &dim);
164: VecGetLocalSize(U, &Np);
165: MatGetOwnershipRange(J, &rStart, NULL);
166: Np /= 2 * dim;
167: for (p = 0; p < Np; ++p) {
168: for (d = 0; d < dim; ++d) {
169: const PetscInt rows[2] = {(p * 2 + 0) * dim + d + rStart, (p * 2 + 1) * dim + d + rStart};
170: MatSetValues(J, 2, rows, 2, rows, vals, INSERT_VALUES);
171: }
172: }
173: MatAssemblyBegin(J, MAT_FINAL_ASSEMBLY);
174: MatAssemblyEnd(J, MAT_FINAL_ASSEMBLY);
175: return 0;
176: }
178: static PetscErrorCode RHSFunctionX(TS ts, PetscReal t, Vec V, Vec Xres, void *ctx)
179: {
180: const PetscScalar *v;
181: PetscScalar *xres;
182: PetscInt Np, p;
185: VecGetLocalSize(Xres, &Np);
186: VecGetArrayRead(V, &v);
187: VecGetArray(Xres, &xres);
188: for (p = 0; p < Np; ++p) xres[p] = v[p];
189: VecRestoreArrayRead(V, &v);
190: VecRestoreArray(Xres, &xres);
191: return 0;
192: }
194: static PetscErrorCode RHSFunctionV(TS ts, PetscReal t, Vec X, Vec Vres, void *ctx)
195: {
196: const PetscReal omega = ((AppCtx *)ctx)->omega;
197: const PetscScalar *x;
198: PetscScalar *vres;
199: PetscInt Np, p;
202: VecGetArray(Vres, &vres);
203: VecGetArrayRead(X, &x);
204: VecGetLocalSize(Vres, &Np);
205: for (p = 0; p < Np; ++p) vres[p] = -PetscSqr(omega) * x[p];
206: VecRestoreArrayRead(X, &x);
207: VecRestoreArray(Vres, &vres);
208: return 0;
209: }
211: PetscErrorCode RHSJacobianS(TS ts, PetscReal t, Vec U, Mat S, void *ctx)
212: {
213: PetscScalar vals[4] = {0., 1., -1., 0.};
214: DM sw;
215: PetscInt dim, d, Np, p, rStart;
218: TSGetDM(ts, &sw);
219: DMGetDimension(sw, &dim);
220: VecGetLocalSize(U, &Np);
221: MatGetOwnershipRange(S, &rStart, NULL);
222: Np /= 2 * dim;
223: for (p = 0; p < Np; ++p) {
224: for (d = 0; d < dim; ++d) {
225: const PetscInt rows[2] = {(p * 2 + 0) * dim + d + rStart, (p * 2 + 1) * dim + d + rStart};
226: MatSetValues(S, 2, rows, 2, rows, vals, INSERT_VALUES);
227: }
228: }
229: MatAssemblyBegin(S, MAT_FINAL_ASSEMBLY);
230: MatAssemblyEnd(S, MAT_FINAL_ASSEMBLY);
231: return 0;
232: }
234: PetscErrorCode RHSObjectiveF(TS ts, PetscReal t, Vec U, PetscScalar *F, void *ctx)
235: {
236: const PetscReal omega = ((AppCtx *)ctx)->omega;
237: DM sw;
238: const PetscScalar *u;
239: PetscInt dim, Np, p;
242: TSGetDM(ts, &sw);
243: DMGetDimension(sw, &dim);
244: VecGetArrayRead(U, &u);
245: VecGetLocalSize(U, &Np);
246: Np /= 2 * dim;
247: for (p = 0; p < Np; ++p) {
248: const PetscReal x2 = DMPlex_DotRealD_Internal(dim, &u[(p * 2 + 0) * dim], &u[(p * 2 + 0) * dim]);
249: const PetscReal v2 = DMPlex_DotRealD_Internal(dim, &u[(p * 2 + 1) * dim], &u[(p * 2 + 1) * dim]);
250: const PetscReal E = 0.5 * (v2 + PetscSqr(omega) * x2);
252: *F += E;
253: }
254: VecRestoreArrayRead(U, &u);
255: return 0;
256: }
258: /* dF/dx = omega^2 x dF/dv = v */
259: PetscErrorCode RHSFunctionG(TS ts, PetscReal t, Vec U, Vec G, void *ctx)
260: {
261: const PetscReal omega = ((AppCtx *)ctx)->omega;
262: DM sw;
263: const PetscScalar *u;
264: PetscScalar *g;
265: PetscInt dim, d, Np, p;
268: TSGetDM(ts, &sw);
269: DMGetDimension(sw, &dim);
270: VecGetArray(G, &g);
271: VecGetArrayRead(U, &u);
272: VecGetLocalSize(U, &Np);
273: Np /= 2 * dim;
274: for (p = 0; p < Np; ++p) {
275: for (d = 0; d < dim; ++d) {
276: g[(p * 2 + 0) * dim + d] = PetscSqr(omega) * u[(p * 2 + 0) * dim + d];
277: g[(p * 2 + 1) * dim + d] = u[(p * 2 + 1) * dim + d];
278: }
279: }
280: VecRestoreArrayRead(U, &u);
281: VecRestoreArray(G, &g);
282: return 0;
283: }
285: static PetscErrorCode CreateSolution(TS ts)
286: {
287: DM sw;
288: Vec u;
289: PetscInt dim, Np;
291: TSGetDM(ts, &sw);
292: DMGetDimension(sw, &dim);
293: DMSwarmGetLocalSize(sw, &Np);
294: VecCreate(PETSC_COMM_WORLD, &u);
295: VecSetBlockSize(u, dim);
296: VecSetSizes(u, 2 * Np * dim, PETSC_DECIDE);
297: VecSetUp(u);
298: TSSetSolution(ts, u);
299: VecDestroy(&u);
300: return 0;
301: }
303: static PetscErrorCode SetProblem(TS ts)
304: {
305: AppCtx *user;
306: DM sw;
308: TSGetDM(ts, &sw);
309: DMGetApplicationContext(sw, (void **)&user);
310: // Define unified system for (X, V)
311: {
312: Mat J;
313: PetscInt dim, Np;
315: DMGetDimension(sw, &dim);
316: DMSwarmGetLocalSize(sw, &Np);
317: MatCreate(PETSC_COMM_WORLD, &J);
318: MatSetSizes(J, 2 * Np * dim, 2 * Np * dim, PETSC_DECIDE, PETSC_DECIDE);
319: MatSetBlockSize(J, 2 * dim);
320: MatSetFromOptions(J);
321: MatSetUp(J);
322: TSSetRHSFunction(ts, NULL, RHSFunction, user);
323: TSSetRHSJacobian(ts, J, J, RHSJacobian, user);
324: MatDestroy(&J);
325: }
326: // Define split system for X and V
327: {
328: IS isx, isv, istmp;
329: const PetscInt *idx;
330: PetscInt dim, Np;
332: DMGetDimension(sw, &dim);
333: DMSwarmGetLocalSize(sw, &Np);
334: ISCreateStride(PETSC_COMM_SELF, Np, 0, 2, &istmp);
335: ISGetIndices(istmp, &idx);
336: ISCreateBlock(PETSC_COMM_SELF, dim, Np, idx, PETSC_COPY_VALUES, &isx);
337: ISRestoreIndices(istmp, &idx);
338: ISDestroy(&istmp);
339: ISCreateStride(PETSC_COMM_SELF, Np, 1, 2, &istmp);
340: ISGetIndices(istmp, &idx);
341: ISCreateBlock(PETSC_COMM_SELF, dim, Np, idx, PETSC_COPY_VALUES, &isv);
342: ISRestoreIndices(istmp, &idx);
343: ISDestroy(&istmp);
344: TSRHSSplitSetIS(ts, "position", isx);
345: TSRHSSplitSetIS(ts, "momentum", isv);
346: ISDestroy(&isx);
347: ISDestroy(&isv);
348: TSRHSSplitSetRHSFunction(ts, "position", NULL, RHSFunctionX, user);
349: TSRHSSplitSetRHSFunction(ts, "momentum", NULL, RHSFunctionV, user);
350: }
351: // Define symplectic formulation U_t = S . G, where G = grad F
352: {
353: TSDiscGradSetFormulation(ts, RHSJacobianS, RHSObjectiveF, RHSFunctionG, user);
354: }
355: return 0;
356: }
358: static PetscErrorCode InitializeSolve(TS ts, Vec u)
359: {
360: DM sw;
361: Vec gc, gc0;
362: IS isx, isv;
363: AppCtx *user;
366: TSGetDM(ts, &sw);
367: DMGetApplicationContext(sw, &user);
368: {
369: PetscReal v0[1] = {1.};
371: DMSwarmInitializeCoordinates(sw);
372: DMSwarmInitializeVelocitiesFromOptions(sw, v0);
373: SetProblem(ts);
374: }
375: TSRHSSplitGetIS(ts, "position", &isx);
376: TSRHSSplitGetIS(ts, "momentum", &isv);
377: DMSwarmCreateGlobalVectorFromField(sw, DMSwarmPICField_coor, &gc);
378: DMSwarmCreateGlobalVectorFromField(sw, "initCoordinates", &gc0);
379: VecCopy(gc, gc0);
380: VecISCopy(u, isx, SCATTER_FORWARD, gc);
381: DMSwarmDestroyGlobalVectorFromField(sw, DMSwarmPICField_coor, &gc);
382: DMSwarmDestroyGlobalVectorFromField(sw, "initCoordinates", &gc0);
383: VecISSet(u, isv, 0.);
384: return 0;
385: }
387: static PetscErrorCode ComputeError(TS ts, Vec U, Vec E)
388: {
389: MPI_Comm comm;
390: DM sw;
391: AppCtx *user;
392: const PetscScalar *u;
393: const PetscReal *coords;
394: PetscScalar *e;
395: PetscReal t;
396: PetscInt dim, d, Np, p;
399: PetscObjectGetComm((PetscObject)ts, &comm);
400: TSGetDM(ts, &sw);
401: DMGetApplicationContext(sw, &user);
402: DMGetDimension(sw, &dim);
403: TSGetSolveTime(ts, &t);
404: VecGetArray(E, &e);
405: VecGetArrayRead(U, &u);
406: VecGetLocalSize(U, &Np);
407: DMSwarmGetField(sw, "initCoordinates", NULL, NULL, (void **)&coords);
408: Np /= 2 * dim;
409: for (p = 0; p < Np; ++p) {
410: const PetscReal omega = user->omega;
411: const PetscReal ct = PetscCosReal(omega * t);
412: const PetscReal st = PetscSinReal(omega * t);
413: const PetscReal x0 = DMPlex_NormD_Internal(dim, &coords[p * dim]);
414: const PetscReal ex = x0 * ct;
415: const PetscReal ev = -x0 * omega * st;
416: const PetscReal x = DMPlex_DotRealD_Internal(dim, &u[(p * 2 + 0) * dim], &coords[p * dim]) / x0;
417: const PetscReal v = DMPlex_DotRealD_Internal(dim, &u[(p * 2 + 1) * dim], &coords[p * dim]) / x0;
419: if (user->error) {
420: const PetscReal en = 0.5 * (v * v + PetscSqr(omega) * x * x);
421: const PetscReal exen = 0.5 * PetscSqr(omega * x0);
422: PetscPrintf(comm, "p%" PetscInt_FMT " error [%.2g %.2g] sol [%.6lf %.6lf] exact [%.6lf %.6lf] energy/exact energy %g / %g (%.10lf%%)\n", p, (double)PetscAbsReal(x - ex), (double)PetscAbsReal(v - ev), (double)x, (double)v, (double)ex, (double)ev, (double)en, (double)exen, (double)(PetscAbsReal(exen - en) * 100. / exen));
423: }
424: for (d = 0; d < dim; ++d) {
425: e[(p * 2 + 0) * dim + d] = u[(p * 2 + 0) * dim + d] - coords[p * dim + d] * ct;
426: e[(p * 2 + 1) * dim + d] = u[(p * 2 + 1) * dim + d] + coords[p * dim + d] * omega * st;
427: }
428: }
429: DMSwarmRestoreField(sw, "initCoordinates", NULL, NULL, (void **)&coords);
430: VecRestoreArrayRead(U, &u);
431: VecRestoreArray(E, &e);
432: return 0;
433: }
435: static PetscErrorCode EnergyMonitor(TS ts, PetscInt step, PetscReal t, Vec U, void *ctx)
436: {
437: const PetscReal omega = ((AppCtx *)ctx)->omega;
438: const PetscInt ostep = ((AppCtx *)ctx)->ostep;
439: DM sw;
440: const PetscScalar *u;
441: PetscReal dt;
442: PetscInt dim, Np, p;
443: MPI_Comm comm;
446: if (step % ostep == 0) {
447: PetscObjectGetComm((PetscObject)ts, &comm);
448: TSGetDM(ts, &sw);
449: TSGetTimeStep(ts, &dt);
450: DMGetDimension(sw, &dim);
451: VecGetArrayRead(U, &u);
452: VecGetLocalSize(U, &Np);
453: Np /= 2 * dim;
454: if (!step) PetscPrintf(comm, "Time Step Part Energy Mod Energy\n");
455: for (p = 0; p < Np; ++p) {
456: const PetscReal x2 = DMPlex_DotRealD_Internal(dim, &u[(p * 2 + 0) * dim], &u[(p * 2 + 0) * dim]);
457: const PetscReal v2 = DMPlex_DotRealD_Internal(dim, &u[(p * 2 + 1) * dim], &u[(p * 2 + 1) * dim]);
458: const PetscReal E = 0.5 * (v2 + PetscSqr(omega) * x2);
459: const PetscReal mE = 0.5 * (v2 + PetscSqr(omega) * x2 - PetscSqr(omega) * dt * PetscSqrtReal(x2 * v2));
461: PetscPrintf(comm, "%.6lf %4" PetscInt_FMT " %4" PetscInt_FMT " %10.4lf %10.4lf\n", (double)t, step, p, (double)E, (double)mE);
462: }
463: VecRestoreArrayRead(U, &u);
464: }
465: return 0;
466: }
468: int main(int argc, char **argv)
469: {
470: DM dm, sw;
471: TS ts;
472: Vec u;
473: AppCtx user;
476: PetscInitialize(&argc, &argv, NULL, help);
477: ProcessOptions(PETSC_COMM_WORLD, &user);
478: CreateMesh(PETSC_COMM_WORLD, &user, &dm);
479: CreateSwarm(dm, &user, &sw);
480: DMSetApplicationContext(sw, &user);
482: TSCreate(PETSC_COMM_WORLD, &ts);
483: TSSetProblemType(ts, TS_NONLINEAR);
484: TSSetDM(ts, sw);
485: TSSetMaxTime(ts, 0.1);
486: TSSetTimeStep(ts, 0.00001);
487: TSSetMaxSteps(ts, 100);
488: TSSetExactFinalTime(ts, TS_EXACTFINALTIME_MATCHSTEP);
489: TSMonitorSet(ts, EnergyMonitor, &user, NULL);
490: TSSetFromOptions(ts);
491: TSSetComputeInitialCondition(ts, InitializeSolve);
492: TSSetComputeExactError(ts, ComputeError);
494: CreateSolution(ts);
495: TSGetSolution(ts, &u);
496: TSComputeInitialCondition(ts, u);
497: TSSolve(ts, NULL);
499: TSDestroy(&ts);
500: DMDestroy(&sw);
501: DMDestroy(&dm);
502: PetscFinalize();
503: return 0;
504: }
506: /*TEST
508: build:
509: requires: triangle !single !complex
511: testset:
512: args: -dm_plex_dim 1 -dm_plex_box_faces 1 -dm_plex_box_lower -1 -dm_plex_box_upper 1 \
513: -dm_swarm_num_particles 2 -dm_swarm_coordinate_density constant \
514: -ts_type basicsymplectic -ts_convergence_estimate -convest_num_refine 2 \
515: -dm_view -output_step 50 -error
516: test:
517: suffix: bsi_1
518: args: -ts_basicsymplectic_type 1
519: test:
520: suffix: bsi_2
521: args: -ts_basicsymplectic_type 2
522: test:
523: suffix: bsi_3
524: args: -ts_basicsymplectic_type 3
525: test:
526: suffix: bsi_4
527: args: -ts_basicsymplectic_type 4 -ts_dt 0.0001
529: testset:
530: args: -dm_plex_dim 2 -dm_plex_simplex 0 -dm_plex_box_faces 1,1 -dm_plex_box_lower -1,-1 -dm_plex_box_upper 1,1 \
531: -dm_swarm_num_particles 2 -dm_swarm_coordinate_density constant \
532: -ts_type basicsymplectic -ts_convergence_estimate -convest_num_refine 2 \
533: -dm_view -output_step 50 -error
534: test:
535: suffix: bsi_2d_1
536: args: -ts_basicsymplectic_type 1
537: test:
538: suffix: bsi_2d_2
539: args: -ts_basicsymplectic_type 2
540: test:
541: suffix: bsi_2d_3
542: args: -ts_basicsymplectic_type 3
543: test:
544: suffix: bsi_2d_4
545: args: -ts_basicsymplectic_type 4 -ts_dt 0.0001
547: testset:
548: args: -dm_plex_dim 3 -dm_plex_simplex 0 -dm_plex_box_faces 1,1 -dm_plex_box_lower -1,-1,-1 -dm_plex_box_upper 1,1,1 \
549: -dm_swarm_num_particles 2 -dm_swarm_coordinate_density constant \
550: -ts_type basicsymplectic -ts_convergence_estimate -convest_num_refine 2 \
551: -dm_view -output_step 50 -error
552: test:
553: suffix: bsi_3d_1
554: args: -ts_basicsymplectic_type 1
555: test:
556: suffix: bsi_3d_2
557: args: -ts_basicsymplectic_type 2
558: test:
559: suffix: bsi_3d_3
560: args: -ts_basicsymplectic_type 3
561: test:
562: suffix: bsi_3d_4
563: args: -ts_basicsymplectic_type 4 -ts_dt 0.0001
565: testset:
566: args: -dm_swarm_num_particles 2 -dm_swarm_coordinate_density constant \
567: -ts_type theta -ts_theta_theta 0.5 -ts_convergence_estimate -convest_num_refine 2 \
568: -mat_type baij -ksp_error_if_not_converged -pc_type lu \
569: -dm_view -output_step 50 -error
570: test:
571: suffix: im_1d
572: args: -dm_plex_dim 1 -dm_plex_box_faces 1 -dm_plex_box_lower -1 -dm_plex_box_upper 1
573: test:
574: suffix: im_2d
575: args: -dm_plex_dim 2 -dm_plex_simplex 0 -dm_plex_box_faces 1,1 -dm_plex_box_lower -1,-1 -dm_plex_box_upper 1,1
576: test:
577: suffix: im_3d
578: args: -dm_plex_dim 3 -dm_plex_simplex 0 -dm_plex_box_faces 1,1,1 -dm_plex_box_lower -1,-1,-1 -dm_plex_box_upper 1,1,1
580: testset:
581: args: -dm_swarm_num_particles 2 -dm_swarm_coordinate_density constant \
582: -ts_type discgrad -ts_discgrad_gonzalez -ts_convergence_estimate -convest_num_refine 2 \
583: -mat_type baij -ksp_error_if_not_converged -pc_type lu \
584: -dm_view -output_step 50 -error
585: test:
586: suffix: dg_1d
587: args: -dm_plex_dim 1 -dm_plex_box_faces 1 -dm_plex_box_lower -1 -dm_plex_box_upper 1
588: test:
589: suffix: dg_2d
590: args: -dm_plex_dim 2 -dm_plex_simplex 0 -dm_plex_box_faces 1,1 -dm_plex_box_lower -1,-1 -dm_plex_box_upper 1,1
591: test:
592: suffix: dg_3d
593: args: -dm_plex_dim 3 -dm_plex_simplex 0 -dm_plex_box_faces 1,1,1 -dm_plex_box_lower -1,-1,-1 -dm_plex_box_upper 1,1,1
595: TEST*/