comparison +multiblock/DiffOp.m @ 346:33b2ef863519 feature/beams

Allowed muliple closure BCs in multiblock.DiffOp.
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 16 Nov 2016 16:15:53 -0800
parents 61b75d6d4899
children 30ff8879162e
comparison
equal deleted inserted replaced
345:7b5ef8b89268 346:33b2ef863519
123 % Boundary är en sträng med en boundary group i. 123 % Boundary är en sträng med en boundary group i.
124 end 124 end
125 end 125 end
126 126
127 % Creates the closure and penalty matrix for a given boundary condition, 127 % Creates the closure and penalty matrix for a given boundary condition,
128 % boundary -- the name of the boundary on the form [id][name] where 128 % boundary -- the name of the boundary on the form {id,name} where
129 % id is the number of a block and name is the name of a 129 % id is the number of a block and name is the name of a
130 % boundary of that block example: 1s or 3w 130 % boundary of that block example: {1,'s'} or {3,'w'}
131 function [closure, penalty] = boundary_condition(obj, boundary, type) 131 function [closure, penalty] = boundary_condition(obj, boundary, type)
132 I = boundary{1}; 132 I = boundary{1};
133 name = boundary{2}; 133 name = boundary{2};
134 134
135 % Get the closure and penaly matrices 135 % Get the closure and penaly matrices
136 [blockClosure, blockPenalty] = obj.diffOps{I}.boundary_condition(name, type); 136 [blockClosure, blockPenalty] = obj.diffOps{I}.boundary_condition(name, type);
137 137
138 % Expand to matrix for full domain. 138 % Expand to matrix for full domain.
139 div = obj.blockmatrixDiv; 139 div = obj.blockmatrixDiv;
140 closure = blockmatrix.zero(div); 140 if ~iscell(blockClosure)
141 closure{I,I} = blockClosure; 141 temp = blockmatrix.zero(div);
142 closure = blockmatrix.toMatrix(closure); 142 temp{I,I} = blockClosure;
143 closure = blockmatrix.toMatrix(temp);
144 else
145 for i = 1:length(blockClosure)
146 temp = blockmatrix.zero(div);
147 temp{I,I} = blockClosure{i};
148 closure{i} = blockmatrix.toMatrix(temp);
149 end
150 end
143 151
144 div{2} = size(blockPenalty, 2); % Penalty is a column vector 152 div{2} = size(blockPenalty, 2); % Penalty is a column vector
145 if ~iscell(blockPenalty) 153 if ~iscell(blockPenalty)
146 p = blockmatrix.zero(div); 154 p = blockmatrix.zero(div);
147 p{I} = blockPenalty; 155 p{I} = blockPenalty;