Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

download Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an  Elastic Continuum

of 53

Transcript of Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    1/53

    Numerical Analysis Energy Approach for

    Predicting the Equilibrium Position of an

    Elastic Continuum

    William E. Johnson

    A Seminar submitted to the Faculty of

    Rensselaer of Hartford

    In Partial Fulfillment of the Requirements for the

    Degree of MASTER OF SCIENCE

    Major Subject: Mechanical Engineering

    The original of the seminar is on file in Rensselaer At Hartford Library

    Approved by the Seminar Advisor, Prof. Brice N. Cassenti

    ______________________

    Rensselaer At Hartford

    Hartford, Connecticut

    December 2003

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    2/53

    2

    Table of Contents

    List Of Figures .......................................................................................................... 3

    1.0 Objective............................................................................................................... 5

    2.0 Development of the Elastica Continuum Equilibrium ............ 5

    3.0 Bezier Curve Development ....................................................................... 7

    3.1 Bezier CurveRadius of Curvature ....................................................................... 11

    3.2 Bezier Curve - Control Points................................................................................. 13

    3.3 Bezier Curve - Frenet Frames ................................................................................ 16

    3.3.1 Frenet FrameUnit Tangent Vector ............................................................... 193.3.2 Frenet FrameBi-Normal Vector ................................................................... 19

    3.3.3 Frenet FramePrincipal Normal Vector......................................................... 20

    3.4 Bezier CurvePhysical Reference Frame ............................................................. 24

    3.4.1 Physical Reference FrameTangent Vector ................................................... 253.4.2 Physical Reference FrameBi-Normal Vector .............................................. 25

    3.4.3 Physical Reference FrameNormal Vector ................................................... 26

    4.0 Total Stored Strain Energy and Potential Energy ................... 26

    4.1 Stored Strain Energy of Bending ............................................................................ 26

    4.2 Stored Strain Energy of Torsion ............................................................................. 27

    4.3 Gravity Potential Energy ........................................................................................ 28

    4.4 Extension Potential Energy..................................................................................... 28

    4.5 Numerical Integration of the Energy Equation ...................................................... 28

    5.0 Nelder-Mead Optimization..................................................................... 29

    6.0 Computer Program Architecture ....................................................... 30

    7.0 Results .................................................................................................................. 33

    8.0 Conclusions ....................................................................................................... 40

    9.0 References.......................................................................................................... 40

    Appendix AFORTRAN ProgramElastica Equilibrium..... 41

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    3/53

    2

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    4/53

    3

    List Of Figures

    Figure 1: Schematic Illustration of Elastic Continuum Centerline with Initial Boundary

    Conditions ................................................................................................................... 6Figure 2: Schematic illustration of Elastic Continuum Centerline with twisting moments

    boundary conditions, the gravity potential is relative to the Global Z coordinate. ..... 6Figure 3: Seventh Order Pascal's Triangle ......................................................................... 8Figure 4: Isometric view of Fourth Order Bezier Curve with Control Points: P0, P1, P2,

    and P3.......................................................................................................................... 9

    Figure 5: XY Plane view Fourth Order Bezier Curve ..................................................... 10

    Figure 6: YZ Plane View Fourth Order Bezier Curve ..................................................... 10Figure 7: ZX Plane View Fourth Order Bezier Curve ..................................................... 11

    Figure 8: Example Diagram of Radius of Curvature for three non-collinear points ....... 12

    Figure 9: (a) Initial Bezier Control Points (b) Optimized Bezier Control Points, after 1st

    iteration ..................................................................................................................... 14Figure 10: (a) Manipulation of Bezier Control Points after first Optimized iteration (b)

    Second set of Bezier Control Points ......................................................................... 15Figure 11: (a) Second Set of Bezier Control Points (b) Optimized Bezier Control Points,

    after 2nd iteration ...................................................................................................... 15

    Figure 12: (a) Manipulation of Bezier Control Points after second Optimized iteration (b)

    Third set of Bezier Control Points ............................................................................ 16Figure 13: Frenet Frame moving Trihedral and Bezier Curve Relationship ................... 16

    Figure 14: Bezier Curve with Frenet Frames at Each Integration Point .......................... 17

    Figure 15: Bezier Curve with Frenet Frames at Each Integration Point (xy plane view) 17

    Figure 16: Bezier Curve with Frenet Frames at Each Integration Point (yz plane view) 18Figure 17: Bezier Curve with Frenet Frames at Each Integration Point (zx plane view) 18

    Figure 18: Flexible Hose (Bezier Curve) with Frenet Frames Bi-Normal and Normal

    End Fibers ................................................................................................................. 21Figure 19: Close-up of End of the Flexible Hose (Bezier Curve) with Frenet Frames Bi-

    Normal and Normal End Fibers ................................................................................ 22

    Figure 20: Flexible Hose with Frenet Frames Bi-Normal and Normal End Fibers (xy

    plane)......................................................................................................................... 22

    Figure 21: Flexible Hose with Frenet Frames Bi-Normal and Normal End Fibers (yz

    plane)......................................................................................................................... 23

    Figure 22: Flexible Hose with Frenet Frames Bi-Normal and Normal End Fibers (zxplane)......................................................................................................................... 23

    Figure 23: Flow chart of Brake Hose Path Optimization Module ................................... 32

    Figure 24: Isometric View of Elastic Continuum Equilibrium Positions with 0-degree

    Twist, 30-degree Twist, 180-degree Twist Angles ................................................... 33Figure 25: Top View of Elastic Continuum Equilibrium Positions with 0-degree Twist,

    30-degree Twist, 180-degree Twist Angles .............................................................. 33

    Figure 26: Side View of Elastic Continuum Equilibrium Positions with 0-degree Twist,30-degree Twist, 180-degree Twist Angles .............................................................. 34

    Figure 27: Front View of Elastic Continuum Equilibrium Positions with 0-degree Twist,

    30-degree Twist, 180-degree Twist Angles .............................................................. 34

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    5/53

    4

    Figure 28: Isometric ViewElastic Continuum Equilibrium Position for Positive Input

    Twist Angles from 0 to positive 20 degrees by 1 degree Increments ....................... 35Figure 29: Top View - Elastic Continuum Equilibrium Position for Positive Input Twist

    Angles from 0 to positive 20 degrees by 1 degree Increments ................................. 35

    Figure 30: Side View - Elastic Continuum Equilibrium Position for Positive Input Twist

    Angles from 0 to positive 20 degrees by 1 degree Increments ................................. 36Figure 31: Front View - Elastic Continuum Equilibrium Position for Positive Input Twist

    Angles from 0 to positive 20 degrees by 1 degree Increments ................................. 36

    Figure 32: Isometric View - Elastic Continuum Equilibrium Position for NegativeSweeping Input Twist Angles from 0 to negative 20 degrees by 1 degree Increments

    ................................................................................................................................... 37

    Figure 33: Top View - Elastic Continuum Equilibrium Position for Negative Input TwistAngles from 0 to negative 20 degrees by 1 degree Increments ................................ 37

    Figure 34: Side View - Elastic Continuum Equilibrium Position for Sweeping Input

    Twist Angles from 0 to negative 20 degrees by 1 degree Increments ...................... 37

    Figure 35: Front View - Elastic Continuum Equilibrium Position for Sweeping Input

    Twist Angles from 0 to negative 20 degrees by 1 degree Increments ...................... 38Figure 36: Isometric ViewElastic Continuum Vertical Translation Displacement of

    Ending Boundary Condition ..................................................................................... 38Figure 37: Top ViewElastic Continuum Vertical Translation Displacement of Ending

    Boundary Condition .................................................................................................. 39

    Figure 38: Side view - Elastic Continuum Vertical Translation Displacement of Ending

    Boundary Condition .................................................................................................. 39Figure 39: Front view - Elastic Continuum Vertical Translation Displacement of Ending

    Boundary Condition .................................................................................................. 39

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    6/53

    5

    1.0 Objective

    The purpose of this seminar paper is to construct a computer model of a flexible elastic

    continuum configured to minimize the sum of its elastic strain and gravitational potentialenergies. This computer model will be a FORTRAN based numerical analysis program

    for predicting the equilibrium position of an elastic continuum in three dimensionalspace. The function to be minimized will contain an integral over a curve of prescribedlength representing the centerline of the elastic continuum. The so-called Direct Methods

    for the solution of the problem has been chosen because of their simplicity, a more

    conservative approach than that afforded by the Indirect Methods, which rely on the

    solution of a system of ordinary differential equations subject to two-point boundaryconditions.

    The minimization will be done by a relaxation method implemented by the use of a

    Nelder-Mead downhill simplex optimization, which are available for the unconstrainedoptimization of smooth functions of even a large number of parameters, which will

    minimize an objection function that consist of the stored strain energy and potentialenergy of the elastic continuum. As those parameters are chosen the coordinates ofcontrol points of a sequence of Bezier curves of increasingly higher degrees order,

    increasing until convergence is obtained. By starting with curves of low degree

    convergence to a relative minimum is expected to arrive quickly, which corresponds toless-contorted elastic continuums than other relative minima, which may be present.

    2.0 Development of the Elastica Continuum Equilibrium

    In more detail, given two points in space, Ri and Rf, two unit tangent vectors (directional

    vectors) attached to these points, Ti and Tf, and two unit orientation vectors iand fperpendicular to Ti and Tf, respectively. An elastic continuum is configured with a freelength L0 between these two points in such a way that the tangents to the centerline of the

    elastic continuum are parallel to the two vectors at its end points, and such that the

    twisting moments maybe applied at the end points about the tangency vectors, and suchthat the stored energy of the elastic continuum is minimal.

    Figure 1 illustrates schematically the relationship between the centerline of the flexible

    hose and their associated boundary conditions. This figure shows the initial routing of

    the centerline of the flexible hose with a starting point (P 0), starting direction vector point(P1), ending point (P4) and ending direction vector point (P4).

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    7/53

    6

    Figure 1: Schematic Illustration of Elastic Continuum Centerline with Initial Boundary Conditions

    Figure 2: Schematic illustration of Elastic Continuum Centerline with twisting moments boundary

    conditions, the gravity potential is relative to the Global Z coordinate.

    The centerline of the elastic continuum will be based on a Bernstein-Bezier Curve [1].

    The initial routing will be based on four control points; starting point, starting tangentialpoint, ending point, and ending tangential point. The location of these initial starting and

    ending tangential points shall be based on the average distance between the start point

    (P0) and the end point (P3). Additional control points will be added to reach a stable free

    equilibrium state of the flexible hose that has the least total strain energy. The followingsection discusses the development of the Bernstein-Bezier curve and the addition of more

    control points.

    P3

    P

    P2P0

    P3P

    P2

    P0

    1

    2

    Z

    Y

    X

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    8/53

    7

    3.0 Bezier Curve Development

    The initial routing of the elastica continuums centerline shall consist of a Bernstein-

    Bezier Curve given the following relationship:

    where C(t) is a vector from the global origin that traces out the Bernstein-Bezier curve

    and Pi are the control points and Bi,n are the Bernstein polynomials [1, 2, and 3] Thestarting point is represented as P0 and the ending point is represented as Pn. The starting

    directional vector is the tangential starting vector from point P0 and point P1. The ending

    directional is the tangential ending vector from Pn to point Pn-1. The t variable goes from

    zero to unity and the number of divisions between zero and unity are called integrationpoints. The Bernstein-Bezier module shall be able to develop a Bezier Curve based on

    the input of any number of control points.

    The initial boundary conditions for the initial Bezier Curve shall be based on only fourpoints consisting of a starting point, ending point, and two control points. The distance to

    the two control points shall be on the average distance between the start and end points.

    The Bernstein polynomials are defined by:

    where

    i

    nis a binomial coefficient. The Bernstein polynomials of degree n form a basis

    for the power polynomials of degree n. The first few polynomials are:

    n

    i

    nii tBPtC0

    ,)()(

    3

    3,3

    2

    3,2

    2

    3,1

    3

    3,0

    2

    2,2

    2,1

    2

    2,0

    1,1

    1,0

    0,0

    )(

    13)(

    13)(

    1)()(

    12)(

    1)(

    )(

    1)(

    1)(

    ttB

    tttB

    tttB

    ttBttB

    tttB

    ttB

    ttB

    ttB

    tB

    inini tti

    ntB

    1)(

    ,

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    9/53

    8

    The valve of the binomial coefficient,

    i

    n, is given by

    !)!(

    !

    iin

    n

    i

    n

    which also can be represented as a triangle of numbers arranged in staggered rows know

    as Pascals triangle. Figure 3provides a seventh order Pascals triangle.

    1

    1 1

    1 2 1

    1 3 3 1

    1 4 6 4 1

    1 5 10 10 5 1

    1 6 15 20 15 6 1

    Figure 3: Seventh Order Pascal's Triangle

    For the initial routing of the elastic continuum, the Bezier curve shall be made up of fourpoints, starting point (P0) and starting vector point (P1); and ending point (P4) and ending

    vector point (P3) the binominal coefficients are associated with the third row of the

    Pascals triangle. Therefore, resulting in a 3rd order Bernstein-Bezier Curve equation,

    using the fourth row of the Pascals triangle and the Bernstein-Bezier polynomial

    becomes:

    3032

    2

    2

    1

    03

    0)1(1131311)( ttPttPttPttPtC

    Following this same pattern and using Pascals triangle for the polynomial coefficients,for additional control points being added to define the Bezier curve, a fourth order

    Bernstein-Bezier Curve equation would be given as:

    40

    4

    31

    3

    22

    2

    13

    1

    04

    0 )1(1)1(4)1(6)1(4)1(1)( ttPttPttPttPttPtC

    As the more control points are added to the Bezier Curve then the order of the Bernstein

    polynomials are proportional to the number of control points. The addition of more

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    10/53

    9

    control points to define the Bezier Curve will be necessary to determine a stable

    equilibrium position of the elastic continuum with the least strain energy. Additionalcontrol points shall be added to the Bezier Curve until the optimization routine has

    reached an overall minimum energy state.

    Figure 4 shows an example of a third order Bezier Curve with 100 integration pointsalong the length of the curve. Figure 5 through Figure 7 provide the XY, YZ, and ZX

    plane views of the Bezier Curve, respectively.

    Figure 4: Isometric view of Fourth Order Bezier Curve with Control Points: P0, P1, P2, and P3

    Bezier Curve Points

    Starting Directional Vector

    Ending Directional Vector

    P3 (end point)

    P2

    P0 start oint

    P1

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    11/53

    10

    Figure 5: XY Plane view Fourth Order Bezier Curve

    Figure 6: YZ Plane View Fourth Order Bezier Curve

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    12/53

    11

    Figure 7: ZX Plane View Fourth Order Bezier Curve

    3.1 Bezier CurveRadius of Curvature

    The radius of curvature at each integration point along the Bezier Curve shall be

    determined geometrically from each successive and previous integration point. This can

    be described as an osculating circle as it is rolling along the 3-D Bezier Curve and

    passing through three unique non-collinear points. Using the fact that the length of an arcon the circumference of the osculating circle is equal to the angle (in radians) included by

    that arc at the center of the circle times the radius of the circle, where the length of the arc

    is approximated by the sum of the two distances from P(n) to the mid-points of the chordsjoining it with P(n-1) and P(n+1). The center of the osculating circle is at the intersection

    of three planes, the two planes perpendicular to the two chords through their midpoints,

    and the osculating plane. The osculating circle is uniquely determined by the fact that it

    passes through the three points P(n-1), P(n), and P(n+1). The osculating circle lies in thisosculating plane that is made up of these unique three non-collinear points.

    Figure 8 provides an example diagram for the radius of curvature calculation for three

    non-collinear points. This diagram is provided for an illustration supporting thefollowing calculations steps for determining the radius of curvature.

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    13/53

    12

    Figure 8: Example Diagram of Radius of Curvature for three non-collinear points

    The numbers shown in Figure 8 are used as an example calculation for determining the

    radius of curvature formulation. First the pre-vector and post-vector around the subject

    radius of curvature point are determined:

    Pre-Vector P(n-1) to P(n) ==> V1 = 50i + 13j + 0k

    Post-Vector P(n) to P(n+1) ==> V2 = 50i13j + 0k

    Next the dot product between these two vectors are determined by the following

    relationship:

    zzyyxx VVVVVVVV 21212121

    = (50)*(50) + (13)(-13) + (0)(0)

    = 2500 - 169= 2331

    The magnitudes of the pre-vector (V1) and the post-vector are now determined by thefollowing relationships:

    Magnitude of V1 vector is

    2221111 zyx VVVV

    = [(50)^2+(13)^2+(0)^2]^0.5=51.6623

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    14/53

    13

    Magnitude of V2 vector is

    2222222 zyx VVVV

    = [(50)^2+(13)^2+(0)^2]^0.5=51.6623

    To determine the angle () between the pre-vector and post-vector, which is also theangle between the perpendicular planes at the mid-chord points, the following InnerProduct formula is used:

    21

    21)cos(

    VV

    VV

    cos() = 2331 / (51.6623 * 51.6623)

    cos() = 0.87336

    = 29.148 degrees (0.5087 radians)

    Finally, to calculate the Radius of Curvature, it is assumed that small angle theory

    applies, such the following relationships can be evaluated:

    rvatureradiusOfCu

    arcLengthsin

    for small angles sin()=; therefore,

    arcLengthrvatureradiusOfCu

    Radius of Curvature = 50 / 0.5087

    Radius of Curvature = 98.289

    Notice for this particular example there is a slight error in the radius of curvature (98.289

    versus 100), this is caused the fairly large angle of 30 degrees relative to the radius ofcurvature. The smaller the included angle (i.e. finer resolution of points) should result in

    negligible errors.

    3.2 Bezier Curve - Control Points

    The following section describes the procedure for adding more control points to theBezier Curve for the expenditure for convergence of the least strain energy of the flexible

    continuum. After each optimization run for determining of the least strain energy, the

    current energy computation will be compared to previous least strain energy calculation,the system will reach a convergence value of the overall least strain energy when the

    variation of the strain energies between consecutive optimization runs reaches a

    predetermined critical tolerance.

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    15/53

    14

    Figure 9 (a) shows schematically the initial Bezier control points, start point and end

    point, and two control points. These two initial control points are on a tangent vector tothe start and end points of the Bezier Curve. These sketches are only to illustrate

    purposes to describe the procedure for adding more control points to the Bezier curve.

    Figure 9 (b) shows the Bezier control points shown in red after the initial location control

    points have been modified by the Nelder-Mead optimization to the minimize the strainenergy location.

    Figure 9: (a) Initial Bezier Control Points (b) Optimized Bezier Control Points, after 1st iteration

    Figure 10 (a) shows the dimensional rules for programmatically adding more control

    points after the Nelder-Mead Optimization. After the first Nelder-Mead optimization two

    additional will be added programmatic resulting in a Bezier Curve will be made up offour control points and a start and end point. Figure 10 (b) shows the resulting newcontrol points will be passed into the Nelder-Mead Optimization routine for manipulation

    to determine the least energy state. Notice that the P1 and the P4 points remain on a

    tangency vector relative to the starting and ending points on the Bezier Curve and canvary in only one direction along this tangency vector. The other control points P2 and P3

    are allowed to move freely in 3-D space (x, y, and z). Figure 11(a) and Figure 11(b)

    schematically illustrates the new optimized positions of the control points after runningthe Nelder-Mead optimization on the least strain energy.

    (a) (b)

    P2

    P0 P3

    P1

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    16/53

    15

    Figure 10: (a) Manipulation of Bezier Control Points after first Optimized iteration (b) Second set of

    Bezier Control Points

    Figure 11: (a) Second Set of Bezier Control Points (b) Optimized Bezier Control Points, after 2nd

    iteration

    These iterations add more control points continues until the total strain energy level

    between consecutive is within an acceptable tolerance value. This acceptable tolerance

    value will be determined at a later time and may need to be adjusted during testing and

    validation of the system. Figure 12 shows the procession of the next set of control pointsbeing added to the Bezier Curve, this procession adds control points until convergence of

    the strain energy is achieved.

    (a) (b)

    (b)(a)

    P0

    P2

    P1

    P3

    P4

    P5

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    17/53

    16

    Figure 12: (a) Manipulation of Bezier Control Points after second Optimized iteration (b) Third set

    of Bezier Control Points

    3.3 Bezier Curve - Frenet Frames

    The Frenet frame is an orthogonal coordinate system (trihedral) that is moving down the

    Bezier Curve and rotating about the tangent vector. An elastic continuum is a

    unidimensional piece of material which can be mathematically modeled by a curve in

    space, together with extra information about its twist, that is, how longitudinal lines onthe edge of the elastic continuum wind around it. This Frenet frame is made up of a unit

    tangent vector, principal normal vector, and bi-normal vector. Figure 13 shows the unit

    vectors of the Frenet frame moving trihedral relative to the forward direction of the

    Bezier Curve.

    Figure 13: Frenet Frame moving Trihedral and Bezier Curve Relationship

    Next applying these Frenet Frames to a 3-D Bezier Curve with twenty integrations points

    and boundary condition of a starting point at point(0;0;10), starting directional vector at

    (a) (b)P0

    P1

    P2

    P3

    P4 P5

    P6

    P7

    P8

    P9

    T

    N

    B

    P

    Bezier Curve

    (flexible hose centerline)

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    18/53

    17

    vector(0;cos(45);sin(45)), ending point at point(10;20;0), and ending directional vector at

    vector(-1;0 ; 0) with two control points located at the average distance between the startpoint and ending point of 12.247. Figure 14 shows an isometric view of this Bezier

    Curve with twenty integrations points and a Frenet Frame at each of these integrations

    points. Figures 15 through 17 show the Bezier Curve and Frenet Frames for the xy plane,

    yz plane, and zx plane views, respectively.

    Figure 14: Bezier Curve with Frenet Frames at Each Integration Point

    Figure 15: Bezier Curve with Frenet Frames at Each Integration Point (xy plane view)

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    19/53

    18

    Figure 16: Bezier Curve with Frenet Frames at Each Integration Point (yz plane view)

    Figure 17: Bezier Curve with Frenet Frames at Each Integration Point (zx plane view)

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    20/53

    19

    3.3.1 Frenet FrameUnit Tangent Vector

    Let C = C(t) be a space curve that is given by the Bezier-Bernstein polynomials, and =(dC/dt) / |dC/dt| the unit tangent vectorat point P. Then the unit tangent vectorat point P

    can be determined numerically by the following differentiation relationship:

    kTjTiTdtdC

    dtdCT

    n

    tzntz

    n

    tynty

    n

    txntx

    dt

    dC

    kn

    tzntzj

    n

    tyntyi

    n

    txntx

    dt

    dC

    zyx

    /

    /

    /1

    /1

    /1

    /1

    /1

    /1

    /1

    /1

    /1

    /1

    /1

    /1

    2/1222

    where:

    ktzjtyitxtC )()()()(

    t = integration point varies from 0 to 1

    n = number of integration points along the Bezier Curvex(t) = current x-component coordinate

    x(t+1) = leading x-component coordinate

    y(t) = current y-component coordinatey(t+1) = leading y-component coordinate

    z(t) = current z-component coordinatez(t+1) = leading z-component coordinate

    i, j, and k = unit vectors in x,y, and z, respectively

    3.3.2 Frenet FrameBi-Normal Vector

    The bi-normal vectoris perpendicular to the osculating circle datum plane that is

    determined from the three non-collinear points used to calculate the radius of curvature.Therefore, the direction of the bi-normal vectorcan be readily determined by the cross

    product of the pre-vector (V1) to the post-vector (V2):

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    21/53

    20

    zyx

    zyx

    zyx

    VVV

    VVV

    kji

    VV

    kBjBiBVV

    VVB

    222

    111

    21

    21

    21

    Using the example for the non-collinear points shown in Figure 8, the following

    computations are performed:

    kjiVV

    VVB

    VV

    kjiVV

    kjiVV

    kjiVV

    kji

    VV

    10021

    21

    13000021

    13000021

    )50)(13()13)(50()50)(0()0)(50()13)(0()0)(13(21

    1350

    1350

    050

    050

    013

    01321

    01350

    01350

    21

    2/1222

    3.3.3 Frenet FramePrincipal Normal Vector

    Theprincipal normal vectoris orthogonal to both the bi-normal vectorand the tangent

    vector; therefore, theprincipal normal vectorcan readily be determined by the cross

    product:

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    22/53

    21

    kNjNiNN

    TTT

    BBB

    kji

    TBN

    zyx

    zyx

    zyx

    Now, N = B x T is the third unit vector perpendicular to both T and N. Thus, at each

    point of the curve we have a right-handed set of orthogonal unit vectors, T, N, and B. As

    a point transverses the Bezier Curve, we have a moving orthogonal coordinate systemTNB.

    To better understand the behavior of the Frenet Frames at each of the integrations points

    along the Bezier Curve, a solid flexible hose was created with outer solid fibers on theend bi-normal and normal vectors of the Frenet Frame. Figure 18 shows an illustration of

    the flexible hose solid with end solid fibers on the normal and bi-normal of the FrenetFrames. Figure 19 provides a close up view of the flexible hose end condition.

    Figure 18: Flexible Hose (Bezier Curve) with Frenet Frames Bi-Normal and Normal End Fibers

    Normal Vector

    Outer Fiber

    Bi-Normal Vector

    Outer Fiber

    Flexible Hose

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    23/53

    22

    Figure 19: Close-up of End of the Flexible Hose (Bezier Curve) with Frenet Frames Bi-Normal and

    Normal End Fibers

    Figure 20: Flexible Hose with Frenet Frames Bi-Normal and Normal End Fibers (xy plane)

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    24/53

    23

    Figure 21: Flexible Hose with Frenet Frames Bi-Normal and Normal End Fibers (yz plane)

    Figure 22: Flexible Hose with Frenet Frames Bi-Normal and Normal End Fibers (zx plane)

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    25/53

    24

    3.4 Bezier CurvePhysical Reference Frame

    The Bezier Curve physical reference frame ( 'T

    , 'N

    , and 'B

    ) is the unrotated orthogonal

    reference frame that travels along the Bezier Curve, which is derived from the Frenet

    Frame. It may be recalled that any curve in space is characterized at each point by a

    curvature and torsion. This torsion (which we shall not use) should not be confused withthe torsional deformation, which is the twisting of the flexible hose about its axis. The

    flexible hoses torsional deformation is relative to the physical reference frame in lieu ofthe Frenet frame. Therefore, the physical reference frame is derived from the Frenet

    Frame by unrotating the bi-normal and the normal vectors about the tangent vector by the

    integral of the torsion rate with respect to s from 0 to the length, L of the elasticcontinuum.

    SinceB

    is a unit vector, dB

    /ds, if not zero, must be perpendicular toB

    . Hence dB

    /ds is

    perpendicular to T

    as well as B

    and therefore must be parallel to B

    xT

    =N

    . Therefore,

    the torsion angle can be determined from the following relationship:

    Nds

    Bd

    where is a scalar called the torsion of curve at P. The minus sign is introduced so that

    when is positive, dB

    /ds has the direction of - N

    ; then, as point P moves along the

    Bezier Curve in the positive direction, B

    revolves about T

    in the same sense as the right-

    hand rule in the direction ofT

    .

    Now, the following sets of equations are used to numerically to determine the torsionangle, , of the Frenet Frame as a function of the positions along the Bezier Curve:

    kBjBiBdt

    Bd

    kn

    tBntBj

    n

    tBntBi

    n

    tBntB

    dt

    Bd

    zyx

    zzyyxx

    /1

    )()/1(

    /1

    )()/1(

    /1

    )()/1(

    then,

    dtCd

    dtBd

    dtds

    dtBd

    ds

    dt

    dt

    Bd

    ds

    Bd

    /

    /

    /

    /

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    26/53

    25

    so,

    kBjBiBdsBd

    kdtdC

    Bj

    dtdC

    Bi

    dtdC

    B

    ds

    Bd

    zyx

    zyx

    '''

    /

    /

    /

    therefore, the torsion of the Frenet Frame at each point along the Bezier Curve is derived

    by the following,

    )'''( zzyyxx NBNBNB

    Nds

    Bd

    NNNds

    Bd

    3.4.1 Physical Reference FrameTangent Vector

    Since the physical reference frames unit tangent vector is identical to the Frenet framesunit tangent vector then,

    z

    y

    x

    z

    y

    x

    TT

    T

    TT

    T

    ''

    '

    3.4.2 Physical Reference FrameBi-Normal Vector

    The physical reference frames unit bi-normal vector is transformed about the unit

    tangent vector by the integral of the torsion using the transformation matrix relationship,

    z

    y

    x

    z

    y

    x

    z

    y

    x

    zzz

    yyy

    xxx

    z

    y

    x

    B

    B

    B

    N

    N

    N

    B

    B

    B

    BNT

    BNT

    BNT

    B

    B

    B

    *)cos(*)sin(

    '

    '

    '

    1

    0

    0

    )cos()sin(0

    )sin()cos(0

    001

    '

    '

    '

    00

    00

    00

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    27/53

    26

    3.4.3 Physical Reference FrameNormal Vector

    The physical reference frames normal vector is transformed about the unit tangent vectorby the integral of the torsion using the cross product of B x T = N relationship,

    kTBTBjTBTBiTBTB

    N

    NN

    kTT

    BBj

    TT

    BBi

    TT

    BB

    N

    N

    N

    TTT

    BBB

    kji

    TB

    N

    N

    N

    xyyxxzzxyzzy

    z

    y

    x

    yx

    yx

    zx

    zx

    zy

    zy

    z

    y

    x

    zyx

    zyx

    z

    y

    x

    )''''()''''()''''(

    '

    '

    '

    ''

    ''

    ''

    ''

    ''

    ''

    '

    '

    '

    '''

    '''

    '

    '

    '

    4.0 Total Stored Strain Energy and Potential Energy

    The equilibrium position of the flexible hose shall be based on an energy approach of the

    total stored strain energies and the potential energies of the elastic continuum. The totalenergy is made up of the stored strain energy of bending (UB), stored strain energy of

    torsion (UT), gravity potential (Vg), and extension potential (VE). Then the total elastic

    strain energy is found by integrating the elastic strain energy through the entire arc lengthof Bezier curve. Therefore, the total energy is the summation of all the individual energyterms:

    EgTBtotal VVUUE

    The bending strain energy is directly proportional to the inverse of radius of curvature

    squared at points of the Bezier Curve. The torsion strain energy is directly proportionalto the angle of twist per unit length. The gravity potential is associated with the mass

    density relative to the elevation above an inertial reference frame. The extension

    potential energy is due to the addition of additional length to the original free equilibrium

    length of the flexible hose. A numerical Simpsons Rule of integration or summation ofthe differential energies will be utilized to solve the integration of the total strain energy.

    4.1 Stored Strain Energy of Bending

    The stored strain energy of bending is readily determined by integration along the lengthof the Bezier Curve and determining the radius of curvature at each point of the Beizer

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    28/53

    27

    Curve. The stored strain energy of bending is also a function of the bending rigidity of

    the flexible continuum. The following equation shall be used to calculate the storedstrain energy of bending:

    dsasdU

    dsasU

    B

    l

    B

    2

    1

    2

    0

    1

    1

    2

    1)(

    1

    2

    1)(

    where:

    a1 = Bending Rigidity (EI)

    E = Modulus of Elasticity

    I = area momentum of interia

    = radius of curvaturel = length of flexible hose

    Although, the initial iterations are to determine the free length equilibrium length of the

    flexible hose with the least strain energy, the initial length is first determined by the

    boundary conditions described in the Bezier Curve Development section.

    4.2 Stored Strain Energy of Torsion

    The stored strain energy of torsion is readily determined by integrating along the length

    of the Bezier Curve and the degree of twist angle per unit length. The following equation

    shall be used to calculate the stored strain energy of torsion:

    dsds

    dasdU

    dsds

    dasU

    r

    l

    T

    2

    2

    0

    2

    2

    2

    1)(

    2

    1)(

    where:

    a2 = torsional rigidity (GJ/L)

    G = shear modulus

    J = polar area momentum of inertia

    ds

    ddegree of twist angle per unit length

    l = length of flexible hose

    During the initial iteration to determine the free equilibrium length of the flexible hosewith the least strain energy, the degree of twist angle per unit length is zero. Since the

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    29/53

    28

    twist is evenly distributed throughout the length of the flexible hose, then the derivative

    of d/ds equals a constant that is the total twist angle divided by the total arc length.

    4.3 Gravity Potential Energy

    The gravity potential energy is associated with a vertical force caused by gravity pulling

    the flexible hose in the negative Z-direction.

    AdsygdV

    AdsygV

    b

    l

    B

    0

    where:

    g = gravitational constant (9810 mm/sec2)

    = flexible hose density

    A = constant cross-sectional area

    4.4 Extension Potential Energy

    The extension potential energy term is associated with elongation potential energy of the

    elastic continuum. Prior to adding this extensional potential energy the Nelder-Mead

    optimization routine was seeking an minimal energy state at infinity, therefore, it asnecessary to constrain the elastic continuum by adding an elastic axial stiffness energy

    term. The following equation shall be used to determine the extension potential energy:

    2

    03)(

    2

    1LLaVE

    where:

    a3 = extension potential constant (AE/L)

    A = cross sectional areaE = Modulus of Elasticity

    L = new addition length

    L0 = original equilibrium free length

    4.5 Numerical Integration of the Energy Equation

    The numerical integration of the energy equation will be calculated by the summation ofthe differential elements (ds) along the centerline of the Bezier Curve.

    E

    n

    i

    gtbtotal VdVdUdUE 1

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    30/53

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    31/53

    30

    fixedP

    TnPP

    nP

    nP

    nP

    P

    P

    P

    n

    fnn

    n

    n

    n

    *)(

    )1()3(

    )2()2(

    )3()1(

    )7()3(

    )6()2(

    )5()1(

    1

    2

    2

    2

    3

    3

    3

    The outer loop counter is one in which there are initially four control points for n=1, asshown in Figure 9, then six control points for n=2 as shown in Figure 10, and then ten

    control points for n=3 as shown in Figure 12 and this continues until convergence of the

    an energy tolerance value has been reached.

    6.0 Computer Program Architecture

    A FORTRAN computer program was developed for determining the equilibrium position

    of the elastic continuum based on assumed material properties and a given set of

    boundary conditions. The computer program architecture of the equilibrium position ofthe flexible hose has three elements: (1.) free energy state without twist or additional

    length, (2.) energy state with twist and without additional length, (3.) energy state with

    twist and additional length. Figure 23 provides the flowchart of the FORTRAN programfor determining the equilibrium path of the flexible hose with the least energy level. The

    program requires the following modules:

    1.) Initiation Simplex Module2.) Bezier Curve Module3.) Energy Equation Module4.) Nelder-Mead Optimization Module5.) Additional Bezier Curve Control Points Module

    The initiation simplex module initializes the vertices of the simplex according to thenumber of dimensions for a particular number of control points. For example, the first

    iteration through the program the number of optimizing variables which equals,

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    32/53

    31

    k=2+3*(2^n+2) were 2+3*(2^1-2) = 2. The following provide below is pseudo

    FORTRAN code for initiation of the simplex prior to conducting an optimization.

    DO 14 I=1,K+1

    DO 13 J=1,K

    VERTEX(I,J) = 0.0D013 CONTINUE

    14 CONTINUE

    DO 15 I=2,KVERTEX(I,I-1) = 1.0D0

    15 CONTINUE

    Appendix A contains the entire FORTRAN program for determining the equilibrium

    position of an elastic continuum.

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    33/53

    32

    Figure 23: Flow chart of Brake Hose Path Optimization Module

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    34/53

    33

    7.0 Results

    To study the results of the FORTRAN program, the deformation of U-shape elasticcontinuum were evaluated under different boundary conditions of twist and translation.

    The resulting centerline points of the finalized Bezier Curve were graphed in aUnigraphics CAD system and the solid elastic continuums were created. Thesepresentations of the results enable a better understanding how the elastic continuum

    behaves under different boundary conditions.

    Figure 24 through Figure 27 present the results of an elastic continuum undergoing zero,thirty, and one hundred and eighty degrees of starting twist input. The elastic continuum

    equilibrium position with zero twist shows the effects of gravity slightly having a

    downward deformation of the continuum. The thirty and one hundred and eighty degrees

    of starting twist input have an effect of the elastic continuum causing it to seek a helixpattern.

    Figure 24: Isometric View of Elastic Continuum Equilibrium Positions with 0-degree Twist, 30-

    degree Twist, 180-degree Twist Angles

    Figure 25: Top View of Elastic Continuum Equilibrium Positions with 0-degree Twist, 30-degree

    Twist, 180-degree Twist Angles

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    35/53

    34

    Figure 26: Side View of Elastic Continuum Equilibrium Positions with 0-degree Twist, 30-degree

    Twist, 180-degree Twist Angles

    Figure 27: Front View of Elastic Continuum Equilibrium Positions with 0-degree Twist, 30-degree

    Twist, 180-degree Twist Angles

    Figure 28 through Figure 31 show the results of elastic continuums in which the input

    twist angle varies from zero to positive twenty degrees by one-degree increments. Theseresults show that there is a smooth transition in the shape of the elastic continuum from

    zero to twenty degrees. This behavior of an elastic continuum matches closely withqualitative analysis of an elastic continuum.

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    36/53

    35

    Figure 28: Isometric ViewElastic Continuum Equilibrium Position for Positive Input Twist Angles

    from 0 to positive 20 degrees by 1 degree Increments

    Figure 29: Top View - Elastic Continuum Equilibrium Position for Positive Input Twist Angles from

    0 to positive 20 degrees by 1 degree Increments

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    37/53

    36

    Figure 30: Side View - Elastic Continuum Equilibrium Position for Positive Input Twist Angles from

    0 to positive 20 degrees by 1 degree Increments

    Figure 31: Front View - Elastic Continuum Equilibrium Position for Positive Input Twist Angles

    from 0 to positive 20 degrees by 1 degree Increments

    Figure 32 through Figure 36 show the results of elastic continuums in which the inputtwist angle varies from zero to negative twenty degrees by one-degree increments. These

    results show that there is a smooth transition in the shape of the elastic continuum from

    zero to negative twenty degrees except for a few positions. The optimizer failed toaccurately predict the equilibrium of the elastic continuum when imposing a negative

    twist angle. The qualitative behavior of an elastic continuum with a negative twist angleshould have equilibrium paths that in the negative z-direction.

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    38/53

    37

    Figure 32: Isometric View - Elastic Continuum Equilibrium Position for Negative Sweeping Input

    Twist Angles from 0 to negative 20 degrees by 1 degree Increments

    Figure 33: Top View - Elastic Continuum Equilibrium Position for Negative Input Twist Angles

    from 0 to negative 20 degrees by 1 degree Increments

    Figure 34: Side View - Elastic Continuum Equilibrium Position for Sweeping Input Twist Angles

    from 0 to negative 20 degrees by 1 degree Increments

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    39/53

    38

    Figure 35: Front View - Elastic Continuum Equilibrium Position for Sweeping Input Twist Angles

    from 0 to negative 20 degrees by 1 degree Increments

    Figure 36 through Figure 39 show the results of elastic continuums in which the ending

    boundary condition undergoes pure translation movement in the z-direction. These

    results show that there is a smooth transition in the shape of the elastic continuum with aninduced twist resulting from this translation movement.

    Figure 36: Isometric ViewElastic Continuum Vertical Translation Displacement of Ending

    Boundary Condition

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    40/53

    39

    Figure 37: Top ViewElastic Continuum Vertical Translation Displacement of Ending Boundary

    Condition

    Figure 38: Side view - Elastic Continuum Vertical Translation Displacement of Ending Boundary

    Condition

    Figure 39: Front view - Elastic Continuum Vertical Translation Displacement of Ending Boundary

    Condition

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    41/53

    40

    8.0 Conclusions

    It can be concluded from this seminar project that the equilibrium path of an elastic

    continuum can be satisfactorily determined using a numerical analysis energy approachcoupled with a Bezier Curve and a numerical optimization routine. However, there are

    numerical inaccuracies when the numbers of control points (optimized parameters)become greater then 8 to 10 variables.

    The results reports herein qualitatively match those of an elastic continuum (i.e. flexible

    hose) when subject to the prescribed boundary conditions. Material properties for this

    study where developed from the experimental analysis of flexible hoses under inautomobile braking systems. These material properties were slightly modified for the

    elastica to match qualitative the proper positions of equilibrium.

    9.0 References

    1. Bartels, R H., Beatty, J. C., and Barsky, B. A. Bezier Curves. Ch. 10 inAnIntroduction to Splines for Use in Computer and Geometric Modeling, San Francisco,

    CA: Morgran Kaufmann, pp. 211-245, 1998

    2. Peigl, L, Fundamental Developments of Computer Aided Geometric Design, San

    Diego, CA; Academic Press, 1993

    3. Wolfram Research, Eric Wesissteins World of Mathematics, Bezier Curve,http://mathworld.wolfram.com/BezierCurve.html

    4. Louis Brand, Vector and Tensor Analysis, John Wiley & Sons, Inc., New York (1947).

    5. A. E. H. Love,A Treatise on the Mathematical Theory of Elasticity, Dover

    Publications, New York.

    6. W. H. Press, B. P. Flannerey, S. A. Teukolsky and W. T., Vetterling, Numerical

    Recipes in FORTRAN, Second Edition, Cambridge University Press, New York (1992).

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    42/53

    41

    Appendix AFORTRAN ProgramElastica Equilibrium

    PROGRAM EKRod

    IMPLICIT NONE

    INTEGER MAXDIM, MPMAX, LEVMAX, MAXMAXDOUBLE PRECISION FTOLPARAMETER (LEVMAX=3, MAXDIM=2+3*(2**LEVMAX-2),& MPMAX=MAXDIM+1, MAXMAX=500, FTOL=1.0D-5)INTEGER I, J, ITER, NDIM, MP, BINOM(0:2**LEVMAX+1),& DEGREE, LEVEL, IMAXDOUBLE PRECISION VERTEX(MAXDIM+1,MAXDIM), X(MAXDIM), Y(MPMAX),& Tinitl(3), Tfinal(3), MARKI(3), MARKF(3),& Abend, Atwist, Aelong, L0, LENGTH,& P(0:2**LEVMAX+1,3), NORM, SCALE,& R(MAXMAX,3), C(MAXMAX,3), PI, ETA,& TEMP1, TEMP2, VECTOR(3), VEC1(3),& BEZIER, UTOTAL

    DOUBLE PRECISION mass,acc_gEXTERNAL BEZIER, UTOTALCHARACTER TITLE*72, INNAM*30, OUTNAM*30, CHAR72*72

    CHARACTER CHAR1*1LOGICAL DEBUG

    COMMON/BEZ/ P, BINOM, LEVEL, IMAXCOMMON/UTOTL/ Abend, Atwist,& Aelong, L0, C, LENGTHCOMMON/EndPnt/ Tinitl, Tfinal, MARKI, MARKF

    * Glossary** BEZIER Curve generator, an external function* BINOM() Binomial coeficients for the Bezier polynomial* C(i,j) jth coordinate of the ith grid point on the* centerline of the rod* DEGREE Degree of the Bezier polynomial and therefore one* less than the number of control points. Therefore* it equals 2**LEVEL + 1.* I, J Counters* LEVEL Counter for the outer loop, the loop in which* the number of control points increases.* LEVMAX Maximum allowable value for LEVEL* MARKI,MARKF Marks at the initial and final positions to show* where a specified ruling of the straight rod is to* be placed when it is twisted.* MAXDIM Maximum allowable value for NDIM* MP Number of vertices in the simplex* MPMAX Maximum allowed number of vertices in the simplex* NDIM The number of parameters varied by Nelder-Mead.* It equals two plus, three times four less than* the number of control points; which also equals* 2 + 3*(2**LEVEL - 2).* P(i,j) jth coordinate of the ith control point

    * SCALE Initial estimate of the size of the convex set* containing the configured rod.* TEMPi Temporary scalar variables* Tinitl() Unit vector tangent to the centerline of the rod,* pointing into the rod from its initial endpoint.* Tfinal() Unit vector tangent to the centerline of the rod,* pointing into the rod from its final endpoint.* UTOTAL total stored energy, an external function* VECi() Temporary vector variables* VECTOR() Temporary vector variable* VERTEX(i,j) jth coordinate of the ith vertex of the simplex* X(j) jth coordinate of a vertex

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    43/53

    42

    * Y() Values of the stored energy at the NDIM+1 vertices* of the Nelder-Mead simplexC-----------------------------------------------------------------------

    WRITE(*,*)'Opening results.out'WRITE(*,*)'Opening r_ctrl_pts.out'WRITE(*,*)'Opening r_curve.out'WRITE(*,*)'Opening v_bnm.out'

    WRITE(*,*)'---'OPEN(UNIT=21,FILE='results.out',STATUS='unknown')OPEN(UNIT=31,FILE='r_ctrl_pts.out',STATUS='unknown')OPEN(UNIT=91,FILE='energy.out',STATUS='unknown')

    DEBUG = .TRUE.

    PI = ACOS(-1.D0)IMAX = 496

    CC BEGIN READING INPUT DATAC

    OPEN( 35, FILE='inputs.txt', STATUS='OLD')READ( 35, 9800) TITLEWRITE(*,*)WRITE(*,*) ' The title of the input file is:'WRITE(*,*)

    WRITE(*,*) TITLEREAD( 35, 9800) CHAR72READ( 35, 9800) CHAR72READ(35,*) P(0,1), P(0,2), P(0,3)READ(35,*) P(1,1), P(1,2), P(1,3)READ(35,*) P(2,1), P(2,2), P(2,3)READ(35,*) P(3,1), P(3,2), P(3,3)READ(35,*) L0READ(35,*) MarkIREAD(35,*) MarkFREAD(35,*) AbendREAD(35,*) AtwistREAD(35,*) AelongREAD(35,*) massREAD(35,*) acc_gCLOSE(35)

    C

    C END READING INPUT DATAC

    TEMP1 = SQRT( (P(0,1)-P(3,1))**2 + (P(0,2)-P(3,2))**2 +& (P(0,3)-P(3,3))**2)IF ( TEMP1 .GT. L0*1.001) THEN

    WRITE(*,*)'The proposed initial and final points'WRITE(*,*)'of the centerline are further apart'write(*,*)'than its proposed length.'WRITE(*,*)'Please resubmit your data.'

    ELSE IF ( TEMP1 .GT. L0*1.999) THEN* Output a straight line.

    DO 7 I=1,IMAXR(I,1) = P(0,1) + ( P(3,1) - P(0,1))*(I-1)/DBLE(IMAX-1)R(I,2) = P(0,2) + ( P(3,2) - P(0,2))*(I-1)/DBLE(IMAX-1)R(I,3) = P(0,3) + ( P(3,3) - P(0,3))*(I-1)/DBLE(IMAX-1)

    7 CONTINUEGO TO 9999

    ENDIF

    * Compute the unit tangent vectors at the end-points of the* centerline of the rod.

    DO 8 J=1,3Tinitl(J) = P(1,J) - P(0,J)Tfinal(J) = P(3,J) - P(2,J)

    8 CONTINUETEMP1 = NORM(Tinitl)IF (TEMP1 .LE. FTOL) THEN

    WRITE(*,*)'Your first two points are too close together.'WRITE(*,*)'Please reenter them.'

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    44/53

    43

    GOTO 9999ENDIFTEMP2 = NORM(Tfinal)IF (TEMP2 .LE. FTOL) THEN

    WRITE(*,*)'Your last two points are too close together.'WRITE(*,*)'Please reenter them.'GOTO 9999

    ENDIF

    DO 9 J=1,3Tinitl(J) = Tinitl(J)/TEMP1Tfinal(J) = Tfinal(J)/TEMP2

    9 CONTINUE

    * Initialize the simplex.VERTEX(1,1) = TEMP1VERTEX(1,2) = TEMP2VERTEX(2,1) = TEMP1/2VERTEX(2,2) = TEMP2VERTEX(3,1) = TEMP1VERTEX(3,2) = TEMP2/2

    SCALE = ( TEMP1 + TEMP2)/2

    VECTOR(1) = P(3,1) - P(0,1)VECTOR(2) = P(3,2) - P(0,2)

    VECTOR(3) = P(3,3) - P(0,3)CALL XPROD( Tinitl, VECTOR, VEC1)TEMP1 = NORM( VEC1)CALL XPROD( Tfinal, VECTOR, VEC1)TEMP2 = NORM( VEC1)IF ( NORM(VECTOR).GT.1.D-14 .AND. TEMP1+TEMP2.LT.1.D-14) THEN

    WRITE(*,*)WRITE(*,*)'Bifurcation: Solutions to the optimization problem,'WRITE(*,*)'with the given endpoint conditions, exist but are'WRITE(*,*)'not unique.'

    ENDIF

    * Initialize BINOM.BINOM(0) = 1DO 100 I=1,LEVMAX

    BINOM(I) = 0100 CONTINUE

    * Initialize the binomial coefficients* for the cubic Bezier polynomial.

    DO 3 J=1,3DO 2 I=J,1,-1

    BINOM(I) = BINOM(I) + BINOM(I-1)2 CONTINUE3 CONTINUE

    ***** Enter the first level for a two-parameter minimization of the* stored energy.

    LEVEL = 1NDIM = 2 + 3*(2**LEVEL - 2)MP = NDIM + 1DEGREE = 2**LEVEL + 1

    * Evaluate the stored energy at each vertex of the initial simplex.

    DO 112 I=1,MPDO 111 J=1,NDIMX(J) = VERTEX(I,J)

    111 CONTINUEY(I) = BEZIER( X, NDIM)

    112 CONTINUE

    * Start the optimization by a two-parameter approximation to the* rod-configuration which minimizes its stored energy.

    CALL NELMED( VERTEX, Y, MP, MAXDIM, NDIM, FTOL, BEZIER, ITER)

    WRITE(21,*)

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    45/53

    44

    WRITE(21,'(1X,A,I5)') 'When the number of parameters was', NDIMWRITE(21,'(1X,A,I5)') 'the number of iterations was ', iterWRITE(21,'(1X,A,1X,F22.15)') 'the length of the rod was ', LENGTHWRITE(21,'(1X,A,2(1X,F22.15))') 'and the minimum was', Y(1)WRITE(21,*)'Grid points were at'DO 31, I=1,(IMAX+2)/3

    WRITE(21,9500) 3*(I-1)+1,& C(3*(I-1)+1,1), C(3*(I-1)+1,2), C(3*(I-1)+1,3)

    31 CONTINUEIF ( LEVEL .NE. LEVMAX) THEN* Invoke BEZIER one more time at this level* to leave the control points in their optimal positions.

    DO 150 J=1,NDIMX(J) = VERTEX(1,J)

    150 CONTINUETEMP1 = BEZIER( X, NDIM)

    ENDIF

    ***** Enter the LEVEL loop.DO 6000 LEVEL=2,LEVMAX

    NDIM = 2 + 3*(2**LEVEL - 2)MP = NDIM + 1DEGREE = 2**LEVEL + 1

    * Advance the binomial coefficients to* those for the DEGREEic Bezier polynomial.DO 43 J=2**(LEVEL-1)+2,DEGREE

    DO 42 I=J,1,-1BINOM(I) = BINOM(I) + BINOM(I-1)

    42 CONTINUE43 CONTINUE

    * Split the middle control points from the previous level* to form the middle control points for this level.

    DO 50 J=1,3* Move the last control point up in the array* to make room for the other new control points.

    P(DEGREE,J) = P(2**(LEVEL-1)+1,J)* Store the next to the last old control point.

    VECTOR(J) = P(2**(LEVEL-1),J)* Move it up the array, and then move it half-way towards

    * the last new control point.P(DEGREE-1,J) = ( P(DEGREE,J) + VECTOR(J))/2

    * Split the other varying old control points, using I to count* the old line-segments connecting adjacent pairs of such* control points.

    DO 52 I=2**(LEVEL-1),2,-1P(DEGREE - 2*(2**(LEVEL-1) - I + 1), J) =

    & ( 3*VECTOR(J) + P(I-1,J))/4P(DEGREE - 2*(2**(LEVEL-1) - I + 1) - 1,J) =

    & ( VECTOR(J) + 3*P(I-1,J))/4VECTOR(J) = P(I-1,J)

    52 CONTINUE* Now move the old P(1,*) half-way towards P(0,*).

    P(1,J) = (VECTOR(J) + P(0,J))/250 CONTINUE

    * Initialize the simplex as one with its first

    * vertex at the best vertex from the previous LEVEL* by transforming from the control point variables* to the optimizer variables.*

    60 CONTINUE* First take care of the first vertex, VERTEX(1,*).* Set VERTEX(1,1) equal to the inner product* of Tinitl(*) with P(1,*) - P(0,*).

    VERTEX(1,1) = 0.0D0DO 20 J=1,3

    VERTEX(1,1) = VERTEX(1,1) + Tinitl(J)*(P(1,J) - P(0,J))20 CONTINUE

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    46/53

    45

    * Initialize the remaining coordinates of the first vertex* except for its last.

    DO 21 J=1,3DO 55 I=2,DEGREE-2

    VERTEX(1, 1 + 3*(I-2) + J) = P(I,J)55 CONTINUE21 CONTINUE

    * Initialize the last coordinate of the first vertex.

    * Set VERTEX(1,NDIM) equal to the inner product* of Tfinal(*) with P(DEGREE-1,*) - P(DEGREE,*).VERTEX(1,NDIM) = 0.0D0DO 22 J=1,3

    VERTEX(1,NDIM) = VERTEX(1,NDIM) +& Tfinal(J)*(P(DEGREE-1,J) - P(DEGREE,J))

    22 CONTINUE

    * Now that the first vertex has been taken care of* initialize the remaining vertices of the simplex.

    DO 24 I=2,MPDO 23 J=1,NDIM

    VERTEX(I,J) = VERTEX(1,J)23 CONTINUE24 CONTINUE

    DO 25 I=2,MPVERTEX(I,I-1) = VERTEX(I,I-1) + SCALE/(4*LEVEL)

    25 CONTINUE

    DO 212 I=1,MPDO 211 J=1,NDIMX(J) = VERTEX(I,J)

    211 CONTINUEY(I) = BEZIER( X, NDIM)

    212 CONTINUE

    CALL NELMED( VERTEX, Y, MP, MAXDIM, NDIM, FTOL, BEZIER, iter)

    WRITE(21,*)WRITE(21,'(1X,A,I5)') 'When the number of parameters was', NDIMWRITE(21,'(1X,A,I5)') 'the number of iterations was ', iterWRITE(21,'(1X,A,1X,F22.15)') 'the length of the rod was ', LENGTHWRITE(21,'(1X,A,2(1X,F22.15))') 'and the minimum was', Y(1)

    WRITE(21,*)'Grid points were at'DO 32, I=1,(IMAX+2)/3

    WRITE(21,9500) 3*(I-1)+1,& C(3*(I-1)+1,1), C(3*(I-1)+1,2), C(3*(I-1)+1,3)

    32 CONTINUEC WRITE(*,*)'Press ENTER key to continue.'C WRITE(*,*)'Running...'* Invoke BEZIER one more time at this level* to leave the control points in their optimal positions.

    DO 250 J=1,NDIMX(J) = VERTEX(1,J)

    250 CONTINUETEMP1 = BEZIER( X, NDIM)

    IF ( LEVEL .EQ. LEVMAX) THENWRITE(*,*)'Do you want another iteration at this level? (Y/N)'READ(*,9800) CHAR1

    IF ( CHAR1.EQ.'Y' .OR. CHAR1.EQ.'y') GO TO 60ENDIF

    6000 CONTINUE***** Exit from the LEVEL loop.

    DO i=1,DEGREE+1WRITE(31,'(1X,3(F22.15,1X))') (P(i-1,j),j=1,3)

    ENDDO

    9999 WRITE(*,*)CLOSE(21)

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    47/53

    46

    CLOSE(31)STOP

    9500 FORMAT(I5,1X,3(1X,F12.6))9800 FORMAT(A)

    END

    ************************************************************************

    SUBROUTINE NELMED( VERTEX, y, mp, MAXDIM, NDIM, ftol, FUNC, iter)

    * Glossary** MAXDIM Maximum allowable value for NDIM* MP Number of vertices in the simplex* NDIM Number of parameters varied by the optimizer.* VERTEX(i,j) jth coordinate of the ith simplex.* Y(i) Value of the objective function at the vertex* of the ith simplex.*************************************************************************

    IMPLICIT NONE

    INTEGER iter, mp, NDIM, MAXDIM, NMAX, ITMAXDOUBLE PRECISION ftol, VERTEX(MAXDIM+1,MAXDIM), y(mp), FUNCPARAMETER (NMAX=189, ITMAX=40000)EXTERNAL FUNCINTEGER i, ihi, ilo, inhi, j, m,nDOUBLE PRECISION rtol, sum, swap, ysave, ytry, psum(NMAX), amotry

    iter = 01 DO 12 n=1,NDIM

    sum = 0.DO 11 m=1,NDIM+1sum = sum+VERTEX(m,n)

    11 CONTINUEpsum(n) = sum

    12 CONTINUE2 ilo = 1

    if (y(1).gt.y(2)) then

    ihi = 1inhi = 2

    ELSEihi = 2inhi = 1

    ENDIFDO 13 i=1,NDIM+1if(y(i).le.y(ilo)) ilo=iif(y(i).gt.y(ihi)) theninhi = ihiihi = i

    ELSE if(y(i).gt.y(inhi)) thenif(i.ne.ihi) inhi = i

    ENDIF13 CONTINUE

    * Test to see if NELMED has converged.

    rtol = 2.*abs(y(ihi)-y(ilo))/(abs(y(ihi))+abs(y(ilo)))IF (rtol.lt.ftol) THEN

    * NELMED has converged.swap = y(1)y(1) = y(ilo)y(ilo) = swapDO 14 n=1,NDIM

    swap = VERTEX(1,n)VERTEX(1,n) = VERTEX(ilo,n)VERTEX(ilo,n) = swap

    14 CONTINUE

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    48/53

    47

    * Exit to calling program.RETURN

    ENDIF

    c if (iter.ge.ITMAX) PAUSE 'ITMAX exceeded in NELMED'if (iter.ge.ITMAX) THEN

    PRINT*, 'ITMAX exceeded in NELMED'

    PRINT*, 'Press any key to STOP'returnendifiter = iter+2ytry = amotry(VERTEX,y,psum,mp,MAXDIM,NDIM,FUNC,ihi,-1.0D0)if (ytry.le.y(ilo)) thenytry = amotry(VERTEX,y,psum,mp,MAXDIM,NDIM,FUNC,ihi,2.0D0)

    ELSE if (ytry.ge.y(inhi)) thenysave = y(ihi)ytry = amotry(VERTEX,y,psum,mp,MAXDIM,NDIM,FUNC,ihi,0.5D0)if (ytry.ge.ysave) thenDO 16 i=1,NDIM+1if(i.ne.ilo)thenDO 15 j=1,NDIMpsum(j) = 0.5*(VERTEX(i,j)+VERTEX(ilo,j))VERTEX(i,j) = psum(j)

    15 CONTINUE

    y(i) = FUNC( psum, NDIM)ENDIF16 CONTINUE

    iter = iter+NDIMGOTO 1

    ENDIFELSEiter = iter-1

    ENDIFGOTO 2

    END

    ************************************************************************

    FUNCTION amotry(VERTEX, y, psum, mp, MAXDIM, NDIM, FUNC, ihi, fac)

    Contact: Developer Bill Johnson @ (860)394-7097 [email protected] Details on contents of this function.

    RETURNEND

    ************************************************************************

    DOUBLE PRECISION FUNCTION BEZIER( LAMBDA, NDIM)

    * Given the control points P(i,*), for a Bezier curve, and a* parameter value T for that curve, return the corresponding point* C(*) on the curve.

    ************************************************************************

    Contact: Developer Bill Johnson @ (860)394-7097 [email protected] Details on contents of this function.

    ************************************************************************

    mailto:[email protected]:[email protected]:[email protected]:[email protected]:[email protected]:[email protected]:[email protected]:[email protected]
  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    49/53

    48

    DOUBLE PRECISION FUNCTION UTOTAL( R, IMAX)* Compute the length and strain-energy of the curve R as an elastica.

    IMPLICIT NONE

    INTEGER I, IMAX, MAXMAX, JPARAMETER ( MAXMAX=500)DOUBLE PRECISION LENGTH, ENERGY, DSNEW, DSOLD, ANGLE,

    & R(MAXMAX,3), C(MAXMAX,3), XNEW(3), XOld(3),& BOld(3),& Tinitl(3), Tfinal(3), Twist, VECTOR(3),& Abend, Atwist, Aelong, L0, TauDS,& NORM, INPROD, TEMP1, BNew(3), Torse, Beta,& Perp(3), NoTwst(3), MARKI(3), MARKF(3)

    DOUBLE PRECISION mass,acc_g,z,HH

    COMMON/UTOTL/ Abend, Atwist,& Aelong, L0, C, LENGTHCOMMON/EndPnt/ Tinitl, Tfinal, MARKI, MARKF

    * Beta Angle between MARKI and the binormal in the initial* Frenet frame.

    * BOld() Binormal to the curve at the (I-1)st grid point.* BNew() Binormal to the curve at the Ith grid point.* C(i,j) jth coordinate of the ith grid point on the* centerline of the rod, duplicate of R(i,j) in order* to avoid conflict of dummy argument with COMMON* MARKI,MARKF Marks at the initial and final positions to show* where a specified ruling of the straight rod is to* be placed when it is twisted.* NoTwst() Binormal in the untwisted frame.* Perp() Vector in the osculating plane at the Ith grid point,* perpendicular to the straight line segment joining the* (I-1)th grid point with the Ith. It is that perpendicular* which makes an acute angle with the line segment joining* the Ith point with the (I+1)th point. (It differs from* the normal vector which points towards the center of* curvature.)* R(i,j) jth coordinate of the ith grid point on the

    * centerline of the rod* TauDS The increment of torsion* TEMPi Temporary variables* Tinitl Unit tangent vector in the initial Frenet frame.* Tfinal The negative of the unit tangent vector in the final* Frenet frame.* Torse Accumulated torsion* VECTOR Temporary vector*

    OPEN(UNIT=42,FILE='ds.out',STATUS='unknown')OPEN(UNIT=45,FILE='v_bnm.out',STATUS='unknown')OPEN(UNIT=46,FILE='beta.out',STATUS='unknown')

    Torse = 0XOld(1) = Tinitl(1)XOld(2) = Tinitl(2)

    XOld(3) = Tinitl(3)XNEW(1) = R(2,1) - R(1,1)XNEW(2) = R(2,2) - R(1,2)XNEW(3) = R(2,3) - R(1,3)Z = (R(1,3) + R(2,3))/2.d0DSNEW = NORM(XNEW)WRITE(42,*)DSNEWIF ( DSNEW .LT. 1.D-14) THEN

    WRITE(*,*)WRITE(*,*)'The first two grid points on the curve'WRITE(*,*)'are coincident.'

    * Return a large energy so that it will be rejected

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    50/53

    49

    * by the minimizer.ENERGY = 1.D20RETURN

    END IFCALL XPROD( Tinitl, XNEW, BOld)TEMP1 = NORM( BOld)IF ( TEMP1 .LT. 1.D-14) THEN

    WRITE(*,*)

    WRITE(*,*)'The first two grid points on the curve'WRITE(*,*)'are parallel to the initial tangent.'STOP' '

    END IFBOld(1) = BOld(1)/TEMP1BOld(2) = BOld(2)/TEMP1BOld(3) = BOld(3)/TEMP1write(45,9400)BOldCALL XPROD( BOld, XNew, Perp)Beta = ACOS( MIN( INPROD( MARKI, Bold),1.d0))IF ( INPROD( MARKI, Perp) .LT. 0.D0) Beta = - Betawrite(46,9400) Beta, TorseLENGTH = DSNEWANGLE = ACOS( MIN( INPROD( Tinitl, XNew)/DSNEW, 1.D0)) / 2ENERGY = 2 * Abend * ANGLE**2 / DSNEW - mass*length*acc_g*z

    * IF ( TEMP2 .LT. 1.D-14) THEN

    * WRITE(*,*)* WRITE(*,*)'The curve makes a 90 degree turn at its origin.'* Return a large energy so that it will be rejected* by the minimizer.* ENERGY = 1.D20* RETURN* ENDIF

    * The movement to the second grid point has been completed.

    DO 1000 I=2,IMAX-1DSOLD = DSNEWXOLD(1) = XNEW(1)XOLD(2) = XNEW(2)XOLD(3) = XNEW(3)XNEW(1) = R(I+1,1) - R(I,1)XNEW(2) = R(I+1,2) - R(I,2)

    XNEW(3) = R(I+1,3) - R(I,3)z = (R(I+1,3) + R(I,3))/2.d0DSNEW = NORM(XNEW)WRITE(42,*)DSNEWLENGTH = LENGTH + DSNEWANGLE = ACOS(MIN( INPROD( XOLD, XNEW) / (DSOLD*DSNEW), 1.D0))ENERGY = ENERGY + 2 * Abend * ANGLE**2 / ( DSOLD + DSNEW)

    & - mass*dsnew*acc_g*zCALL XPROD( XOld, XNEW, BNew)TEMP1 = NORM( BNew)IF ( TEMP1 .LT. 1.D-14) THEN

    WRITE(*,*)WRITE(*,*)'Colinear grid points at', IGO TO 900

    END IFBNew(1) = BNew(1)/TEMP1BNew(2) = BNew(2)/TEMP1

    BNew(3) = BNew(3)/TEMP1write(45,9400) BnewTauDS = ACOS( MIN( INPROD(BOld, BNew),1.d0))IF ( INPROD( Perp, BNew) .LT. 0.D0) TauDS = - TauDSTorse = Torse + TauDSwrite(46,9400) TauDS,Torse

    * Prepare for the next grid point.900 BOld(1) = BNew(1)

    BOld(2) = BNew(2)BOld(3) = BNew(3)CALL XPROD( BOld, XNew, Perp)

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    51/53

    50

    1000 CONTINUE

    * Store R-values in C in order to avoid conflict of dummy argument* with COMMON.

    DO 2000 I=1,IMAXDO 2001 J=1,3

    C(I,J) = R(I,J)2001 CONTINUE

    2000 CONTINUE

    IF( LENGTH .GT. 1.D30) THENWRITE(*,*)WRITE(*,*)'The optimizer is trying out rods of a length far'WRITE(*,*)'far greater than anything that could conceivably'WRITE(*,*)'be realistic. The grid points were at'DO 2500, I=1,(IMAX+2)/3

    WRITE(*,9500) 3*(I-1)+1,& C(3*(I-1)+1,1), C(3*(I-1)+1,2), C(3*(I-1)+1,3)

    2500 CONTINUEWRITE(*,*)WRITE(*,*)'Please re-run this program with a better guess'WRITE(*,*)'at a starting configuration.'STOP' '

    ENDIF

    ANGLE = ACOS( MIN( -INPROD( Tfinal, XNEW) / DSNEW, 1.D0)) / 2

    VECTOR(1) = - Tfinal(1)VECTOR(2) = - Tfinal(2)VECTOR(3) = - Tfinal(3)CALL XPROD( XNEW, VECTOR, BNew)TEMP1 = NORM( BNew)IF ( TEMP1 .LT. 1.D-14) THEN

    WRITE(*,*)WRITE(*,*)'The last two grid points on the curve'WRITE(*,*)'are parallel to the final tangent.'STOP' '

    END IFBNew(1) = - BNew(1)/TEMP1BNew(2) = - BNew(2)/TEMP1BNew(3) = - BNew(3)/TEMP1HH = INPROD(BOld, BNew)

    IF( INPROD(BOld, BNew).GE.1.d0) THENHH = 1.d0

    ELSEIF( INPROD(BOld, BNew).LE.-1.d0) THENHH =-1.d0

    ENDIFTauDS = ACOS( HH)IF ( INPROD( Perp, BNew) .LT. 0.D0) TauDS = - TauDSTorse = Torse + TauDSwrite(46,9400) TauDS,Torse

    CALL XPROD( BNew, VECTOR, Perp)TEMP1 = NORM( Perp)IF ( TEMP1 .LT. 1.D-14) THEN

    WRITE(*,*)WRITE(*,*)'The curve makes a 90 degree turn at its origin.'

    * Return a large energy so that it will be rejected* by the minimizer.

    ENERGY = 1.D20RETURN

    ENDIFPerp(1) = Perp(1)/TEMP1Perp(2) = Perp(2)/TEMP1Perp(3) = Perp(3)/TEMP1NoTwst(1) = COS(Beta-Torse)*BNew(1) + SIN(Beta-torse)*Perp(1)NoTwst(2) = COS(Beta-Torse)*Bnew(2) + SIN(Beta-torse)*Perp(2)NoTwst(3) = COS(Beta-Torse)*BNew(3) + SIN(Beta-torse)*Perp(3)Twist = ACOS( MIN( INPROD( NoTwst, MARKF),1.d0))IF ( INPROD( NoTwst, Perp) .LT. 0.D0) Twist = -Twist

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    52/53

    51

    UTOTAL = ENERGY + 2 * Abend * ANGLE**2 / DSNEW& - mass*dsnew*acc_g*z& + Aelong*(LENGTH - L0)**2 / 2& + Atwist * Twist**2 / ( 2 * LENGTH)

    CLOSE(42)CLOSE(45)CLOSE(46)

    9200 FORMAT(A3,3(F12.8,1x))9400 FORMAT(3(F18.10,1X))9500 FORMAT( I5, 1X, 3( 4X, E9.2))

    END

    ************************************************************************

    DOUBLE PRECISION FUNCTION INPROD(X,Y)* Compute the inner product of X and Y.

    DOUBLE PRECISION X(3), Y(3)

    INPROD = X(1) * Y(1) + X(2) * Y(2) + X(3) * Y(3)

    RETURNEND

    ************************************************************************

    DOUBLE PRECISION FUNCTION NORM(X)* Compute the length of X.

    DOUBLE PRECISION X(3)

    NORM = DSQRT( X(1)**2 + X(2)**2 + X(3)**2)

    RETURNEND

    ************************************************************************

    SUBROUTINE XPROD( X1, X2, X)* Compute the cross product X of the two vectors X1 and X2.

    DOUBLE PRECISION X1(3), X2(3), X(3)

    X(1) = X1(2) * X2(3) - X1(3) * X2(2)X(2) = X1(3) * X2(1) - X1(1) * X2(3)X(3) = X1(1) * X2(2) - X1(2) * X2(1)

    RETURNEND

    ************************************************************************

    DOUBLE PRECISION FUNCTION AACOS(X)* Compute the Arc Cosine of an angle avoiding round off errors.

    DOUBLE PRECISION X

    AACOS = ACOS(X)

    IF( AACOS.GE.1.d0) THENAACOS = 1.d0

    ELSEIF( AACOS.LE.-1.d0) THENAACOS =-1.d0

    ENDIF

    RETURNEND

    ************************************************************************

  • 7/31/2019 Numerical Analysis Energy Approach for Predicting the Equilibrium Position of an Elastic Continuum

    53/53