annotate +noname/Discretization.m @ 1031:2ef20d00b386 feature/advectionRV

For easier comparison, return both the first order and residual viscosity when evaluating the residual. Add the first order and residual viscosity to the state of the RungekuttaRV time steppers
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Thu, 17 Jan 2019 10:25:06 +0100
parents 484b48e95c83
children
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.
142
484b48e95c83 Removed ylim from setup1dPlot added some comments and fixed timestepper paramters.
Jonatan Werpers <jonatan@werpers.com>
parents: 121
diff changeset
22 ts = getTimestepper(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
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 % Sets up a plot of the discretisation
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
38 % 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
39 % 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
40 % 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
41 [update,hand] = setupPlot(obj, type)
0
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
42
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
43 end
48b6fb693025 Initial commit.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
44 end