[petsc-users] Obtaining TS rosw solver output at regular time steps
Jed Brown
jed at jedbrown.org
Thu May 22 12:57:37 CDT 2014
Fiona Reid <fiona at epcc.ed.ac.uk> writes:
> Dear PETSc Users,
>
> Can anyone advise as to how I can obtain output from the TS rosw solver
> at regular time steps, e.g. every 0.05 seconds?
>
> I'm using a very slightly modified version of the example code from
> petsc-3.4.3/src/ts/examples/tutorials/ex20.c (changes are user.mu = 1.0
> and user->next_output += 0.05). I set the initial time step to be 0.05
> via TSSetInitialTimeStep.
If you want a constant time step size, use -ts_adapt_type none. By
default, RosW uses an adaptive step size with an embedded error
estimator. Note that RosW is a multi-stage method, so you might, for
example, compare the accuracy and efficiency of
-ts_type rosw -ts_rosw_type ra34pw2 -ts_dt 0.2
to
-ts_type beuler -ts_dt 0.05
> If I use the default solver (beuler) and the -monitor option I get
> output looking like:
>
> ./ex20 -ts_type beuler -monitor | more
> [0.0] 0 TS 0.000000 (dt = 0.050000) X 2.000000e+00 0.000000e+00
> [0.1] 1 TS 0.050000 (dt = 0.050000) X 1.995658e+00 -8.683325e-02
> [0.1] 2 TS 0.100000 (dt = 0.050000) X 1.987545e+00 -1.622726e-01
> [0.2] 3 TS 0.150000 (dt = 0.050000) X 1.976146e+00 -2.279661e-01
> [0.2] 4 TS 0.200000 (dt = 0.050000) X 1.961876e+00 -2.854046e-01
> [0.2] 5 TS 0.250000 (dt = 0.050000) X 1.945081e+00 -3.359109e-01
> [0.3] 6 TS 0.300000 (dt = 0.050000) X 1.926048e+00 -3.806427e-01
> [0.3] 7 TS 0.350000 (dt = 0.050000) X 1.905018e+00 -4.206033e-01
> [0.4] 8 TS 0.400000 (dt = 0.050000) X 1.882185e+00 -4.566572e-01
> [0.4] 9 TS 0.450000 (dt = 0.050000) X 1.857708e+00 -4.895467e-01
> [0.5] 10 TS 0.500000 (dt = 0.050000) X 1.831713e+00 -5.199087e-01
>
> However if I switch to using the rosw solver instead I get:
>
> ./ex20 -ts_type rosw -monitor | more
> [0.0] 0 TS 0.000000 (dt = 0.050000) X 0.000000e+00 0.000000e+00
> [0.1] 1 TS 0.050000 (dt = 0.061949) X 1.997620e+00 -9.284729e-02
> [0.1] 2 TS 0.111949 (dt = 0.065192) X 1.990961e+00 -1.726821e-01
> [0.2] 3 TS 0.177141 (dt = 0.068763) X 1.980577e+00 -2.414006e-01
> [0.2] 4 TS 0.245904 (dt = 0.073732) X 1.966977e+00 -3.007620e-01
> [0.2] 5 TS 0.319635 (dt = 0.080204) X 1.950593e+00 -3.523419e-01
> [0.3] 5 TS 0.319635 (dt = 0.080204) X 1.931848e+00 -3.974691e-01
> [0.3] 6 TS 0.399840 (dt = 0.088357) X 1.910959e+00 -4.373211e-01
> [0.4] 7 TS 0.488197 (dt = 0.098465) X 1.888151e+00 -4.729449e-01
> [0.4] 7 TS 0.488197 (dt = 0.098465) X 1.863723e+00 -5.051196e-01
> [0.5] 8 TS 0.586663 (dt = 0.110786) X 1.837695e+00 -5.346152e-01
> [0.5] 8 TS 0.586663 (dt = 0.110786) X 1.810291e+00 -5.620222e-01
>
> Sometimes I get two different X values for the same value of TS. Ideally
> I'd like to have the output from rosw for exactly the same time values
> as beuler, e.g. every 0.05 seconds, such that it's possible to directly
> compare the two solvers.
>
> Is there a way to fix the time step in PETSc for the rosw solver such
> that I can get output every 0.05 seconds? if so how can I do this?
>
> Thank you very much in advance.
>
> Fiona
>
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140522/88869abb/attachment-0001.pgp>
More information about the petsc-users
mailing list