Mercurial > repos > public > sbplib
changeset 15:16bad7c459da
Added abstract methods to allow for comparing of solutions. Added a bunch of error functions.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 22 Sep 2015 13:36:45 +0200 |
parents | a66aefd5e6ac |
children | f7975c054bc3 |
files | +noname/Discretization.m +scheme/Scheme.m +scheme/error1d.m +scheme/error2d.m +scheme/errorMax.m +scheme/errorSbp.m +scheme/errorVector.m |
diffstat | 7 files changed, 34 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/+noname/Discretization.m Tue Sep 22 09:46:20 2015 +0200 +++ b/+noname/Discretization.m Tue Sep 22 13:36:45 2015 +0200 @@ -16,9 +16,18 @@ % method is a string that states which timestepping method should be used. % The implementation should switch on the string and deliver % the appropriate timestepper. It should also provide a default value. - % time_align is a time that the timesteps should align with so that for some - % integer number of timesteps we end up exactly on time_align - ts = getTimestepper(obj,method,time_align,cfl) %% ??? + % k is a desired timestep + % cfl is a choses cfl constant used to set the timestep. ignored if k is set. + ts = getTimestepper(obj,method,k,cfl) + + % Calculates a timestep for the discretization and a given timestepping method. + % Can take order, differnt types of scaling in h, or other parameters in Discr into + % account. + % method -- time stepping method for which to give a timestep. + % cfl -- [optioanal] a cfl constant to use to calculate the timetep. + % if skipped getTimestep should use a precomputed value. + k = getTimestep(obj, method, cfl) + % Sets up movie recording to a given file. % saveFrame is a function_handle with no inputs that records the current state
--- a/+scheme/Scheme.m Tue Sep 22 09:46:20 2015 +0200 +++ b/+scheme/Scheme.m Tue Sep 22 13:36:45 2015 +0200 @@ -28,9 +28,9 @@ m = interface(obj,boundary,neighbour_scheme,neighbour_boundary) N = size(obj) % Returns the number of degrees of freedom. - + e = compareSolution(obj, p,v, p_ref, v_ref, errorFunction) % Use ismemeber(p,p_ref,'rows') and vector2cell() for winning + e = compareSolutionAnalytical(obj, p, v, v_ref, errorFunction) - % Static function to calculate the coupling of two domains with an interface ??? end methods(Static)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/+scheme/error1d.m Tue Sep 22 13:36:45 2015 +0200 @@ -0,0 +1,4 @@ +function e = error1d(schm, v1, v2) + h = schm.h; + e = sqrt(h*sum((v1-v2).^2)); +end \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/+scheme/error2d.m Tue Sep 22 13:36:45 2015 +0200 @@ -0,0 +1,5 @@ +function e = error2d(schm, v1, v2) + hu = schm.h(1); + hv = schm.h(2); + e = sqrt(hu*hv*sum((v1-v2).^2)); +end \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/+scheme/errorMax.m Tue Sep 22 13:36:45 2015 +0200 @@ -0,0 +1,3 @@ +function e = errorMax(schm, v1, v2) + e = sqrt(max(abs(v1-v2))); +end \ No newline at end of file