Mercurial > repos > public > sbplib
annotate +noname/Discretization.m @ 26:ed6a704b028d
Made some changes to error functions and comparison functions before finalizing convergence script.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 25 Sep 2015 14:54:26 +0200 |
parents | c7efff913935 |
children | 7067bf8adbfa |
rev | line source |
---|---|
0 | 1 classdef Discretization < handle |
2 properties (Abstract) | |
3 name %Short description | |
4 description %Longer description | |
5 order %Order of accuracy | |
26
ed6a704b028d
Made some changes to error functions and comparison functions before finalizing convergence script.
Jonatan Werpers <jonatan@werpers.com>
parents:
20
diff
changeset
|
6 h % scalar desciribing the grid spacing.. (IS THIS THE RIGHT PLACE FOR THIS?) |
0 | 7 end |
8 | |
9 methods (Abstract) | |
10 % Prints some info about the discretisation | |
11 printInfo() | |
12 | |
13 % Return the number of DOF | |
14 n = size(obj) | |
15 | |
16 % Returns a timestepper for integrating the discretisation in time | |
17 % method is a string that states which timestepping method should be used. | |
18 % The implementation should switch on the string and deliver | |
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. |
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
|
22 ts = getTimestepper(obj,method,k,cfl) |
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 |
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
|
26 % account. |
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. |
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
|
30 k = getTimestep(obj, method, cfl) |
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
|
31 |
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
|
32 % 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
|
33 % if ts is empty or 0 a representation of the initial conditions be returned. |
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 repr = getTimeSnapshot(obj,ts) |
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
|
35 |
0 | 36 |
37 % Sets up movie recording to a given file. | |
38 % saveFrame is a function_handle with no inputs that records the current state | |
39 % as a frame in the moive. | |
40 saveFrame = setupMov(obj, file) | |
41 | |
42 % Sets up a plot of the discretisation | |
43 % update is a function_handle accepting a timestepper that updates the plot to the | |
44 % 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
|
45 % 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
|
46 [update,hand] = setupPlot(obj, type) |
0 | 47 |
48 end | |
49 end |