source: issm/trunk/src/m/classes/public/BasinConstrain.m@ 1234

Last change on this file since 1234 was 1234, checked in by Eric.Larour, 16 years ago

Added basin constraint routine

File size: 1.3 KB
Line 
1function md=BasinConstrain(md,domain);
2%BASINCONSTRAIN constrain basin, using a constraint domain outline, to dirichlet boundary conditions.
3%
4% usage: md=BasinConstrain(md,constraindomain)
5%
6% where constraindomain is an Argus domain outline file enclosing the geographical area of interest.
7%
8% See also: N/A
9
10%prepare barycentre positions.
11xelem=md.x(md.elements)*[1;1;1]/3;
12yelem=md.y(md.elements)*[1;1;1]/3;
13
14%now, flag grids and elements outside the domain outline.
15[gridondomain elementondomain]=ContourToMesh(md.elements,md.x,md.y,expread(domain,1),'element and node',2);
16gridnotondomain=find(~gridondomain);
17elementnotondomain=find(~elementondomain);
18
19%all elements outside the constraint domain are equivalent to water. all grids outside are spc'd.
20md.gridondirichlet_diag(gridnotondomain)=1;
21md.dirichletvalues_diag(gridnotondomain,1)=md.vx_obs(gridnotondomain);
22md.dirichletvalues_diag(gridnotondomain,2)=md.vy_obs(gridnotondomain);
23md.elementonwater(elementnotondomain)=1;
24
25
26%now, make sure all elements on water have grids that are spc'd, otherwise, we'll get a singular problem.
27pos=find(md.elementonwater);
28grids=unique(md.elements(pos,:));
29
30md.gridondirichlet_diag(grids)=1;
31md.dirichletvalues_diag(grids,1)=md.vx_obs(grids);
32md.dirichletvalues_diag(grids,2)=md.vy_obs(grids);
33
Note: See TracBrowser for help on using the repository browser.