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

8                      "y_dot = -0.2*x\n"
9 … "Using two event functions = piecewise-polynomials, zeros = 1 (rank-0), 9 (last rank)\n"
11 "-dir d : zero-crossing direction for events\n"
12 "-flg : additional output in Postevent\n"
13 … "-errtol e : error tolerance, for printing 'pass/fail' for located events (1e-5 by default)\n"
14 "-restart : flag for TSRestartStep() in PostEvent\n"
15 … "-dtpost x : if x > 0, then on even PostEvent calls 1st-post-event-step = x is set,\n"
16 … " on odd PostEvent calls 1st-post-event-step = PETSC_DECIDE is set,\n"
26 PetscReal evres[MAX_NEV]; // times of found zero-crossings
27 PetscReal ref[MAX_NEV]; // reference times of zero-crossings, for checking
31 …errtol; // error tolerance, for printing 'pass/fail' for located events (1e-5 by default)
33 PetscReal dtpost; // post-event step
56 ctx.pi = PetscAcosReal(-1.0); in main()
60 ctx.errtol = 1e-5; in main()
71 vals[2] = -0.2; in main()
102 …PetscCall(PetscOptionsGetInt(NULL, NULL, "-dir", &dir0, NULL)); // desired zero-crossi… in main()
103 …PetscCall(PetscOptionsHasName(NULL, NULL, "-flg", &ctx.flg)); // flag for additional… in main()
104 …PetscCall(PetscOptionsGetReal(NULL, NULL, "-errtol", &ctx.errtol, NULL)); // error tolerance for… in main()
105 …PetscCall(PetscOptionsGetBool(NULL, NULL, "-restart", &ctx.restart, NULL)); // flag for TSRestartS… in main()
106 PetscCall(PetscOptionsGetReal(NULL, NULL, "-dtpost", &ctx.dtpost, NULL)); // post-event step in main()
109 if (ctx.rank == 0) { // first event -- on rank-0 in main()
114 if (ctx.rank == ctx.size - 1) { // second event -- on last rank in main()
128 if (j < ctx.cntref) err = PetscAbsReal(ctx.evres[j] - ctx.ref[j]); in main()
142 User callback for defining the event-functions
150 // for the test purposes, event-functions are defined based on t in EventFunction()
151 // first event -- on rank-0 in EventFunction()
152 if (Ctx->rank == 0) { in EventFunction()
153 if (t < 2.0) gval[n++] = 0.5 * (1 - PetscPowReal(t - 2.0, 12)); in EventFunction()
157 // second event -- on last rank in EventFunction()
158 if (Ctx->rank == Ctx->size - 1) { in EventFunction()
159 if (t > 8.0) gval[n++] = 0.25 * (1 - PetscPowReal(t - 8.0, 12)); in EventFunction()
166 User callback for the post-event stuff
173 if (Ctx->flg) { in Postevent()
174 PetscCallBack("EventFunction", EventFunction(ts, t, U, Ctx->fvals, ctx)); in Postevent()
175 …, "[%d] At t = %20.16g : %" PetscInt_FMT " events triggered, fvalues =", Ctx->rank, (double)t, nev… in Postevent()
176 …j++) PetscCall(PetscSynchronizedPrintf(PETSC_COMM_WORLD, "\t%g", (double)Ctx->fvals[evs_zero[j]])); in Postevent()
181 if (Ctx->cnt + nev_zero < MAX_NEV) in Postevent()
182 …for (PetscInt i = 0; i < nev_zero; i++) Ctx->evres[Ctx->cnt++] = t; // save the repeating zeros se… in Postevent()
185 Ctx->postcnt++; // sync in Postevent()
186 if (Ctx->dtpost > 0) { in Postevent()
187 if (Ctx->postcnt % 2 == 0) PetscCall(TSSetPostEventStep(ts, Ctx->dtpost)); in Postevent()
192 if (Ctx->restart) PetscCall(TSRestartStep(ts)); in Postevent()
195 /*---------------------------------------------------------------------------------------------*/
197 Note, in the tests below, -ts_event_post_event_step is occasionally set to -1,
199 explicitly specify -1 in this option. Rather, if PETSC_DECIDE behaviour is needed,
203 /*TEST
204 test:
208 args: -dir 0
209 args: -restart 0
210 args: -dtpost 0.25
211 args: -ts_event_post_event_step {{-1 0.31}}
212 args: -ts_type {{beuler rk}}
213 args: -ts_adapt_type {{none basic}}
216 test:
220 args: -dir 0
221 args: -restart 1
222 args: -dtpost {{0 0.25}}
223 args: -ts_event_post_event_step -1
224 args: -ts_type {{beuler rk}}
225 args: -ts_adapt_type {{none basic}}
230 test:
234 args: -dir 1
235 args: -restart {{0 1}}
236 args: -dtpost 0
237 args: -ts_event_post_event_step 0.31005
238 args: -ts_type rk
239 args: -ts_adapt_type {{none basic}}
244 test:
248 args: -dir -1
249 args: -restart 0
250 args: -dtpost 0.25
251 args: -ts_event_post_event_step {{-1 0.305}}
252 args: -ts_type {{beuler rk}}
253 args: -ts_adapt_type {{none basic}}
256 test:
260 args: -dir -1
261 args: -restart 1
262 args: -dtpost {{0 0.25}}
263 args: -ts_event_post_event_step -1
264 args: -ts_type {{beuler rk}}
265 args: -ts_adapt_type {{none basic}}
270 test:
274 args: -dir 0 -ts_event_dt_min 1e-6 -errtol 5e-5
275 args: -restart {{0 1}}
276 args: -dtpost 0
277 args: -ts_event_post_event_step 0.31
278 args: -ts_type {{beuler rk}}
279 args: -ts_adapt_type {{none basic}}
282 test:
286 args: -dir 0 -ts_event_dt_min 1e-6 -errtol 5e-5
287 args: -restart 0
288 args: -dtpost 0.25
289 args: -ts_event_post_event_step {{-1 0.315}}
290 args: -ts_type {{beuler rk}}
291 args: -ts_adapt_type {{none basic}}
296 test:
300 args: -dir 1 -ts_event_dt_min 1e-6 -errtol 5e-5
301 args: -restart 1
302 args: -dtpost {{0 0.25}}
303 args: -ts_event_post_event_step -1
304 args: -ts_type {{beuler rk}}
305 args: -ts_adapt_type basic
310 test:
314 args: -dir -1 -ts_event_dt_min 1e-6 -errtol 5e-5
315 args: -restart {{0 1}}
316 args: -dtpost 0
317 args: -ts_event_post_event_step 0.30501
318 args: -ts_type {{beuler rk}}
319 args: -ts_adapt_type {{none basic}}
322 test:
326 args: -dir -1 -ts_event_dt_min 1e-6 -errtol 5e-5
327 args: -restart 0
328 args: -dtpost 0.25
329 args: -ts_event_post_event_step {{-1 0.31}}
330 args: -ts_type {{beuler rk}}
331 args: -ts_adapt_type {{none basic}}
335 TEST*/