add_sponge_nodes_list.html 8.93 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of add_sponge_nodes_list</title>
  <meta name="keywords" content="add_sponge_nodes_list">
  <meta name="description" content="Add a set of sponge nodes comprising a single sponge layer to Mesh structure">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html v1.5 &copy; 2003-2005 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../index.html">Home</a> &gt;  <a href="index.html">fvcom_prepro</a> &gt; add_sponge_nodes_list.m</div>

<!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="index.html">Index for fvcom_prepro&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>-->

<h1>add_sponge_nodes_list
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>Add a set of sponge nodes comprising a single sponge layer to Mesh structure</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function [Mobj]  = add_sponge_nodes_list(Mobj,SpongeList,SpongeName,SpongeRadius,SpongeCoeff,plotFig) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> Add a set of sponge nodes comprising a single sponge layer to Mesh structure  

 [Mobj] = add_sponge_nodes(Mobj)

 DESCRIPTION:
    Select using ginput the set of nodes comprising a sponge layer

 INPUT
    Mobj = Matlab mesh object
    SpongeList = List of nodes to which to create a Sponge Layer
    SpongeName = Name of the Sponge Layer
    SpongeRadius = Radius of influence of the Sponge Layer 
    SpongeCoeff  = Sponge damping coefficient
    plotFig = [optional] show a figure of the mesh (1 = yes)

 OUTPUT:
    Mobj = Matlab mesh object with an additional sponge nodelist

 EXAMPLE USAGE
    Mobj = add_sponge_nodes(Mobj,'Sponge1',10000,.0001)

 Author(s):  
    Geoff Cowles (University of Massachusetts Dartmouth)
    Pierre Cazenave (Plymouth Marine Laboratory)
54
    Karen Thurston (National Oceanography Centre, Liverpool)
55 56 57 58

 Revision history
    Modifed from add_sponge_nodes to read in nodes from a supplied list.
    2012-11-26 Add ability to turn off the figures.
59
    2013-01-18 Added support for variable sponge radius
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
   
==============================================================================</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
<!-- crossreference -->



<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function [Mobj]  = add_sponge_nodes_list(Mobj,SpongeList,SpongeName,SpongeRadius,SpongeCoeff,plotFig)</a>
0002 
0003 <span class="comment">% Add a set of sponge nodes comprising a single sponge layer to Mesh structure</span>
0004 <span class="comment">%</span>
0005 <span class="comment">% [Mobj] = add_sponge_nodes(Mobj)</span>
0006 <span class="comment">%</span>
0007 <span class="comment">% DESCRIPTION:</span>
0008 <span class="comment">%    Select using ginput the set of nodes comprising a sponge layer</span>
0009 <span class="comment">%</span>
0010 <span class="comment">% INPUT</span>
0011 <span class="comment">%    Mobj = Matlab mesh object</span>
0012 <span class="comment">%    SpongeList = List of nodes to which to create a Sponge Layer</span>
0013 <span class="comment">%    SpongeName = Name of the Sponge Layer</span>
0014 <span class="comment">%    SpongeRadius = Radius of influence of the Sponge Layer</span>
0015 <span class="comment">%    SpongeCoeff  = Sponge damping coefficient</span>
0016 <span class="comment">%    plotFig = [optional] show a figure of the mesh (1 = yes)</span>
0017 <span class="comment">%</span>
0018 <span class="comment">% OUTPUT:</span>
0019 <span class="comment">%    Mobj = Matlab mesh object with an additional sponge nodelist</span>
0020 <span class="comment">%</span>
0021 <span class="comment">% EXAMPLE USAGE</span>
0022 <span class="comment">%    Mobj = add_sponge_nodes(Mobj,'Sponge1',10000,.0001)</span>
0023 <span class="comment">%</span>
0024 <span class="comment">% Author(s):</span>
0025 <span class="comment">%    Geoff Cowles (University of Massachusetts Dartmouth)</span>
0026 <span class="comment">%    Pierre Cazenave (Plymouth Marine Laboratory)</span>
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
0027 <span class="comment">%    Karen Thurston (National Oceanography Centre, Liverpool)</span>
0028 <span class="comment">%</span>
0029 <span class="comment">% Revision history</span>
0030 <span class="comment">%    Modifed from add_sponge_nodes to read in nodes from a supplied list.</span>
0031 <span class="comment">%    2012-11-26 Add ability to turn off the figures.</span>
0032 <span class="comment">%    2013-01-18 Added support for variable sponge radius</span>
0033 <span class="comment">%</span>
0034 <span class="comment">%==============================================================================</span>
0035 subname = <span class="string">'add_sponge_nodes'</span>;
0036 
0037 <span class="keyword">global</span> ftbverbose
0038 <span class="keyword">if</span>(ftbverbose)
0039     fprintf(<span class="string">'\n'</span>)
0040     fprintf([<span class="string">'begin : '</span> subname <span class="string">'\n'</span>])
0041 <span class="keyword">end</span>
0042 
0043 <span class="comment">% Do we want a figure showing how we're getting along?</span>
0044 <span class="keyword">if</span> nargin == 5
0045     plotFig = 0;
0046 <span class="keyword">end</span>
0047 
123
0048 <span class="comment">%------------------------------------------------------------------------------</span>
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
0049 <span class="comment">% Plot the mesh</span>
0050 <span class="comment">%------------------------------------------------------------------------------</span>
0051 
0052 <span class="keyword">if</span> plotFig == 1
0053     <span class="keyword">if</span>(lower(Mobj.nativeCoords(1:3)) == <span class="string">'car'</span>)
0054         x = Mobj.x;
0055         y = Mobj.y;
0056     <span class="keyword">else</span>
0057         x = Mobj.lon;
0058         y = Mobj.lat;
0059     <span class="keyword">end</span>
0060 
0061     figure
0062     patch(<span class="string">'Vertices'</span>,[x,y],<span class="string">'Faces'</span>,Mobj.tri,<span class="keyword">...</span>
0063             <span class="string">'Cdata'</span>,Mobj.h,<span class="string">'edgecolor'</span>,<span class="string">'k'</span>,<span class="string">'facecolor'</span>,<span class="string">'interp'</span>);
0064     hold on;
0065     plot(x(SpongeList),y(SpongeList),<span class="string">'wx'</span>)
0066     axis(<span class="string">'equal'</span>,<span class="string">'tight'</span>)
0067 <span class="keyword">end</span>
0068 
0069 npts = length(SpongeList);
0070 
0071 <span class="keyword">if</span>(npts == 0)
0072     fprintf(<span class="string">'No points in given list'</span>)
0073     fprintf([<span class="string">'end   : '</span> subname <span class="string">'\n'</span>])
0074     <span class="keyword">return</span>
150
0075 <span class="keyword">end</span>
151 152 153 154 155 156 157 158 159 160 161
0076 <span class="keyword">if</span>(ftbverbose)
0077     fprintf(<span class="string">'%d points provided\n'</span>,npts)
0078 <span class="keyword">end</span>
0079 
0080 <span class="comment">% add to mesh object</span>
0081 Mobj.nSponge = Mobj.nSponge + 1;
0082 Mobj.nSpongeNodes(Mobj.nSponge) = npts;
0083 Mobj.sponge_nodes(Mobj.nSponge,1:npts) = SpongeList;
0084 Mobj.sponge_name{Mobj.nSponge} = SpongeName;
0085 Mobj.sponge_fac(Mobj.nSponge) = SpongeCoeff;
0086 
162
0087 <span class="keyword">if</span> numel(unique(SpongeRadius)) == 1   <span class="comment">% if you have a constant sponge radius</span>
163 164 165 166 167 168 169 170 171
0088     Mobj.sponge_rad(Mobj.nSponge) = SpongeRadius;
0089 <span class="keyword">else</span>    <span class="comment">% if you have a variable sponge radius</span>
0090     Mobj.sponge_rad(Mobj.nSponge,1:npts) = SpongeRadius;
0091 <span class="keyword">end</span>
0092 
0093 <span class="keyword">if</span>(ftbverbose)
0094     fprintf([<span class="string">'end   : '</span> subname <span class="string">'\n'</span>])
0095 <span class="keyword">end</span>
0096</pre></div>
Pierre Cazenave's avatar
Pierre Cazenave committed
172
<hr><address>Generated on Mon 07-Dec-2015 09:59:26 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address>
173 174
</body>
</html>