Mercurial > repos > public > sbplib
annotate +scheme/+bc/closureSetup.m @ 1302:a0d615bde7f8 feature/poroelastic
Add the hollow option to the anisotropic diffops
author | Martin Almquist <malmquist@stanford.edu> |
---|---|
date | Fri, 10 Jul 2020 20:24:23 -0700 |
parents | ba10f24bf476 |
children |
rev | line source |
---|---|
873
dee5b5a57be6
Clean up closureSetup
Jonatan Werpers <jonatan@werpers.com>
parents:
870
diff
changeset
|
1 % Setup closure and penalty matrices for several boundary conditions at once. |
899
ba10f24bf476
Fix the documentation of functions
Jonatan Werpers <jonatan@werpers.com>
parents:
873
diff
changeset
|
2 % Each bc is a struct with the fields |
ba10f24bf476
Fix the documentation of functions
Jonatan Werpers <jonatan@werpers.com>
parents:
873
diff
changeset
|
3 % * type -- Type of boundary condition |
ba10f24bf476
Fix the documentation of functions
Jonatan Werpers <jonatan@werpers.com>
parents:
873
diff
changeset
|
4 % * boundary -- Boundary identifier |
ba10f24bf476
Fix the documentation of functions
Jonatan Werpers <jonatan@werpers.com>
parents:
873
diff
changeset
|
5 % * data -- A function_handle for a function which provides boundary data.(see below) |
ba10f24bf476
Fix the documentation of functions
Jonatan Werpers <jonatan@werpers.com>
parents:
873
diff
changeset
|
6 % Also takes S_sign which modifies the sign of the penalty function, [-1,1] |
ba10f24bf476
Fix the documentation of functions
Jonatan Werpers <jonatan@werpers.com>
parents:
873
diff
changeset
|
7 % Returns a closure matrix and a penalty matrices for each boundary condition. |
ba10f24bf476
Fix the documentation of functions
Jonatan Werpers <jonatan@werpers.com>
parents:
873
diff
changeset
|
8 % |
ba10f24bf476
Fix the documentation of functions
Jonatan Werpers <jonatan@werpers.com>
parents:
873
diff
changeset
|
9 % The boundary data function can either be a function of time or a function of time and space coordinates. |
ba10f24bf476
Fix the documentation of functions
Jonatan Werpers <jonatan@werpers.com>
parents:
873
diff
changeset
|
10 % In the case where it only depends on time it should return the data as grid function for the boundary. |
ba10f24bf476
Fix the documentation of functions
Jonatan Werpers <jonatan@werpers.com>
parents:
873
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. |
ba10f24bf476
Fix the documentation of functions
Jonatan Werpers <jonatan@werpers.com>
parents:
873
diff
changeset
|
12 % For example in the 2D case: f(t,x,y). |
870
fb91d12093f8
Change some naming of functions
Jonatan Werpers <jonatan@werpers.com>
parents:
869
diff
changeset
|
13 function [closure, penalties] = closureSetup(diffOp, bcs) |
873
dee5b5a57be6
Clean up closureSetup
Jonatan Werpers <jonatan@werpers.com>
parents:
870
diff
changeset
|
14 scheme.bc.verifyFormat(bcs, diffOp); |
869
d356f1a22d4f
Start organizing the code
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
15 |
d356f1a22d4f
Start organizing the code
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
16 % Setup storage arrays |
d356f1a22d4f
Start organizing the code
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
17 closure = spzeros(size(diffOp)); |
d356f1a22d4f
Start organizing the code
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
18 penalties = cell(1, length(bcs)); |
d356f1a22d4f
Start organizing the code
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
19 |
d356f1a22d4f
Start organizing the code
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
20 % Collect closures and penalties |
d356f1a22d4f
Start organizing the code
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
21 for i = 1:length(bcs) |
d356f1a22d4f
Start organizing the code
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
22 [localClosure, penalties{i}] = diffOp.boundary_condition(bcs{i}.boundary, bcs{i}.type); |
d356f1a22d4f
Start organizing the code
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
23 closure = closure + localClosure; |
d356f1a22d4f
Start organizing the code
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
24 end |
d356f1a22d4f
Start organizing the code
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
25 end |