annotate +noname/Discretization.m @ 87:0a29a60e0b21

In Curve: Rearranged for speed. arc_length_fun is now a property of Curve. If it is not supplied, it is computed via the derivative and spline fitting. Switching to the arc length parameterization is much faster now. The new stuff can be tested with testArcLength.m (which should be deleted after that).
author Martin Almquist <martin.almquist@it.uu.se>
date Sun, 29 Nov 2015 22:23:09 +0100
parents 14bf01b7a068
children ceba6be0389f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
1 classdef Discretization < handle
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
2 properties (Abstract)
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
3 name %Short description
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
4 description %Longer description
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
5 order %Order of accuracy
64
7067bf8adbfa Fixed some typing and added function to plot eigen values of a matrix.
Jonatan Werpers <jonatan@werpers.com>
parents: 26
diff changeset
6 % h % scalar desciribing the grid spacing.. (IS THIS THE RIGHT PLACE FOR THIS?)
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
7 end
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
8
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
9 methods (Abstract)
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
10 % Prints some info about the discretisation
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
11 printInfo()
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
12
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
13 % Return the number of DOF
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
14 n = size(obj)
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
15
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
16 % Returns a timestepper for integrating the discretisation in time
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
17 % method is a string that states which timestepping method should be used.
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
18 % The implementation should switch on the string and deliver
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
19 % the appropriate timestepper. It should also provide a default value.
15
16bad7c459da Added abstract methods to allow for comparing of solutions. Added a bunch of error functions.
Jonatan Werpers <jonatan@werpers.com>
parents: 2
diff changeset
20 % k is a desired timestep
16bad7c459da Added abstract methods to allow for comparing of solutions. Added a bunch of error functions.
Jonatan Werpers <jonatan@werpers.com>
parents: 2
diff changeset
21 % cfl is a choses cfl constant used to set the timestep. ignored if k is set.
64
7067bf8adbfa Fixed some typing and added function to plot eigen values of a matrix.
Jonatan Werpers <jonatan@werpers.com>
parents: 26
diff changeset
22 ts = getTimestepper(obj, method, k, cfl)
15
16bad7c459da Added abstract methods to allow for comparing of solutions. Added a bunch of error functions.
Jonatan Werpers <jonatan@werpers.com>
parents: 2
diff changeset
23
16bad7c459da Added abstract methods to allow for comparing of solutions. Added a bunch of error functions.
Jonatan Werpers <jonatan@werpers.com>
parents: 2
diff changeset
24 % Calculates a timestep for the discretization and a given timestepping method.
16bad7c459da Added abstract methods to allow for comparing of solutions. Added a bunch of error functions.
Jonatan Werpers <jonatan@werpers.com>
parents: 2
diff changeset
25 % Can take order, differnt types of scaling in h, or other parameters in Discr into
80
14bf01b7a068 Changed noname.animate and noname.Discretization to use a opt struct for timestepper options.
Jonatan Werpers <jonatan@werpers.com>
parents: 64
diff changeset
26 % account. opt is a struct that among other things may contain
15
16bad7c459da Added abstract methods to allow for comparing of solutions. Added a bunch of error functions.
Jonatan Werpers <jonatan@werpers.com>
parents: 2
diff changeset
27 % method -- time stepping method for which to give a timestep.
16bad7c459da Added abstract methods to allow for comparing of solutions. Added a bunch of error functions.
Jonatan Werpers <jonatan@werpers.com>
parents: 2
diff changeset
28 % cfl -- [optioanal] a cfl constant to use to calculate the timetep.
16bad7c459da Added abstract methods to allow for comparing of solutions. Added a bunch of error functions.
Jonatan Werpers <jonatan@werpers.com>
parents: 2
diff changeset
29 % if skipped getTimestep should use a precomputed value.
80
14bf01b7a068 Changed noname.animate and noname.Discretization to use a opt struct for timestepper options.
Jonatan Werpers <jonatan@werpers.com>
parents: 64
diff changeset
30 % k -- timestep to use
14bf01b7a068 Changed noname.animate and noname.Discretization to use a opt struct for timestepper options.
Jonatan Werpers <jonatan@werpers.com>
parents: 64
diff changeset
31 k = getTimestep(obj, opt)
15
16bad7c459da Added abstract methods to allow for comparing of solutions. Added a bunch of error functions.
Jonatan Werpers <jonatan@werpers.com>
parents: 2
diff changeset
32
20
c7efff913935 Decoupled plotting and timesteppers. Added possibility of different plot_types. Added functions for printing and plotting solution file content.
Jonatan Werpers <jonatan@werpers.com>
parents: 15
diff changeset
33 % getTimeSnapshot returns a struct which represents the solution in ts at current time.
c7efff913935 Decoupled plotting and timesteppers. Added possibility of different plot_types. Added functions for printing and plotting solution file content.
Jonatan Werpers <jonatan@werpers.com>
parents: 15
diff changeset
34 % if ts is empty or 0 a representation of the initial conditions be returned.
64
7067bf8adbfa Fixed some typing and added function to plot eigen values of a matrix.
Jonatan Werpers <jonatan@werpers.com>
parents: 26
diff changeset
35 repr = getTimeSnapshot(obj, ts)
20
c7efff913935 Decoupled plotting and timesteppers. Added possibility of different plot_types. Added functions for printing and plotting solution file content.
Jonatan Werpers <jonatan@werpers.com>
parents: 15
diff changeset
36
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
37
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
38 % Sets up movie recording to a given file.
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
39 % saveFrame is a function_handle with no inputs that records the current state
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
40 % as a frame in the moive.
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
41 saveFrame = setupMov(obj, file)
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
42
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
43 % Sets up a plot of the discretisation
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
44 % update is a function_handle accepting a timestepper that updates the plot to the
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
45 % state of the timestepper
20
c7efff913935 Decoupled plotting and timesteppers. Added possibility of different plot_types. Added functions for printing and plotting solution file content.
Jonatan Werpers <jonatan@werpers.com>
parents: 15
diff changeset
46 % type allows for different kinds of plots. Some special values are used by the lib. 'animate' and 'plot' for example
c7efff913935 Decoupled plotting and timesteppers. Added possibility of different plot_types. Added functions for printing and plotting solution file content.
Jonatan Werpers <jonatan@werpers.com>
parents: 15
diff changeset
47 [update,hand] = setupPlot(obj, type)
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
48
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
49 end
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
50 end