changeset 220:5df8d20281fe feature/beams

Made scheme boundary_condition return a cell array of penalties if there are several of them.
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 28 Jun 2016 13:11:14 +0200
parents f66513508c75
children 3e1d8051e68e
files +multiblock/DiffOp.m +scheme/Beam.m +scheme/Scheme.m
diffstat 3 files changed, 19 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
diff -r f66513508c75 -r 5df8d20281fe +multiblock/DiffOp.m
--- a/+multiblock/DiffOp.m	Mon Jun 27 13:26:02 2016 +0200
+++ b/+multiblock/DiffOp.m	Tue Jun 28 13:11:14 2016 +0200
@@ -119,14 +119,20 @@
             div = obj.blockmatrixDiv;
             closure = blockmatrix.zero(div);
             closure{I,I} = blockClosure;
+            closure = blockmatrix.toMatrix(closure);
 
             div{2} = 1; % Penalty is a column vector
-            penalty = blockmatrix.zero(div);
-            penalty{I} = blockPenalty;
-
-            % Convert to matrix
-            closure = blockmatrix.toMatrix(closure);
-            penalty = blockmatrix.toMatrix(penalty);
+            if ~iscell(blockPenalty)
+                p = blockmatrix.zero(div);
+                p{I} = blockPenalty;
+                penalty = blockmatrix.toMatrix(p);
+            else
+                for i = 1:length(blockPenalty)
+                    p = blockmatrix.zero(div);
+                    p{I} = blockPenalty{i};
+                    penalty{i} = blockmatrix.toMatrix(p);
+                end
+            end
         end
 
         function [closure, penalty] = interface(obj,boundary,neighbour_scheme,neighbour_boundary)
diff -r f66513508c75 -r 5df8d20281fe +scheme/Beam.m
--- a/+scheme/Beam.m	Mon Jun 27 13:26:02 2016 +0200
+++ b/+scheme/Beam.m	Tue Jun 28 13:11:14 2016 +0200
@@ -62,7 +62,7 @@
         %       type                is a string specifying the type of boundary condition if there are several.
         %       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_e, penalty_d] = boundary_condition(obj,boundary,type)
+        function [closure, penalty] = boundary_condition(obj,boundary,type)
             default_arg('type','dn');
 
             [e, d1, d2, d3, s] = obj.get_boundary_ops(boundary);
@@ -74,6 +74,7 @@
                     alpha = obj.alpha;
 
                     % tau1 < -alpha^2/gamma
+                    % tuning = 2;
                     tuning = 1.1;
 
                     tau1 = tuning * alpha/delt;
@@ -87,8 +88,8 @@
 
                     closure = obj.Hi*(tau*e' + sig*d1');
 
-                    penalty_e = obj.Hi*tau;
-                    penalty_d = obj.Hi*sig;
+                    penalty{1} = obj.Hi*tau;
+                    penalty{2} = obj.Hi*sig;
                 otherwise % Unknown, boundary condition
                     error('No such boundary condition: type = %s',type);
             end
@@ -106,7 +107,8 @@
             gamm_v = neighbour_scheme.gamm;
             delt_v = neighbour_scheme.delt;
 
-            tuning = 2;
+            % tuning = 2;
+            tuning = 1.1;
 
             alpha_u = obj.alpha;
             alpha_v = neighbour_scheme.alpha;
diff -r f66513508c75 -r 5df8d20281fe +scheme/Scheme.m
--- a/+scheme/Scheme.m	Mon Jun 27 13:26:02 2016 +0200
+++ b/+scheme/Scheme.m	Tue Jun 28 13:11:14 2016 +0200
@@ -24,6 +24,7 @@
         %                           interfaced to.
         %       neighbour_boundary  is a string specifying which boundary to
         %                           interface to.
+        %       penalty  may be a cell array if there are several penalties with different weights
         [closure, penalty] = boundary_condition(obj,boundary,type)
         [closure, penalty] = interface(obj,boundary,neighbour_scheme,neighbour_boundary)