Mercurial > repos > public > sbplib
comparison +multiblock/DiffOp.m @ 335:2d48db7151cf feature/beams
Bug fix in boundary condition.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 21 Oct 2016 11:31:06 +0200 |
parents | 0fc1de5cd85b |
children | ac30761d7bdb |
comparison
equal
deleted
inserted
replaced
334:46462a6f8a5f | 335:2d48db7151cf |
---|---|
103 % Splits a matrix operator into a cell-matrix of matrix operators for | 103 % Splits a matrix operator into a cell-matrix of matrix operators for |
104 % each grid. | 104 % each grid. |
105 ops = sparse2cell(op, obj.NNN); | 105 ops = sparse2cell(op, obj.NNN); |
106 end | 106 end |
107 | 107 |
108 % Creates the closere and penalty matrix for a given boundary condition, | 108 % Creates the closure and penalty matrix for a given boundary condition, |
109 % boundary -- the name of the boundary on the form [id][name] where | 109 % boundary -- the name of the boundary on the form [id][name] where |
110 % id is the number of a block and name is the name of a | 110 % id is the number of a block and name is the name of a |
111 % boundary of that block example: 1s or 3w | 111 % boundary of that block example: 1s or 3w |
112 function [closure, penalty] = boundary_condition(obj,boundary,type) | 112 function [closure, penalty] = boundary_condition(obj, boundary, type) |
113 I = boundary{1}; | 113 I = boundary{1}; |
114 name = boundary{2}; | 114 name = boundary{2}; |
115 | 115 |
116 % Get the closure and penaly matrices | 116 % Get the closure and penaly matrices |
117 [blockClosure, blockPenalty] = obj.diffOps{I}.boundary_condition(name, type); | 117 [blockClosure, blockPenalty] = obj.diffOps{I}.boundary_condition(name, type); |
120 div = obj.blockmatrixDiv; | 120 div = obj.blockmatrixDiv; |
121 closure = blockmatrix.zero(div); | 121 closure = blockmatrix.zero(div); |
122 closure{I,I} = blockClosure; | 122 closure{I,I} = blockClosure; |
123 closure = blockmatrix.toMatrix(closure); | 123 closure = blockmatrix.toMatrix(closure); |
124 | 124 |
125 div{2} = 1; % Penalty is a column vector | 125 div{2} = size(blockPenalty, 2); % Penalty is a column vector |
126 if ~iscell(blockPenalty) | 126 if ~iscell(blockPenalty) |
127 p = blockmatrix.zero(div); | 127 p = blockmatrix.zero(div); |
128 p{I} = blockPenalty; | 128 p{I} = blockPenalty; |
129 penalty = blockmatrix.toMatrix(p); | 129 penalty = blockmatrix.toMatrix(p); |
130 else | 130 else |