On the rapid calculation of tensor-based force field models

13
Copyright ©1996, American Institute of Aeronautics and Astronautics, Inc. AIAA Meeting Papers on Disc, 1996, pp. 324-335 A9627146, AIAA Paper 96-1244 On the rapid calculation of tensor-based force field models James D. Turner Turner Associates, Inc., Woburn, MA IN:AIAA Dynamics Specialists Conference, Salt Lake City, UT, Apr. 18, 19, 1996, Technical Papers (A96-27111 06-39), Reston, VA, American Institute of Aeronautics and Astronautics, 1996, p. 324-335 This paper presents fast algorithms for reducing the computational effort required for evaluating the rotation and contraction operations that arise in generalized force and torque calculations for long-range force field effects. These algorithms exploit multiple levels of symmetry in the tensors. General series expansions are presented for the generalized forces and torques. The physical models are developed by using a combination of binomial and multinomial expansion techniques. The simplified models are shown to naturally lead to Cartesian tensor-based generalized force models. (Author) Page 1

Transcript of On the rapid calculation of tensor-based force field models

Copyright ©1996, American Institute of Aeronautics and Astronautics, Inc.

AIAA Meeting Papers on Disc, 1996, pp. 324-335A9627146, AIAA Paper 96-1244

On the rapid calculation of tensor-based force field models

James D. TurnerTurner Associates, Inc., Woburn, MA

IN:AIAA Dynamics Specialists Conference, Salt Lake City, UT, Apr. 18, 19, 1996, TechnicalPapers (A96-27111 06-39), Reston, VA, American Institute of Aeronautics and Astronautics,

1996, p. 324-335

This paper presents fast algorithms for reducing the computational effort required for evaluating the rotation andcontraction operations that arise in generalized force and torque calculations for long-range force field effects. Thesealgorithms exploit multiple levels of symmetry in the tensors. General series expansions are presented for thegeneralized forces and torques. The physical models are developed by using a combination of binomial andmultinomial expansion techniques. The simplified models are shown to naturally lead to Cartesian tensor-basedgeneralized force models. (Author)

Page 1

96-1244

ON THE RAPID CALCULATION OFTENSOR-BASED FORCE FIELD

MODELS

By: James D. Turner

Turner Associates, Inc.33 Sylvanus Wood Lane

Woburn, MA 01801

I. ABSTRACT

The evaluation of long-range forcefields to produce forces and torques fordistributed systems requires nonlineareffects be computed. Typically thesephysical models are spatially discretized.The classical strategy for handling thesemodeling problems involves theintroduction of approximations for thenonlinear interactions. This approachleads to multipole tensor models.Examples of these nonlinear interactionforces include gravitational and electro-mechanical effects. The tensor modelsarise because of the presence of vectorterms in the approximate models. Thispaper presents fast algorithms for reducingthe computational effort required forevaluating the rotation and contractionoperations that arise in the generalizedforce and torque calculations for the long-range force field effects. These algorithmsexploit multiple levels of symmetry in thetensors. General series expansions arepresented for the generalized forces andtorques. The physical models aredeveloped by using a combination ofbinomial and multinomial expansiontechniques. The simplified models areshown to naturally lead to Cartesiantensor-based generalized force models.

A96-27146

I. 1 Introduction

AIAA-96-1244-CP

It is well known that approximatedynamic models for long-range interactioneffects lead to tensor-based descriptions ofthe behavioral interaction models. Severalproblems have plagued the development ofarbitrary order expansions. First, manyterms arise which makes the book keepingcumbersome. Second, general tensorinteraction models are unfamiliar topracticing engineers. Third, the apparentneed for storing large quantities of tensor-related data has been hampered by limitedcomputer memory availability. Fourth,the required multidimensional arrays usedby computer architectures have beenknown to be very slow.

This paper addresses all of theseissues, and presents a four-step process fordeveloping effective and efficienttechniques for dealing with Cartesiantensors. Section I. 3. 1 identifies theunderlying symmetry of each tensorobject. Section I. 3. 2 presents a fastalgorithm for rotating Cartesian tensorsusing an array algebra-like approach[Rauhala(SO)]. Section I. 3. 3 develops amapping strategy that allows uniquesymmetric elements to be identified fromarbitrary sets of tensor indices. Thesemapping strategies exploit multiple levelsof symmetry. The mapping strategiespermit the traditional multidimensionalarray models to be replaced with a vectorstorage strategy. Only the uniquesymmetric elements are retained in themodel. Section I. 3. 4 presents a fastalgorithm for computing contractionmapping operations. These operations arerequired to evaluate the multipoleinteractions arising in the force and torquecalculations. This Section also presents

Copyright * 1996 by James D. Turner. Published by theAmerican Institute of Aeronautics and Astronautics, Inc. with permission

324

algorithms for exploiting multiple levels ofsymmetry during the contractionoperations.

Section n. 1 presents a long-rangeforce model that is used to develop anapproximate model based on a Cartesiantensors. Section n. 2 presents atraditional binomial expansion-basedapproach for expanding the long-rangeforce models. Section n. 2. 1 presents amultinomial expansion-based approach forproviding closed-form expressions for thetensor-based contraction maps required inthe approximate generalized forces.Sections n. 3 and n. 4 present anarbitrary order expansion model for thelong-range forces and torques actingbetween distributed bodies. Conclusionsare presented in Section IQ.

I. 2 Traditional Tensor Models

Traditional approaches for dealingwith Cartesian tensors are conceptuallystraightforward, and naturally lead tomultilinear algebras of the form:

N

where p, denotes the parameter that scalesthe spatial part of the tensor, Rs denotesthe position vector that locates the s pointin the body relative to the bodies referencepoint, and ( R, )m denotes the m*component of the enclosed 3x1 vectorquantity. Because modern workstationsprovide multidimensional data structures( i.e. , up to 20 dimensions in an array) itis easy to match up the indices of a tensorwith the computer array structure. Thechallenge is to restructure these modelingapproaches to gain efficiencies in

computing solutions to real-worldproblems.

Table 1 summarizes many of theadvantages and disadvantages that arisewhen dealing with traditional approachesfor Cartesian tensors. Three main issuesare identified that effect the use of tensorobjects: (i) Data Structures, (ii)Transformation properties, and (iii)Interaction models. Table 2 presents asummary of the significant advantages thatarise by exploiting symmetry in Cartesiantensors.

I. 3. 1 Algorithms for IdentifyingUnique Symmetric Tensor Elements

There are several ways to developthe generalized mapping function. Severalobservations are in order: (i) The indicesfor a Cartesian tensor can only assumethree values (i.e., 1, 2, or 3), and (ii) aunique symmetric element is identified bya specific number of times that 1, 2, or 3appear. This suggests the followingstrategy for creating a unique scalarsignature for each set of indices. Forexample, if we have the 6th order indexset:

S = ( 1 , 3 , 3 , 2 , 2 , 2 )

one can define the mapping function:s = #3*100+^2*10+2^

where N, denotes the number of times 1appears in the index set ( i , j, ..., k ). Forthe set of indices above one has N! = 1,

325

N2 = 3, and N3 = 2 so thats = 2*ioo + 3*10 + l = 231

This mapping remains valid for anyarbitrary rearrangement of the elements ofthe index set. This suggests a simplealgorithm for identifying unique elements.First, pre-compute a unique set of indices( see Appendix A ) and the associated s-values. The pre-computed s-values arethen used in a search algorithm. The userinputs an n-dimensional set of indiceswhich is converted to an equivalent s-valueand compared with the pre-computedvalues. When a match is found, the outputis a unique storage index. For example, ifboth the pre-computed and input s-valuesare 231 and the pre-computed s-value isstored in location five (5), then the outputof the search algorithm is I, = 5, whichdenotes the storage location is used forboth numerical computation and symbolicalgorithm development.

1.3.2 Fast Algorithms for the Rotationof a Cartesian Tensor

When tensor interaction effects arecomputed for generalized force and torquecalculations, the body tensor componentsfor each body must be rotated to aconsistent coordinate frame so that thecontraction operations are well defined.The inertial frame is the natural frame tocompute these quantities.

Table 3 shows that the number ofmultiplications required to transform aCartesian tensor increases at a rateproportional to 9X for each increasingorder. As a result, when eighth-orderapplications are considered one requiresmore that 3 x 108 multiplications tocomplete the rotation of body-fixed tensor

components to a new coordinateorientation. Even though the basicalgorithms present no technical problems,it is unlikely that any practical applicationscan tolerate this kind of computationaloverhead for dealing with high-ordertensor representations.

To minimize to explosive growth incomputational effort required for dealingwith rotating Cartesian tensors, this paperextends an idea first proposed for arbitrarytensor objects known as array algebra [Rauhala(SO), Blaha(77), Snay(78) ] to thecase of symmetric tensors. The basic ideais to replace a tensor rotation process witha sequence of partial tensor contractionoperations, while exploiting the symmetryassociated with each partial contraction.For example, consider the following 5th

order problem:

where Cy denotes the direction cosinematrix that rotates body frame componentsto the inertial frame. This equation isrecast in the array algebra-like form:

Tnl,j2,j3,j4,j5 = CnljlFjl,j2,j3,j4,j5

Tni,n2,j3,j4,j5 = Cn2j2Tnl,j2,j3,j4,j5

Tni,n2,n3,j4,j5 ~ Cn3j3Tnl,n2,j3,j4,j5

Tnl,n2,n3,n4,j5 = Cn4j4Tnl,n2,n3,j4,j5

Lnl,n2,n3,n4,n5 , n2, n 3 , n4 ,

326

Each of these equations represents a partialcontraction on the second index of thedirection cosine matrix, with an impliedsummation convention. As a result, eachpartial contraction requires three (3)multiplications to complete. Each of thetensors above are represented as an m-dimensional array, where the length ofeach array depends on the number ofunique symmetric elements.

The s-vector for each of the tensorcodes above consists of two parts. Thefirst part corresponds to the transformedindices and the second part corresponds tothe untransformed indices. Both sets ofindices have unique symmetry propertiesthat can be exploited to minimize thenumber of mathematical operationsrequired to rotate the tensor. The numberof unique terms is defined by the productof the number of symmetric elements forthe transformed and untransformedindices. Two examples are nowprovided to clarify how these operationsare counted. For example, consider thefollowing 5th order tensor:

TJ-nl,n2,n3,n4,j5

which has four (4) transformed indices andone (1) untransformed index, leading to

M( 4 ) *M( 1 ) = ( 15 ) *( 3 ) =45

unique symmetric tensor elements, whereM(*) is defined by Eq. (A.I).

As a second example, if one has the tensorT•Lnl,n2,n3,j4,j5

there are three (3) transformed indices andtwo (2) untransformed indices, leading to

M( 3 ) *M( 2 ) = ( 10 ) *( 6 ) =60

unique symmetric tensor elements. Thenumber of unique symmetric elements ateach partial contraction level for a 5th

order tensor is presented in Table 4. Thenumber of required multiplications followsby adding the number of unique elementsin the first through final contraction mapsin Table 4, and multiplying this numberby three (3), leading to 693 requiredmultiplications. This number should alsobe compared with the number ofmultiplications required by the traditionalalgorithm, which is shown in Table 3 tobe —300000 multiplications. In this casethe fast algorithm is approximately 426times faster than the traditional algorithm.

I. 3. 3 Mapping Function when two setsof Tensor Indices are required forRotation

Because the contraction mappingoperations of the previous section involvetwo (2) sets of tensor indices, one mustdevelop a smooth function for predictingthe required storage locations. Themapping function used in this paper isgiven by:

I M ( N ) * ( I-l)+I

where M(*) is defined by Eq. (A.I), NUdenotes the number of untransformedindices, IT denotes the storage location forthe transformed set of indices, lv denotesthe storage location for the untransformedset of indices , and IT+U denotes thestorage location for the combined set oftransformed and untransformed index sets.IT and !„ are the outputs of the indexsearch algorithm of Section I. 3. 1.

327

The transformed and untransformedindices are generated by using thealgorithm presented in Appendix A. Anatural order for generating the sets ofindices consists of incrementing one set ofthe transformed indices and then sweepingthrough all sets of the untransformedindices. This process is repeated until allsets of transformed indices have beenprocessed.

I. 3. 4 Tensor contraction MappingTo evaluate the physical models

that describe the body-level forces andtorques presented in Section II, one mustevaluate tensor objects of the form:

"•

which represents a contraction on the p,...,q indices on the right-hand side of theequation above. All three objects aresymmetric. The unique indices can befound by using the index transformationproperties presented in Section I. 3. 1.For the tensors on the right-hand side two(2) sets of indices are required. The firstset consists of the symmetric indices forC*, given by

(i, . . . ,r, s, . . . ,k)

and the set of general indices given by(p, • • • , q)

The general set requires that all index setsare generated (i.e., no symmetry isexploited). However, when the elementsof A and B are identified for the impliedcontraction operation, one must combinethe symmetric and general indices toidentify the symmetric tensor storage

locations. For example, for the A, B, andC tensors, one needs to compute theunique storage locations given by

Ic =JA =IB =

. ,r,s,

. ,r,p,

. ,q,s,

I. 3. 4. 1 Multiple Levels of Symmetryin Contraction Maps

To exploit multiple levels ofsymmetry in the contraction mappingoperation, one must pre-process theimplied transformation, as a function ofthe implied tensor indices. This operationinvolves tracking the number of unique IAand IB index pairs, as well as tracking thenumber of times that these index pairsoccur, leading to:

where T(*) denotes the symmetric vectorwith index I,, fq denotes the number oftimes that an index pair was found, Npis the number of unique pairs found, andNq is the number of pairs that were foundfq times. Typical numbers for fq havebeen found to be 1, 3, 5, 10, 20, and 30and typical numbers for Nq have been havebeen found to be 1, 3, 6, and 9. Whenapplied to tensors of 6th order thistransformation has been found to reducethe number of multiplications by up to90% in individual cases. As the tensororder increases reductions in numbers ofmultiplications will increase to 100 -10000 fold for contraction maps dominatedby inner product operations.

328

n. 1 Physical Models

The problem considered in thissection consists of two (2) asymmetricrigid bodies that are interacting through aclassical force-at-a-distance that varies asthe square of the separation distance of thebodies. Gravitational and electro-magneticforce fields are application areas. Theassumed form for the differentialinteraction force model ( see Figure 1 ) is

where p. and pb denote the field strengthparameters for bodies A and B, 9 denotesthe position vector describing theseparation distance of bodies differentialmass elements on bodies A and B, Ndenotes the strength of the distancedependent interaction, and d denotes themagnitude of the position vector 3. Eachof the bodies is assumed to be describedby a set of Na and Nb point masses, wherea and b denote local position vectorsrelative to each bodies reference point.

The position vector presented inFigure 1 is expressed as

3 = S - a

(B-S] • (B-S) ] -

A = Ra-Rb

where R. denotes the position vector forbody A relative to the inertia! origin, Rbdenotes the position vector for body Brelative to the inertial origin, b denotes the

position vector locating the field parameteron body B relative to Rb, and a denotesthe position vector locating the fieldparameter on body A relative to Rm.

The evaluation of the interaction ofthe system-level force and torque isstraightforward. The only potentialcomplicating factor is that the forceevaluation requires NaNb operations.

The most expensive part of theforce calculation involves the evaluation ofthe distance dependent displacementvectors. To minimize the computationalthe effort required one can considerreplacing the exact calculation with anapproximate expression. The standardapproach is to replace the exact equationfor d"N given by:

where x = x5 , and

£•£/(£•£)

with an expression that is easier tocompute. By assuming that x is smallrelative to 1 the equation above is taylorexpanded and truncated to provide usefulapproximations. This approach iscompletely described in the next section.

II. 2 Approximation Strategies

An approximate model is obtainedby expanding d"N as the following binomialexpansion

329

where (*) denotes the standard binomialcoefficient, a = -N/2, and m terms areretained in the approximation. The xk

term consists of five vector-valuedexpressions defined in the previousSection.

n. 2. 1 Multinomial Expansion for theVector-Valued part of the BinomialExpansion

The Multinomial ExpansionTheorem [Abramowitz et.al (82) ] can beused to simplify the expression for xk,leading to:

x'r-1

5nwhere k = kt + k2 + k3 + k4 + k5, and(!) denotes the standard factorial function.Appendix C presents an algorithm forgenerating the multinomial expansionsindices kj (i = l,...,5). This expression canbe further simplified by defining thefollowing new variables:

y± = * , (A«A) ; i=l, . . . ,5

r ( k^kt _.

and the vector part can be expanded as thetensor product:

9 \ ̂ l / k2 I 3 I 4 ' 5 ' =

Tkl Dkl

l / 3 I 4 ' 5 '

Tk2

where D^ denotes a contraction operatorof order (*) that is defined in Appendix Band the tensors follow as:

ini,n2,...,nx

1nl,n2,...,na;p

where £ can be A or B. There is animplied order to the operations in g, withthe outer tensor contractions beingcomputed first. The final expression ford'N is given by

leading to

xk = kl T. fff1 2 3 4

The scalar pan the equation is defined as

k=0

which represents a complete factorizationof the vector displacement function.

II. 3 Force Calculation for Bodies Aand B

Introducing the expression for d'I-N

330

into the differential force equation leads to shown to be

This expression describes a singleinteraction between points on bodies A andB. The total force on body B is obtainedby summing over all particles on bodies Aand B, as follows:

leading to

where the tensor-valued objects are givenby:

Tkl &kl Qk^

I, = 0 ( 0 , 0 ) A

T2 = 0(1,0)

a,b

where £ can be A or B. From Newton'slaw of equal and opposite actions theforce on body A is defined by

FA = ~FB

The expression for fl(*,*) isevaluated by first rotating the chargeweighted tensors to the inertial frame usingthe fast rotation algorithm of Section I. 3.2. The resulting expressions for T(*,*)are then evaluated by using the fastcontraction mapping algorithm of SectionI. 3. 4.

II. 4 Torque Calculation for Bodies Aand B

The differential torque acting onbody B can be shown to be

dr = £ x

The total torque acting on body B followson summing the expression above over allparticles on bodies A and B, leading to:

dfu

or

and the charge weighted tensors can bewhere S(*) denotes a selection operator for

331

second-order tensors, defined by

which accounts for vector cross products.The second-order tensor follows as

L = f i ( l , l )

The torque on body A is defined as

d? = -a

The total torque is obtained by summingthe equation above over all particles onbodies A and B, as follows:

leading to

f

HI. Conclusions

This paper has presented a generalformulation for the generalized forces andtorques acting between two distributedbodies. The solution has been presented inthe form of an infinite series, whereclosed-form expressions are provided forthe each of the terms. Fast algorithms arepresented for rotating the body-fixedtensors on each body. These methodshave been found to be 10-100000 foldfaster than traditional tensor rotation

algorithms. Fast algorithms are alsopresented for computing the generalizedcontraction mapping operations arising inthe series expansions for the generalizedforces and torques. These methods havebeen found to be 2-90 fold faster thantraditional tensor contraction algorithms.Both of these methods critically depend onbeing able to exploit multiple levels ofsymmetry in tensor objects. By combiningthese fast algorithms one is able to studylarge-order tensor models, withoutrequiring access to super computers..

IV. References

U. A. Rauhala, "Introduction to ArrayAlgebra", Photogrammetric Engineeringand Remote Sensing, Vol. 46, No. 2, Feb.1980, pp. 177-192.

G. Blaha, "Least Squares Prediction andFiltering in any Dimensions Using thePrinciples of Array Algebra", Bull. Geod.,4th Issue, 1977b.

R. A. Snay, "Applicability of ArrayAlgebra", Reviews of Geophysics andSpace Physics, Vol. 16, No. 3, pp. 459-464.

M. Abramowitz and I. A. Stegun,"Handbook of Mathematical Functions",Dover Publications, Inc., 1982, pp.822,823.

APPENDIX A; Generation OfSymmetric Tensor Indices

The identification of symmetrictensor elements is a standard problem forall the tensor operations defined in thispaper. A simple do-loop based approachis presented for generating symmetric

332

tensor indices. To make the discussionfocused consider the following 3"1 orderexample:

The goal is to create a unique set ofindices. The equation defining the numberof symmetric Cartesian tensor elements isgiven by:

N(m) = (m+1) * ( m + 2 ) / 2

For a 3"" order tensor N(3) = 10. Thefollowing Fortran code generates therequired 10 unique sets:

DO n, = 1, 3DO n2 = n1} 3

DO % = n2, 3C SAVE = { n,, n2) n3 }

END DOEND DO

END DO

APPENDIX B; Contraction Operator

The contraction operator defines ageneralized inner product. The operator isgeneralized in the sense that the resultingobject can be either expanded orcontracted. Several problems are definedin terms of both index notation andcontraction operation notation. Assumethat A is 3^ Order and B is 4th Order, thenthe following problems can be defined:

APPENDIX C: Generation of 5th OrderMultinomial Coefficients

The multinomial coefficientsrequired in Section II are defined by therequirement that k = k1+k2+k3+k4+k5where kj > 0 , i = 1,...,5. Assumingthat m terms are required in the binomialexpansion, the following Fortran codegenerates the sets of Iq (i=l,...,5)coefficients.

DO HI = 0, mDO n2 = 0, ni

DO n3 = 0, n2DO n4 = 0, n3

DO n5 = 0, n4k, = n, - n2k2 = n2 - n3k3 = n3 - n4k4 = n4 - n5k5 = ns

C SAVE { k,, k2, k3, k,, k5 }END DOEND DOEND DOEND DO

END DO

The sets of k-codes are stored and used forevaluating the tensor quantities in the forceand torque equations of Section II. Thecode can be easily modified to handlemultinomial expansions of different order.

ADQB = AijkBlnmp (7thOrder)

AD^B = A1JkBklam (5thOrder)

AD2B = AijkBjklm(3** Order]

AD3B = AijkBijkl (1stOrder)

333

Table 1: Advantages and Disadvantages of Cartesian Tensor Formulations

COco

ISSUEMultidimensional Objects:

Tij...k = T(i,j,...,k)

Transformation Properties:

Tij.-l = QrCjV'Ckp Tre..p

Interaction Effects:

Ajj...k = By r,lpCralp k

ADVANTAGE• Easy to understand• Easy to program• Easy to manipulate

• Easy to program

• Easy to program

DISADVANTAGE• Conceals Symmetry• Requires problem specific code• Memory requirements scale as 3n,where n is the order of the tensor• Slow computer access formultidimensional arrays

• Many redundant operations• Very time consuming for high order« Large storage requirements fortransformed objects

• Conceals Symmetry» Many redundant operations» Very time consuming for high order

TABLE 2: Why Symmetry is Important for Cartesian Tensors of Different Orders

COCOOl

Tensor Order: N

Number of Elementsin a Cartiesian Tensor1

Number of SymmetricElements in a CartesianTensor2

0

1

1

1

3

3

2

9

6

3

27

10

4

81

15

5

243

21

6

729

28

7

2187

36

8

6561

45

9

19683

55

>3N , \ N + 1 )*( N + 2 )/2

TABLE 3: Comparison of the Number of Multiplications Required to Rotate a Cartesian Tensor

Tensor Order: N

Full Tensor1

Symmetric Terms Only2

Fast Algorithm3

Performance ImprovementFast. vs. Full

1

9

9

9

1

2

162

108

45

3

3

2187

810

138

15

4

26244

4860

333

78

5

295245

25515

693

426

6

3188646

122472

1302

2,449

7

33480783

551124

2268

14,762

8

344373768

2361961

3726

92,425

iN*32N ^ 2N*( N + 1 )*( N + 2 )*3N/2, 3 (3/4) * E ( n + 1 )*( n + 2 )*( N - n + 1 )*( N - n + 2 )

TABLE 4: Number of unique tensor elements during a fast rotation of a 5-th Order Cartesian Tensor

Beginning

1 21

1-stContraction

45

2-edContraction

60

3-edContraction

60

4-thContraction

45

FinalContraction

21