Lines Matching +full:test +full:- +full:basic

8                      "y_dot = -0.2*x\n"
11 … "- two polynomial event functions on rank-0 and last-rank (with zeros: 1.05, 9.05[terminating])\n"
12 … "- one event function on rank = '1%size', equal to V*sin(pi*t), zeros = 1,...,10\n"
16 "-dir d : zero-crossing direction for events: 0, 1, -1\n"
17 "-flg : additional output in Postevent\n"
18 … "-errtol e : error tolerance, for printing 'pass/fail' for located events (1e-5 by default)\n"
19 "-restart : flag for TSRestartStep() in PostEvent\n"
20 … "-dtpost x : if x > 0, then on even PostEvent calls 1st-post-event-step = x is set,\n"
21 … " on odd PostEvent calls 1st-post-event-step = PETSC_DECIDE is set,\n"
23 …"-v {float}: scaling of the sin() event function; for small v this event is triggered by the funct…
25 "-change5 : flag to change the state vector at t=5 PostEvent\n";
34 PetscReal evres[MAX_NEV]; // times of found zero-crossings
35 PetscReal ref[MAX_NEV]; // reference times of zero-crossings, for checking
39 …errtol; // error tolerance, for printing 'pass/fail' for located events (1e-5 by default)
41 PetscReal dtpost; // post-event step
57 PetscReal tol = 1e-7; in main()
69 ctx.pi = PetscAcosReal(-1.0); in main()
73 ctx.errtol = 1e-5; in main()
86 vals[2] = -0.2; in main()
117 …PetscCall(PetscOptionsGetInt(NULL, NULL, "-dir", &dir0, NULL)); // desired zero-crossi… in main()
118 …PetscCall(PetscOptionsHasName(NULL, NULL, "-flg", &ctx.flg)); // flag for additional… in main()
119 …PetscCall(PetscOptionsGetReal(NULL, NULL, "-errtol", &ctx.errtol, NULL)); // error tolerance for… in main()
120 …PetscCall(PetscOptionsGetBool(NULL, NULL, "-restart", &ctx.restart, NULL)); // flag for TSRestartS… in main()
121 PetscCall(PetscOptionsGetReal(NULL, NULL, "-dtpost", &ctx.dtpost, NULL)); // post-event step in main()
122 PetscCall(PetscOptionsGetReal(NULL, NULL, "-v", &ctx.V, NULL)); in main()
123 …PetscCall(PetscOptionsGetBool(NULL, NULL, "-change5", &ctx.change5, NULL)); // flag to change the … in main()
126 if (ctx.rank == 0) { // first event -- on rank-0 in main()
132 if (ctx.rank == ctx.size - 1) { // second event (with termination) -- on last rank in main()
138 if (ctx.rank == 1 % ctx.size) { // third event -- on rank = 1%ctx.size in main()
143 for (PetscInt i = 1; i < MAX_NEV - 2; i++) { in main()
160 if (j < ctx.cntref) err = PetscAbsReal(ctx.evres[j] - ctx.ref[j]); in main()
174 User callback for defining the event-functions
182 // for the test purposes, event-functions are defined based on t in EventFunction()
183 // first event -- on rank-0 in EventFunction()
184 if (Ctx->rank == 0) { in EventFunction()
185 if (t < 2.05) gval[n++] = 0.5 * (1 - PetscPowReal(t - 2.05, 12)); in EventFunction()
189 // second event -- on last rank in EventFunction()
190 if (Ctx->rank == Ctx->size - 1) { in EventFunction()
191 if (t > 8.05) gval[n++] = 0.25 * (1 - PetscPowReal(t - 8.05, 12)); in EventFunction()
195 // third event -- on rank = 1%ctx.size in EventFunction()
196 if (Ctx->rank == 1 % Ctx->size) gval[n++] = Ctx->V * PetscSinReal(Ctx->pi * t); in EventFunction()
201 User callback for the post-event stuff
210 if (Ctx->flg) { in Postevent()
211 PetscCallBack("EventFunction", EventFunction(ts, t, U, Ctx->fvals, ctx)); in Postevent()
212 …, "[%d] At t = %20.16g : %" PetscInt_FMT " events triggered, fvalues =", Ctx->rank, (double)t, nev… in Postevent()
213 …j++) PetscCall(PetscSynchronizedPrintf(PETSC_COMM_WORLD, "\t%g", (double)Ctx->fvals[evs_zero[j]])); in Postevent()
219 if (PetscAbsReal(t - (PetscReal)5.0) < 0.01 && Ctx->change5) { in Postevent()
221 if (Ctx->rank == 0) x[1] = -x[1]; in Postevent()
226 if (Ctx->rank == 0) n++; // first event -- on rank-0 in Postevent()
227 if (Ctx->rank == Ctx->size - 1) n++; // second event -- on last rank in Postevent()
228 if (Ctx->rank == 1 % Ctx->size) { // third event -- on rank = 1%ctx.size in Postevent()
229 …if (Ctx->flg) PetscCall(PetscPrintf(PETSC_COMM_SELF, "vtol for sin: %g -> ", (double)Ctx->vtol[n])… in Postevent()
230 Ctx->vtol[n] *= 4; in Postevent()
231 if (PetscAbsReal(t - (PetscReal)5.0) < 0.01) Ctx->vtol[n] /= 100; // one-off decrease in Postevent()
232 if (Ctx->flg) PetscCall(PetscPrintf(PETSC_COMM_SELF, "%g\n", (double)Ctx->vtol[n])); in Postevent()
235 PetscCall(TSSetEventTolerances(ts, 0, Ctx->vtol)); in Postevent()
237 if (Ctx->cnt + nev_zero < MAX_NEV) in Postevent()
238 …for (PetscInt i = 0; i < nev_zero; i++) Ctx->evres[Ctx->cnt++] = t; // save the repeating zeros se… in Postevent()
241 Ctx->postcnt++; // sync in Postevent()
242 if (Ctx->dtpost > 0) { in Postevent()
243 if (Ctx->postcnt % 2 == 0) PetscCall(TSSetPostEventStep(ts, Ctx->dtpost)); in Postevent()
248 if (Ctx->restart) PetscCall(TSRestartStep(ts)); in Postevent()
251 /*---------------------------------------------------------------------------------------------*/
253 Note, in the tests below, -ts_event_post_event_step is occasionally set to -1,
255 explicitly specify -1 in this option. Rather, if PETSC_DECIDE behaviour is needed,
259 /*TEST
260 test:
263 args: -ts_type beuler
264 args: -ts_adapt_type basic
265 args: -v {{1e2 1e5 1e8}}
266 args: -ts_adapt_dt_min 1e-6
267 args: -change5 {{0 1}}
270 test:
273 args: -dir 0
274 args: -v 1e5
275 args: -ts_adapt_dt_min 1e-6
276 args: -restart 1
277 args: -dtpost 0.24
278 args: -ts_event_post_event_step 0.31
279 args: -ts_type {{beuler rk}}
280 args: -ts_adapt_type {{none basic}}
283 test:
286 args: -dir 0
287 args: -v 1e5
288 args: -ts_adapt_dt_min 1e-6
289 args: -restart 1
290 args: -dtpost 0
291 args: -ts_event_post_event_step {{-1 0.31}}
292 args: -ts_type rk
293 args: -ts_adapt_type {{none basic}}
298 test:
301 args: -dir 0
302 args: -v 1e5
303 args: -ts_adapt_dt_min 1e-6
304 args: -restart {{0 1}}
305 args: -dtpost 0.24
306 args: -ts_event_post_event_step 0.21
307 args: -ts_type beuler
308 args: -ts_adapt_type {{none basic}}
313 test:
316 args: -dir 1
317 args: -v 1e5
318 args: -ts_adapt_dt_min 1e-6
319 args: -restart 0
320 args: -dtpost 0.24
321 args: -ts_type {{beuler rk}}
322 args: -ts_adapt_type {{none basic}}
325 test:
328 args: -dir 1
329 args: -v 1e5
330 args: -ts_adapt_dt_min 1e-6
331 args: -restart 1
332 args: -dtpost {{0 0.24}}
333 args: -ts_type rk
334 args: -ts_adapt_type {{none basic}}
339 test:
342 args: -dir 1
343 args: -v 1e9
344 args: -ts_adapt_dt_min 1e-6
345 args: -restart 0
346 args: -dtpost 0
347 args: -ts_event_post_event_step {{-1 0.32}}
348 args: -ts_type beuler
349 args: -ts_adapt_type {{none basic}}
350 args: -change5 1
355 test:
358 args: -dir -1
359 args: -v 1e5
360 args: -ts_adapt_dt_min 1e-6
361 args: -restart 1
362 args: -dtpost {{0 0.24}}
363 args: -ts_type {{beuler rk}}
364 args: -ts_adapt_type basic
367 test:
370 args: -dir -1
371 args: -v 1e5
372 args: -ts_adapt_dt_min 1e-6
373 args: -restart 0
374 args: -dtpost {{0 0.24}}
375 args: -ts_type rk
376 args: -ts_adapt_type {{none basic}}
381 test:
384 args: -dir -1
385 args: -v 1e5
386 args: -ts_adapt_dt_min 1e-6
387 args: -restart 0
388 args: -dtpost {{0 0.24}}
389 args: -ts_event_post_event_step 0.3
390 args: -ts_type beuler
391 args: -ts_adapt_type {{none basic}}
395 TEST*/