diff +scheme/Burgers1D.m @ 853:cda996e64925 feature/burgers1d

Minor renaming and clean up
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Fri, 12 Oct 2018 08:41:57 +0200
parents fbb8be3177c8
children
line wrap: on
line diff
--- a/+scheme/Burgers1D.m	Thu Sep 27 09:30:21 2018 +0200
+++ b/+scheme/Burgers1D.m	Fri Oct 12 08:41:57 2018 +0200
@@ -20,10 +20,6 @@
             assert(grid.size() == length(params.eps));
             m = grid.size();
             lim = grid.lim{1}; % Ugly, and only applicable for cartesian grids.
-            default_arg('pde_form','skew-symmetric');
-            default_arg('operator_type','narrow');
-            default_arg('dissipation','on');
-
             switch operator_type
                 case 'narrow'
                     ops = sbp.D4Variable(m, lim, order);
@@ -65,7 +61,6 @@
                     error('Other operator types not yet supported', operator_type);
             end
 
-            %% TODO: Figure out how to evaluate viscosity as viscosity(v,t) here instead of parametrizing D on the viscosity.
             switch pde_form
                 case 'skew-symmetric'
                     if (strcmp(dissipation,'on'))
@@ -79,6 +74,8 @@
                     else
                         D = @(v, viscosity) -1/2*D1*v.^2 + D2(params.eps + viscosity)*v;
                     end
+                otherwise
+                    error('Not supported', pde_form);
             end
 
             obj.grid = grid;
@@ -94,17 +91,15 @@
             obj.d_r =  d_r;
         end
 
-        % Closure functions return the opertors applied to the own doamin to close the boundary
-        % Penalty functions return the opertors to force the solution. In the case of an interface it returns the operator applied to the other domain.
+        % Closure functions return the operators applied to the own doamin to close the boundary
+        % Penalty functions return the operators to force the solution. In the case of an interface it returns the operator applied to the other domain.
         %       boundary            is a string specifying the boundary e.g. 'l','r' or 'e','w','n','s'.
         %       type                is a string specifying the type of boundary condition if there are several.
         %       data                is a function returning the data that should be applied at the boundary.
-        %       neighbour_scheme    is an instance of Scheme that should be interfaced to.
-        %       neighbour_boundary  is a string specifying which boundary to interface to.
         function [closure, penalty] = boundary_condition(obj,boundary,type,data)
             default_arg('type','robin');
             default_arg('data',0);
-            [e, s, d, i_b] = obj.get_boundary_ops(boundary);
+            [e, d, i_b, s] = obj.get_boundary_ops(boundary);
             switch type
                 % Stable robin-like boundary conditions ((u+-abs(u))*u/3 - eps*u_x)) with +- at left/right boundary
                 case {'R','robin'}
@@ -118,26 +113,25 @@
                         otherwise
                             error('Wierd data argument!')
                     end
-                % Unknown, boundary condition
                 otherwise
                     error('No such boundary condition: type = %s',type);
             end
         end
 
-        % Ruturns the boundary ops and sign for the boundary specified by the string boundary.
+        % Ruturns the boundary ops, boundary index and sign for the boundary specified by the string boundary.
         % The right boundary is considered the positive boundary
-        function [e, s, d, i_b] = get_boundary_ops(obj,boundary)
+        function [e, d, i_b, s] = get_boundary_ops(obj,boundary)
             switch boundary
                 case 'l'
                     e = obj.e_l;
-                    s = -1;
                     d = obj.d_l;
                     i_b = 1;
+                    s = -1;
                 case 'r'
                     e = obj.e_r;
-                    s = 1;
                     d = obj.d_r;
                     i_b = length(e);
+                    s = 1;
                 otherwise
                     error('No such boundary: boundary = %s',boundary);
             end