comparison +scheme/+bc/closureSetup.m @ 1033:037f203b9bf5 feature/burgers1d

Merge with branch feature/advectioRV to utilize the +rv package
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Thu, 17 Jan 2019 10:44:12 +0100
parents ba10f24bf476
children
comparison
equal deleted inserted replaced
854:18162a0a5bb5 1033:037f203b9bf5
1 % Setup closure and penalty matrices for several boundary conditions at once.
2 % Each bc is a struct with the fields
3 % * type -- Type of boundary condition
4 % * boundary -- Boundary identifier
5 % * data -- A function_handle for a function which provides boundary data.(see below)
6 % Also takes S_sign which modifies the sign of the penalty function, [-1,1]
7 % Returns a closure matrix and a penalty matrices for each boundary condition.
8 %
9 % The boundary data function can either be a function of time or a function of time and space coordinates.
10 % In the case where it only depends on time it should return the data as grid function for the boundary.
11 % In the case where it also takes space coordinates the number of space coordinates should match the number of dimensions of the problem domain.
12 % For example in the 2D case: f(t,x,y).
13 function [closure, penalties] = closureSetup(diffOp, bcs)
14 scheme.bc.verifyFormat(bcs, diffOp);
15
16 % Setup storage arrays
17 closure = spzeros(size(diffOp));
18 penalties = cell(1, length(bcs));
19
20 % Collect closures and penalties
21 for i = 1:length(bcs)
22 [localClosure, penalties{i}] = diffOp.boundary_condition(bcs{i}.boundary, bcs{i}.type);
23 closure = closure + localClosure;
24 end
25 end