**NAME**

polygon

**SYNOPSIS**

polygon [-A name] [-N name] first x0 y0 ray x y [-optional link arguments] bcurv type dim [-optional link arguments] x_1 y_1 x_2 y_2 ... ... x_dim y_dim carc [-optional link arguments] x_1 y_1 length sgn sing x y [-optional link arguments] end

**DESCRIPTION**

polygoncreates irregularly shaped immersed boundaries by piecewise combinations of line segments, circular arcs, parameterically defined curves and single points.polygonsubcommands, bcurv, ray, carc, and sing can be used an arbitrary number of times allowingpolygonto draw arbitrary objects.

polygonrequires two arguments, each on a separate line, and it requires at least one optional statement. These arguments are:These commands must have the form:

- first - specifies the first point of the polygon
- end - specifies the end of the polygon statements
polygon first x0 y0 endpolygoninterpretes two optional statements.The default elastic link properties of a

- -A name - indicates this entity is active and provides a name
- -N name - provides a name
polygoncan be changed in two ways. Thespring pcommands can be used to change the defaults for anypolygonsubcommand, see thespringsynopsis for the relevant details on this method. Second, the elastic link properties for a given subsection of apolygoncan be changed using the optional arguments that define that subsection.

**POLYGON SUBCOMMANDS**

Thepolygonsubcommands ``draw'' the immersed boundary, and the optional arguments of thepolygonsubcommands specify the elastic link properties of the immersed boundary, The subcommands ofpolygonand their uses are:

firstandendspecify the start and end of the polygon and must be included in every polygon.

bcurvspecifies a parametrically defined curve segment from the current point to the last point in a list of (x,y) data pairs that follows thebcurvstatement.

carcspecifies an arc of a circle from the current point to a specified endpoint and having a specified arclength. The optional arguments specify the elastic link properties of thecarc.

rayspecifies a line segment from the current point to the last point listed in the required arguments. The optional arguments specify the elastic link properties.

singspecifies a single immersed boundary point that can be tethered with an optional argument.

**CLOSED AND OPEN POLYGONS:**

If the distance between the first and last points of a polygon is less than half the spatial grid spacing, then the polygon is assumed to be closed, otherwise the polygon is assumed to be open.The difference between an open and closed polygon is that a closed polygon has an interior, while an open polygon does not. This difference can make a substantial difference in the outcome of all computations.

The forces that the immersed boundary generate are computed periodically for all closed polygons, i.e. there are elastic links between the first and last points of the polygon. In an open polygon, no such links are created. Additionally, when the color graphics files are generated, the interiors of objects are coded to allow for different colors than used in the exterior.

**PROPERTIES OF THE PIECEWISE CURVE**

The piecewise curve created bypolygonis constructed sequentially. To imagine drawing a polygon, put a pen down on the paper at the starting point and leave it there. Evaluate the next statement and draw the new section of the curve that the statement defines, leaving your pen on the paper. Repeat this process until there are no more statements, and never raise your pen until you are done.In the definition of the piecewise curve created by

polygon, the first point of a segment belongs to that segment, but the last point of a segment belongs to the next segment. This is important because the elastic link properties of a segment are applied at the first point and not the last point. For example a tethered line segment is tethered at the first point but not the last point. Tethering can be applied at the last point by using a singlet at the last poin and tethering that point. For example, to create a polygon that consists of a line of points from (1,1) to (1,2), tether them and include tethering at the point (1,2), the following code would be usedpolygon first 1.0 1.0 ray 1.0 2.0 -t 1000.0 sing 1.0 2.0 -t 1000.0 end

**DEFAULT CONNECTING ANGLES:**

The default connecting angle between two segments must be calculated at the point where the two segments meet. The resting positions of the immersed boundary points involved in this calculation are the the cooresponding tether point locations. Let the resting position of the point where the segments meet beX_{j}and the resting position of the previous and next points beX_{j-1}andX_{j+1}, respectively. The default connecting angle is calculated from the inner product ofX_{j}-X_{j-1}andX_{j}-X_{j+1}. To override this default, determine the desired resting angle, and use the-uoptional statement.

**EXAMPLES:**

The balloon apparatus was created using polygon. The following code will create one large and one small balloon on the ends of the straw. The elastic link properties of the balloons are slightly different.polygon first 1.50 1.125 bcurv s 4 -n 200 0.50 2.50 -0.50 1.00 0.50 -0.50 1.50 0.875 ray 2.50 0.875 bcurv s 4 -n 200 3.00 0.25 3.50 1.00 3.00 1.75 2.50 1.125 ray 1.50 1.125 endThebcurvstatements place immersed boundary points on a curve defined by a polynomial. That polynomial is described in Appendix ???. Theraystatements place immersed boundary points on a straight line segment. Notice that the last point of the control polygon is the same as the first point of the polygon, thus creating a closed curve.

**NAME**

polygon - bcurv

**SYNOPSIS**

bcurv type n [-optional link arguments] x1 y1 x2 y2 ... ... n data pairs xn yn

**DESCRIPTION**

bcurvspecifies a parametrically defined curve segment from the current point to the last point in a list of (xn,yn) .

bcurvhas two sets of required arguments. On thebcurvcommand line, the required arguments are:The second set of

- type - Specifies the resting position of the curve from a predetermined set. This possible types are:

- f - resting initial positions are the same
- s - resting position is a straight line between current point and (
xn,yn).- n - Number of data pairs that define the curve.
bcurvrequired arguments consist of a set of (x,y) data pairs (one pair per line) that define the curve. The role of these points will be discussed below.The optional arguments of

bcurvspecify the elastic link properties of that curve.bcurvinterprets the following options.

- -a angle - resting angle at the IB points (default=0)
- -b bend - bending stiffness at the IB points (default=40000)
- -d distance - initial distance between IB points (default=0.5)
- -e end tether - tether spring stiffness at the endpoints (default=0)
- -l link - inter-IB-point spring rest length (default=0.5)
- -s stiff - inter-IB-point spring stiffness (default=40000)
- -t tether - tether spring stiffness (default=0)
The (

x,y) data pairs that are specfied inbcurvare the control points of a Berstein-Bezier (BB) polygon. These points determine a parametrically-defined polynomial curve. Mathematical details about the BB curve are given in Appendix ???, but the important features of the curve as it relates to the required points are;Figure ??? gives an example, using four data pairs, of a cubic BB curve. The figure displays how moving a specific point on the control polygon changes the curve.

- The first point of the control polygon is the current point.
- The curve interpolates the current and last points.
- The tangent to the curve at the beginning point is parallel to the vector pointing from the first control point to the second control point.
- The curve is drawn toward, but not through, the points of the BB polygon. Thus to force the curve in a specified direction, place control point farther in that direction than where the position of the curve is desired.

**EXAMPLE**

bcurv s 3 x1 y1 x2 y2 x3 y3

This code draws the BB curve shown in Figure ???.

**NAME**

polygon - carc

**SYNOPSIS**

carc [-optional link arguments] x y length sgn

**DESCRIPTION**

carcspecifies a circular arc of immersed boundary points in the polygon.carcrequires two separate lines, each containing two arguments. These lines and arguments are:The circular arc extends from the current point to the specified endpoint and has the specified arclength. If the arclength is less than the distance between the current point and the endpoint, then

x y- The endpoints of the circular arc.length sgn- The length of the arc and the direction of the center of the circle that contains the arc.sgnmust be either 1 or -1.carcdetermines an error has occurred and terminates. Two points on a circular arc and the arclength between them does not determine a unique circle. Therefore, the direction of the center of the circle must be specified.sgnsets that directions.sgnshould be set to 1 if the difference between thexcomponent of the center of the circle from the midpoint of the current point and the endpoint is positive.sgnshould be set to -1 otherwise. This uniquely determines a circle, except in one case where the center of the circle and the midpoint of the current point and the endpoint are the same. This case, IBIS will will cheat by adding a small number to the endpoint to resolve this problem.

carcinterpretes the following options.

- -a angle - resting angle at the IB points (default=determined analytically)
- -b bend - bending stiffness at the IB points (default=40000)
- -d distance - initial distance between IB points (default=0.5)
- -e end tether - tether spring stiffness at the endpoints (default=0)
- -l link - inter-IB-point spring rest length (default=0.5)
- -n number - number of IB points on the circular arc
- -s stiff - inter-IB-point spring stiffness (default=40000)
- -t tether - tether spring stiffness (default=0)

**EXAMPLE**

carc [-optional link arguments] x y length sgn

Starts the polygon at (1,2).

**NAME**

polygon - end

**SYNOPSIS**

end

**DESCRIPTION**

endis a required statement in apolygonthat specifies the end of thepolygon.endmust appear on the last line of a set ofpolygonsubcommands.endhas no arguments.

**NAME**

polygon - first

**SYNOPSIS**

first x y

**DESCRIPTION**

firstis a required statement in apolygonthat specifies the first immersed boundary point in the polygon.firstmust appear on the line directly belowpolygon.firstrequires two arguments.

- x - The
xcoordinate of the first polygon point.- y - The
ycoordinate of the first polygon point.firsthas no optional statements.

**EXAMPLE**

first 1 2

Starts the polygon at (1,2).

**NAME**

polygon - ray

**SYNOPSIS**

ray x y [-optional link arguments]

**DESCRIPTION**

rayspecifies a straight line segment of immersed boundary points in the polygon.rayrequires two arguments.

- x - The
xendpoint of the line segment- y - The
yendpoint of the line segmentrayinterpretes the following options.

- -a angle - resting angle at the IB points (default=0)
- -b bend - bending stiffness at the IB points (default=40000)
- -d distance - initial distance between IB points (default=0.5)
- -e endtether - tether spring stiffness at the first point (default=0)
- -n number - number of IB points on the line
- -s stiff - inter-IB-point spring stiffness (default=40000)
- -t tether - tether spring stiffness (default=0)

**EXAMPLE**

ray 1 2 -e 10000.

Run a straight line of IB points from the current point to the point (1,2), and tethers the first point with a spring whose resting length is zero and stiffness is 10000. The point (1,2) is not contained in the segment, see the polygon section.

**NAME**

polygon - sing

**SYNOPSIS**

sing x y [-optional link arguments]

**DESCRIPTION**

singspecifies a single immersed boundary point in the polygon. Thepolygonversionsingdiffers fromsingletin thatsingis embedded in a curve and may interact with its neighbors.singrequires two arguments.

- x - The
xendpoint of the line segment- y - The
yendpoint of the line segmentsinginterpretes the following options.

- -a angle - resting angle at the IB points (default=0)
- -b bend - bending stiffness at the IB points (default=0)
- -l link - inter-IB-point spring rest length (default=0)
- -s stiff - inter-IB-point spring stiffness (default=0)
- -t tether - tether spring stiffness (default=0)

**EXAMPLE**

sing 1 2 -t 2000

Places a single IB point at (1,2) and tethers that point.