Mercurial > repos > public > sbplib
annotate +scheme/bcSetup.m @ 1037:2d7ba44340d0 feature/burgers1d
Pass scheme specific parameters as cell array. This will enabale constructDiffOps to be more general. In addition, allow for schemes returning function handles as diffOps, which is currently how non-linear schemes such as Burgers1d are implemented.
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Fri, 18 Jan 2019 09:02:02 +0100 |
parents | b45a6dcb61ac |
children | 386ef449df51 |
rev | line source |
---|---|
619
9dd49d622a4c
Add a function for easily applying many boundary conditions at the same time
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
1 % Takes a diffOp and a cell array of boundary condition definitions. |
9dd49d622a4c
Add a function for easily applying many boundary conditions at the same time
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
2 % Each bc is a struct with the fields |
9dd49d622a4c
Add a function for easily applying many boundary conditions at the same time
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
3 % * type -- Type of boundary condition |
9dd49d622a4c
Add a function for easily applying many boundary conditions at the same time
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
4 % * boundary -- Boundary identifier |
749
1de60c4d462d
Allow gird functions as data in bcSetup
Jonatan Werpers <jonatan@werpers.com>
parents:
723
diff
changeset
|
5 % * data -- A function_handle for a function which provides boundary data.(see below) |
899
ba10f24bf476
Fix the documentation of functions
Jonatan Werpers <jonatan@werpers.com>
parents:
876
diff
changeset
|
6 % Also takes S_sign which modifies the sign of the penalty function, [-1,1] |
749
1de60c4d462d
Allow gird functions as data in bcSetup
Jonatan Werpers <jonatan@werpers.com>
parents:
723
diff
changeset
|
7 % Returns a closure matrix and a forcing function S. |
1de60c4d462d
Allow gird functions as data in bcSetup
Jonatan Werpers <jonatan@werpers.com>
parents:
723
diff
changeset
|
8 % |
1de60c4d462d
Allow gird functions as data in bcSetup
Jonatan Werpers <jonatan@werpers.com>
parents:
723
diff
changeset
|
9 % The boundary data function can either be a function of time or a function of time and space coordinates. |
1de60c4d462d
Allow gird functions as data in bcSetup
Jonatan Werpers <jonatan@werpers.com>
parents:
723
diff
changeset
|
10 % In the case where it only depends on time it should return the data as grid function for the boundary. |
1de60c4d462d
Allow gird functions as data in bcSetup
Jonatan Werpers <jonatan@werpers.com>
parents:
723
diff
changeset
|
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. |
1de60c4d462d
Allow gird functions as data in bcSetup
Jonatan Werpers <jonatan@werpers.com>
parents:
723
diff
changeset
|
12 % For example in the 2D case: f(t,x,y). |
785
c02b6d03c77c
Change name from bc to bcs
Jonatan Werpers <jonatan@werpers.com>
parents:
777
diff
changeset
|
13 function [closure, S] = bcSetup(diffOp, bcs, S_sign) |
619
9dd49d622a4c
Add a function for easily applying many boundary conditions at the same time
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
14 default_arg('S_sign', 1); |
785
c02b6d03c77c
Change name from bc to bcs
Jonatan Werpers <jonatan@werpers.com>
parents:
777
diff
changeset
|
15 assertType(bcs, 'cell'); |
619
9dd49d622a4c
Add a function for easily applying many boundary conditions at the same time
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
16 assert(S_sign == 1 || S_sign == -1, 'S_sign must be either 1 or -1'); |
9dd49d622a4c
Add a function for easily applying many boundary conditions at the same time
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
17 |
870
fb91d12093f8
Change some naming of functions
Jonatan Werpers <jonatan@werpers.com>
parents:
869
diff
changeset
|
18 [closure, penalties] = scheme.bc.closureSetup(diffOp, bcs); |
fb91d12093f8
Change some naming of functions
Jonatan Werpers <jonatan@werpers.com>
parents:
869
diff
changeset
|
19 S = scheme.bc.forcingSetup(diffOp, penalties, bcs, S_sign); |
619
9dd49d622a4c
Add a function for easily applying many boundary conditions at the same time
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
20 end |