annotate +scheme/bcSetupStaggered.m @ 1339:bcdb14b05d03 feature/D2_boundary_opt

Fix comment
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Fri, 22 Jul 2022 16:31:18 +0200
parents c7f5b480e455
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1280
c7f5b480e455 Add bcSetup for staggered, where displacement and traction data must be evaluated on different grids.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
1 % Takes a diffOp and a cell array of boundary condition definitions.
c7f5b480e455 Add bcSetup for staggered, where displacement and traction data must be evaluated on different grids.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
2 % Each bc is a struct with the fields
c7f5b480e455 Add bcSetup for staggered, where displacement and traction data must be evaluated on different grids.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
3 % * type -- Type of boundary condition
c7f5b480e455 Add bcSetup for staggered, where displacement and traction data must be evaluated on different grids.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
4 % * boundary -- Boundary identifier
c7f5b480e455 Add bcSetup for staggered, where displacement and traction data must be evaluated on different grids.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
5 % * data -- A function_handle for a function which provides boundary data.(see below)
c7f5b480e455 Add bcSetup for staggered, where displacement and traction data must be evaluated on different grids.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
6 % Also takes S_sign which modifies the sign of the penalty function, [-1,1]
c7f5b480e455 Add bcSetup for staggered, where displacement and traction data must be evaluated on different grids.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
7 % Returns a closure matrix and a forcing function S.
c7f5b480e455 Add bcSetup for staggered, where displacement and traction data must be evaluated on different grids.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
8 %
c7f5b480e455 Add bcSetup for staggered, where displacement and traction data must be evaluated on different grids.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
9 % The boundary data function can either be a function of time or a function of time and space coordinates.
c7f5b480e455 Add bcSetup for staggered, where displacement and traction data must be evaluated on different grids.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
10 % In the case where it only depends on time it should return the data as grid function for the boundary.
c7f5b480e455 Add bcSetup for staggered, where displacement and traction data must be evaluated on different grids.
Martin Almquist <malmquist@stanford.edu>
parents:
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.
c7f5b480e455 Add bcSetup for staggered, where displacement and traction data must be evaluated on different grids.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
12 % For example in the 2D case: f(t,x,y).
c7f5b480e455 Add bcSetup for staggered, where displacement and traction data must be evaluated on different grids.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
13 function [closure, S] = bcSetupStaggered(diffOp, bcs, S_sign)
c7f5b480e455 Add bcSetup for staggered, where displacement and traction data must be evaluated on different grids.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
14 default_arg('S_sign', 1);
c7f5b480e455 Add bcSetup for staggered, where displacement and traction data must be evaluated on different grids.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
15 assertType(bcs, 'cell');
c7f5b480e455 Add bcSetup for staggered, where displacement and traction data must be evaluated on different grids.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
16 assert(S_sign == 1 || S_sign == -1, 'S_sign must be either 1 or -1');
c7f5b480e455 Add bcSetup for staggered, where displacement and traction data must be evaluated on different grids.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
17
c7f5b480e455 Add bcSetup for staggered, where displacement and traction data must be evaluated on different grids.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
18 [closure, penalties] = scheme.bc.closureSetup(diffOp, bcs);
c7f5b480e455 Add bcSetup for staggered, where displacement and traction data must be evaluated on different grids.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
19 S = scheme.bc.forcingSetupStaggered(diffOp, penalties, bcs, S_sign);
c7f5b480e455 Add bcSetup for staggered, where displacement and traction data must be evaluated on different grids.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
20 end