Mercurial > repos > public > sbplib
changeset 1056:b4fa176b4287 feature/poroelastic
Elastic2dVariable: boundary condition type can now be a string, normal or tangential, as well as component number.
author | Martin Almquist <malmquist@stanford.edu> |
---|---|
date | Fri, 25 Jan 2019 15:15:44 -0800 |
parents | b828e589d540 |
children | ff274c7404cc |
files | +scheme/Elastic2dVariable.m |
diffstat | 1 files changed, 30 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/+scheme/Elastic2dVariable.m Fri Jan 25 14:04:23 2019 -0800 +++ b/+scheme/Elastic2dVariable.m Fri Jan 25 15:15:44 2019 -0800 @@ -344,7 +344,9 @@ % Penalty functions return the operators to force the solution. In the case of an interface it returns the operator applied to the other doamin. % boundary is a string specifying the boundary e.g. 'l','r' or 'e','w','n','s'. % bc is a cell array of component and bc type, e.g. {1, 'd'} for Dirichlet condition - % on the first component. + % on the first component. Can also be e.g. + % {'normal', 'd'} or {'tangential', 't'} for conditions on + % tangential/normal component. % data is a function returning the data that should be applied at the boundary. % neighbour_scheme is an instance of Scheme that should be interfaced to. % neighbour_boundary is a string specifying which boundary to interface to. @@ -354,12 +356,14 @@ assert( iscell(bc), 'The BC type must be a 2x1 cell array' ); comp = bc{1}; type = bc{2}; + if ischar(comp) + comp = obj.getComponent(comp, boundary); + end % j is the coordinate direction of the boundary j = obj.get_boundary_number(boundary); [e, T, tau, H_gamma] = obj.getBoundaryOperator({'e','T','tau','H'}, boundary); - E = obj.E; Hi = obj.Hi; LAMBDA = obj.LAMBDA; @@ -476,6 +480,30 @@ end end + % Returns the component number that is the tangential/normal component + % at the specified boundary + function comp = getComponent(obj, comp_str, boundary) + assertIsMember(comp_str, {'normal', 'tangential'}); + assertIsMember(boundary, {'w', 'e', 's', 'n'}); + + switch boundary + case {'w', 'e'} + switch comp_str + case 'normal' + comp = 1; + case 'tangential' + comp = 2; + end + case {'s', 'n'} + switch comp_str + case 'normal' + comp = 2; + case 'tangential' + comp = 1; + end + end + end + % Returns the boundary operator op for the boundary specified by the string boundary. % op: may be a cell array of strings % Only operators with name *_tot can be used with multiblock.DiffOp.getBoundaryOperator()