changeset 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 791decafe6e4
children 97a638f91fb8
files +noname/Discretization.m +scheme/Scheme.m +scheme/error1d.m +scheme/error2d.m +scheme/errorMax.m +scheme/errorRelative.m +scheme/errorSbp.m +scheme/errorVector.m
diffstat 8 files changed, 15 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/+noname/Discretization.m	Fri Sep 25 14:51:18 2015 +0200
+++ b/+noname/Discretization.m	Fri Sep 25 14:54:26 2015 +0200
@@ -3,6 +3,7 @@
         name         %Short description
         description  %Longer description
         order        %Order of accuracy
+        h            % scalar desciribing the grid spacing.. (IS THIS THE RIGHT PLACE FOR THIS?)
     end
 
     methods (Abstract)
@@ -45,12 +46,4 @@
         [update,hand] = setupPlot(obj, type)
 
     end
-
-    methods(Abstract,Static)
-        % Compare two functions u and v in the discrete l2 norm.
-        e = compareSolutions(u, v)
-
-        % Compare the functions u to the analytical function g in the discrete l2 norm.
-        e = compareSolutionsAnalytical(u, g)
-    end
 end
\ No newline at end of file
--- a/+scheme/Scheme.m	Fri Sep 25 14:51:18 2015 +0200
+++ b/+scheme/Scheme.m	Fri Sep 25 14:54:26 2015 +0200
@@ -28,9 +28,6 @@
         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)
-
     end
 
     methods(Static)
--- a/+scheme/error1d.m	Fri Sep 25 14:51:18 2015 +0200
+++ b/+scheme/error1d.m	Fri Sep 25 14:54:26 2015 +0200
@@ -1,4 +1,4 @@
-function e = error1d(schm, v1, v2)
-    h = schm.h;
+function e = error1d(discr, v1, v2)
+    h = discr.h;
     e = sqrt(h*sum((v1-v2).^2));
 end
\ No newline at end of file
--- a/+scheme/error2d.m	Fri Sep 25 14:51:18 2015 +0200
+++ b/+scheme/error2d.m	Fri Sep 25 14:54:26 2015 +0200
@@ -1,5 +1,5 @@
-function e = error2d(schm, v1, v2)
-    hu = schm.h(1);
-    hv = schm.h(2);
-    e = sqrt(hu*hv*sum((v1-v2).^2));
+function e = error2d(discr, v1, v2)
+    % If v1 and v2 are more complex types, something like grid functions... Then we may use .getVectorFrom here!
+    h = discr.h;
+    e = sqrt(h.^2*sum((v1-v2).^2));
 end
\ No newline at end of file
--- a/+scheme/errorMax.m	Fri Sep 25 14:51:18 2015 +0200
+++ b/+scheme/errorMax.m	Fri Sep 25 14:54:26 2015 +0200
@@ -1,3 +1,3 @@
-function e = errorMax(schm, v1, v2)
+function e = errorMax(~, v1, v2)
     e = sqrt(max(abs(v1-v2)));
 end
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/+scheme/errorRelative.m	Fri Sep 25 14:54:26 2015 +0200
@@ -0,0 +1,3 @@
+function e = errorRelative(~,v1,v2)
+    e = sqrt(sum((v1-v2).^2)/sum(v2.^2));
+end
\ No newline at end of file
--- a/+scheme/errorSbp.m	Fri Sep 25 14:51:18 2015 +0200
+++ b/+scheme/errorSbp.m	Fri Sep 25 14:54:26 2015 +0200
@@ -1,5 +1,6 @@
-function e = errorSbp(schm, v1, v2)
-    H = schm.H;
+function e = errorSbp(discr, v1, v2)
+    % If v1 and v2 are more complex types, something like grid functions... Then we may use .getVectorFrom here!
+    H = discr.H;
     err = v2 - v1;
     e = sqrt(err'*H*err);
 end
\ No newline at end of file
--- a/+scheme/errorVector.m	Fri Sep 25 14:51:18 2015 +0200
+++ b/+scheme/errorVector.m	Fri Sep 25 14:54:26 2015 +0200
@@ -1,3 +1,3 @@
-function e = errorVector(schm, v1, v2)
+function e = errorVector(~, v1, v2)
     e = v2-v1;
 end
\ No newline at end of file