<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6352511023055453909</id><updated>2012-02-13T14:12:54.305-08:00</updated><category term='Grasshopper'/><category term='transformation matrices'/><category term='Verlet'/><category term='Dynamics'/><category term='Finite Volume'/><category term='quaternions'/><category term='Finite Element Method'/><category term='Shape function'/><category term='FEM'/><category term='Lagrange Multipliers'/><category term='Finite Element'/><category term='Mass Spring System'/><category term='Finite Elements'/><category term='tetrahedralization'/><title type='text'>Stochastic Simulation and Lagrangian Dynamics</title><subtitle type='html'>This is the blog-diary created to monitorize the evolution of Rabindranath Andujar's thesis on Stochastic Simulation and Lagrangian dynamics applied to Structural Design.
It is intended to extend collaboration with other people, allow the register of the studies, and force a discipline on recording references, lines of study, and whatever else appears.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>34</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-4647723184045671349</id><published>2012-01-31T14:02:00.000-08:00</published><updated>2012-01-31T14:02:05.350-08:00</updated><title type='text'>A brief summary on the stiffness method for structural engineering</title><content type='html'>Well, another year has gone by, and it has been a while since the last post. Life in Barcelona is being quite busy, so I am not dealing very well with my updates...This doesn't mean I am not researching, but apparently the topics I am getting to are deeper and deeper, so conclusions are getting harder to write...&lt;br /&gt;&lt;br /&gt;The following is a summary of what I found here: &lt;a href="http://www.civil.iitb.ac.in/%7Esghosh/CE317/history-stiffness-method.pdf"&gt;www.civil.iitb.ac.in/~sghosh/CE317/history-stiffness-method.pdf&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It is authored by the famous Zienkiewicz, so it must be a warranty of rigor. Out of it I have written my own summary, on pure chronological order, that goes as follows:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;1862: Glebsch, Alfred wrote an algorithm for 3D trusses where no moments were involved. The models one would get out of it is as putting lots of springs connected by pins.&lt;/li&gt;&lt;li&gt;1883: Saint Venant, Andre wrote an article with comments on Glebsch's methodology.&lt;/li&gt;&lt;li&gt;1880: Manderla, Heinrich proposed an iterative method for the solution of the set of equations involved in pin-jointed trusses&lt;/li&gt;&lt;li&gt;1892: Mohr, Otto introduced the notion of "secondary stresses". He was referring to the moments. They were called secondary then as in steel and iron trusses the main ones were axial.&lt;/li&gt;&lt;li&gt;1910: Richardson provided the study of the stresses in a dam by means onf the Airy stress function.&lt;/li&gt;&lt;li&gt;1914: Bendixsen, Axel published a method similar to the slope deflection for structures with internal hyperstaticity.&lt;/li&gt;&lt;li&gt;1915: Wilson&amp;amp;Money proposed the slope deflection method, apparently unaware of Bendixsen's.&lt;/li&gt;&lt;li&gt;1922: Ĉaliŝev gave an iterative solution of successive approximations for frames without side-sway.&lt;/li&gt;&lt;li&gt;1930: Cross, Hardy published his famous method for redistributing unbalanced moments according to the internal stiffnesses of the composing bars. This provided the engineer with the necessary joint rotations.&lt;/li&gt;&lt;li&gt;1932: Grinter wrote a method for multi-story frames with side-sway called "method of successive corrections"&lt;/li&gt;&lt;li&gt;1935: Southwell tackled the problem of the constraints in a similar manner giving his famous method of "systematic relaxation of constraints", commonly known as dynamic relaxation.&lt;/li&gt;&lt;li&gt;1941: Courant, Richard explained his "variational methods for the solution of problems of equilibrium and vibrations". As he was a mathematician, the practical application of his work results still of some difficulty.&lt;/li&gt;&lt;li&gt;1943: McHenry in U.S. and Hrenikoff in Canada proposed a lattice analogy for the solution of stress problems so that continuum could be represented as a set of beams.&lt;/li&gt;&lt;li&gt;1944: Kron, Gabriel provided a complete algorithm in matrix form for 3D frames. In the 1930s it became fashionable to show the whole process of solving the linear equations in this systematic manner.&lt;/li&gt;&lt;li&gt;1954: Argyris wrote his "Energy theorems ans structural analysis", &lt;i&gt;a comprehensive presentation of both the force and the displacement method for complicated airplane structures&lt;/i&gt;.&lt;/li&gt;&lt;li&gt;1967: Zienkiewicz presented his summary of the "Finite Element Method in structural Mechanics".&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-4647723184045671349?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/4647723184045671349/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2012/01/brief-summary-on-stiffness-method-for.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/4647723184045671349'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/4647723184045671349'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2012/01/brief-summary-on-stiffness-method-for.html' title='A brief summary on the stiffness method for structural engineering'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-4458689635137779699</id><published>2011-11-26T09:26:00.001-08:00</published><updated>2011-11-26T15:41:57.465-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tetrahedralization'/><category scheme='http://www.blogger.com/atom/ns#' term='Finite Volume'/><category scheme='http://www.blogger.com/atom/ns#' term='quaternions'/><category scheme='http://www.blogger.com/atom/ns#' term='transformation matrices'/><category scheme='http://www.blogger.com/atom/ns#' term='Mass Spring System'/><category scheme='http://www.blogger.com/atom/ns#' term='Finite Element'/><title type='text'>Tetrahedra discretization of a beam</title><content type='html'>In this post I will introduce the advances of the last weeks regarding the discretization into tetrahedra of a beam with Grasshopper's VB component.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Rotations about an arbitrary axis&lt;/b&gt; &lt;br /&gt;An important part of the research has been devoted to the topic of 3d rotation, as for locating the sub-nodes of the beam appropiately we need to transform the beam's local coordinates with respect of its axis into the actual world's coordinates for Rhino to interpret.&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-n7_W6BlZUCY/TtFbkIF7ymI/AAAAAAAAAT4/G3GZ-s84yTs/s1600/rotations.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="205" src="http://2.bp.blogspot.com/-n7_W6BlZUCY/TtFbkIF7ymI/AAAAAAAAAT4/G3GZ-s84yTs/s400/rotations.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;The most popular way to make it are rotation matrices (&lt;a href="http://www.siggraph.org/education/materials/HyperGraph/modeling/mod_tran/3drota.htm"&gt;here&lt;/a&gt; there is a thorough explanation on how), but also quaternions have been contemplated and still not fully discarded. Apparently rotation matrices present some numerical drifting problems when utilized for many time steps, as well as other problems that quaternions solve quite easily (mentioned &lt;a href="http://www.ogre3d.org/tikiwiki/Quaternion+and+Rotation+Primer"&gt;here&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Tetrahedra subdivision&lt;/b&gt;&lt;br /&gt;The beam is defined by two points arbitrarily located in 3d space. These points define a director vector and also a distance.&lt;br /&gt;The remaining geometric properties (height h and width b) in the attached code have been assimilated to a percentage of the lenght. Also the number of segments s has been hardcoded to be proportional to the width but it could be anything else.&lt;br /&gt;The attached code uses two functions: one for coordinate transformation by means of transformation matrices and another for matrix multiplication. The rest of the subroutine simply locates points along the beam according to the width b, the height h and the segment separation s.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-imPPNyPVwZM/TtF0FkTHFrI/AAAAAAAAAUI/bPmmVN189bI/s1600/tetrahedra-2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="205" src="http://1.bp.blogspot.com/-imPPNyPVwZM/TtF0FkTHFrI/AAAAAAAAAUI/bPmmVN189bI/s400/tetrahedra-2.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-twbbU4qReIM/TtFz6QmX1cI/AAAAAAAAAUA/enqWUI9LiKY/s1600/tetrahedra.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;The image above shows how the beam is discretized into nodes located at the edges. Each segment gives place to five embedded tetrahedron (right).&lt;br /&gt;Local axes of the beam will be later utilized for the matter integration.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Code&lt;/b&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;Private Sub RunScript(ByVal ni As Point3d, ByVal nj As Point3d, ByVal angle As Double, ByRef geom As Object) &lt;/span&gt;&lt;/i&gt;&lt;/blockquote&gt;&lt;blockquote class="tr_bq"&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'This code was written by Rabindranath Andujar, Jordi Casabo, Jaume Roset, Vojko Kilar and Simon Petrovcic with the purposes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'of the development of Rabindranath Andujar's Phd Thesis "Stochastic Simulation and Lagrangian dynamics applied to Structural&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Design"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Version 1.3 Or any later version published by the Free Software Foundation; With no Invariant Sections, no Front-Cover Texts,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'And no Back-Cover Texts.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'This code is intended to facilitate a tetrahedric discretization of a beam provided two points (initial and final). It should&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'serve to be inserted into a wider matter integration code (FEM/FVM/MSS, etc) for which nodal coordinates, topological table&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'and material properties are eventually given.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim L As Double 'lenght of the beam&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim s As Double 'space between divisions&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim b As Double 'width of the beam&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim h As Double 'height of the beam&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim u,v,w As Double 'components of the director vector of the beam&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim lines As New list(Of rhino.geometry.line) 'geometric representation of the beam&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim Nodes As New List(Of rhino.geometry.point3d) 'geometric nodes of the beam, where matter will be integrated&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim n As Integer 'number of nodes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim i As Integer 'auxiliar index&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim line As Rhino.Geometry.Line 'auxiliar instantiation variable&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim Node As rhino.geometry.point3d 'Auxiliar coordinates for the shape of the beam&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'The components of the director vector of the beam are the difference between the initial and the final points&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; u = nj.X - ni.X&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; v = nj.y - ni.y&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; w = nj.z - ni.z&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' The lenght of the beam is the norm of the vector&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; L = math.Sqrt(u * u + v * v + w * w)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'We have chosen arbitrarily here a height h=10% of the lenght, width b=60% of the height and spacing a portion of the width&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; h = L * 0.1&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; b = h * 0.6&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; n = int(L / b)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; s = L / n&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'The nodes located in the vertices of the section are positioned along the beam by means of matrix&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'transformations with respect to the director vector and the initial point of the beam.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'The function TransformCoordinates serves such purpose.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'u,v,w coordinates enter divided by the lenght of the beam in order to operate with a normalized vector.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'The angle parameter represents the rotation of the section around the longitudinal axis (local x)&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' local z axis&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp; angle of rotation along x local axis&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp; /&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '&amp;nbsp; *---*&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' h| |/|&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' -|-+-|---local y axis&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '&amp;nbsp; | | |&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '&amp;nbsp; *---*&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '&amp;nbsp;&amp;nbsp;&amp;nbsp; b&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; For i = 0 To n&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Top left corner of the beam section&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Node = TransformCoordinates(ni.X, ni.Y, ni.Z, -b / 2, h / 2, S * i, u / L, v / L, w / L, angle)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Then we collect their values into Rhino Point3Ds&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Nodes.Add(Node)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Top right corner of the beam section&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Node = TransformCoordinates(ni.X, ni.Y, ni.Z, b / 2, h / 2, S * i, u / L, v / L, w / L, angle)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Then we collect their values into Rhino Point3Ds&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Nodes.Add(Node)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Lower right corner of the beam section&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Node = TransformCoordinates(ni.X, ni.Y, ni.Z, b / 2, -h / 2, S * i, u / L, v / L, w / L, angle)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Then we collect their values into Rhino Point3Ds&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Nodes.Add(Node)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Lower left corner of the beam section&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Node = TransformCoordinates(ni.X, ni.Y, ni.Z, -b / 2, -h / 2, S * i, u / L, v / L, w / L, angle)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Then we collect their values into Rhino Point3Ds&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Nodes.Add(Node)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Next i&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'This loop repeats the cross section of the beam (a b x h rectangle) using the vertices previously collected&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'along a beam defined by an initial and a final points.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Also the longitudinal edges of the prism are iterated for every segment of beam.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; For i = 0 To nodes.Count - 8 Step 4&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Four sides of the section&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Line = New Rhino.Geometry.Line(nodes(i), nodes(i + 1))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Lines.Add(Line)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Line = New Rhino.Geometry.Line(nodes(i + 1), nodes(i + 2))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Lines.Add(Line)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Line = New Rhino.Geometry.Line(nodes(i + 2), nodes(i + 3))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Lines.Add(Line)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Line = New Rhino.Geometry.Line(nodes(i + 3), nodes(i))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Lines.Add(Line)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Longitudinal segments of the edges&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Line = New Rhino.Geometry.Line(nodes(i), nodes(i + 4))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Lines.Add(Line)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Line = New Rhino.Geometry.Line(nodes(i + 1), nodes(i + 5))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Lines.Add(Line)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Line = New Rhino.Geometry.Line(nodes(i + 2), nodes(i + 6))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Lines.Add(Line)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Line = New Rhino.Geometry.Line(nodes(i + 3), nodes(i + 7))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Lines.Add(Line)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Next i&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Here we iterate in order to make the outer longitudinal diagonals and the inner cross sectional ones&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'On each segment we have to change the direction, so they are alternated. It was carefully done, as the&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'final purpose is to create the edges of tetrahedra that do not overlap.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'To such end, diagonals change every two segments in outer faces as in inner cross sectional connections.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; For i = 1 To nodes.Count - 4 Step 8&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Top faces&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Line = New Rhino.Geometry.Line(nodes(i), nodes(i + 5))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Lines.Add(Line)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Line = New Rhino.Geometry.Line(nodes(i + 5), nodes(i + 8))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Lines.Add(Line)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Right side faces&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Line = New Rhino.Geometry.Line(nodes(i + 2), nodes(i + 5))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Lines.Add(Line)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Line = New Rhino.Geometry.Line(nodes(i + 5), nodes(i + 10))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Lines.Add(Line)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Bottom faces&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Line = New Rhino.Geometry.Line(nodes(i + 2), nodes(i + 3))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Lines.Add(Line)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Line = New Rhino.Geometry.Line(nodes(i + 3), nodes(i + 10))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Lines.Add(Line)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Left side faces&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Line = New Rhino.Geometry.Line(nodes(i), nodes(i + 3))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Lines.Add(Line)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Line = New Rhino.Geometry.Line(nodes(i + 3), nodes(i + 8))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Lines.Add(Line)&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Sectional diagonals&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Line = New Rhino.Geometry.Line(nodes(i), nodes(i + 2))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Lines.Add(Line)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Line = New Rhino.Geometry.Line(nodes(i + 3), nodes(i + 5))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Lines.Add(Line)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Next i&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'And the final section to close the prism: perimetral and diagonal lines&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Line = New Rhino.Geometry.Line(nodes(nodes.count - 4), nodes(nodes.count - 3))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Lines.Add(Line)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Line = New Rhino.Geometry.Line(nodes(nodes.count - 3), nodes(nodes.count - 2))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Lines.Add(Line)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Line = New Rhino.Geometry.Line(nodes(nodes.count - 2), nodes(nodes.count - 1))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Lines.Add(Line)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Line = New Rhino.Geometry.Line(nodes(nodes.count - 1), nodes(nodes.count - 4))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Lines.Add(Line)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Diagonal goes from the last node to the node in the opposite side of the section&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Line = New Rhino.Geometry.Line(nodes(nodes.count - 1), nodes(nodes.count - 3))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Lines.Add(Line)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Finally everything is delivered to Rhino for visualization&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Geom = Lines&lt;br /&gt;&amp;nbsp; End Sub&amp;nbsp; &lt;/span&gt;&lt;/i&gt;&lt;/blockquote&gt;&lt;blockquote class="tr_bq"&gt;&lt;i&gt;&amp;nbsp;&lt;span style="font-size: x-small;"&gt; Function TransformCoordinates(a As Double, b As Double, c As Double, x As Double, y As Double, z As Double, u As Double, v As Double, w As Double, Alpha As Double) As rhino.Geometry.Point3d&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'This function returns a Rhino.Geometry.Point3d rotated around an arbitrary axis.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'The initial point of the beam is defined by a,b and c coordinates&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Point's coordinates to be transformed are x,y,z&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'The axis is defined by the u,v,w coordinates, which should be normalized&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Angle is provided in the Alpha parameter&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim CAlpha As Double 'Auxiliar variable for storing the cosine of the rotation around the axial axis&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim SAlpha As Double 'Auxiliar variable for storing the sine of the rotation around the axial axis&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim d As Double 'Auxiliar variable for storing the sine of the rotation around the y axis&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim Vector(3) As Double 'Auxiliar Vector to store and make the neccessary operations&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim Point As rhino.Geometry.Point3d 'The returned instance of a modified Point3d&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Initialize variables&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Vector(0) = x&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Vector(1) = y&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Vector(2) = z&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Vector(3) = 1&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; d = math.Sqrt(v ^ 2 + w ^ 2)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CAlpha = math.Cos(Alpha)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SAlpha = math.Sin(Alpha)&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'The translation matrix moves the point to the a,b,c coordinates&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim Transl(,) As Double = { _&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {1, 0, 0, a}, _&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {0, 1, 0, b}, _&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {0, 0, 1, c}, _&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {0, 0, 0, 1}}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Rotation matrix along the world's x axis&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim Rotx(,) As Double = { _&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {1, 0, 0, 0}, _&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {0, w/d, v/d, 0}, _&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {0, -v/d, w/d, 0}, _&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {0, 0, 0, 1}}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Rotation matrix along the beam's y axis&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim Roty(,) As Double = { _&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {d, 0, u, 0}, _&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {0,1, 0, 0}, _&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {-u, 0, d, 0}, _&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {0, 0, 0, 1}}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Rotation matrix along the world's z axis&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim Rotz(,) As Double = { _&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {CAlpha, -SAlpha, 0, 0}, _&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {SAlpha, CAlpha, 0, 0}, _&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {0, 0, 1, 0}, _&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {0, 0, 0, 1}}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Each transformation is made sequentially as a matrix-vector product&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Vector = MultiplyMatrixVector(Rotz, Vector)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Vector = MultiplyMatrixVector(Roty, Vector)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Vector = MultiplyMatrixVector(Rotx, Vector)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Vector = MultiplyMatrixVector(Transl, Vector)&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'And eventually data is returned into the auxiliar point3d&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Point.X = Vector(0)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Point.y = Vector(1)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Point.z = Vector(2)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return point&lt;br /&gt;&amp;nbsp; End Function&lt;/span&gt;&lt;/i&gt; &lt;/blockquote&gt;&lt;blockquote class="tr_bq"&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp; Function MultiplyMatrixVector(Matrix(,) As Double, Vector() As Double) As Double()&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'This function returns the product of a matrix times a vector.&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Matrix column number must be the same as vector's components number:&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | |&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | |&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'M=|&amp;nbsp; mxn&amp;nbsp; | , V=|n|&amp;nbsp;&amp;nbsp; ===&amp;gt;&amp;nbsp; M·V=|n|&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | |&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | |&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim i,j As Integer 'Auxiliar indexes&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim n As Integer 'Matrix's column number&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim VAux() As Double 'Auxiliar temporary vector&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Vector's size is reset to the number of matrix's columns&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; n = Ubound(Matrix, 1)&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ReDim VAux(n)&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'In this loop we proceed to the summation of the products of the matrix terms times the&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'corresponding vector terms.&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'First we iterate by the columns&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; For i = 0 To n&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'And then by each term of the vector&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; For j = 0 To n&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Auxiliar vector accumulates the products in the corresponding index&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Vaux(i) = Vaux(i) + Matrix(i, j) * Vector(j)&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Next j&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Next&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'And then we return the resulting vector&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return Vaux&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp; End Function&lt;/span&gt;&lt;/i&gt; &lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-4458689635137779699?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/4458689635137779699/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2011/11/tetrahedra-discretization-of-beam.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/4458689635137779699'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/4458689635137779699'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2011/11/tetrahedra-discretization-of-beam.html' title='Tetrahedra discretization of a beam'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-n7_W6BlZUCY/TtFbkIF7ymI/AAAAAAAAAT4/G3GZ-s84yTs/s72-c/rotations.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-1527963113142228168</id><published>2011-10-31T14:42:00.000-07:00</published><updated>2011-10-31T14:42:02.317-07:00</updated><title type='text'>Yet one more article...</title><content type='html'>And another article published!&lt;br /&gt;This once in the journal Iranian journal WASJ (World Applied Science Journal).&lt;br /&gt;This is the link: &lt;a href="http://www.idosi.org/wasj/wasj14%288%2911/21.pdf"&gt;&lt;cite&gt;www.idosi.org/wasj/wasj14(8)11/21.pdf. &lt;/cite&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;cite&gt;&lt;b&gt;Abstract&lt;/b&gt;: Structural dynamics is a rather complex field of research that concerns to a broad range of disciplines, from structural engineering to graphics animation, robotics or aeronautics. A primary consequence of this is an overwhelming amount of literature on the topic, apparently disconnected, as each author focuses on his / her particular field. To complicate things further, the daunting list of numerical methods severely blurs the scope of the researcher, making it very difficult to understand what their purpose is in each case and even if these are applicable to the analysis of structural behavior. This paper presents a reference framework where researchers and developers from diverse disciplines can assess the main methods currently used in structural dynamics simulation. A direct correlation is made between methods to solve&amp;nbsp; Ordinary, Partial and Algebraic Differential Equations and their physical counterparts Time, Matter and Constraints. It is also discussed their application in different industries.&lt;/cite&gt;&lt;br /&gt;&lt;cite&gt;&lt;/cite&gt;&lt;br /&gt;&lt;cite&gt;&lt;br /&gt;&lt;/cite&gt;&lt;br /&gt;&lt;cite&gt;Thanks to my mentors, Jaume and Vojko&lt;/cite&gt;&lt;br /&gt;&lt;cite&gt;&amp;nbsp;&lt;/cite&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-1527963113142228168?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/1527963113142228168/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2011/10/yet-one-more-article.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/1527963113142228168'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/1527963113142228168'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2011/10/yet-one-more-article.html' title='Yet one more article...'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-1340230021788094759</id><published>2011-10-09T09:44:00.000-07:00</published><updated>2011-10-09T16:34:51.768-07:00</updated><title type='text'>My first SCI Indexed Article!</title><content type='html'>&lt;div style="text-align: justify;"&gt;Here it is! A whole achievement! &lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;After some while working hard in collaboration with the Faculty of Architecture of&amp;nbsp; the University of Ljubljana the result of our research appears published in a scientific Journal: &lt;a href="http://www.ttem-bih.org/ttem_3_2011.html"&gt;http://www.ttem-bih.org/ttem_3_2011.html&lt;/a&gt;.&lt;br /&gt;As a computational dynamics rookie myself I find it very hard to understand the whole complexity of the topic. For that reason, we decided to make an introductory overview of what is needed to start scouting through such a steepy and accidented path. I hope it serves to somebody else...&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;However, from all the article my favourite part is at the beginning:&amp;nbsp;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;blockquote&gt;&lt;i&gt;“Structural engineering is the art of molding materials we don’t wholly understand, into shapes we can’t fully analyze, so as to withstand forces we can’t really assess, in such a way that the community at large has no reason to suspect the extent of our ignorance.”&lt;/i&gt;&lt;/blockquote&gt;Which I found as a quote from James E. Amrhein of the Masonry Institute of America...&lt;br /&gt;&lt;br /&gt;Well, happy autumn!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-1340230021788094759?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/1340230021788094759/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2011/10/my-first-sci-indexed-article.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/1340230021788094759'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/1340230021788094759'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2011/10/my-first-sci-indexed-article.html' title='My first SCI Indexed Article!'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-5471875880341921025</id><published>2011-09-25T06:30:00.000-07:00</published><updated>2011-09-25T06:30:17.072-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Grasshopper'/><category scheme='http://www.blogger.com/atom/ns#' term='FEM'/><category scheme='http://www.blogger.com/atom/ns#' term='Finite Elements'/><category scheme='http://www.blogger.com/atom/ns#' term='Lagrange Multipliers'/><title type='text'>First FEM + Lagrange multipliers program in Grasshopper</title><content type='html'>Good, good...summer is about to finish and here I am, back in Ljubljana!&lt;br /&gt;&lt;br /&gt;The last post was created two months ago and a shift in the researching techinques was announced: from C++ under Code:Blocks, Visual Studio or any other IDE (never found the one that fitted my needs), to Visual Basic under Grasshopper...&lt;br /&gt;&lt;br /&gt;What a change! It really has boosted productivity...debugging is now as easy as dragging a panel and linking it to a component, results of the changes in the program can be viewed on real time and also with a bit of tweaking its consequences in a CAD model can be represented...wow..absolutely good...&lt;br /&gt;&lt;br /&gt;In concrete means, during the summer I have been able to produce the whole Grasshopper definition shown below:&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-rLDxAXzpMLw/Tn8kS-8Xi0I/AAAAAAAAATY/78rvWlaokKM/s1600/GH-FEM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="126" src="http://1.bp.blogspot.com/-rLDxAXzpMLw/Tn8kS-8Xi0I/AAAAAAAAATY/78rvWlaokKM/s400/GH-FEM.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;The initial part simply parses data from three files that I chose to be in .txt format, but anyone else could have chosen any other way (i.e. Excel or OpenOffice): Constraints.txt, Nodes.txt and ExternalForces.txt.&lt;br /&gt;The heavy programming components are FEM, LM and LUPD, and I provide their contents here:&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-5pMnbwujMK0/Tn8lx-Y5F5I/AAAAAAAAATc/raYHC21mNxo/s1600/FEM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="185" src="http://1.bp.blogspot.com/-5pMnbwujMK0/Tn8lx-Y5F5I/AAAAAAAAATc/raYHC21mNxo/s200/FEM.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;b&gt;FEM Component:&lt;/b&gt; &lt;br /&gt;&lt;textarea cols="55" name="textfield" rows="20"&gt;Private Sub RunScript(ByVal Constraints As List(Of String), ByVal Nodes As List(Of String), ByVal Forces As List(Of String), ByRef Kg As Object, ByRef u As Object, ByRef F As Object, ByRef Geom As Object)     'your code goes here…    Dim Lenght As Double    Dim Lxy As Double    Dim ni As Int16    Dim nj As int16    Dim EModulus As Double    Dim GModulus As Double    Dim Area As Double    Dim Theta As Double    Dim InertiaY As Double    Dim InertiaZ As Double    Dim JModulus As Double    Dim PosNi(2) As Double    Dim PosNj(2) As Double    Dim i As Int16    Dim j As Int16    Dim k As Int16    Dim m As int16    Dim n As Int16    Dim ConstraintType As int32    Dim lines As New list(Of rhino.geometry.line)    Dim KgAux(,) As Double    ReDim KgAux(6 * (nodes.count - 1), 6 * (nodes.count - 1))    For i = 1 To Constraints.Count - 1      ConstraintType = CInt(constraints(i).split(",")(0))      If ConstraintType = 0 Then        ni = CInt(constraints(i).split(",")(1))        nj = CInt(constraints(i).split(",")(2))        Emodulus = CDbl(constraints(i).split(",")(3))        GModulus = CDbl(constraints(i).split(",")(4))        Area = CDbl(constraints(i).split(",")(5))        InertiaY = CDbl(constraints(i).split(",")(6))        InertiaZ = CDbl(constraints(i).split(",")(7))        JModulus = CDbl(constraints(i).split(",")(8))        Theta = CDbl(constraints(i).split(",")(9))        posni(0) = CDbl(nodes(ni).split(",")(0))        posni(1) = CDbl(nodes(ni).split(",")(1))        posni(2) = CDbl(nodes(ni).split(",")(2))        posnj(0) = CDbl(nodes(nj).split(",")(0))        posnj(1) = CDbl(nodes(nj).split(",")(1))        posnj(2) = CDbl(nodes(nj).split(",")(2))        Dim Line As New Rhino.Geometry.Line(posni(0), posni(1), posni(2), posnj(0), posnj(1), posnj(2))        Lines.Add(Line)        Lenght = math.Sqrt((posnj(0) - posni(0)) ^ 2 + (posnj(1) - posni(1)) ^ 2 + (posnj(2) - posni(2)) ^ 2)        Lxy = math.Sqrt((posnj(0) - posni(0)) ^ 2 + (posnj(1) - posni(1)) ^ 2)        'Lets compose the element's matrix first        Dim Ke(11,11) As Double        For j = 0 To 5          For k = 0 To 5            Ke(j, k) = kenini(Lenght, Emodulus, GModulus, Area, InertiaY, InertiaZ, JModulus)(j, k)            Ke(j, 6 + k) = keninj(Lenght, Emodulus, GModulus, Area, InertiaY, InertiaZ, JModulus)(j, k)            Ke(6 + j, k) = kenjni(Lenght, Emodulus, GModulus, Area, InertiaY, InertiaZ, JModulus)(j, k)            Ke(6 + j, 6 + k) = kenjnj(Lenght, Emodulus, GModulus, Area, InertiaY, InertiaZ, JModulus)(j, k)          Next k        Next j        'Then create the transformation matrix components        Dim s1,s2,s3 As Double        Dim c1,c2,c3 As Double        Dim Tinv(11,11) As Double        Dim T(11,11) As Double        If Lxy &amp;gt; 0.0001 Then          s1 = (posnj(1) - posni(1)) / Lxy          c1 = (posnj(0) - posni(0)) / Lxy        Else          s1 = 0.0          c1 = 1.0        End If        s2 = (posnj(2) - posni(2)) / Lenght        c2 = Lxy / Lenght        s3 = math.sin(theta)        c3 = math.cos(theta)        T = Transformatrix(c1 * c2, s1 * c2, s2, -c1 * s2 * s3 - s1 * c3, -s1 * s2 * s3 + c1 * c3, s3 * c2, -c1 * s2 * c3 - s1 * s3, -s1 * s2 * c3 - c1 * s3, c3 * c2)        Tinv = TransformatrixT(c1 * c2, s1 * c2, s2, -c1 * s2 * s3 - s1 * c3, -s1 * s2 * s3 + c1 * c3, s3 * c2, -c1 * s2 * c3 - s1 * s3, -s1 * s2 * c3 - c1 * s3, c3 * c2)        'And proceed to transform the element's matrix into global coordinates        Dim KeAux(11,11) As Double        KeAux = multiply2DMatrices(Ke, Tinv)        Ke = multiply2DMatrices(T, KeAux)        For j = 0 To 11          print(ke(j, 0) &amp;amp; "," &amp;amp; ke(j, 1) &amp;amp; "," &amp;amp; ke(j, 2) &amp;amp; "," &amp;amp; ke(j, 3) &amp;amp; "," &amp;amp; ke(j, 4) &amp;amp; "," &amp;amp; ke(j, 5) &amp;amp; "," &amp;amp; ke(j, 6) &amp;amp; "," &amp;amp; ke(j, 7) &amp;amp; "," &amp;amp; ke(j, 8) &amp;amp; "," &amp;amp; ke(j, 9) &amp;amp; "," &amp;amp; ke(j, 10) &amp;amp; "," &amp;amp; ke(j, 11))        Next        print("****************")        'Once translated into global coordinates, we can assemble the element in the temporary global matrix        For j = 0 To 5          For k = 0 To 5            KgAux(6 * (ni - 1) + j, 6 * (ni - 1) + k) = KgAux(6 * (ni - 1) + j, 6 * (ni - 1) + k) + Ke(j, k)            KgAux(6 * (ni - 1) + j, 6 * (nj - 1) + k) = KgAux(6 * (ni - 1) + j, 6 * (nj - 1) + k) + Ke(j, 6 + k)            KgAux(6 * (nj - 1) + j, 6 * (ni - 1) + k) = KgAux(6 * (nj - 1) + j, 6 * (ni - 1) + k) + Ke(6 + j, k)            KgAux(6 * (nj - 1) + j, 6 * (nj - 1) + k) = KgAux(6 * (nj - 1) + j, 6 * (nj - 1) + k) + Ke(6 + j, 6 + k)          Next k        Next j      End If    Next i    'And parse it into a tree structure for management into Grasshopper    Dim Tree As New DataTree(Of Double)    For m = 0 To ubound(KgAux) - 1      'Iterate over the second dimension of the array      For n = 0 To ubound(KgAux) - 1        'Insert the current value into the DataTree.        'The first dimension ends up as the Path,        'the second dimension ends up as the index.        tree.Insert(KgAux(m, n), New GH_Path(m), n)      Next n    Next m    Kg = tree    F = ReadForces(Forces)    u = InitializeDisplacements(Nodes)    Geom = Lines  End Sub   '&amp;lt;Custom additional code&amp;gt;   Function KeNiNi(L As Double, E As Double, G As Double, A As Double, Iy As Double, Iz As Double, J As Double) As  Double(,)    Dim Kaux(,) As Double = { _      {A * E / L, 0, 0, 0, 0, 0}, _      {0, 12 * E * Iz / (L * L * L), 0, 0, 0, 6*E*Iz/(L * L)}, _      {0, 0, 12 * E * Iy / (L * L * L), 0, -6*E*Iy/(L * L), 0}, _      {0, 0, 0, G * J / L, 0, 0}, _      {0, 0, -6*E*Iy/(L * L), 0, 4*E*Iy/L, 0}, _      {0, 6*E*Iz/(L * L), 0, 0, 0, 4*E*Iz/L} _      }    Return Kaux  End Function  Function KeNiNj(L As Double, E As Double, G As Double, A As Double, Iy As Double, Iz As Double, J As Double) As Double(,)    Dim Kaux(,) As Double = { _      {-A*E/L, 0, 0, 0, 0, 0}, _      {0, -12*E*Iy/(L*L*L), 0, 0, 0, 6*E*Iz/(L*L)}, _      {0, 0, -12*E*Iz/(L*L*L), 0, -6*E*Iy/(L*L),0}, _      {0, 0, 0,-G*J/L, 0, 0}, _      {0, 0, 6*E*Iy/(L*L), 0, 2*E*Iy/L, 0}, _      {0, -6*E*Iz/(L*L), 0, 0, 0, 2*E*Iz/L} _      }    Return Kaux  End Function  Function KeNjNi(L As Double, E As Double, G As Double, A As Double, Iy As Double, Iz As Double, J As Double) As Double(,)    Dim Kaux(,) As Double = { _      {-A*E/L, 0, 0, 0, 0, 0}, _      {0, -12 * E * Iz / (L * L * L), 0, 0, 0, -6*E*Iz/(L * L)}, _      {0, 0, -12 * E * Iy / (L * L * L), 0, 6*E*Iy/(L * L), 0}, _      {0, 0, 0, -G * J / L, 0, 0}, _      {0, 0, -6*E*Iy/(L * L), 0, 2*E*Iy/L, 0}, _      {0, 6*E*Iz/(L * L), 0, 0, 0, 2*E*Iz/L} _      }    Return Kaux  End Function  Function KeNjNj(L As Double, E As Double, G As Double, A As Double, Iy As Double, Iz As Double, J As Double) As Double(,)    Dim Kaux(,) As Double = { _      {A*E/L, 0, 0, 0, 0, 0}, _      {0, 12 * E * Iz / (L * L * L), 0, 0, 0, -6*E*Iz/(L * L)}, _      {0, 0, 12 * E * Iy / (L * L * L), 0, 6*E*Iy/(L * L), 0}, _      {0, 0, 0, G * J / L, 0, 0}, _      {0, 0, 6*E*Iy/(L * L), 0, 4*E*Iy/L, 0}, _      {0, -6*E*Iz/(L * L), 0, 0, 0, 4*E*Iz/L} _      }    Return Kaux  End Function  Function Transformatrix(lx As Double, mx As Double, nx As Double, ly As Double, my As Double, ny As Double, lz As Double, mz As Double, nz As Double) As Double(,)    Dim Kaux(,) As Double = { _      {lx, mx, nx, 0, 0, 0, 0, 0, 0, 0, 0, 0}, _      {ly, my, ny, 0, 0, 0, 0, 0, 0, 0, 0, 0}, _      {lz, mz, nz, 0, 0, 0, 0, 0, 0, 0, 0, 0}, _      {0, 0, 0, lx, mx, nx, 0, 0, 0, 0, 0, 0}, _      {0, 0, 0, ly, my, ny, 0, 0, 0, 0, 0, 0}, _      {0, 0, 0, lz, mz, nz, 0, 0, 0, 0, 0, 0}, _      {0, 0, 0, 0, 0, 0, lx, mx, nx, 0, 0, 0}, _      {0, 0, 0, 0, 0, 0, ly, my, ny, 0, 0, 0}, _      {0, 0, 0, 0, 0, 0, lz, mz, nz, 0, 0, 0}, _      {0, 0, 0, 0, 0, 0, 0, 0, 0, lx, mx, nx}, _      {0, 0, 0, 0, 0, 0, 0, 0, 0, ly, my, ny}, _      {0, 0, 0, 0, 0, 0, 0, 0, 0, lz, mz, nz} _      }    Return Kaux  End Function  Function TransformatrixT(lx As Double, mx As Double, nx As Double, ly As Double, my As Double, ny As Double, lz As Double, mz As Double, nz As Double) As Double(,)    Dim Kaux(,) As Double = { _      {lx, ly, lz, 0, 0, 0, 0, 0, 0, 0, 0, 0}, _      {mx, my, mz, 0, 0, 0, 0, 0, 0, 0, 0, 0}, _      {nx, ny, nz, 0, 0, 0, 0, 0, 0, 0, 0, 0}, _      {0, 0, 0, lx, ly, lz, 0, 0, 0, 0, 0, 0}, _      {0, 0, 0, mx, my, mz, 0, 0, 0, 0, 0, 0}, _      {0, 0, 0, nx, ny, nz, 0, 0, 0, 0, 0, 0}, _      {0, 0, 0, 0, 0, 0, lx, ly, lz, 0, 0, 0}, _      {0, 0, 0, 0, 0, 0, mx, my, mz, 0, 0, 0}, _      {0, 0, 0, 0, 0, 0, nx, ny, nz, 0, 0, 0}, _      {0, 0, 0, 0, 0, 0, 0, 0, 0, lx, ly, lz}, _      {0, 0, 0, 0, 0, 0, 0, 0, 0, mx, my, mz}, _      {0, 0, 0, 0, 0, 0, 0, 0, 0, nx, ny, nz} _      }    Return Kaux  End Function  Function Multiply2DMatrices(A(,) As Double, B(,) As Double) As Double(,)    Dim i As int32    Dim j As int32    Dim k As int32    Dim MAux(,) As Double    ReDim MAux(ubound(A, 1), ubound(B, 2))    For i = 0 To ubound(A, 1)      For j = 0 To ubound(B, 1)        For k = 0 To ubound(B, 2)          MAux(i, j) = MAux(i, j) + A(i, k) * B(k, j)        Next k      Next    Next    Return MAux  End Function  Function ReadForces(F As list(Of String)) As datatree(Of Double)    Dim i As Integer    Dim FAux As New datatree(Of Double)    For i = 1 To F.count - 1      FAux.insert(CDbl(F(i).split(",")(1)), New GH_Path(i), 0)      FAux.insert(CDbl(F(i).split(",")(2)), New GH_Path(i), 1)      FAux.insert(CDbl(F(i).split(",")(3)), New GH_Path(i), 2)      FAux.insert(CDbl(F(i).split(",")(4)), New GH_Path(i), 3)      FAux.insert(CDbl(F(i).split(",")(5)), New GH_Path(i), 4)      FAux.insert(CDbl(F(i).split(",")(6)), New GH_Path(i), 5)    Next    Return FAux  End Function  Function InitializeDisplacements(N As list(Of String)) As datatree(Of Double)    Dim i As Integer    Dim NAux As New datatree(Of Double)    For i = 1 To N.count - 1      NAux.insert(0, New GH_Path(i), 0)      NAux.insert(0, New GH_Path(i), 1)      NAux.insert(0, New GH_Path(i), 2)      NAux.insert(0, New GH_Path(i), 3)      NAux.insert(0, New GH_Path(i), 4)      NAux.insert(0, New GH_Path(i), 5)    Next    Return NAux  End Function&lt;/textarea&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-HUMgtCGQ5F0/Tn8lyqxC8cI/AAAAAAAAATg/GCv5d1r1grk/s1600/LM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="178" src="http://4.bp.blogspot.com/-HUMgtCGQ5F0/Tn8lyqxC8cI/AAAAAAAAATg/GCv5d1r1grk/s200/LM.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;b&gt;LM Component:&lt;/b&gt; &lt;br /&gt;&lt;textarea cols="55" name="textfield" rows="20"&gt;Private Sub RunScript(ByVal Constraints As List(Of String), ByVal Kg As DataTree(Of Double), ByVal u As DataTree(Of Double), ByVal F As DataTree(Of Double), ByRef KgExt As Object, ByRef uExt As Object, ByRef FExt As Object)     'your code goes here…    Dim ConstraintType As Int16    Dim RotationX As Double    Dim RotationY As Double    Dim RotationZ As Double    Dim DisplacementX As Double    Dim DisplacementY As Double    Dim DisplacementZ As Double    Dim i As int32    Dim j As int32    Dim k As int32    Dim ExtraRow As int32    Dim ExtraCol As int32    Dim ni As int32    Dim KgAux As New DataTree(Of Double)(Kg)    For i = 1 To Constraints.Count - 1      ConstraintType = CInt(constraints(i).split(",")(0))      ni = CInt(constraints(i).split(",")(1))      If ConstraintType = 1 Then        RotationX = CDbl(constraints(i).split(",")(3))        RotationY = CDbl(constraints(i).split(",")(4))        RotationZ = CDbl(constraints(i).split(",")(5))        DisplacementX = CDbl(constraints(i).split(",")(6))        DisplacementY = CDbl(constraints(i).split(",")(7))        DisplacementZ = CDbl(constraints(i).split(",")(8))        InsertConstraint(DisplacementX, KgAux, 6 * (ni - 1))        InsertConstraint(DisplacementY, KgAux, 6 * (ni - 1) + 1)        InsertConstraint(DisplacementZ, KgAux, 6 * (ni - 1) + 2)        InsertConstraint(RotationX, KgAux, 6 * (ni - 1) + 3)        InsertConstraint(RotationY, KgAux, 6 * (ni - 1) + 4)        InsertConstraint(RotationZ, KgAux, 6 * (ni - 1) + 5)      End If    Next i    ExtraCol = KgAux.BranchCount    ExtraRow = KgAux.BranchCount    For i = Kg.BranchCount To ExtraRow - 1      For j = Kg.BranchCount To ExtraCol - 1        KgAux.Insert(0, New GH_Path(i), j)      Next j    Next i    j = F.BranchCount + 1    k = 0    FExt = New DataTree(Of Double)(F)    For i = Kg.BranchCount To ExtraRow - 1      FExt.insert(0, New GH_Path(j), k)      k = k + 1    Next    uExt = New DataTree(Of Double)(u)    KgExt = New DataTree(Of Double)(KgAux)    'Dim Txt As New System.IO.StreamWriter("C:\Users\John\Desktop\Matrix1.csv")    'For i = 0 To KgAux.BranchCount - 1    'For j = 0 To KgAux.BranchCount - 1    '  print(i &amp;amp; "," &amp;amp; j)    '  Txt.Write(KgAux.Branch(i).item(j) &amp;amp; ",")    ' Next    ' txt.WriteLine()    'Next    'txt.Flush()  End Sub   '&amp;lt;Custom additional code&amp;gt;   Sub InsertConstraint(Value As Double, ByRef K As datatree(Of Double), n As int32)    Dim i As int32    Dim ExtraCol As int32    Dim ExtraRow As int32    ExtraCol = K.BranchCount    ExtraRow = K.BranchCount    For i = 0 To n - 1      K.Insert(0, New GH_Path(ExtraRow), i)      K.Insert(0, New GH_Path(i), ExtraCol)    Next i    K.Insert(Value, New GH_Path(ExtraRow), n)    K.Insert(Value, New GH_Path(n), ExtraCol)    For i = n + 1 To K.BranchCount - 1      K.Insert(0, New GH_Path(ExtraRow), i)      K.Insert(0, New GH_Path(i), ExtraCol)    Next i  End Sub&lt;/textarea&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-NuB2-B2Z5D0/Tn8mDm7dwwI/AAAAAAAAATo/pL1H7tZIuHo/s1600/LUPD.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="177" src="http://2.bp.blogspot.com/-NuB2-B2Z5D0/Tn8mDm7dwwI/AAAAAAAAATo/pL1H7tZIuHo/s200/LUPD.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;b&gt;LUPD Component:&lt;/b&gt; &lt;br /&gt;&lt;textarea cols="55" name="textfield" rows="20"&gt;Private Sub RunScript(ByVal A As DataTree(Of Double), ByVal X As DataTree(Of Double), ByVal B As DataTree(Of Double), ByRef Xsol As Object)     'your code goes here…    Dim n As Int32    Dim er As Int32    Dim i As Int32    Dim j As Int32    Dim m As int32    Dim BAux() As Double    Dim XAux() As Double    Dim tol As Double    Dim AAux(,) As Double    n = A.BranchCount - 1    ReDim Aaux(n, n)    ReDim Baux(n)    ReDim Xaux(n)    For i = 0 To n      For j = 0 To n        AAux(i, j) = A.Branch(i).item(j)      Next j    Next i    For i = 0 To B.BranchCount - 1      For j = 0 To b.Branch(i).Count - 1        BAux(m) = B.Branch(i).item(j)        m = m + 1      Next j    Next i    tol = 1E-17    LUD(AAux, BAux, n, XAux, tol, er)    Xsol = XAux  End Sub   '&amp;lt;Custom additional code&amp;gt;   Sub LUD(a(,) As Double, b() As Double, n As Integer, x() As Double, tol As Double, er As Int32)    Dim o() As Double    Dim s() As Double    ReDim o(n)    ReDim s(n)    Call Decompose(a, n, tol, o, s, er)    If er = 0 Then      Call Substitute(a, o, n, b, x)    Else      MsgBox("ill-conditioned system")      Exit Sub    End If  End Sub  Sub Decompose(a(,) As Double, n As int32, tol As Double, o() As Double, s() As Double, er As int32)    Dim i As Integer    Dim j As Integer    Dim k As Integer    Dim factor As Double    For i = 0 To n      o(i) = i      s(i) = Math.Abs(a(i, 0))      For j = 2 To n        If Math.Abs(a(i, j)) &amp;gt; s(i) Then          s(i) = Math.Abs(a(i, j))        End If      Next j    Next i    For k = 0 To n - 1      Call Pivot(a, o, s, n, k)      If Math.Abs(a(o(k), k) / s(o(k))) &amp;lt; tol Then        er = -1        Exit For      End If      For i = k + 1 To n        factor = a(o(i), k) / a(o(k), k)        a(o(i), k) = factor        For j = k + 1 To n          a(o(i), j) = a(o(i), j) - factor * a(o(k), j)        Next j      Next i    Next k    If (Math.Abs(a(o(k), k) / s(o(k))) &amp;lt; tol) Then er = -1  End Sub  Sub Pivot(a(,) As Double, o() As Double, s() As Double, n As int32, k As int32)    Dim ii As Integer    Dim p As Integer    Dim big As Double    Dim dummy As Double    p = k    big = Math.Abs(a(o(k), k) / s(o(k)))    For ii = k + 1 To n      dummy = Math.Abs(a(o(ii), k) / s(o(ii)))      If dummy &amp;gt; big Then        big = dummy        p = ii      End If    Next ii    dummy = o(p)    o(p) = o(k)    o(k) = dummy  End Sub  Sub Substitute(a(,) As Double, o() As Double, n As int32, b() As Double, x() As Double)    Dim k As Integer    Dim i As Integer    Dim j As Integer    Dim sum As Double    Dim factor As Double    For k = 0 To n - 1      For i = k + 1 To n        factor = a(o(i), k)        b(o(i)) = b(o(i)) - factor * b(o(k))      Next i    Next k    x(n) = b(o(n)) / a(o(n), n)    For i = n - 1 To 0 Step -1      sum = 0      For j = i + 1 To n        sum = sum + a(o(i), j) * x(j)      Next j      x(i) = (b(o(i)) - sum) / a(o(i), i)    Next i  End Sub&lt;/textarea&gt;&lt;/div&gt;&lt;br /&gt;Consistently with the hipothesis that numerical methods for structural can be classifed into Time integrators, Matter Integrators, and Constraint Integrators, I have so far distinguished between LM (Lagrange Multipliers) and FEM (Finite Element Method), remaining for a near future the implemementation of a Newmark-Beta component.&lt;br /&gt;The code provided above simply serves to calculate statics of structures, as the time is yet to be integrated.&lt;br /&gt;&lt;br /&gt;I have made the convenient comparisons with a SAP2000 model to verify the exactness of the implementation, with very satisfactory results.&lt;br /&gt;&lt;br /&gt;Well...more to come in future editions!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-5471875880341921025?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/5471875880341921025/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2011/09/first-fem-lagrange-multipliers-program.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/5471875880341921025'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/5471875880341921025'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2011/09/first-fem-lagrange-multipliers-program.html' title='First FEM + Lagrange multipliers program in Grasshopper'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-rLDxAXzpMLw/Tn8kS-8Xi0I/AAAAAAAAATY/78rvWlaokKM/s72-c/GH-FEM.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-8896575675169664917</id><published>2011-07-17T09:04:00.000-07:00</published><updated>2011-08-01T11:36:20.926-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Grasshopper'/><category scheme='http://www.blogger.com/atom/ns#' term='Dynamics'/><title type='text'>Programming FEM with Grasshopper(R) for Rhino(R)</title><content type='html'>In the past year a powerful design tool called Rhinoceros has come into my sphere of activity.&lt;br /&gt;After several attempts of programming the necessary code to experiment with numerical methods using OGRE and C++, I have come to the conclusion that I need some more productive tools. The problem with C++ is that is good for final products and optimized code, but the available libraries for my purposes are normally too specific and complicated, and even simple debugging processes become a nightmare of libraries and strange variables.&lt;br /&gt;&lt;br /&gt;Rhinoceros has an IDE plugin called Grasshopper that allows for visually programming with an object-oriented approach, which is very close to what we are intending now.&lt;br /&gt;The next step in the research is to study the differences that appear when combining different methods in order to assess an optimum path for different applications. When studied with object-oriented mind, the numerical methods can easily be composed into GH components that afterwards we just need to link.&lt;br /&gt;&lt;br /&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-kgD_6p_3_Oc/TiMEE7MNzBI/AAAAAAAAATA/9p17bYN5tEI/s1600/GH-Methods.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="317" src="http://4.bp.blogspot.com/-kgD_6p_3_Oc/TiMEE7MNzBI/AAAAAAAAATA/9p17bYN5tEI/s400/GH-Methods.jpg" width="400" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Arrangement of possible components with different integration concepts&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;One of my main concerns when developing with proprietary non-opensource IDEs and codes comes with the fact that there is always the chance of having to pay fees at some point, not to mention that they are opaque and not always supported by a community willing to help when there is trouble.&lt;br /&gt;However,&amp;nbsp; the case of Grasshopper seems quite strange as there is a strong and dynamic community of researchers and developers also often supported by excellent professionals (at least as far as I have researched, we'll see..).&lt;br /&gt;&lt;br /&gt;Well, lets hope I have made the right decision and GH boosts my research results in the near future.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-8896575675169664917?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/8896575675169664917/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2011/07/programming-fem-with-grasshopperr-for.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/8896575675169664917'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/8896575675169664917'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2011/07/programming-fem-with-grasshopperr-for.html' title='Programming FEM with Grasshopper(R) for Rhino(R)'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-kgD_6p_3_Oc/TiMEE7MNzBI/AAAAAAAAATA/9p17bYN5tEI/s72-c/GH-Methods.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-1386469421872809031</id><published>2011-07-17T08:05:00.000-07:00</published><updated>2011-09-25T05:36:30.555-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Shape function'/><category scheme='http://www.blogger.com/atom/ns#' term='Finite Element'/><title type='text'>WHAT DOES SHAPE FUNCTION MEAN IN FINITE ELEMENT FORMULATION?</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;Finite Element Analysis is a mathematical tool very extended among engineers. However, after more than a year researching on the topic of computer simulation, where FEA plays such an important role, I haven't yet found a satisfactory explanation on how they really really work...&lt;br /&gt;Hopefully by means of this post I get to clarify some of the topics, trying to remove excessive algebraic and mathematical verbosity that is so annoyingly present everywhere.&lt;br /&gt;&lt;br /&gt;The main background of FEM is that of structural engineering in the 60s. Engineers are very practical people, so initially they devised a system which allowed them to set algebraic equations where the relations between different points or "nodes" of their structures could be set.&lt;br /&gt;These algebraic relations were further proven to be of many different types, not only structural, so also thermal relations could be formulated and many others: all one needed to analyze was a proper discretizacion of the space in the form of a mesh with nodes to relate to each other.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;For our particular case of&amp;nbsp; structural engineering (the one that matters for my PhD thesis),&amp;nbsp; I have tried to illustrate the procedure in its three main steps, so the main ideas come up in a graphic taste:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;u&gt;STEP 1: Discretization&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;In this basic yet classic example, I have chosen to divide my sample structure in only 5 elements where nodes are clearly identifiable in the meetings between beams. There are four nodes.&lt;br /&gt;&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-XWDXV9o8Rlg/TiLnvdan0mI/AAAAAAAAASk/-WqeR7bpY5E/s1600/DOFs.jpg" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="180" src="http://2.bp.blogspot.com/-XWDXV9o8Rlg/TiLnvdan0mI/AAAAAAAAASk/-WqeR7bpY5E/s200/DOFs.jpg" width="200" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Degrees of Freedom&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;Each node will have 6DOF (Degrees Of Freedom): three for linear displacement on each axis (X,Y,Z) and three for rotational around each axis (X,Y,Z), because we are working on 3D. Many examples available provide the more "simple" 2D situation, but in my opinion this only complicates things further.&lt;br /&gt;&lt;br /&gt;&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-toVYIrRhuuY/TiK9vB1HW_I/AAAAAAAAASU/YU798OujDB4/s1600/Structure.jpg" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="285" src="http://3.bp.blogspot.com/-toVYIrRhuuY/TiK9vB1HW_I/AAAAAAAAASU/YU798OujDB4/s400/Structure.jpg" width="400" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;A sample structure (mesh) and its topology table&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;Once the nodes are located and there is a network of how they relate to each other, we can consider we have a mesh. In our example, the correlation is depicted in the table: The elements serve to "link" nodes to each other. The table establishes a "topology" for the nodes.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;u&gt;STEP 2: Element characterization and shape functions&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;In this step is where FEM formulation and literature get really really awkward and nasty. In fact, this is the core of everything and where FEM differenciates from other ways of solving PDEs.&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-FUH06hTm9RU/TiLwQBPpkQI/AAAAAAAAAS0/z9lzZgybB1E/s1600/TimoshenkoBeam-2.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-rUQMZ1BuVnI/TiLwGJlGGOI/AAAAAAAAASw/fkaV3Z1aQFo/s1600/FEMShapes.gif" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="151" src="http://3.bp.blogspot.com/-rUQMZ1BuVnI/TiLwGJlGGOI/AAAAAAAAASw/fkaV3Z1aQFo/s400/FEMShapes.gif" width="400" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Different types of Finite Elements&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;In reality, and despite its mathematical complexity (also unneccesary to be explained so much in detail in my opinion), what we are looking for is a way of characterizing the material properties of the element. For such purpose, the method requires that the behavior of those links among nodes obeys some formula. This formula is the actual &lt;b&gt;Shape Function&lt;/b&gt;. In fact, the shape function can be any mathematical formula that helps us to interpolate what happens wherever there are no points to define the mesh. This "ghost" entity that appears between nodes is in fact the &lt;b&gt;Finite Element&lt;/b&gt;. &lt;i&gt;&lt;b&gt;In practical terms, as engineers we are more interested in the implementation of the FEM, not so much on its formulation, so what is important to understand is that for different shape functions we obtain different element matrices&lt;/b&gt;&lt;/i&gt;.&lt;br /&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-XdKJkvfkKkQ/TiLwC-YfY3I/AAAAAAAAASo/CXjJT1lPl3k/s1600/beamKe.jpg" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-XdKJkvfkKkQ/TiLwC-YfY3I/AAAAAAAAASo/CXjJT1lPl3k/s1600/beamKe.jpg" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;2DOF Beam element matrix&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-_2lpo-BaoMc/TiLwD07eUfI/AAAAAAAAASs/_L6OJm8Pbtk/s1600/3DBeamKe.jpg" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="226" src="http://2.bp.blogspot.com/-_2lpo-BaoMc/TiLwD07eUfI/AAAAAAAAASs/_L6OJm8Pbtk/s320/3DBeamKe.jpg" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;3DOF Beam Element matrix&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-FUH06hTm9RU/TiLwQBPpkQI/AAAAAAAAAS0/z9lzZgybB1E/s1600/TimoshenkoBeam-2.gif" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="151" src="http://3.bp.blogspot.com/-FUH06hTm9RU/TiLwQBPpkQI/AAAAAAAAAS0/z9lzZgybB1E/s400/TimoshenkoBeam-2.gif" width="400" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;3DOF Timoshenko Beam element matrix&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-vKPazSY-HeY/Tn8gJ-LC3NI/AAAAAAAAATQ/SgaYQRCHGt0/s1600/Sin+nombre.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="163" src="http://2.bp.blogspot.com/-vKPazSY-HeY/Tn8gJ-LC3NI/AAAAAAAAATQ/SgaYQRCHGt0/s400/Sin+nombre.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&amp;nbsp;6DOF Timoshenko Beam element matrix&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;Depending on the chosen formulation we have different degrees of interpolation and hence presumably higher or lower degrees of precision. Also depending on the chosen formulation we might have different ways of locating and relating our nodes to each other.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-QQOWJptKj3A/TiK9vwZcDZI/AAAAAAAAASc/U5vVpyr52u4/s1600/Matrix.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="263" src="http://4.bp.blogspot.com/-QQOWJptKj3A/TiK9vwZcDZI/AAAAAAAAASc/U5vVpyr52u4/s400/Matrix.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;For our example we can choose any of the formulations provided in literature (above are the most common used in structural engineering). It is important to note the internal structure of these element matrices, which are symmetrical and clearly divided into parts each corresponding to the nodes that reside on the element's boundaries (2 nodes in the case of a beam - 4 quadrants in the matrix).&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;u&gt;&lt;b&gt;STEP 3: Matrix assembly and solution&lt;/b&gt;&lt;/u&gt; &lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Because the relations between nodes need to be accomplished all at the same time, we have to set all the equations in such a manner that they compose an algebraic system of equations. The matrix equation we want to solve (at least in statics) is as follows:&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;b&gt;[F]= [Kg]·[u]&lt;/b&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Where &lt;b&gt;[F]&lt;/b&gt; is the vector of applied external forces, &lt;b&gt;[Kg]&lt;/b&gt; is the system's global stiffness matrix and &lt;b&gt;[u]&lt;/b&gt; is the vector of displacements resulting from the application of the forces. The size of&lt;b&gt; [Kg]&lt;/b&gt;, &lt;b&gt;[F]&lt;/b&gt; and &lt;b&gt;[u]&lt;/b&gt; is that of the number of DOFs times the number of nodes, being &lt;b&gt;[Kg]&lt;/b&gt; squared and &lt;b&gt;[F]&lt;/b&gt; and &lt;b&gt;[u]&lt;/b&gt; unidimensional.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;In order to generate the Force vector, all we need to do is collect the applied forces (linear and moment forces) and sort them according to the index of the node they are applied to.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;For the global stiffness matrix, it is necessary a bit more laborious procedure by means of which we iterate throughout each element's particular stiffness matrix. Out of each one of those, we get only the part that corresponds to the position of the node we are storing in the matrix, and add it to the possible concurrent data that comes from other elements. Warning: before entering in the global stiffness matrix, we must convert local coordinates to global coordinates!&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;To get the displacement vector, it is needed to first enforce the constraints and then solve the resulting algebraic system of equations. To do this there are two classical approaches: Penalty Method and Lagrange Multipliers method, but we wont enter into this here...&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/--12uZt_fauo/TiL5-BohT8I/AAAAAAAAAS8/GrJRxc2KwQk/s1600/Assembly.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="205" src="http://2.bp.blogspot.com/--12uZt_fauo/TiL5-BohT8I/AAAAAAAAAS8/GrJRxc2KwQk/s400/Assembly.jpg" width="400" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Global Matrix Assembly&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Afterwards, all we need to do is use any available algebraic equation solver (LU decomposition is one of the most extended), and obtain the solution of the system.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-1386469421872809031?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/1386469421872809031/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2011/07/what-does-shape-function-mean-in-finite.html#comment-form' title='2 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/1386469421872809031'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/1386469421872809031'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2011/07/what-does-shape-function-mean-in-finite.html' title='WHAT DOES SHAPE FUNCTION MEAN IN FINITE ELEMENT FORMULATION?'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-XWDXV9o8Rlg/TiLnvdan0mI/AAAAAAAAASk/-WqeR7bpY5E/s72-c/DOFs.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-5691821022552905548</id><published>2011-05-09T09:20:00.000-07:00</published><updated>2011-08-01T11:38:02.635-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Verlet'/><category scheme='http://www.blogger.com/atom/ns#' term='Finite Element Method'/><title type='text'>Impulses, FEM and Verlet</title><content type='html'>After some time struggling with formulations of many diverse categories, I have eventually managed to implement a computer program where the scheme explained in the november entry (&lt;a href="http://stochasticandlagrangian.blogspot.com/2010/11/proposal-on-course-on-real-time.html"&gt;A proposal on a course on Real-Time Structural Dynamics&lt;/a&gt;) becomes clear and useful.&lt;span style="font-size: small;"&gt;The main point here is to explain how, by organizing the numerical methods according to what they really discretize, it is possible to grasp and understand such an entangled area of knowledge.One of the main difficulties that I am encountering through this research period is not just that of the thick mathematical language employed but mainly that of mixed concepts when authors come to explain each of the endless methods available in literature.The following is an step by step procedure where time, constraints and material properties are respectively integrated by means of Verlet, Impulse formulation and Finite Elements numerical methods.The software framework for development and visualization is that presented in April 2010 (one year already uuf!):&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://stochasticandlagrangian.blogspot.com/2010/04/first-ogreverletgauss-seidel-simulation.html"&gt; First Ogre+Verlet+Gauss-Seidel simulation.&lt;/a&gt;On top of it I have made the necessary modifications and also the adaptation from Linux to Windows so it is easier to make further comparisons with commercial codes.The first that is needed is a set of nodes with their coordinates and their masses, along with the list of constraints that topologically relate one to another and to the environment:&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-asKnsvEu6q8/TcfxXzFXEVI/AAAAAAAAARQ/jM1XR83CsD8/s1600/Model.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="205" src="http://2.bp.blogspot.com/-asKnsvEu6q8/TcfxXzFXEVI/AAAAAAAAARQ/jM1XR83CsD8/s400/Model.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Time integration:&lt;/b&gt; Verlet ODE integration method is known to have certain stability but not a big deal of accuracy. However, is fairly easy to implement. An exhaustive explanation on how it works can be found here: &lt;a href="http://en.wikipedia.org/wiki/Verlet_integration"&gt;http://en.wikipedia.org/wiki/Verlet_integration&lt;/a&gt;. In our implementation, it is divided into functions: AccumulateAccelerations and Verlet.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;In AccumulateAccelerations we iterate through each mass and add up earthquake readings from a file (per millisecond), gravity acceleration (980 cm/s2), and the internal forces caused by deformation divided by the weight of the mass.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;The Verlet procedure, simply updates the position of each particle according to the formula:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;b&gt;&lt;span style="font-size: small;"&gt;x(t)=x(t-1) + v(t)·dt + a(t)·dt^2&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;b&gt;&lt;span style="font-size: small;"&gt;Constraint integration: &lt;/span&gt;&lt;/b&gt;&lt;span style="font-size: small;"&gt;The only constraints included in the current implementation &lt;/span&gt;&lt;span style="font-size: small;"&gt;are those of the distance between two particles. By means of the concept of impulse, once two particles move close or apart by the effect of the accelerations, a corrective force is applied on each one of them. This force is applied in a very short lapse of time, hence can be regarded as an impulse. A more detailed explanation can be found in the work by Jan Bender (&lt;a href="http://www.impulse-based.de/"&gt;www.impulse-based.de&lt;/a&gt;). The algebraic system of equations that arises so as to satisfy all of the constraints simultaneously is solved by means of a Gauss-Seidel iterations.&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-D4Tg4vf3kEE/TcgPKImZLgI/AAAAAAAAARU/ZhsbqrfDtVk/s1600/Model2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-D4Tg4vf3kEE/TcgPKImZLgI/AAAAAAAAARU/ZhsbqrfDtVk/s1600/Model2.jpg" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="205" src="http://2.bp.blogspot.com/-D4Tg4vf3kEE/TcgPKImZLgI/AAAAAAAAARU/ZhsbqrfDtVk/s400/Model2.jpg" width="400" /&gt;&lt;/a&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;Matter integration: &lt;/b&gt;For the consideration of matter properties the program uses the Finite Element Method. A quadratic shape function is used according to the implementation taught in&lt;a href="http://www.colorado.edu/engineering/cas/courses.d/IFEM.d/"&gt; http://www.colorado.edu/engineering/cas/courses.d/IFEM.d/&lt;/a&gt;. Chapters 20 and 21 explain clearly how to infer the values for the case of an elastic beam.&lt;br /&gt;This provides our system with a rigidity matrix that is easily attached to each of the distance constraints. As the displacements have already been obtained previously, the solution of the force vector is straightforward by means of a simple rigidity matrix-displacements vector operation:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;b&gt;[f] = [K] · [u]&lt;/b&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;This force vector stores the effect of the deformation into the constraint and is later used to obtain the particle acceleration in the next timestep.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-5691821022552905548?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/5691821022552905548/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2011/05/impulses-fem-and-verlet.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/5691821022552905548'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/5691821022552905548'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2011/05/impulses-fem-and-verlet.html' title='Impulses, FEM and Verlet'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-asKnsvEu6q8/TcfxXzFXEVI/AAAAAAAAARQ/jM1XR83CsD8/s72-c/Model.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-1576674231222360676</id><published>2011-03-19T15:13:00.000-07:00</published><updated>2011-03-19T15:13:15.327-07:00</updated><title type='text'>CANE STRUCTURES WITH FEM</title><content type='html'>Currently Barcelona is holding a lot of activity in cane structure promoted by krfr collective (&lt;a href="http://www.krfr.org/"&gt;www.krfr.org&lt;/a&gt;). In a recent conversation with my colleague Oriol Palou (&lt;a href="http://www.sustenta.eu/"&gt;www.sustenta.eu&lt;/a&gt;) we discussed about the material properties of cane that are being studied within the&lt;a class="l" href="http://www.upc.edu/unitat/fitxa_unitat.php?id_unitat=123&amp;amp;lang=ing"&gt; School of Building Construction of Barcelona (EPSEB).&lt;/a&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;object width="320" height="266" class="BLOG_video_class" id="BLOG_video-dda60520f4d7792c" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"&gt;&lt;param name="movie" value="http://www.youtube.com/get_player"&gt;&lt;param name="bgcolor" value="#FFFFFF"&gt;&lt;param name="allowfullscreen" value="true"&gt;&lt;param name="flashvars" value="flvurl=http://v9.nonxt6.googlevideo.com/videoplayback?id%3Ddda60520f4d7792c%26itag%3D5%26app%3Dblogger%26ip%3D0.0.0.0%26ipbits%3D0%26expire%3D1331348135%26sparams%3Did,itag,ip,ipbits,expire%26signature%3DDC4CD39E3962C7C73561050DA57B4F6C396E0F.21DDC826AA8D3A86FB3FE32ABECF7CABDFE7FAA8%26key%3Dck1&amp;amp;iurl=http://video.google.com/ThumbnailServer2?app%3Dblogger%26contentid%3Ddda60520f4d7792c%26offsetms%3D5000%26itag%3Dw160%26sigh%3DkSzS8CBbK0KLSMZ1qP7q_JKskcg&amp;amp;autoplay=0&amp;amp;ps=blogger"&gt;&lt;embed src="http://www.youtube.com/get_player" type="application/x-shockwave-flash"width="320" height="266" bgcolor="#FFFFFF"flashvars="flvurl=http://v9.nonxt6.googlevideo.com/videoplayback?id%3Ddda60520f4d7792c%26itag%3D5%26app%3Dblogger%26ip%3D0.0.0.0%26ipbits%3D0%26expire%3D1331348135%26sparams%3Did,itag,ip,ipbits,expire%26signature%3DDC4CD39E3962C7C73561050DA57B4F6C396E0F.21DDC826AA8D3A86FB3FE32ABECF7CABDFE7FAA8%26key%3Dck1&amp;iurl=http://video.google.com/ThumbnailServer2?app%3Dblogger%26contentid%3Ddda60520f4d7792c%26offsetms%3D5000%26itag%3Dw160%26sigh%3DkSzS8CBbK0KLSMZ1qP7q_JKskcg&amp;autoplay=0&amp;ps=blogger"allowFullScreen="true" /&gt;&lt;/object&gt;&lt;/div&gt;This led to a first experiment with FEM which video I show here. This simulates one load test made in EPSEB laboratories, where deflections in the middle of the arch under a 200 kg load were around 30 cm, with purely elastic behavior.&lt;br /&gt;Obviously our model needs some refinement, as I had to load it with 2000 kg to make it deform that much, but the results are somehow encouraging&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-1576674231222360676?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/1576674231222360676/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2011/03/cane-structures-with-fem.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/1576674231222360676'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/1576674231222360676'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2011/03/cane-structures-with-fem.html' title='CANE STRUCTURES WITH FEM'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-8292503958376312647</id><published>2011-02-04T05:41:00.000-08:00</published><updated>2011-03-21T04:44:10.011-07:00</updated><title type='text'>ON LAGRANGE'S UBIQUITI IN MODERN PHYSICS</title><content type='html'>This post is just to point out a quite dazzling phenomenon I have been encountering during this year of research: Joseph Louis Lagrange.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_1CZ6zhe_ay0/TTcca5yR_8I/AAAAAAAAAN4/5SxyMZPgyiY/s1600/Langrange_portrait.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_1CZ6zhe_ay0/TTcca5yR_8I/AAAAAAAAAN4/5SxyMZPgyiY/s1600/Langrange_portrait.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_1CZ6zhe_ay0/TTcazBHY6RI/AAAAAAAAAN0/d7vtOt1_Pqw/s1600/lagrange.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;It happens to be that this Italian gentleman revolutionized the world of Physics some two hundred years ago (&lt;a href="http://plus.maths.org/issue36/features/dartnell/index.html"&gt;see here a beautiful explanation on how&lt;/a&gt;), in such a manner that now is nearly impossible not to encounter his surname nearly everywhere when trying to understand them.&lt;br /&gt;The following is a short outline of the mathematical/physical concepts including Lagrange (a larger version can be found in &lt;a href="http://en.wikipedia.org/wiki/List_of_topics_named_after_Joseph_Louis_Lagrange"&gt;http://en.wikipedia.org/wiki/List_of_topics_named_after_Joseph_Louis_Lagrange&lt;/a&gt;):&lt;br /&gt;&lt;br /&gt;&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_1CZ6zhe_ay0/TTceRw2kIOI/AAAAAAAAAN8/i7XcoLe6Wa0/s1600/800px-LagrangeMultipliers3D.png" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="130" src="http://1.bp.blogspot.com/_1CZ6zhe_ay0/TTceRw2kIOI/AAAAAAAAAN8/i7XcoLe6Wa0/s200/800px-LagrangeMultipliers3D.png" width="200" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Lagrange multipliers&lt;/td&gt;&lt;td class="tr-caption" style="text-align: left;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;ul&gt;&lt;li style="text-align: justify;"&gt;&lt;b&gt;Lagrange multipliers&lt;/b&gt;: These are mathematical artifacts for the solution of &lt;u&gt;optimization&lt;/u&gt; problems (&lt;a href="http://en.wikipedia.org/wiki/Lagrange_multiplier"&gt;http://en.wikipedia.org/wiki/Lagrange_multiplier&lt;/a&gt;)&lt;/li&gt;&lt;li style="text-align: justify;"&gt;&lt;b&gt;Euler-Lagrange equation&lt;/b&gt;: The Euler–Lagrange equation was developed in the 1750s by Euler and Lagrange in connection with their studies of the tautochrone problem. This is the problem of determining a curve on which a weighted particle will fall to a fixed point in a fixed amount of time, independent of the starting point. Lagrange solved this problem in 1755 and sent the solution to Euler. The two further developed Lagrange's method and applied it to mechanics, which led to the formulation of &lt;u&gt;Lagrangian mechanics&lt;/u&gt;.&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_1CZ6zhe_ay0/TTcgs-e0xjI/AAAAAAAAAOA/F3H7ArNnVbo/s1600/fcbb2da13495c1c12bef98ab883e9abd.png" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_1CZ6zhe_ay0/TTcgs-e0xjI/AAAAAAAAAOA/F3H7ArNnVbo/s1600/fcbb2da13495c1c12bef98ab883e9abd.png" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Euler-Lagrange equation&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;Their correspondence ultimately led to the calculus of variations, a term coined by Euler himself in 1766.&lt;sup&gt; &lt;/sup&gt;In classical mechanics, it is equivalent to Newton's laws of motion, but it has the advantage that it takes the same form in any system of generalized coordinates, and it is better suited to generalizations. Is also related to optimization according to variational principles (&lt;a href="http://en.wikipedia.org/wiki/Euler%E2%80%93Lagrange_equation%29"&gt;http://en.wikipedia.org/wiki/Euler%E2%80%93Lagrange_equation)&lt;/a&gt;.&lt;/li&gt;&lt;li style="text-align: justify;"&gt;&lt;b&gt;Lagrangian function&lt;/b&gt;: The concept of a Lagrangian was originally introduced in a reformulation of &lt;u&gt;classical mechanics&lt;/u&gt; by Irish mathematician William Rowan Hamilton known as Lagrangian mechanics. &lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;img alt="L = T - V.\quad" class="tex" src="http://upload.wikimedia.org/math/b/f/b/bfb2ab0977e6e5fedbd978efceee5845.png" style="margin-left: auto; margin-right: auto;" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Lagrangian function&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;In classical mechanics, the Lagrangian is defined as the kinetic energy, &lt;span class="texhtml"&gt;&lt;i&gt;T&lt;/i&gt;&lt;/span&gt;, of the system minus its potential energy.&lt;/li&gt;&lt;li style="text-align: justify;"&gt;&lt;b&gt;Green-Lagrangian tensor&lt;/b&gt;: In &lt;u&gt;continuum mechanics&lt;/u&gt;, the finite strain theory also called large strain theory, or large deformation theory, deals with deformations in which both rotations and strains are arbitrarily large. This means to invalidate the assumptions inherent in infinitesimal strain theory. In this case, the undeformed and deformed configurations of the continuum are significantly different and a clear distinction has to be made between them. This is commonly the case with elastomers, plastically-deforming materials and other fluids and biological soft tissue. The concept of &lt;i&gt;strain&lt;/i&gt; is used to evaluate how much a given displacement differs locally from a rigid body displacement . One of such strains for large deformations is the &lt;i&gt;Lagrangian finite strain tensor&lt;/i&gt;, also called the &lt;i&gt;Green-Lagrangian strain tensor&lt;/i&gt; or &lt;i&gt;Green - St-Venant strain tensor.&lt;/i&gt;&lt;/li&gt;&lt;li style="text-align: justify;"&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;b&gt;Lagrange description of motion&lt;/b&gt;. In continuum mechanics the Lagrangian specification of the flow field is a way of looking at fluid motion where the observer follows an individual fluid parcel as it moves through space and time. Plotting the position of an individual parcel through time gives the pathline of the parcel. This can be visualized as sitting in a boat and drifting down a river. The Eulerian specification of the flow field is a way of looking at fluid motion that focuses on specific locations in the space through which the fluid flows as time passes. This can be visualized by sitting on the bank of a river and watching the water pass the fixed location. The Lagrangian approach is also associated to particle based formulation, whereas the Eulerian is referred to as grid based formulations.&lt;br /&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_1CZ6zhe_ay0/TUv_FpA5WeI/AAAAAAAAAO8/xMZ0kA019a4/s1600/800px-EulerianMesh.png" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="138" src="http://3.bp.blogspot.com/_1CZ6zhe_ay0/TUv_FpA5WeI/AAAAAAAAAO8/xMZ0kA019a4/s320/800px-EulerianMesh.png" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Eulerian description&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_1CZ6zhe_ay0/TUv_Ead757I/AAAAAAAAAO4/1WtuKte25Cg/s1600/400px-LagrangianMesh.png" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="147" src="http://2.bp.blogspot.com/_1CZ6zhe_ay0/TUv_Ead757I/AAAAAAAAAO4/1WtuKte25Cg/s320/400px-LagrangianMesh.png" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Lagrangian description&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;i&gt;&amp;nbsp;&lt;/i&gt;&lt;/li&gt;&lt;/ul&gt;And this is just a small sample. However, it fully justifies the name of the thesis and this blog's, as our research departs from Lagrange's work to try to find engineering solutions.&lt;br /&gt;It must be said that Lagrange's prolificacy results somehow dazing and stunning, as there are so many fields he got involved in, and none of them of trivial nature.&lt;br /&gt;I hope this quick outline serves others to find a way through all this tangled knowledge. &lt;br /&gt;&lt;ul&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-8292503958376312647?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/8292503958376312647/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2011/02/on-lagranges-ubiquiti-in-modern-physics.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/8292503958376312647'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/8292503958376312647'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2011/02/on-lagranges-ubiquiti-in-modern-physics.html' title='ON LAGRANGE&apos;S UBIQUITI IN MODERN PHYSICS'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_1CZ6zhe_ay0/TTcca5yR_8I/AAAAAAAAAN4/5SxyMZPgyiY/s72-c/Langrange_portrait.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-5409428150648206969</id><published>2010-11-22T14:08:00.000-08:00</published><updated>2010-11-22T14:08:42.093-08:00</updated><title type='text'>A proposal on a course on Real-Time Structural Dynamics</title><content type='html'>&amp;nbsp;The following is a tree with the key concepts that, although already at reach of any graduated structural engineer, need to be tied together, maybe in a course, in order to achieve a proper scope on how to simulate real-time structural dynamics:&lt;br /&gt;&lt;ul&gt;&lt;li&gt; Main &lt;b&gt;time&lt;/b&gt; integration methods (&lt;b&gt;ODE&lt;/b&gt;), their limitations (drawbacks), advantages, motivation, references, illustrations, year, all related to the three disciplines applied physics, maths and applied computing:&lt;/li&gt;&lt;ul&gt;&lt;ul&gt;&lt;li&gt;1st order&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Euler&lt;/li&gt;&lt;li&gt;Backward Euler&lt;/li&gt;&lt;li&gt;Semi-implicit Euler&lt;/li&gt;&lt;li&gt;Exponential Euler&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;2nd order&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Verlet&lt;/li&gt;&lt;li&gt;Velocity Verlet&lt;/li&gt;&lt;li&gt;Midpoint Method&lt;/li&gt;&lt;li&gt;Heun's&lt;/li&gt;&lt;li&gt;Newmark-beta&lt;/li&gt;&lt;li&gt;Leapfrog&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Higher order&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Runge-Kutta&lt;/li&gt;&lt;li&gt;Linear multistep&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;li&gt;Main &lt;b&gt;constraint/collision&lt;/b&gt; (&lt;b&gt;DAE&lt;/b&gt;) integration methods, their limitations (drawbacks), advantages, motivation, references, illustrations, year, all related to the three disciplines applied physics, maths and applied computing.&lt;/li&gt;&lt;ul&gt;&lt;ul&gt;&lt;li&gt;Coordinate Partitioning&lt;/li&gt;&lt;li&gt;Constraint Orthogonalization&lt;/li&gt;&lt;li&gt;Udwadia-Kalaba&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;li&gt;Main &lt;b&gt;matter/continuum&lt;/b&gt; (&lt;b&gt;PDE&lt;/b&gt;) integration methods, their limitations (drawbacks), advantages, motivation, references, illustrations, year, all related to the three disciplines applied physics, maths and applied computing.&lt;/li&gt;&lt;ul&gt;&lt;ul&gt;&lt;li&gt;MESH BASED METHODS&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Finite Element&lt;/li&gt;&lt;li&gt;Finite Differences&lt;/li&gt;&lt;li&gt;Finite Volume&lt;/li&gt;&lt;li&gt;Boundary Element&lt;/li&gt;&lt;li&gt;Mass-spring systems&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;MESH FREE METHODS&lt;/li&gt;&lt;ul&gt;&lt;li&gt;SPH&lt;/li&gt;&lt;li&gt;Diffuse Element Method&lt;/li&gt;&lt;li&gt;Partition of Unity&lt;/li&gt;&lt;li&gt;Moving Least Square&lt;/li&gt;&lt;li&gt;Reproducing Kernel Method&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;/ul&gt;A graphical approach to ths subject, not so tied to complex formalisms and formulation, would be a real help to attract more researchers into this fascinating discipline.&lt;br /&gt;It also would reinforce the interest on the very differential equations, as these are a very abstract concept explained and taught on a very abstract basis. This makes them first candidate to be either forgotten or banned into the minds of students.&lt;br /&gt;&lt;br /&gt;I will try to develop these subjects with more care in future issues...&lt;br /&gt;&lt;br /&gt;Se vidimo!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-5409428150648206969?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/5409428150648206969/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/11/proposal-on-course-on-real-time.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/5409428150648206969'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/5409428150648206969'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/11/proposal-on-course-on-real-time.html' title='A proposal on a course on Real-Time Structural Dynamics'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-4180870345992912097</id><published>2010-10-26T06:49:00.000-07:00</published><updated>2010-10-26T06:49:07.590-07:00</updated><title type='text'>Physics Engines Benchmarking</title><content type='html'>The target was to devise in some manner the way different computationalphysics simulation models/engines/environments performed against acanonical one.&lt;br /&gt; &lt;br /&gt;For such purpose, I have reviewed the paper &lt;i&gt;"Beam Benchmark Problems For Validation Of Flexible Multibody Dynamic Codes"&lt;/i&gt; by A.L. Schwab and J.P. Meijgaard.&lt;br /&gt;The following is an outline of the proposed in this paper:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;1.- Introduction&lt;/li&gt;&lt;ul&gt;&lt;li&gt;The paper presents some basic problems for which analytic solution is known&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;2.- Beam benchmark problems&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Tests to be performed&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Static analyses in small displacements for the validation of the correct formulation of elastic forces&lt;/li&gt;&lt;li&gt;Static analyses for large displacements and rotations, on straight and curved beams&lt;/li&gt;&lt;li&gt;Bucklingtests in normal, lateral and torsional directions to check the waygeometric stiffness due to prestress is taken into account&lt;/li&gt;&lt;li&gt;Eigenfrequency analyses for the validation of the combination of elastic forces and distributed inertia forces&lt;/li&gt;&lt;li&gt;Mesh refinement tests for all the above to prove convergence of the results&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Underlying model: Timoshenko beam with large displacements and large rotations&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Finite Element Method Beam Element&lt;/li&gt;&lt;li&gt;Shear flexible based on the elastic line concept&lt;/li&gt;&lt;li&gt;Slender beam, cross section doubly symmetric&lt;/li&gt;&lt;li&gt;Large rotation and displacements, but small deformations&lt;/li&gt;&lt;li&gt;Isotropic and linearly elastic&lt;/li&gt;&lt;li&gt;BEAM model: standard strain-displacement relations&lt;/li&gt;&lt;li&gt;BEAMNL model: additional quadratic terms included in the strain-displacement for better performance in the pre-stress cases&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;/ul&gt;Interestingly enough, the analytical solution isprovided for each of the tests, and the proposed model is simple enoughso as not having too much trouble in introducing it in a fewcharacteristic ready made softwares currently available.&lt;br /&gt;&lt;br /&gt;The implementation of such a benchmark over some of the most popular engines revised lately would surely make a nice contribution.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-4180870345992912097?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/4180870345992912097/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/10/physics-engines-benchmarking.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/4180870345992912097'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/4180870345992912097'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/10/physics-engines-benchmarking.html' title='Physics Engines Benchmarking'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-6840944432677541330</id><published>2010-10-14T04:49:00.000-07:00</published><updated>2010-10-14T04:49:00.850-07:00</updated><title type='text'>Integration Overview</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: justify;"&gt;In order to get some scope I have prepared a new diagram where the different integration fields of any multibody physics engine can be fit.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: justify;"&gt;Normally we have to integrate time, via ODEs, for which any of the available schemes can be chosen, but then also the Differential Algebraic Equations for constraints (related to collisions) and the Partial Differential Equations related to the continuum have to be solved.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: justify;"&gt;&lt;br /&gt;Of course, not every engine implements the continuum part (limiting to rigid solid) and some matter integration schemes already consider the very collisions so the constraint integration is explicitly sorted...&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: justify;"&gt;The associated disciplines where each concept fits are represented by the horizontal blocks.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_1CZ6zhe_ay0/TLbrqQNBJ9I/AAAAAAAAALU/wFNFrV4mGVs/s1600/Discipline+overview.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="300" src="http://3.bp.blogspot.com/_1CZ6zhe_ay0/TLbrqQNBJ9I/AAAAAAAAALU/wFNFrV4mGVs/s400/Discipline+overview.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-6840944432677541330?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/6840944432677541330/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/10/integration-overview.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/6840944432677541330'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/6840944432677541330'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/10/integration-overview.html' title='Integration Overview'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_1CZ6zhe_ay0/TLbrqQNBJ9I/AAAAAAAAALU/wFNFrV4mGVs/s72-c/Discipline+overview.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-8052630822390742544</id><published>2010-09-22T04:45:00.000-07:00</published><updated>2010-09-22T04:46:53.528-07:00</updated><title type='text'>Discipline Overview</title><content type='html'>Holidays are over already. I am now living in Slovenia, Ljubljana, and developing the thesis in the Faculty of Architecture (lovely place, by the way...).&lt;br /&gt;&lt;br /&gt;Last June I presented my Thesis Proposal to the jury of the Computational and Applied Physics Department in the UPC and...it was accepted!!&lt;br /&gt;&lt;br /&gt;After the long pause I have had to prepare an overview of all the studied subjects, just to get some scope on what is coming and where we are now. The following diagrams give some idea on how it is:&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_1CZ6zhe_ay0/TJnqDxOAIsI/AAAAAAAAALE/-z3ZjmQ2bLE/s1600/Screenshot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="290" src="http://3.bp.blogspot.com/_1CZ6zhe_ay0/TJnqDxOAIsI/AAAAAAAAALE/-z3ZjmQ2bLE/s400/Screenshot.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;And with a bit more of detail:&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_1CZ6zhe_ay0/TJnqFm-jlNI/AAAAAAAAALM/WeHU4BOlwy0/s1600/Screenshot-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="302" src="http://1.bp.blogspot.com/_1CZ6zhe_ay0/TJnqFm-jlNI/AAAAAAAAALM/WeHU4BOlwy0/s400/Screenshot-1.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;These diagrams derive from the need of disentangling disciplines that more often than seldom get mixed in the literature and make it fairly hard to follow.&lt;br /&gt;The literature I am talking about is that of the computational simulation of physics, where numerical methods meet with very different origins.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-8052630822390742544?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/8052630822390742544/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/09/discipline-overview.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/8052630822390742544'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/8052630822390742544'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/09/discipline-overview.html' title='Discipline Overview'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_1CZ6zhe_ay0/TJnqDxOAIsI/AAAAAAAAALE/-z3ZjmQ2bLE/s72-c/Screenshot.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-8618706826070246611</id><published>2010-07-27T08:45:00.000-07:00</published><updated>2010-07-27T08:48:43.086-07:00</updated><title type='text'>SUSTAINABLE DYNAMIC STRUCTURES WITH CANE</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_1CZ6zhe_ay0/TE7_sbxq28I/AAAAAAAAAKU/2vFgmuxqIIQ/s1600/IMG_1948.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="265" src="http://4.bp.blogspot.com/_1CZ6zhe_ay0/TE7_sbxq28I/AAAAAAAAAKU/2vFgmuxqIIQ/s400/IMG_1948.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;The last month I have been quite busy helping out raise the structure above.&lt;br /&gt;It is located near Idanha Velha, in the premises for the International Boom Festival in Portugal.&lt;br /&gt;&lt;br /&gt;It is one of the most clear examples of dynamic structures, where ordinary laws of statics don't apply, and one of my first fields of intense research.&lt;br /&gt;&lt;br /&gt;The aim is to reach a comprehensive computational model that allows the designer (Jonathan Cory Wright - &lt;a href="http://www.canyaviva.com/"&gt;www.canyaviva.com&lt;/a&gt;) to experiment with his designs prior to having to actually raise his buildings!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-8618706826070246611?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/8618706826070246611/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/07/sustainable-dynamic-structures-with.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/8618706826070246611'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/8618706826070246611'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/07/sustainable-dynamic-structures-with.html' title='SUSTAINABLE DYNAMIC STRUCTURES WITH CANE'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_1CZ6zhe_ay0/TE7_sbxq28I/AAAAAAAAAKU/2vFgmuxqIIQ/s72-c/IMG_1948.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-771607119889247705</id><published>2010-04-20T14:55:00.000-07:00</published><updated>2010-04-20T15:08:36.725-07:00</updated><title type='text'>An Overview on Constraint Enforced Formulations of Variational Dynamics</title><content type='html'>A couple of weeks ago a very interesting paper entered my hard drive: &lt;a href="http://www.google.es/url?sa=t&amp;amp;source=web&amp;amp;ct=res&amp;amp;cd=1&amp;amp;ved=0CAoQFjAA&amp;amp;url=http%3A%2F%2Fsoliton.ae.gatech.edu%2Fpeople%2Fobauchau%2Fpublications%2FLaulusa%2BBauchau07.pdf&amp;amp;ei=WhfOS_3JNIKe_ganppxt&amp;amp;usg=AFQjCNGO1CDPIxNxdwc9JPhcDkk5cu_VXA&amp;amp;sig2=4aLcduMx8UpE4g3sLnRAgQ"&gt;Review of classical approaches for constraint enforcement in multibody systems&lt;/a&gt;.&lt;br /&gt;It is a fairly clarifying overview on solid grounds of certain methodologies to solve multibody systems dynamics.&lt;br /&gt;These methodologies differ from the ones I have encountered in the spreaded dynamics engines in their apparently more robust and simple formulation.&lt;br /&gt;Here is a synthesis of this paper:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;Multibody systems present two distinguishable features:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Bodies undergo finite relative rotations, which introduce nonlinearities&lt;/li&gt;&lt;li&gt;Bodies are connected by mechanical joints that impose restrictions, which mean a set of governing equations that combine differential and algebraic equations (ODEs and DAEs, respectively).&lt;/li&gt;&lt;/ol&gt;Lagrange's equation of the first kind has the following aspect:&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_1CZ6zhe_ay0/S84btYzOWXI/AAAAAAAAAJE/ViuafLK0QzY/s1600/Pantallazo.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_1CZ6zhe_ay0/S84btYzOWXI/AAAAAAAAAJE/ViuafLK0QzY/s320/Pantallazo.png" /&gt;&lt;/a&gt;&lt;/div&gt;Where&lt;br /&gt;&lt;ul&gt;&lt;li&gt;M=M(q,t) is the mass matrix&lt;/li&gt;&lt;li&gt;q is the generalized coordinates vector&lt;/li&gt;&lt;li&gt;B is the constraint matrix&lt;/li&gt;&lt;li&gt;λ is the array of Lagrange multipliers&lt;/li&gt;&lt;li&gt;F is the dynamic externally applied forces&lt;/li&gt;&lt;/ul&gt;If all the constraints are holonomic (velocity independent), B is called the Jacobian matrix, and the generalized coordinates, q, are linked by m algebraic constraints.&lt;br /&gt;Lagrange's equations of the first kind form a set of (m+n) Differential Algebraic Equations.&lt;br /&gt;The approach of the following methods is to use algebraic procedures in order to eliminate Lagrange's multipliers and then obtain a set of ODEs.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Maggi's formulation: implies the creation of a vector containing the so called &lt;i&gt;kinematic parameters&lt;/i&gt;, &lt;i&gt;generalized speeds&lt;/i&gt; or &lt;i&gt;independent quasi-velocities&lt;/i&gt; by the analyst in order to obtain a Γ matrix. This matrix spans the null space of the constraint matrix and allows for the elimination of the Lagrange multipliers.&lt;/li&gt;&lt;li&gt;Index-1 formulation: requires that initial condition of the problem be subjected to the constraint conditions. Then, it is possible to obtain a system of 2nd order ODEs that is solvable by rearranging the previous equation, extracting the Lagrange multipliers and hence obtaining:&lt;span id="goog_883168442"&gt;&lt;/span&gt;&lt;span id="goog_883168443"&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_1CZ6zhe_ay0/S84hMPH4heI/AAAAAAAAAJM/eA8mkNIa8PQ/s1600/Pantallazo-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_1CZ6zhe_ay0/S84hMPH4heI/AAAAAAAAAJM/eA8mkNIa8PQ/s320/Pantallazo-1.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Null space formulation: this method solves the system of second order ODEs by premultiplying the first part of the equation by the transposed null space matrix thus eliminating the Lagrange multipliers.&lt;/li&gt;&lt;li&gt;Udwadia-Kalaba formulation: this method represents a more compact and general form of solving the DAEs by means of the Moore-Penrose generalized inverse. It is based on Gauss' Principle of Minimum Constraint, which establishes that the explicit equations of motion be expressed as the solution of a quadratic minimization problem subjected to constraints, but at the acceleration level.&lt;/li&gt;&lt;/ul&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;br /&gt;All these formulations transform the (2n+m) first order DAEs into ODEs by eliminating Lagrange multipliers.&lt;br /&gt;Maggi's formulation yields (2n-m) first order ODEs.&lt;br /&gt;Index-1, null space and Udwadia-Kalaba form sets of (n) second order ODEs which could be alternatively recast into (2n) first order ODEs for the n generalized coordinates and the n generalized velocities.&lt;br /&gt;The main advantage of these methodologies is not so much the reduction in the number of equations but rather in the change from DAEs to ODEs.&lt;br /&gt;There is a warning on the constraint drift phenomenon, for which these method will be more affected (not so much in Maggi's formulation), and that would require constraint stabilization techniques.&lt;/blockquote&gt;My conclusion is that it seems the way to go, not only for the claims of more stable and quick numerical techniques available to get them working, but also for an apparently more clear approach in the theoretical field.&lt;br /&gt;Particularly, I have done some research into the Udwadia-Kalaba formulation, and definitively is a very promising one.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-771607119889247705?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/771607119889247705/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/04/overview-on-constraint-enforced.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/771607119889247705'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/771607119889247705'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/04/overview-on-constraint-enforced.html' title='An Overview on Constraint Enforced Formulations of Variational Dynamics'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_1CZ6zhe_ay0/S84btYzOWXI/AAAAAAAAAJE/ViuafLK0QzY/s72-c/Pantallazo.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-856764917740920547</id><published>2010-04-15T15:26:00.000-07:00</published><updated>2010-04-15T15:26:32.407-07:00</updated><title type='text'>ODE DYNAMICS ENGINE QUICK OVERVIEW</title><content type='html'>After seeing my own simulator running there is a whole lot of things that I wish it had.&lt;br /&gt;All this stuff is more or less complicated to achieve, but from my previous research I have found some Open Source engines from which I can learn a lot.&lt;br /&gt;&lt;br /&gt;The best documented one so far is ODE (&lt;a href="http://www.ode.org/"&gt;www.ode.org&lt;/a&gt;), and also the one I intend to merge with Blender.&lt;br /&gt;So, I present a very quick and thorough overview on how this works, in order to have some scope.&lt;br /&gt;&lt;br /&gt;The first thing to disentangle is how it gets working. For that, just looking at the user's manual one gets the following algorithm:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;1.-Create a Dynamics world&lt;br /&gt;&lt;ul&gt;&lt;li&gt;This basically means to make an instance of the dxWorld struct.&lt;/li&gt;&lt;/ul&gt;2.-Create the bodies&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Attach the bodies to the world (this means adding data to the dxBody* array of the dynamics world).&lt;/li&gt;&lt;li&gt;Set their properties (position and orientation of point of reference, its linear and angular velocities, the mass of the bodies and some other stuff of the like).&lt;/li&gt;&lt;/ul&gt;3.-Create the joints&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Attach the joints to the world (by adding data to the dxJoints* array of the dynamics world)&lt;/li&gt;&lt;li&gt;Set their properties (depending of the selected type of joint, one has to provide different details).&lt;/li&gt;&lt;/ul&gt;4.-Manage collisions&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Create a new collision world (just by making an instance to the dxSpace struct).&lt;/li&gt;&lt;li&gt;Create a joint group where collisions will be stored temporarily for every frame step.&lt;/li&gt;&lt;/ul&gt;5.-Loop&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Apply forces to bodies.&lt;/li&gt;&lt;li&gt;Adjust joint parameters.&lt;/li&gt;&lt;li&gt;Call collision detection.&lt;/li&gt;&lt;li&gt;Create a contact joint for every detected collision point and add it to the collision joint group.&lt;/li&gt;&lt;li&gt;Take a simulation step.&lt;/li&gt;&lt;li&gt;Clear the collision joint group.&lt;/li&gt;&lt;/ul&gt;6.-Destroy the dynamics and the collision worlds (wow, that sounds evil...hehehe).&lt;/blockquote&gt;&lt;br /&gt;All of this seems fairly easy to do but then one has to get to know where and how things have been implemented. This is when things become a bit harder.&lt;br /&gt;I am sure the file structure and the class definitions make perfect sense for the programmers of this engine.&lt;br /&gt; Fortunately, they have been careful enough so as to comment everything in an understandable way, for which I feel deeply grateful.&lt;br /&gt;After some digging, I have managed to restructure the ode/src folder into the following topics:&lt;br /&gt;&lt;blockquote&gt;&lt;ul&gt;&lt;li&gt;Accessories&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Memory management&lt;/li&gt;&lt;li&gt;Math&lt;/li&gt;&lt;li&gt;Matrix handling&lt;/li&gt;&lt;li&gt;External applications&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Collision&lt;/li&gt;&lt;li&gt;Core&lt;/li&gt;&lt;li&gt;Joints &lt;/li&gt;&lt;li&gt;Primitives&lt;/li&gt;&lt;li&gt;Solver&lt;/li&gt;&lt;/ul&gt;&lt;/blockquote&gt;Which means one can tackle the engine in an ordered manner and find things when needed.&lt;br /&gt;&lt;br /&gt;From a theoretical point of view, this engine presents the following features:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;A Lagrange multiplier velocity based model from Trinkle and Stewart&lt;/li&gt;&lt;li&gt;A friction model from Baraff&lt;/li&gt;&lt;li&gt;A Danzig LCP solver&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-856764917740920547?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/856764917740920547/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/04/ode-dynamics-engine-quick-overview.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/856764917740920547'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/856764917740920547'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/04/ode-dynamics-engine-quick-overview.html' title='ODE DYNAMICS ENGINE QUICK OVERVIEW'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-6550386111535592553</id><published>2010-04-13T20:14:00.000-07:00</published><updated>2010-09-07T03:16:33.343-07:00</updated><title type='text'>First Ogre+Verlet+Gauss-Seidel simulation</title><content type='html'>Once the Ogre3D engine is ready to draw what we numerically compute, it was about time to start having some fun.&lt;br /&gt;&lt;br /&gt;I found this excellent article from Thomas Jakobsen: &lt;a href="http://www.gotoandplay.it/_articles/2005/08/advCharPhysics.php"&gt;http://www.gotoandplay.it/_articles/2005/08/advCharPhysics.php&lt;/a&gt; where a very neat and simple engine is implemented (thanks Mr. Jakobsen).&lt;br /&gt;&lt;br /&gt;It is very well explained so adapting it to my little lab was not very hard.&lt;br /&gt;Here I proudly present my very first simulation!&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;object height="320" width="400"&gt;&lt;param name="movie" value="http://www.youtube.com/v/sxoBJJ2f8uQ&amp;hl=es_ES&amp;fs=1&amp;border=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/sxoBJJ2f8uQ&amp;hl=es_ES&amp;fs=1&amp;border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="400" height="320"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;I am perfectly conscious that it lacks of a lot of things...namely collision detection, a proper stable, precise integrator, an optimized implementation...and a long etcetera...but it's just a baby!&lt;br /&gt;&lt;br /&gt;Here is a zip file with the code (an extension from what I presented in the last post):&lt;br /&gt;&lt;a href="http://www.blogger.com/goog_1516204070"&gt;&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.mnbvlabs.com/Thesis/VerletRelaxation.zip"&gt;http://www.mnbvlabs.com/Thesis/VerletRelaxation.zip&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-6550386111535592553?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/6550386111535592553/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/04/first-ogreverletgauss-seidel-simulation.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/6550386111535592553'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/6550386111535592553'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/04/first-ogreverletgauss-seidel-simulation.html' title='First Ogre+Verlet+Gauss-Seidel simulation'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-6151249302511128532</id><published>2010-04-11T15:51:00.000-07:00</published><updated>2010-04-27T04:36:20.925-07:00</updated><title type='text'>Setting Ogre3D as Graphic Environment</title><content type='html'>The last days I have been working on getting a Graphics Environment for my Toy Physics Engine.&lt;br /&gt;Last December and January I had already fiddled around with excellent engines Ogre (&lt;a href="http://www.ogre3d.org/"&gt;www.ogre3d.org&lt;/a&gt;) and Bullet (&lt;a href="http://bulletphysics.org/wordpress/"&gt;http://bulletphysics.org/wordpress/&lt;/a&gt;), trying to put them to work together.I have a post from february where some simulations on youtube can be seen and some preliminary introductions are made.&lt;br /&gt;&lt;br /&gt;However, now I am starting to understand things, and whenever I have the drive to test them always encounter the problem on how visualize them.&lt;br /&gt;&lt;br /&gt;So, I came across with Blender (&lt;a href="http://www.blender.org/"&gt;www.blender.org&lt;/a&gt;), another fantastic tool, and got surprised to find their Google Summer of Code mentorship for 2010 (&lt;a href="http://wiki.blender.org/index.php/Dev:Ref/GSoC/2010/Info"&gt;http://wiki.blender.org/index.php/Dev:Ref/GSoC/2010/Info&lt;/a&gt;).&lt;br /&gt;I have applied for it. Deadline was 9th April, which meant preparing everything in a hurry and some embarrasing trouble with their wiki page (I have already apologised in their bf-commiters mailing list...ooops).&lt;br /&gt;Here is my proposal for such an important event: (&lt;a href="http://wiki.blender.org/index.php/User:Ndujar"&gt;http://wiki.blender.org/index.php/User:Ndujar&lt;/a&gt;).&lt;br /&gt;Hopefully they find it interesting and contact me to complete it!&lt;br /&gt;&lt;br /&gt;In the meantime, I have prepared a short and basic Ogre framework to begin doing some tests.&lt;br /&gt;It is composed of a few files and classes integrating Ogre.&lt;br /&gt;&lt;br /&gt;I generated it basically copying, cutting and pasting from the very good tutorials available at the Ogre web page (&lt;a href="http://www.ogre3d.org/wiki/index.php/Ogre_Tutorials"&gt;http://www.ogre3d.org/wiki/index.php/Ogre_Tutorials&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;It goes as follows:&lt;br /&gt;&lt;br /&gt;The first step is to intall and cofigure Ogre in your computer. This is the best tutorial I found: &lt;a href="http://ubuntuforums.org/archive/index.php/t-1148570.html"&gt;http://ubuntuforums.org/archive/index.php/t-1148570.html&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Then, using whatever IDE of your taste (I am on EasyEclipse), just get the following files to compile.&lt;br /&gt;&lt;br /&gt;The core of the application is the BaseApp object, from which I will later extend further as needed. It is basically in charge of doing everything Ogre requires to be done to put things up in a rendering window.&lt;br /&gt;&lt;b&gt;BaseApp.h&lt;/b&gt;: &lt;br /&gt;&lt;textarea cols="55" name="textfield" rows="20"&gt;#include &amp;lt;Ogre.h&amp;gt;#include "BaseFrameListener.h"#include "PhysicsFrameListener.h"#include "PhysicsEntity.h"#include &amp;lt;iostream&amp;gt;#include &amp;lt;math.h&amp;gt;#include &amp;lt;vector&amp;gt;#include &amp;lt;time.h&amp;gt;#include &amp;lt;ctime&amp;gt;#include &amp;lt;stdio.h&amp;gt;#include &amp;lt;unistd.h&amp;gt;#include &amp;lt;stdlib.h&amp;gt;using namespace Ogre;class BaseApp{public:    void go();    ~BaseApp();private:    Root *mRoot;    BaseFrameListener *mListener;    PhysicsFrameListener *PhListener;    Ogre::String mResourcePath;    SceneManager *mgr;    RenderWindow *win;    Camera *mCamera;    std::vector&amp;lt;PhysicsEntity&amp;gt; PhysicsEntities;    void createRoot();    void defineResources();    void loadResources();    void setupRenderSystem();    void createRenderWindow();    void initializeResourceGroups();    void setupScene();    void setupInputSystem();    void setupCEGUI();    void createFrameListener();    void createPhysicsFrameListener();    void startRenderLoop();};&lt;/textarea&gt;&lt;br /&gt;&lt;b&gt;BaseApp.cpp&lt;/b&gt;: &lt;br /&gt;&lt;textarea cols="55" name="textfield" rows="20"&gt;#include "BaseApp.h"using namespace Ogre;using namespace std; ///This code is adapted from the Ogre tutorials webpage for my own purposes ///http://www.ogre3d.org/wiki/index.php/Basic_Tutorial_6#Creating_the_RenderSystem ///Main function, calling all the private settings to make the application run in proper order: ///The basic Ogre life cycle looks like this: ///   1. Create the Root object. ///   2. Define the resources that Ogre will use. ///   3. Choose and set up the RenderSystem (that is, DirectX, OpenGL, etc). ///   4. Create the RenderWindow (the window which Ogre resides in). ///   5. Initialize the resources that you are going to use. ///   6. Create a scene using those resources. ///   7. Set up any third party libraries and plugins. ///   8. Create any number of frame listeners. ///   9. Start the render loop.    void BaseApp::go()    {        createRoot();        defineResources();        loadResources();        setupRenderSystem();        createRenderWindow();        initializeResourceGroups();        setupScene();        createFrameListener();        createPhysicsFrameListener();        startRenderLoop();    }    ///Destructor releases the FrameListener and the Root object from memory    BaseApp::~BaseApp()    {        delete mListener;        delete mRoot;    } ///-createRoot sets the Ogre Root object from where all others derive.    ///The Root object is the core of the Ogre library,    ///and must be created before you can do almost anything with the engine.    void BaseApp::createRoot()    {        mRoot = new Root();    } ///-defineResources sets all the Ogre engine requirements by iterating the configuration file.    ///The next thing we have to do is define the resources that the application uses.    ///This includes the textures, models, scripts, and so on.    ///Everything is set up in the resources.cfg file.    void BaseApp::defineResources()    // Method which will define the source of resources (other than current folder)    {        // Load resource paths from config file        ConfigFile cf;        mResourcePath = "";        cf.load(mResourcePath + "resources.cfg");        // Go through all sections &amp;amp; settings in the file        ConfigFile::SectionIterator seci = cf.getSectionIterator();        String secName, typeName, archName;        while (seci.hasMoreElements())        {            secName = seci.peekNextKey();            ConfigFile::SettingsMultiMap *settings = seci.getNext();            ConfigFile::SettingsMultiMap::iterator i;            for (i = settings-&amp;gt;begin(); i != settings-&amp;gt;end(); ++i)            {                typeName = i-&amp;gt;first;                archName = i-&amp;gt;second;                ResourceGroupManager::getSingleton().addResourceLocation(archName, typeName, secName);            }        }    } ///-loadResources intializes the application ResourceGroupManager.    ///The function defineResources adds all of the resources from the config file,    ///but it only tells Ogre where they are.    ///Before you can use any of them you have to either initialize the group that you want to use,    ///or you must initialize them all.    void BaseApp::loadResources()    {       // Initialise, parse scripts etc       ResourceGroupManager::getSingleton().initialiseAllResourceGroups();    } ///-setupRenderSystem checks wether the config file Ogre.cfg has already set things up and calls the /// Ogre render system setup dialog in case it isn't.    ///In the first part of the if statement, we attempt to restore the config file.    ///If that function returns false it means that the file does not exist so we should show the config dialog,    ///which is the second portion of that if statement.    ///If that also returns false it means the user canceled out of config dialog    ///(meaning they want to exit the program).    void BaseApp::setupRenderSystem()    {        if (!mRoot-&amp;gt;restoreConfig() &amp;amp;&amp;amp; !mRoot-&amp;gt;showConfigDialog())            throw Exception(52, "User canceled the config dialog!", "BaseApp::setupRenderSystem()");    } ///-createRenderWindow sets the Ogre root window where everything is going to be displayed    ///Now that we have chosen the RenderSystem, we need a window to render Ogre in.    ///There are actually a lot of options for how to do this, but we will really only need this to    ///keep thing simple.    void BaseApp::createRenderWindow()    {        mRoot-&amp;gt;initialise(true, "Physics World");    }    ///The only thing left to do is to initialize the resources we are about to use.    ///In a very large game or application, we may have hundreds or even thousands of    ///resources that our game uses - everything from meshes to textures to scripts.    ///At any given time though, we probably will only be using a small subset of these resources.    ///To keep down memory requirements, we can load only the resources that our application is using.    ///We do this by dividing the resources into sections and only initializing them as we go.    void BaseApp::initializeResourceGroups()    {        TextureManager::getSingleton().setDefaultNumMipmaps(5);        ResourceGroupManager::getSingleton().initialiseAllResourceGroups();    }    ///There are at least three things that must be done before you start adding things to a scene:    ///creating the SceneManager, creating the Camera, and creating the Viewport.    ///I have added some lights and entities to give it some flesh.    ///Entities are instances of PhysicsEntity, which is the class where all physics properties    ///will be implemented    void BaseApp::setupScene()    {        mgr = mRoot-&amp;gt;createSceneManager(ST_GENERIC, "Default SceneManager");        Viewport *vp;        PhysicsEntity *PhysEnt(0);        Light *light;        mgr-&amp;gt;setAmbientLight( ColourValue( 0, 0, 0 ) );        mgr-&amp;gt;setShadowTechnique( SHADOWTYPE_TEXTURE_MODULATIVE );        mCamera = mgr-&amp;gt;createCamera("PlayerCam");        mCamera-&amp;gt;setPosition(Vector3(300,300,200));        mCamera-&amp;gt;lookAt(Vector3(0,0,0));        mCamera-&amp;gt;setNearClipDistance(5);        vp = mRoot-&amp;gt;getAutoCreatedWindow()-&amp;gt;addViewport(mCamera);        vp-&amp;gt;setBackgroundColour(ColourValue(0,0,0));        mCamera-&amp;gt;setAspectRatio(Real(vp-&amp;gt;getActualWidth()) / Real(vp-&amp;gt;getActualHeight()));        light = mgr-&amp;gt;createLight("Light1");        light-&amp;gt;setType(Light::LT_POINT);        light-&amp;gt;setPosition(0, 15, 25);        light-&amp;gt;setDiffuseColour(.25, .25, 0);        light-&amp;gt;setSpecularColour(.25, .25, 0);        light = mgr-&amp;gt;createLight("Light3");        light-&amp;gt;setType(Light::LT_DIRECTIONAL);        light-&amp;gt;setPosition(10,10,10);        light-&amp;gt;setCastShadows(true);        light-&amp;gt;setDiffuseColour(.25, .25, 0);        light-&amp;gt;setSpecularColour(.25, .25, 0);        light-&amp;gt;setDirection(Vector3( 0, -1, 1 ));        PhysEnt=new PhysicsEntity(mgr,PhysicsEntity::cube);        PhysEnt-&amp;gt;Geometry-&amp;gt;scale(10,10,10);        PhysicsEntities.push_back(*PhysEnt);        PhysEnt=new PhysicsEntity(mgr,PhysicsEntity::plane);        PhysEnt-&amp;gt;Geometry-&amp;gt;scale(1000,1000,1000);        PhysicsEntities.push_back(*PhysEnt);    }    ///Every frame you must call the capture method on all Keyboard, Mouse, and Joystick objects you use.    ///Our BaseFrameListener class manages all this for us.    void BaseApp::createFrameListener()    {     mListener= new BaseFrameListener(mRoot-&amp;gt;getAutoCreatedWindow(),mCamera);        mRoot-&amp;gt;addFrameListener(mListener);    }    ///Every frame you must also update all physics entities    ///Our PhysicsFramelistener class manages all this for us.    void BaseApp::createPhysicsFrameListener()    {     PhListener= new PhysicsFrameListener(PhysicsEntities);        mRoot-&amp;gt;addFrameListener(PhListener);    }    ///This will render the application until a FrameListener returns false.    void BaseApp::startRenderLoop()    {        mRoot-&amp;gt;startRendering();    }&lt;/textarea&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The BaseFrameListener is another very important piece of code that allows one to control the rendering flow. &lt;br /&gt;In order to manage whatever happens on every rendering step, Ogre provides the FrameListener object.&lt;br /&gt;With the installed package comes an ExampleFrameListener.h file, which overrides the basic Ogre FrameListener and allows for a fairly good control over the inputting devices such as keyboard and mouse.I have slightly customised it for my purposes.&lt;br /&gt;It has been a bit tricky however, and has made my computer crash a few times.&lt;br /&gt;Anyway, here it is, domesticated at last!&lt;br /&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;BaseFrameListener.h&lt;/b&gt;: &lt;br /&gt;&lt;textarea cols="55" name="textfield" rows="20"&gt;/*-----------------------------------------------------------------------------This source file is part of OGRE    (Object-oriented Graphics Rendering Engine)For the latest info, see http://www.ogre3d.org/Copyright (c) 2000-2006 Torus Knot Software LtdAlso see acknowledgements in Readme.htmlYou may use this sample code for anything you like, it is not covered by theLGPL like the rest of the engine.-----------------------------------------------------------------------------*//*-----------------------------------------------------------------------------Filename:    ExampleFrameListener.h-&amp;gt;Adapted into BaseFrameListenerDescription: Defines an example frame listener which responds to frame events.This frame listener just moves a specified camera around based onkeyboard and mouse movements.Mouse:    FreelookW or Up:  ForwardS or Down:BackwardA:        Step leftD:        Step rightPgUp:     Move upwardsPgDown:   Move downwardsF:        Toggle frame rate stats on/offR:        Render modeT:        Cycle texture filtering                       Bilinear, Trilinear, Anisotropic(8)P:        Toggle on/off display of camera position / orientationImp Pant: Saves an incremental Screenshot-----------------------------------------------------------------------------*/#ifndef BASEFRAMELISTENER_H_#define BASEFRAMELISTENER_H_#include "Ogre.h"#include "OgreStringConverter.h"#include "OgreException.h"//Use this define to signify OIS will be used as a DLL//(so that dll import/export macros are in effect)#define OIS_DYNAMIC_LIB#include &amp;lt;OIS/OIS.h&amp;gt;using namespace Ogre;class BaseFrameListener: public FrameListener, public WindowEventListener{protected: Camera* mCamera; Vector3 mTranslateVector; Real mCurrentSpeed; RenderWindow* mWindow; bool mStatsOn; std::string mDebugText; unsigned int mNumScreenShots; float mMoveScale; float mSpeedLimit; Degree mRotScale; // just to stop toggles flipping too fast Real mTimeUntilNextToggle ; Radian mRotX, mRotY; TextureFilterOptions mFiltering; int mAniso; int mSceneDetailIndex ; Real mMoveSpeed; Degree mRotateSpeed; Overlay* mDebugOverlay; //OIS Input devices OIS::InputManager* mInputManager; OIS::Keyboard* mKeyboard; OIS::Mouse*    mMouse; virtual void updateStats(void) {  static String currFps = "Current FPS: ";  static String avgFps = "Average FPS: ";  static String bestFps = "Best FPS: ";  static String worstFps = "Worst FPS: ";  static String tris = "Triangle Count: ";  static String batches = "Batch Count: ";  // update stats when necessary  try {   OverlayElement* guiAvg = OverlayManager::getSingleton().getOverlayElement("Core/AverageFps");   OverlayElement* guiCurr = OverlayManager::getSingleton().getOverlayElement("Core/CurrFps");   OverlayElement* guiBest = OverlayManager::getSingleton().getOverlayElement("Core/BestFps");   OverlayElement* guiWorst = OverlayManager::getSingleton().getOverlayElement("Core/WorstFps");   const RenderTarget::FrameStats&amp;amp; stats = mWindow-&amp;gt;getStatistics();   guiAvg-&amp;gt;setCaption(avgFps + StringConverter::toString(stats.avgFPS));   guiCurr-&amp;gt;setCaption(currFps + StringConverter::toString(stats.lastFPS));   guiBest-&amp;gt;setCaption(bestFps + StringConverter::toString(stats.bestFPS)    +" "+StringConverter::toString(stats.bestFrameTime)+" ms");   guiWorst-&amp;gt;setCaption(worstFps + StringConverter::toString(stats.worstFPS)    +" "+StringConverter::toString(stats.worstFrameTime)+" ms");   OverlayElement* guiTris = OverlayManager::getSingleton().getOverlayElement("Core/NumTris");   guiTris-&amp;gt;setCaption(tris + StringConverter::toString(stats.triangleCount));   OverlayElement* guiBatches = OverlayManager::getSingleton().getOverlayElement("Core/NumBatches");   guiBatches-&amp;gt;setCaption(batches + StringConverter::toString(stats.batchCount));   OverlayElement* guiDbg = OverlayManager::getSingleton().getOverlayElement("Core/DebugText");   guiDbg-&amp;gt;setCaption(mDebugText);  }  catch(...) { /* ignore */ } }public: // Constructor takes a RenderWindow because it uses that to determine input context BaseFrameListener(RenderWindow* win, Camera* cam, bool bufferedKeys = false, bool bufferedMouse = false) :  mCamera(cam),  mTranslateVector(Vector3::ZERO),  mCurrentSpeed(0),  mWindow(win),  mStatsOn(true),  mNumScreenShots(0),  mMoveScale(0.0f),  mRotScale(0.0f),  mTimeUntilNextToggle(0),  mFiltering(TFO_BILINEAR),  mAniso(1),  mSceneDetailIndex(0),  mMoveSpeed(100),  mRotateSpeed(36),  mDebugOverlay(0),  mInputManager(0),  mKeyboard(0),  mMouse(0) {  mDebugOverlay = OverlayManager::getSingleton().getByName("Core/DebugOverlay");  LogManager::getSingletonPtr()-&amp;gt;logMessage("*** Initializing OIS ***");  OIS::ParamList pl;  size_t windowHnd = 0;  std::ostringstream windowHndStr;  win-&amp;gt;getCustomAttribute("WINDOW", &amp;amp;windowHnd);  windowHndStr &amp;lt;&amp;lt; windowHnd;  pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));  mInputManager = OIS::InputManager::createInputSystem( pl );  //Create all devices (We only catch joystick exceptions here, as, most people have Key/Mouse)  mKeyboard = static_cast&amp;lt;OIS::Keyboard*&amp;gt;(mInputManager-&amp;gt;createInputObject( OIS::OISKeyboard, bufferedKeys ));  mMouse = static_cast&amp;lt;OIS::Mouse*&amp;gt;(mInputManager-&amp;gt;createInputObject( OIS::OISMouse, bufferedMouse ));  //Set initial mouse clipping size  windowResized(mWindow);  showDebugOverlay(true);  //Register as a Window listener  WindowEventUtilities::addWindowEventListener(mWindow, this); } //Adjust mouse clipping area virtual void windowResized(RenderWindow* rw) {  unsigned int width, height, depth;  int left, top;  rw-&amp;gt;getMetrics(width, height, depth, left, top);  const OIS::MouseState &amp;amp;ms = mMouse-&amp;gt;getMouseState();  ms.width = width;  ms.height = height; } //Unattach OIS before window shutdown (very important under Linux) virtual void windowClosed(RenderWindow* rw) {  //Only close for window that created OIS (the main window in these demos)  if( rw == mWindow )  {   if( mInputManager )   {    mInputManager-&amp;gt;destroyInputObject( mMouse );    mInputManager-&amp;gt;destroyInputObject( mKeyboard );    OIS::InputManager::destroyInputSystem(mInputManager);    mInputManager = 0;   }  } } virtual ~BaseFrameListener() {  //Remove ourself as a Window listener  WindowEventUtilities::removeWindowEventListener(mWindow, this);  windowClosed(mWindow); } virtual bool processUnbufferedKeyInput(const FrameEvent&amp;amp; evt) {  if(mKeyboard-&amp;gt;isKeyDown(OIS::KC_A))   mTranslateVector.x = -mMoveScale; // Move camera left  if(mKeyboard-&amp;gt;isKeyDown(OIS::KC_D))   mTranslateVector.x = mMoveScale; // Move camera RIGHT  if(mKeyboard-&amp;gt;isKeyDown(OIS::KC_UP) || mKeyboard-&amp;gt;isKeyDown(OIS::KC_W) )   mTranslateVector.z = -mMoveScale; // Move camera forward  if(mKeyboard-&amp;gt;isKeyDown(OIS::KC_DOWN) || mKeyboard-&amp;gt;isKeyDown(OIS::KC_S) )   mTranslateVector.z = mMoveScale; // Move camera backward  if(mKeyboard-&amp;gt;isKeyDown(OIS::KC_PGUP))   mTranslateVector.y = mMoveScale; // Move camera up  if(mKeyboard-&amp;gt;isKeyDown(OIS::KC_PGDOWN))   mTranslateVector.y = -mMoveScale; // Move camera down  if(mKeyboard-&amp;gt;isKeyDown(OIS::KC_RIGHT))   mCamera-&amp;gt;yaw(-mRotScale);  if(mKeyboard-&amp;gt;isKeyDown(OIS::KC_LEFT))   mCamera-&amp;gt;yaw(mRotScale);  if( mKeyboard-&amp;gt;isKeyDown(OIS::KC_ESCAPE) || mKeyboard-&amp;gt;isKeyDown(OIS::KC_Q) )   return false;        if( mKeyboard-&amp;gt;isKeyDown(OIS::KC_F) &amp;amp;&amp;amp; mTimeUntilNextToggle &amp;lt;= 0 )  {   mStatsOn = !mStatsOn;   showDebugOverlay(mStatsOn);   mTimeUntilNextToggle = 1;  }  if( mKeyboard-&amp;gt;isKeyDown(OIS::KC_T) &amp;amp;&amp;amp; mTimeUntilNextToggle &amp;lt;= 0 )  {   switch(mFiltering)   {   case TFO_BILINEAR:    mFiltering = TFO_TRILINEAR;    mAniso = 1;    break;   case TFO_TRILINEAR:    mFiltering = TFO_ANISOTROPIC;    mAniso = 8;    break;   case TFO_ANISOTROPIC:    mFiltering = TFO_BILINEAR;    mAniso = 1;    break;   default: break;   }   MaterialManager::getSingleton().setDefaultTextureFiltering(mFiltering);   MaterialManager::getSingleton().setDefaultAnisotropy(mAniso);   showDebugOverlay(mStatsOn);   mTimeUntilNextToggle = 1;  }  if(mKeyboard-&amp;gt;isKeyDown(OIS::KC_SYSRQ) &amp;amp;&amp;amp; mTimeUntilNextToggle &amp;lt;= 0)  {   std::ostringstream ss;   ss &amp;lt;&amp;lt; "screenshot_" &amp;lt;&amp;lt; ++mNumScreenShots &amp;lt;&amp;lt; ".png";   mWindow-&amp;gt;writeContentsToFile(ss.str());   mTimeUntilNextToggle = 0.5;   mDebugText = "Saved: " + ss.str();  }  if(mKeyboard-&amp;gt;isKeyDown(OIS::KC_R) &amp;amp;&amp;amp; mTimeUntilNextToggle &amp;lt;=0)  {   mSceneDetailIndex = (mSceneDetailIndex+1)%3 ;   switch(mSceneDetailIndex) {    case 0 : mCamera-&amp;gt;setPolygonMode(PM_SOLID); break;    case 1 : mCamera-&amp;gt;setPolygonMode(PM_WIREFRAME); break;    case 2 : mCamera-&amp;gt;setPolygonMode(PM_POINTS); break;   }   mTimeUntilNextToggle = 0.5;  }  static bool displayCameraDetails = false;  if(mKeyboard-&amp;gt;isKeyDown(OIS::KC_P) &amp;amp;&amp;amp; mTimeUntilNextToggle &amp;lt;= 0)  {   displayCameraDetails = !displayCameraDetails;   mTimeUntilNextToggle = 0.5;   if (!displayCameraDetails)    mDebugText = "";  }  // Print camera details  if(displayCameraDetails)   mDebugText = "P: " + StringConverter::toString(mCamera-&amp;gt;getDerivedPosition()) +       " " + "O: " + StringConverter::toString(mCamera-&amp;gt;getDerivedOrientation());  // Return true to continue rendering  return true; } virtual bool processUnbufferedMouseInput(const FrameEvent&amp;amp; evt) {  // Rotation factors, may not be used if the second mouse button is pressed  // 2nd mouse button - slide, otherwise rotate  const OIS::MouseState &amp;amp;ms = mMouse-&amp;gt;getMouseState();  if( ms.buttonDown( OIS::MB_Right ) )  {   mTranslateVector.x += ms.X.rel * 0.13;   mTranslateVector.y -= ms.Y.rel * 0.13;  }  else  {   mRotX = Degree(-ms.X.rel * 0.13);   mRotY = Degree(-ms.Y.rel * 0.13);  }  return true; } virtual void moveCamera() {  // Make all the changes to the camera  // Note that YAW direction is around a fixed axis (freelook style) rather than a natural YAW  //(e.g. airplane)  mCamera-&amp;gt;yaw(mRotX);  mCamera-&amp;gt;pitch(mRotY);  mCamera-&amp;gt;moveRelative(mTranslateVector); } virtual void showDebugOverlay(bool show) {  if (mDebugOverlay)  {   if (show)    mDebugOverlay-&amp;gt;show();   else    mDebugOverlay-&amp;gt;hide();  } } // Override frameRenderingQueued event to process that (don't care about frameEnded) bool frameRenderingQueued(const FrameEvent&amp;amp; evt) {  if(mWindow-&amp;gt;isClosed()) return false;  mSpeedLimit = mMoveScale * evt.timeSinceLastFrame;  //Need to capture/update each device  mKeyboard-&amp;gt;capture();  mMouse-&amp;gt;capture();     Ogre::Vector3 lastMotion = mTranslateVector;  //Check if one of the devices is not buffered  if(!mKeyboard-&amp;gt;buffered()|| !mMouse-&amp;gt;buffered() )  {   // one of the input modes is immediate, so setup what is needed for immediate movement   if (mTimeUntilNextToggle &amp;gt;= 0)    mTimeUntilNextToggle -= evt.timeSinceLastFrame;   // Move about 100 units per second   mMoveScale = mMoveSpeed * evt.timeSinceLastFrame;   // Take about 10 seconds for full rotation   mRotScale = mRotateSpeed * evt.timeSinceLastFrame;   mRotX = 0;   mRotY = 0;   mTranslateVector = Ogre::Vector3::ZERO;  }  //Check to see which device is not buffered, and handle it  if( !mKeyboard-&amp;gt;buffered() )   if( processUnbufferedKeyInput(evt) == false )    return false;  if( !mMouse-&amp;gt;buffered() )   if( processUnbufferedMouseInput(evt) == false )    return false;  // ramp up / ramp down speed     if (mTranslateVector == Ogre::Vector3::ZERO)  {   // decay (one third speed)   mCurrentSpeed -= evt.timeSinceLastFrame * 0.3;   mTranslateVector = lastMotion;  }  else  {   // ramp up   mCurrentSpeed += evt.timeSinceLastFrame;  }  // Limit motion speed  if (mCurrentSpeed &amp;gt; 1.0)   mCurrentSpeed = 1.0;  if (mCurrentSpeed &amp;lt; 0.0)   mCurrentSpeed = 0.0;  mTranslateVector *= mCurrentSpeed;  if(!mKeyboard-&amp;gt;buffered() || !mMouse-&amp;gt;buffered())   moveCamera();  return true; } bool frameEnded(const FrameEvent&amp;amp; evt) {  updateStats();  return true; }};#endif /*BASEFRAMELISTENER_H_*/&lt;/textarea&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Once the beast is under control, the rest is a piece of cake...hehehe...&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;br /&gt;You can make as many instances of a FrameListener as you need in an Ogre application.&lt;br /&gt;I have chosen to create a separate framelistener for managing whatever goes under the physics, to keep things up neat and tidy.&lt;br /&gt;It is the PhysicsFrameListener class:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;PhysicsFrameListener.h&lt;/b&gt;: &lt;br /&gt;&lt;textarea cols="55" name="textfield" rows="20"&gt;/*#ifndef PHYSICSFRAMELISTENER_H_#define PHYSICSFRAMELISTENER_H_#include "PhysicsEntity.h"#include &amp;lt;iostream&amp;gt;#include &amp;lt;math.h&amp;gt;#include &amp;lt;vector&amp;gt;#include &amp;lt;time.h&amp;gt;#include &amp;lt;ctime&amp;gt;#include &amp;lt;stdio.h&amp;gt;#include &amp;lt;unistd.h&amp;gt;#include &amp;lt;stdlib.h&amp;gt;#include &amp;lt;Ogre.h&amp;gt;using namespace Ogre;///This class is in charge to manage the physics before every///render step on the Ogre window.class PhysicsFrameListener : public FrameListener{public:    ///The Ents vector contains the entities with physical properties attached to them    ///In this example, no physics are used yet. Just an X-axis displacement is applied    ///to perceive motion.    PhysicsFrameListener(std::vector&amp;lt;PhysicsEntity&amp;gt; Ents):     Entities(Ents)    {    }    ///frameStarted is an overriden event from the Ogre FrameListener.    ///Note that positions are updated before sending the information    ///to the root object in the go loop.    bool frameStarted(const FrameEvent&amp;amp; evt)    {     UpdatePositions();     return true;    }    ///Update positions is in charge to reallocate the entities to their future locations    void UpdatePositions()    {//     PhysicsEntity::EntityType TypeEnt;     for (unsigned int i=0; i&amp;lt;Entities.size(); i++)     {      if (Entities[i].GeomType==PhysicsEntity::cube)       Entities[i].Geometry-&amp;gt;translate(0.1,0,0,Ogre::Node::TS_WORLD);     }    }private:    std::vector&amp;lt;PhysicsEntity&amp;gt; Entities;};#endif /*PHYSICSFRAMELISTENER_H_*/&lt;/textarea&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The elementary brick on which everything else will be constructed is likely to be called PhysicsEntity.&lt;br /&gt;So I have defined my PhysicsEntity Class.&lt;br /&gt;In this code is still at its very bones, just presenting a couple of functions to make things visible.&lt;br /&gt;Hopefully in the near future some more flesh will get added on it!&lt;br /&gt;&lt;br /&gt;&lt;b&gt;PhysicsEntity.h&lt;/b&gt;: &lt;br /&gt;&lt;textarea cols="55" name="textfield" rows="20"&gt;/*#ifndef PHYSICSENTITY_H_#define PHYSICSENTITY_H_#include &amp;lt;Ogre.h&amp;gt;using namespace Ogre;class PhysicsEntity{public: enum EntityType {  cube,  plane }; PhysicsEntity(SceneManager *SceneMgr,EntityType ShapeType); ~PhysicsEntity(); double mass; Vector3 position; Vector3 velocity; Vector3 acceleration; SceneNode *Geometry; EntityType GeomType;private: ManualObject* createCubeMesh(Ogre::String, Ogre::String); ManualObject* createPlane(Ogre::String, Ogre::String);};#endif /*PHYSICSENTITY_H_*/&lt;/textarea&gt;&lt;br /&gt;&lt;b&gt;PhysicsEntity.cpp&lt;/b&gt;: &lt;br /&gt;&lt;textarea cols="55" name="textfield" rows="20"&gt;/*#include "PhysicsEntity.h"PhysicsEntity::PhysicsEntity(SceneManager *SceneMgr,EntityType ShapeType){ Geometry = SceneMgr-&amp;gt;getRootSceneNode()-&amp;gt;createChildSceneNode(); Geometry-&amp;gt;setPosition(0,5,0); GeomType=ShapeType; switch (GeomType) { case cube:        Geometry-&amp;gt;attachObject(createCubeMesh("Cube","myMaterial"));  break; case plane:        Geometry-&amp;gt;attachObject(createPlane("Plane","myMaterial"));  break; };}PhysicsEntity::~PhysicsEntity(){}ManualObject* PhysicsEntity::createCubeMesh(Ogre::String name, Ogre::String matName){ ManualObject* cube = new ManualObject(name); cube-&amp;gt;begin(matName); cube-&amp;gt;position(0.5,-0.5,1.0);cube-&amp;gt;normal(0.408248,-0.816497,0.408248);cube-&amp;gt;textureCoord(1,0); cube-&amp;gt;position(-0.5,-0.5,0.0);cube-&amp;gt;normal(-0.408248,-0.816497,-0.408248);cube-&amp;gt;textureCoord(0,1); cube-&amp;gt;position(0.5,-0.5,0.0);cube-&amp;gt;normal(0.666667,-0.333333,-0.666667);cube-&amp;gt;textureCoord(1,1); cube-&amp;gt;position(-0.5,-0.5,1.0);cube-&amp;gt;normal(-0.666667,-0.333333,0.666667);cube-&amp;gt;textureCoord(0,0); cube-&amp;gt;position(0.5,0.5,1.0);cube-&amp;gt;normal(0.666667,0.333333,0.666667);cube-&amp;gt;textureCoord(1,0); cube-&amp;gt;position(-0.5,-0.5,1.0);cube-&amp;gt;normal(-0.666667,-0.333333,0.666667);cube-&amp;gt;textureCoord(0,1); cube-&amp;gt;position(0.5,-0.5,1.0);cube-&amp;gt;normal(0.408248,-0.816497,0.408248);cube-&amp;gt;textureCoord(1,1); cube-&amp;gt;position(-0.5,0.5,1.0);cube-&amp;gt;normal(-0.408248,0.816497,0.408248);cube-&amp;gt;textureCoord(0,0); cube-&amp;gt;position(-0.5,0.5,0.0);cube-&amp;gt;normal(-0.666667,0.333333,-0.666667);cube-&amp;gt;textureCoord(0,1); cube-&amp;gt;position(-0.5,-0.5,0.0);cube-&amp;gt;normal(-0.408248,-0.816497,-0.408248);cube-&amp;gt;textureCoord(1,1); cube-&amp;gt;position(-0.5,-0.5,1.0);cube-&amp;gt;normal(-0.666667,-0.333333,0.666667);cube-&amp;gt;textureCoord(1,0); cube-&amp;gt;position(0.5,-0.5,0.0);cube-&amp;gt;normal(0.666667,-0.333333,-0.666667);cube-&amp;gt;textureCoord(0,1); cube-&amp;gt;position(0.5,0.5,0.0);cube-&amp;gt;normal(0.408248,0.816497,-0.408248);cube-&amp;gt;textureCoord(1,1); cube-&amp;gt;position(0.5,-0.5,1.0);cube-&amp;gt;normal(0.408248,-0.816497,0.408248);cube-&amp;gt;textureCoord(0,0); cube-&amp;gt;position(0.5,-0.5,0.0);cube-&amp;gt;normal(0.666667,-0.333333,-0.666667);cube-&amp;gt;textureCoord(1,0); cube-&amp;gt;position(-0.5,-0.5,0.0);cube-&amp;gt;normal(-0.408248,-0.816497,-0.408248);cube-&amp;gt;textureCoord(0,0); cube-&amp;gt;position(-0.5,0.5,1.0);cube-&amp;gt;normal(-0.408248,0.816497,0.408248);cube-&amp;gt;textureCoord(1,0); cube-&amp;gt;position(0.5,0.5,0.0);cube-&amp;gt;normal(0.408248,0.816497,-0.408248);cube-&amp;gt;textureCoord(0,1); cube-&amp;gt;position(-0.5,0.5,0.0);cube-&amp;gt;normal(-0.666667,0.333333,-0.666667);cube-&amp;gt;textureCoord(1,1); cube-&amp;gt;position(0.5,0.5,1.0);cube-&amp;gt;normal(0.666667,0.333333,0.666667);cube-&amp;gt;textureCoord(0,0); cube-&amp;gt;triangle(0,1,2);      cube-&amp;gt;triangle(3,1,0); cube-&amp;gt;triangle(4,5,6);      cube-&amp;gt;triangle(4,7,5); cube-&amp;gt;triangle(8,9,10);      cube-&amp;gt;triangle(10,7,8); cube-&amp;gt;triangle(4,11,12);   cube-&amp;gt;triangle(4,13,11); cube-&amp;gt;triangle(14,8,12);   cube-&amp;gt;triangle(14,15,8); cube-&amp;gt;triangle(16,17,18);   cube-&amp;gt;triangle(16,19,17); cube-&amp;gt;end(); return cube;}ManualObject* PhysicsEntity::createPlane(Ogre::String name, Ogre::String matName){ ManualObject* plane = new ManualObject(name); plane-&amp;gt;begin(matName); plane-&amp;gt;position(-0.5,0,-0.5);plane-&amp;gt;normal(0.408248,-0.816497,0.408248);plane-&amp;gt;textureCoord(1,0); plane-&amp;gt;position(-0.5,0.0,0.5);plane-&amp;gt;normal(-0.408248,-0.816497,-0.408248);plane-&amp;gt;textureCoord(0,1); plane-&amp;gt;position(0.5,0.0,0.5);plane-&amp;gt;normal(0.666667,-0.333333,-0.666667);plane-&amp;gt;textureCoord(1,1); plane-&amp;gt;position(0.5,0.0,-0.5);plane-&amp;gt;normal(-0.666667,-0.333333,0.666667);plane-&amp;gt;textureCoord(0,0); plane-&amp;gt;triangle(0,1,2);      plane-&amp;gt;triangle(0,2,3); plane-&amp;gt;end(); return plane;}&lt;/textarea&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Last, but not least, is the main.cpp file, where everything gets blended:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;main.cpp&lt;/b&gt;: &lt;br /&gt;&lt;textarea cols="55" name="textfield" rows="20"&gt;/*#include "BaseApp.h"///This is the top module for running any Ogre based application///Is just simple an concise.///Call the go method of the BaseApp class and everything just goesint main(int argc, char **argv){    // Create application object    BaseApp app;    //Just in case, catch any errors    try    {     //Call the go method, where all the private settings     //for running an Ogre app are called        app.go();    }    catch(Exception&amp;amp; e)    {        printf( "An exception has occurred: %s\n",            e.getFullDescription().c_str());    }    return 0;}&lt;/textarea&gt;&lt;br /&gt;&lt;br /&gt;And this is it.Now...Let's get busy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-6151249302511128532?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/6151249302511128532/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/04/setting-ogre3d-as-graphic-environment.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/6151249302511128532'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/6151249302511128532'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/04/setting-ogre3d-as-graphic-environment.html' title='Setting Ogre3D as Graphic Environment'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-1983365413444375414</id><published>2010-03-31T14:29:00.000-07:00</published><updated>2010-03-31T15:11:29.862-07:00</updated><title type='text'>CODE NAME: Brachistochrona</title><content type='html'>Today I'm going to reveal a classified archive. Or so it seems...&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_1CZ6zhe_ay0/S7O7E83Cz9I/AAAAAAAAAIM/5wvXmhu-x-8/s1600/top-secret.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_1CZ6zhe_ay0/S7O7E83Cz9I/AAAAAAAAAIM/5wvXmhu-x-8/s320/top-secret.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;Physicians have been keeping this knowledge from us simple mortals for centuries...hehehe...&lt;br /&gt;While trying to understand the essentials on variational mechanics, I have come into this article: &lt;a href="http://jazz.openfun.org/wiki/Brachistochrone"&gt;http://jazz.openfun.org/wiki/Brachistochrone&lt;/a&gt;.&lt;br /&gt;The problem of the brachistochrone dates back to Newton (17th century) and appears mentioned frequently as one of the problems that can be solved be means of this refined technique.&lt;br /&gt;&lt;br /&gt;In fact, this problem appears to be the actual trigger for the modern physics (or better stated, its solution), and reveals a completely counterintuitive phenomenon:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The quickest path is not the straight line&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Amazingly, the solution for a bead on a wire going in the least time from point A to point B:&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_1CZ6zhe_ay0/S7O9DhCr8lI/AAAAAAAAAIU/IS4S6rwzd5k/s1600/Brachistochrone.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_1CZ6zhe_ay0/S7O9DhCr8lI/AAAAAAAAAIU/IS4S6rwzd5k/s320/Brachistochrone.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Is the cycloid represented in the picture.&lt;br /&gt;&lt;br /&gt;As standard human, one always tends to think that the shortest path would be the quickest one. It is wrong.&lt;br /&gt;Analogously, when it comes to minimize the action (see previous posts on the subject), it is very hard to imagine that the stationary points would not come at flattening the curve for the action.&lt;br /&gt;This is what makes so hard to understand the variational principles that rule over Lagrangian, Eulerian and Hamiltonian mechanics.&lt;br /&gt;&lt;br /&gt;If one only had been told...&lt;br /&gt;&lt;br /&gt;I have made a spreadsheet with openoffice (&lt;a href="http://www.openoffice.org/"&gt;www.openoffice.org&lt;/a&gt;) where this can be numerically perceived also.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The spreadsheet is &lt;a href="http://www.mnbvlabs.com/Thesis/EulerVariational.ods"&gt;here&lt;/a&gt;.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;I have made it with the help of a paper by Jozef Hanc: &lt;a href="http://www.google.es/url?sa=t&amp;amp;source=web&amp;amp;ct=res&amp;amp;cd=1&amp;amp;ved=0CAYQFjAA&amp;amp;url=http%3A%2F%2Fwww.eftaylor.com%2Fpub%2FHancEulerEJP.pdf&amp;amp;ei=RMizS-ejAs-N4gba0e2cAg&amp;amp;usg=AFQjCNG4UqmFWYufyzZHPcz2LMO0XwgZlQ&amp;amp;sig2=ncESlxp5h9GL2BeTuIlByA"&gt;The original Euler's calculus-of-variations method: Key to Lagrangian mechanics for beginners.&lt;/a&gt;&lt;br /&gt;I found it extremely appropriate for my case, and also absolutely clarifying. Thanks mr Hanc&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-1983365413444375414?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/1983365413444375414/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/03/code-name-brachistochrona.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/1983365413444375414'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/1983365413444375414'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/03/code-name-brachistochrona.html' title='CODE NAME: Brachistochrona'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_1CZ6zhe_ay0/S7O7E83Cz9I/AAAAAAAAAIM/5wvXmhu-x-8/s72-c/top-secret.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-8838000827248720932</id><published>2010-03-28T17:27:00.000-07:00</published><updated>2010-03-29T07:52:53.254-07:00</updated><title type='text'>Ilustrating Lagrangian Variables</title><content type='html'>In the last post we had a tentative on Variational Mechanics which resulted very stimulating.&lt;br /&gt;&lt;br /&gt;In order settle ideas down, I have left the subject cooling in the fridge and I have fiddled around with the Lego Mindstorms(c) robot we have at the RGEX research group, trying to make a positioning system that is accurate enough for our purposes.&lt;br /&gt;Surely Jaume (my thesis director) will be very happy to hear about it.&lt;br /&gt;I know this is not the exact place for it, but it's my blog and I do what I want to...hehehe...anyway, whoever wants to see what we do there, it is available at: &lt;a href="http://www.rgex.blogspot.com/"&gt;www.rgex.blogspot.com&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;And now, back to work:&lt;br /&gt;&lt;br /&gt;The intention of this post it to illustrate some relationships that exist in Mechanics and that are repeated ad-vomitum in every reference one finds on Variational Mechanics.&lt;br /&gt;The main problem I have encountered is that explanations mix numerical methods with physical concepts, and more often that seldom everything is written in the cryptic language of mathematicians. Of course, in complete absence of figures or anything of the like.&lt;br /&gt;&lt;br /&gt;So, here we go... &lt;br /&gt;With the help of some coding in C++ and QtOctave (&lt;a href="https://forja.rediris.es/projects/csl-qtoctave/"&gt;https://forja.rediris.es/projects/csl-qtoctave/&lt;/a&gt;), I have made some graphics for the simulation of a moving particle.&lt;br /&gt;I have used the same deductive principle I have seen in the papers, which is not intuitive at all. Hopefully some drawings will make it more clear.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;A moving particle&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Instead of trying to obtain the formula in a straightforward manner, the Least Action Principle suggest one to imagine an arbitrary particle that changes its position from one place to another. So, that's exactly what I have done.&lt;br /&gt;The code iterates some 100 times and assigns random values to the new position of our particle. Really simple stuff.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_1CZ6zhe_ay0/S6_-a4mbvnI/AAAAAAAAAHI/wFvsKDpjxYY/s1600/Helvetica:12" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_1CZ6zhe_ay0/S6_-a4mbvnI/AAAAAAAAAHI/wFvsKDpjxYY/s320/Helvetica:12" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;The red dots represent all 100 different positions the particle goes when random increments in x and y are applied.&lt;br /&gt;The initial point is at (10,10), and all the following are &lt;b&gt;dQ&lt;/b&gt; further (&lt;b&gt;dQ&lt;/b&gt; is divided in X and Y components, of course). &lt;b&gt;dQ&lt;/b&gt; gets a random value for each iteration. &lt;br /&gt;Once we have the new positions, it is straightforward to apply physics concepts to get the values of Velocity, Acceleration, Kinetic Energy and Potential Energy that have to be applied to get the particle there:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;b&gt;V=dQ/dt&lt;/b&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;b&gt;A=dV/dt&lt;/b&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;b&gt;Ep=m*A*dQ&lt;/b&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;b&gt;Ec=1/2(m*|V|²)&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;With a &lt;b&gt;dt&lt;/b&gt; value of 0.1 and a mass &lt;b&gt;m&lt;/b&gt; of 5, it is also a piece of cake to obtain a table with the respective values.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Work and energy&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The magnitudes Work and Energy are directly related to the &lt;b&gt;Ep&lt;/b&gt; and &lt;b&gt;Ec&lt;/b&gt; values.&lt;br /&gt;From a physical point of view, there are some very interesting things that can be observed when putting their values against the |&lt;b&gt;dQ&lt;/b&gt;| values:&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_1CZ6zhe_ay0/S7Af5OFgkhI/AAAAAAAAAHQ/AoqBv64sXfA/s1600/Helvetica:12" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_1CZ6zhe_ay0/S7Af5OFgkhI/AAAAAAAAAHQ/AoqBv64sXfA/s320/Helvetica:12" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;Distance |&lt;b&gt;dQ&lt;/b&gt;| vs kynetic energy &lt;b&gt;Ec&lt;/b&gt;&lt;span id="goog_991653520"&gt;&lt;/span&gt;&lt;span id="goog_991653521"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_1CZ6zhe_ay0/S7AgJOugOSI/AAAAAAAAAHY/rhSGtxba0_o/s1600/Helvetica:12" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_1CZ6zhe_ay0/S7AgJOugOSI/AAAAAAAAAHY/rhSGtxba0_o/s320/Helvetica:12" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;Distance |&lt;b&gt;dQ&lt;/b&gt;| vs potential energy &lt;b&gt;Ep&lt;/b&gt;&lt;/div&gt;&lt;div style="margin: 0px; text-indent: 0px;"&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;From the same experiment, the random values of distance show a correlation of two types with the respective energies:&amp;nbsp;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Kynetic energy is linearly related to the distance covered by the particle. Its values depend solely on the module of the velocity parameter, which itself is linearly dependent on the distance.&lt;/li&gt;&lt;li&gt;Potential energy shows a more quadratic behaviour, provided its acceleration component is multiplied by the covered distance.&lt;/li&gt;&lt;/ul&gt;It is also interesting to have a look at the graph &lt;b&gt;Ec&lt;/b&gt; vs &lt;b&gt;Ep&lt;/b&gt;, where also the quadratic behaviour is observed:&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_1CZ6zhe_ay0/S7Ajw7KGKnI/AAAAAAAAAHg/6BJUzeycR3M/s1600/Helvetica:12" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_1CZ6zhe_ay0/S7Ajw7KGKnI/AAAAAAAAAHg/6BJUzeycR3M/s320/Helvetica:12" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;Kynetic energy &lt;b&gt;Ec&lt;/b&gt; vs Potential energy &lt;b&gt;Ep&lt;/b&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;Interestingly enough, both (|&lt;b&gt;dQ&lt;/b&gt;| vs &lt;b&gt;Ep&lt;/b&gt;) and (&lt;b&gt;Ec&lt;/b&gt; vs &lt;b&gt;Ep&lt;/b&gt;) are exactly the same shape, but for the scale of the X axis, which is of course linearly related.&lt;/div&gt;&lt;style type="text/css"&gt; white-space: p&lt;/style&gt;&lt;/div&gt;&lt;div style="margin: 0px; text-indent: 0px;"&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;The basic variational principle&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The following step once these observations are made, is that of nesting our little freely moving particle loop into another broader loop, and accumulate the values of the position to form a trajectory.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;Provided the inner loop generates a bunch of 100 probable future positions, one tempting criterion would be to choose that of minimum value for the total calculated energy...&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_1CZ6zhe_ay0/S7AmkhJvPyI/AAAAAAAAAHo/ux25wi6dL3s/s1600/Helvetica:12" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_1CZ6zhe_ay0/S7AmkhJvPyI/AAAAAAAAAHo/ux25wi6dL3s/s320/Helvetica:12" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;The random accumulated trajectory of the particle&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;Just to verify that by adding the minimum energy substeps we still get a random trajectory.&lt;/div&gt;&lt;div style="text-align: left;"&gt;Obviously, no constraints have been applied, and the particle represents a "Markov process".&lt;/div&gt;&lt;div style="text-align: left;"&gt;What the basic variational principle teachs us is that, given certain constraints, the trajectory of the particle would have been that of minimum energy.&lt;/div&gt;&lt;div style="text-align: left;"&gt;In our code for each time step the chosen subpath has been that of minimum energy.&lt;br /&gt;Nonetheless, for the global trajectory, i.e. after a series of timesteps, a more holistic approach has to be taken in order to obtain the actual "natural" path.&lt;br /&gt;That is the ODEs approach, and we'll talk about it in further episodes...&lt;br /&gt;&lt;br /&gt;The following is the C++ code employed to obtain the tables. These have been plotted with QTOctave, an opensource version of MathLab.&lt;br /&gt;Please note that it is the version which provides the complete path. The inner loop provides the random new positions and the outer loops concatenates one position after another, selecting each time that with the minimum energy.&lt;/div&gt;&lt;br /&gt;&lt;b&gt;main.cpp&lt;/b&gt;: &lt;br /&gt;&lt;textarea cols="55" name="textfield" rows="20"&gt;#include &amp;lt;stdio.h&amp;gt;#include &amp;lt;stdlib.h&amp;gt;#include &amp;lt;time.h&amp;gt;#include &amp;lt;math.h&amp;gt;using namespace std;int main(){ double Ec; double Ep; double Emin; double m; double dX; double dY; double dT; double Px=10; double Py=10; double Vx=0; double Vy=0; double VminX=0; double VminY=0; double dVx; double dVy; double Ax; double Ay; double Fx; double Fy; FILE * pFile; pFile = fopen ("myfile.txt","w"); dT=0.1; m=5; for (int i=0;i&amp;lt;1000;i++) {  for (int j=0;j&amp;lt;100;j++)  {   srand((unsigned) time(NULL));   dX=drand48() -drand48()  ;   dY=drand48() -drand48()  ;      printf("%f %f\n",dX,dY);   dVx=dX/dT-VminX;   dVy=dY/dT-VminY;   Vx=dX/dT;   Vy=dY/dT;   Ax=dVx/dT;   Ay=-9.8+dVy/dT;   Fx=m*Ax;   Fy=m*Ay;   Ec = 0.5*m*(sqrt(Vx*Vx + Vy*Vy));   Ep = Fx*dX + Fx*dX + Fy*dX + Fy*dY;   //   fprintf (pFile, "%f %f %f %f %f\n",Px,Py,Vx,Vy,Emin);   if (Ep+Ec&amp;lt;=Emin||j==0)   {    Emin=Ep+Ec;    Px=Px+dX;    Py=Py+dY;    VminX=Vx;    VminY=Vy;//    fprintf (pFile, "%f %f %f %f %f\n",Px,Py,Vx,Vy,Emin);   }  }  fprintf (pFile, "%f %f %f %f %f %f %f %f %f\n",Px,Py,sqrt(dX*dX+dY*dY),Vx,Vy,Ax,Ay,Ec,Ep); }}&lt;/textarea&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-8838000827248720932?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/8838000827248720932/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/03/ilustrating-lagrangian-variables.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/8838000827248720932'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/8838000827248720932'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/03/ilustrating-lagrangian-variables.html' title='Ilustrating Lagrangian Variables'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_1CZ6zhe_ay0/S6_-a4mbvnI/AAAAAAAAAHI/wFvsKDpjxYY/s72-c/Helvetica:12' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-302134809515021657</id><published>2010-03-20T21:29:00.000-07:00</published><updated>2010-03-31T14:35:15.043-07:00</updated><title type='text'>ACTION!</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: left;"&gt;One more week spent on Lagrangian Dynamics...and more results!&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Well, the main point about Lagrange and his ubiqutous formulae (that following level of abstraction I talked about in the last post), passes through the concept of ACTION.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Inexplicably, when learning physics at the Secondary or even at the Graduate studies, everything seems to finish when we get to the three laws of Newton.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;That's the highest point one ever gets...and then we reach the concept of energy by integrating forces along paths.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;But there is still one step further (or maybe more, now that the world seems to be round instead of flat, one never knows...).&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;The notion of &lt;b&gt;action&lt;/b&gt; is that of the integral of the energy along time. Easy, isn't it? Its units are &lt;b&gt;energy&lt;/b&gt;·&lt;b&gt;time&lt;/b&gt; (Joule-second in SI).&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Ok then. The problem, I guess, is that in order to be able to do something useful with it, one has to go also one step further in the mathematical notion of function: that of &lt;b&gt;Functional&lt;/b&gt;.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;And perhaps here is where our poor brains become at risk of melting...or maybe not, because a functional is just a function where the variable is...a function.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;So, we are supposed to understand and memorize the linearity property of the integrals, and not the idea of functional? Come on...&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Anyway, let's forgive our poor teachers of calculus and physics, who did their best I am sure, and get to work...&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;The discipline in charge to explain functionals is Variational Calculus, a fairly complex matter. When applied to physics, it happens to produce the Variational Principle of Physics, which is on where all Lagrangian, Jacobian, Hamiltonian and Eulerian dynamics rest.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;So , in order to properly grasp the ideas of Lagrangian Dynamics, we better start with a little revision. The best one I found is from Mr. Claude Lacoursière's thesis &lt;a href="http://umu.diva-portal.org/smash/record.jsf?pid=diva2:140361"&gt;"Ghost and machines: Regularized Variational Method for Interactive Simulation Multibodyes with dry friction"&lt;/a&gt; , combined with the following extremely clear explanation of the concept of action (&lt;a href="http://wapedia.mobi/en/Action_%28physics%29"&gt;http://wapedia.mobi/en/Action_(physics)&lt;/a&gt;):&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span style="font-size: large;"&gt;1.-Work and Energy:&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;When a force is applied over a mass along a trajectory kinetic energy is dissipated. Integrating the formula, we can obtain its value as:&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; T(x')=(m·||x'||²)/2&lt;/i&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;where x' (aka velocity) is the derivative of the position, m is the mass of the particle and T(x') is the total kinetic energy.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;For the cases when the force assumes values tangent to the energy function, then another form of energy appears: this is potential energy.&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;This special form of energy has the special property of being independent of the trajectory.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;a href="http://3.bp.blogspot.com/_1CZ6zhe_ay0/S6Wo74eENtI/AAAAAAAAAGw/QSWNPDvMD74/s1600-h/IMG00083.GIF" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_1CZ6zhe_ay0/S6Wo74eENtI/AAAAAAAAAGw/QSWNPDvMD74/s320/IMG00083.GIF" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;And this form of energy must also be considered into our energy equation if we want to account for everything.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;This leaves our equation for the energy of the system the following way:&lt;i&gt;&amp;nbsp;&lt;/i&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; E=T(x')+V(x)&lt;/i&gt;&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Being T(x') the kinetic energy described above and V(x) the potential energy.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span style="font-size: large;"&gt;2.-Basic Variational principle:&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;Once we have our Energy Equation, we are able to define the Action S for that Energy.&lt;br /&gt;This would be, as explained above, the integral of this equation &lt;b&gt;over time&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_1CZ6zhe_ay0/S6WXgbyr5EI/AAAAAAAAAGQ/QkXWsrYjk00/s1600-h/images.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_1CZ6zhe_ay0/S6WXgbyr5EI/AAAAAAAAAGQ/QkXWsrYjk00/s320/images.jpeg" /&gt;&lt;/a&gt;&amp;nbsp;&lt;/div&gt;&lt;br /&gt;Here, t1 and t2 are the initial and final time positions, and L(x,x') is our LAGRANGIAN, which is exactly our Energy Equation, but with another name.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;The funny thing about this integral is that it solves nothing by itself. There is a lot of possible solutions for our trajectory, all of them valid in mathematical terms, but only one of them is good for us.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;a href="http://3.bp.blogspot.com/_1CZ6zhe_ay0/S6WpvmdxOxI/AAAAAAAAAG4/6mkiG8wrd0w/s1600-h/action+integral.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_1CZ6zhe_ay0/S6WpvmdxOxI/AAAAAAAAAG4/6mkiG8wrd0w/s320/action+integral.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;The D'Alembert principle states that, &lt;i&gt;"for a physical trajectory and infinitesimal displacements thereof at each point in time, and compatible with all imposed constraints, the work done by the virtual displacements along the trajectory vanishes when the motion is not bounded, and non-positive otherwise&lt;/i&gt;".&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;In plain English: &lt;b&gt;the path followed is going to be that for which the action is minimized&lt;/b&gt; (or more strictly, for which the action is stationary, i.e. there is a minimum point).&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&amp;nbsp;&lt;a href="http://1.bp.blogspot.com/_1CZ6zhe_ay0/S6Wp81MCF7I/AAAAAAAAAHA/Mpeeyuj-Sqs/s1600-h/Stationary_vs_inflection_pts.gif.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_1CZ6zhe_ay0/S6Wp81MCF7I/AAAAAAAAAHA/Mpeeyuj-Sqs/s320/Stationary_vs_inflection_pts.gif.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;To express the constraints mentioned by monsieur D'Alembert, all we need is to apply Euler-Lagrange equation:&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ∂L/∂&lt;b&gt;x&lt;/b&gt;&lt;sub&gt;i&lt;/sub&gt; - d/dt ( ∂L/∂&lt;b&gt;x&lt;/b&gt;&lt;sub&gt;i&lt;/sub&gt;' )      = 0&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;And then use the mathematical technique of the Lagrangian Multipliers (which I will not explain here), in order to simplify our Action Integral into something we can operate with, i.e. a second order differential equation.&lt;br /&gt;&lt;br /&gt;And this is it. The basis, the cornerstone of Lagrangian Dynamics, demystified.&lt;br /&gt;Once these concepts are comprehended, it is relatively easy to toddle around all the rest of this vast world...now at least we have legs!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-302134809515021657?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/302134809515021657/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/03/action.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/302134809515021657'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/302134809515021657'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/03/action.html' title='ACTION!'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_1CZ6zhe_ay0/S6Wo74eENtI/AAAAAAAAAGw/QSWNPDvMD74/s72-c/IMG00083.GIF' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-5942720757957756731</id><published>2010-03-14T19:02:00.000-07:00</published><updated>2010-03-16T19:44:55.328-07:00</updated><title type='text'>LAGRANGIAN DYNAMICS</title><content type='html'>These days I've been researching on Lagrangian Dynamics.&lt;br /&gt;&lt;br /&gt;Finally, some light has been shed through the thick mesh of formulae, technical and mathematical verbiage, and an atom of understanding has entered into my banged head.&lt;br /&gt;&lt;br /&gt;The paper that has finally put everything together is this:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://box2d.googlecode.com/files/GDC2009_ErinCatto.zip"&gt;http://box2d.googlecode.com/files/GDC2009_ErinCatto.zip&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;But before, I have had to go through an odissey of other papers to understand why they call it Lagrangian Dynamics, and Lagrangian by extension, to everything related to dynamics in the latest physics simulation R+D world.&lt;br /&gt;&lt;br /&gt;The thing is as follows, explained in plane English for plane human beings (like myself, ahem...):&lt;br /&gt;&lt;br /&gt;Classical Newtonian mechanics have some limitations when it comes to computing the equations of motion. &lt;br /&gt;We want to iteratively solve a set of Ordinary Differential Equations (ODE) for acceleration, velocity and position if we want to know where our physical elements will be.&lt;br /&gt;But it happened that mysteriously, when computing them, the total energy of the system got affected, because dissipative forces like damping, friction, etc... had to be also implemented, at that is a daunting task...&lt;br /&gt;&lt;br /&gt;And there is where Lagrange comes into play: he theorized that we can make use of a further abstraction of our system and embed it into another, a bit broader conceptually, where all these forces would not be so determinant and we still could retrieve our results for position, by applying energetic conservation concepts.&lt;br /&gt;Of course this abstraction comes at the price of having to understand a lot of many other things, not simple either (one funny thing about all this is that the only examples I have been able to find are that of a pendulum, a spring tied to a mass and a bead on a wire...If you didn't get it at the beginning, you'll never do...until you get it. Then these are so obvious you can't think of another!)&lt;br /&gt;&lt;br /&gt;Anyway, the main point on Lagrangian approach to dynamics is that we can (and we normally do) find a set of equations that constraint the movement so the energy of the particles individually remains untouched.&lt;br /&gt;These constraints materialize in the form of Jacobian Matrices or Lagrange Multipliers applied to each particle, rigid body or mass in a mass-spring system into our simulation (this is much deeper explained in the paper).&lt;br /&gt;&lt;br /&gt;Fortunatelly also, all the above can be applied to Finite Element Method meshes. All we have to consider is that, in Lagrangian dynamical FEM, instead of having only one term for the stiffness matrix as usual:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [F]=[K]·[u]&lt;br /&gt;&lt;br /&gt;a few more matrices that represent the dynamic terms appear:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [M][u''] + [C][u'] + [K][u] = [F]&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;And this is it regarding brand new concepts. It is as far as I can go by now.&lt;br /&gt;&lt;br /&gt;In the way I have encountered many intensely related diverse topics, which should be explained in following posts. Some of them are:&lt;br /&gt;&lt;ul&gt;&lt;li&gt; Linear Complementary Problem Solvers&lt;/li&gt;&lt;li&gt; Principle of Virtual Work&lt;/li&gt;&lt;li&gt;Differential Equations&lt;/li&gt;&lt;li&gt;Smoothed Particle Hydrodynamics (SPH)&lt;/li&gt;&lt;li&gt;Kynematics&lt;/li&gt;&lt;/ul&gt;But for now I will leave this introduction as it is &lt;br /&gt;&lt;ul&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-5942720757957756731?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/5942720757957756731/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/03/lagrangian-dynamics.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/5942720757957756731'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/5942720757957756731'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/03/lagrangian-dynamics.html' title='LAGRANGIAN DYNAMICS'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-3645677333522351841</id><published>2010-03-10T19:51:00.000-08:00</published><updated>2010-03-10T20:21:12.650-08:00</updated><title type='text'>Stiffness Method and SBRA</title><content type='html'>Eventually I have managed to implement the full code for a simple Direct Stiffness calculator.&lt;br /&gt;The previous post has been conveniently modified to reflect this.&lt;br /&gt;&lt;br /&gt;The results have been fairly discouraging for my intemptions to use it as a basis for the SBRA: initial research led me to the wrong idea that the most computationally intensive part was that of assembly of the stiffness matrix, but my own experiments have proven the opposite.&lt;br /&gt;&lt;br /&gt;The code provided, on a 1.66 GHz processor (the computer is actually dual core, but no parallelization was used), with 2GB RAM, takes 46 seconds only in the solving part. The modelled structure is 1000 nodes and 1800 elements large.&lt;br /&gt;&lt;br /&gt;According to the paper, about 10⁷ iterations are needed over the solver to get a proper reliability assessment. Hence, grosso modo, applying SBRA to this structure on this computer would take 46*10⁷ seconds, some 14.5 long years.&lt;br /&gt;&lt;br /&gt;It is likely that, for smaller structures and using parallelization, times become significantly smaller.&lt;br /&gt;&lt;br /&gt;Nonetheless, the point I wanted to make here is that of the solving step being the most computationally intensive, instead of the presumed assembly step.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-3645677333522351841?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/3645677333522351841/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/03/stiffness-method-and-sbra.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/3645677333522351841'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/3645677333522351841'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/03/stiffness-method-and-sbra.html' title='Stiffness Method and SBRA'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-5165137010917529647</id><published>2010-03-05T04:50:00.000-08:00</published><updated>2010-09-13T04:55:26.359-07:00</updated><title type='text'>DSF Implementation</title><content type='html'>Well...the following is the C++ code to achieve the initial stages of the DSF (e.g. member formation, globalization, merging and linear solving):&lt;br /&gt;&lt;b&gt;main.cpp&lt;/b&gt;: &lt;br /&gt;&lt;textarea cols="55" name="textfield" rows="20"&gt;#include &amp;lt;iostream&amp;gt;#include &amp;lt;math.h&amp;gt;#include "Stiffness.h"#include &amp;lt;vector&amp;gt;#include &amp;lt;gsl/gsl_matrix.h&amp;gt;#include &amp;lt;gsl/gsl_blas.h&amp;gt;#include &amp;lt;time.h&amp;gt;#include &amp;lt;ctime&amp;gt;#include &amp;lt;stdio.h&amp;gt;#include &amp;lt;unistd.h&amp;gt;#include &amp;lt;stdlib.h&amp;gt;int main(){ struct timespec start, stop1, stop2,stop3;    double accum;    clock_gettime( CLOCK_REALTIME, &amp;amp;start);    vector&amp;lt;Element&amp;gt; Elements;    vector&amp;lt;Node&amp;gt; Nodes;    Element Ele;    Node Node;    int numelements=0;    int numnodes=0;    //Create an structure of ten flat meshes one on top of the next    //In total makes 1000 nodes and 1800 elements    for (int h=0;h&amp;lt;10;h++)    {     for (int i=0;i&amp;lt;=9;i++)         {          for (int j=0;j&amp;lt;9;j++)          {           Ele.A=1;           Ele.E=100;           Ele.nodei=h*100+10*i+j;           Ele.nodej=h*100+10*i+j+1;           Elements.push_back(Ele);           numelements++;          }         }                  for (int i=0;i&amp;lt;=9;i++)         {          for (int j=0;j&amp;lt;9;j++)          {           Ele.A=1;           Ele.E=100;           Ele.nodei=h*100+10*j+i;           Ele.nodej=h*100+10*j+i+10;           Elements.push_back(Ele);           numelements++;          }         }                  for (int i=0;i&amp;lt;10;i++)            {              for (int j=0;j&amp;lt;10;j++)              {                  Node.Coordinates[0]=10*i;                  Node.Coordinates[1]=10*j;                  Node.Coordinates[2]=h*50;                  Node.DOF[0]=1;                  Node.DOF[1]=1;                  Node.DOF[2]=1;                  Node.Forces[0]=0;                  Node.Forces[1]=0;                  Node.Forces[2]=-10;                  Node.PrescribedDisplacements[0]=0;                  Node.PrescribedDisplacements[1]=0;                  Node.PrescribedDisplacements[2]=0;                  Nodes.push_back(Node);                                    numnodes++;              }            }    }        printf("Number of elements:%d\n",numelements);       printf("Number of nodes:%d\n",numnodes);     printf("Assembling...\n"); Structure *Fem=new Structure(Elements,Nodes); Fem-&amp;gt;SpaceTrussMasterStiffness(); printf("Assembled!\n"); // printf("***********************************************************************\n");// printf("*******************************Kg Matrix*******************************\n");// printf("***********************************************************************\n");// for (int i=0;i&amp;lt;=Fem-&amp;gt;NumNodes*3-1;i++)// {//  for (int j=0;j&amp;lt;=Fem-&amp;gt;NumNodes*3-1;j++)//  {//   printf("%6.2f,",gsl_matrix_get(Fem-&amp;gt;Kg,i,j));//  }//  printf("\n");// } clock_gettime( CLOCK_REALTIME, &amp;amp;stop1);    accum = ( stop1.tv_sec - start.tv_sec );    printf( "Elapsed time (ms): %4.6f\n", accum ); Fem-&amp;gt;ModifiedMasterStiffness(Fem-&amp;gt;Kg);//// printf("***********************************************************************\n");// printf("*************************Forces Vector*********************************\n");// printf("***********************************************************************\n");// for (int i=0;i&amp;lt;Fem-&amp;gt;NumNodes*3;i++)// {//  printf("%g ", gsl_vector_get(Fem-&amp;gt;VectorForces,i));// } Fem-&amp;gt;ModifiedNodeForces();  printf("Solving...\n"); Fem-&amp;gt;LinearSolve(Fem-&amp;gt;Kg,Fem-&amp;gt;VectorForces); delete Fem;    clock_gettime( CLOCK_REALTIME, &amp;amp;stop2);    accum = ( stop2.tv_sec - stop1.tv_sec );    printf( "Elapsed time (ms): %4.6f\n", accum );        clock_gettime( CLOCK_REALTIME, &amp;amp;stop3);    accum = ( stop3.tv_sec - start.tv_sec );    printf( "Total elapsed time (ms): %4.6f\n", accum );};&lt;/textarea&gt; &lt;br /&gt;&lt;b&gt;Element.h&lt;/b&gt;:&lt;br /&gt;&lt;textarea cols="55" name="textfield" rows="20"&gt;#ifndef ELEMENT_H_#define ELEMENT_H_class Element{public: Element(); virtual ~Element(); double A; double E; double L; int nodei; int nodej; double Sigma; double IntForces;};#endif /*ELEMENT_H_*/&lt;/textarea&gt; &lt;b&gt;Element.cpp&lt;/b&gt;:&lt;br /&gt;&lt;textarea cols="55" name="textfield" rows="20"&gt;#include "Element.h"Element::Element(){}Element::~Element(){}&lt;/textarea&gt; &lt;b&gt;Node.h&lt;/b&gt;:&lt;br /&gt;&lt;textarea cols="55" name="textfield" rows="20"&gt;#ifndef NODE_H_#define NODE_H_#include &amp;lt;iostream&amp;gt;#include &amp;lt;vector&amp;gt;using namespace std;class Node{ public:  Node();  ~Node();  vector&amp;lt;double&amp;gt; Coordinates;  vector&amp;lt;double&amp;gt; DOF;  vector&amp;lt;double&amp;gt; Forces;  vector&amp;lt;double&amp;gt; PrescribedDisplacements;};#endif /*NODE_H_*/&lt;/textarea&gt; &lt;b&gt;Node.cpp&lt;/b&gt;:&lt;br /&gt;&lt;textarea cols="55" name="textfield" rows="20"&gt;#include &amp;lt;iostream&amp;gt;#include "Node.h"using namespace std;Node::Node(){ Coordinates.resize(3); DOF.resize(3); Forces.resize(3); PrescribedDisplacements.resize(3);}Node::~Node(){}&lt;/textarea&gt; &lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;Stiffness.h&lt;/b&gt;:&lt;br /&gt;&lt;textarea cols="55" name="textfield" rows="20"&gt;#ifndef STIFFNESS_H_#define STIFFNESS_H_#include &amp;lt;iostream&amp;gt;#include &amp;lt;vector&amp;gt;#include &amp;lt;gsl/gsl_matrix.h&amp;gt;#include &amp;lt;gsl/gsl_blas.h&amp;gt;#include "Node.h"#include "Element.h"using namespace std;class Structure{ public:  int NumNodes;  int NumElements;  vector&amp;lt;Node::Node&amp;gt; Nodes;  vector&amp;lt;Element::Element&amp;gt; Elements;  vector&amp;lt;double&amp;gt; PrescDOFTable;  vector&amp;lt;double&amp;gt; PrescForcesTable;  gsl_matrix *Kg;  gsl_vector *VectorForces;  Structure(vector&amp;lt;Element&amp;gt;,vector&amp;lt;Node&amp;gt;);  ~Structure();  void SpaceTrussSolution();  void SpaceTrussMasterStiffness();  void ModifiedMasterStiffness(gsl_matrix*);  void ModifiedNodeForces();  void SpaceTrussStresses();  void SpaceBar2Stiffness(vector&amp;lt;double&amp;gt;,        vector&amp;lt;double&amp;gt;,        double ,        double ,        gsl_matrix*);  void PrescDisplacementDOFS();  void LinearSolve (gsl_matrix*,gsl_vector*);};#endif /*Structure_H_*/&lt;/textarea&gt; &lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;Stiffness.cpp&lt;/b&gt;: &lt;br /&gt;&lt;textarea cols="55" name="textfield" rows="20"&gt;#include &amp;lt;iostream&amp;gt;#include &amp;lt;string&amp;gt;#include &amp;lt;cstdio&amp;gt;#include &amp;lt;vector&amp;gt;#include &amp;lt;math.h&amp;gt;#include &amp;lt;gsl/gsl_matrix.h&amp;gt;#include &amp;lt;gsl/gsl_blas.h&amp;gt;#include &amp;lt;gsl/gsl_linalg.h&amp;gt;#include "Stiffness.h"#include "Node.h"#include "Element.h"using namespace std;Structure::Structure(vector&amp;lt;Element&amp;gt; ImpElements,vector&amp;lt;Node&amp;gt; ImpNodes){ printf("Initializing...\n"); Elements=ImpElements; Nodes=ImpNodes; NumElements=Elements.size(); NumNodes=Nodes.size(); Kg = gsl_matrix_alloc(NumNodes*3,NumNodes*3); VectorForces=gsl_vector_alloc(NumNodes*3); int counter=0; int n1=Nodes.size(); int n2=3; for (int i=0;i&amp;lt;n1;i++) {  for (int j=0;j&amp;lt;n2;j++)  {   gsl_vector_set(VectorForces,counter,Nodes[i].Forces.at(j));   counter+=1;  } }// printf("Creating DOF table...\n"); this-&amp;gt;PrescDisplacementDOFS();// printf("Created!\n");// printf("Initialized!\n");}Structure::~Structure(){ printf("Removing data...\n"); gsl_matrix_free( this-&amp;gt;Kg );}void Structure::SpaceTrussMasterStiffness(){ int ii,jj; printf("Assembling...\n"); for (int e=0; e&amp;lt;NumElements; e++) {  gsl_matrix *Ke=gsl_matrix_alloc(6,6);  Element Ele=Elements.at(e);//  printf("**********************************************\n");//  printf("Processing element (%d)\n", e);//  printf("**********************************************\n");  int ni=Ele.nodei;  int nj=Ele.nodej;  int eftab[6]={3*(ni+1)-3,3*(ni+1)-2,3*(ni+1)-1,3*(nj+1)-3,3*(nj+1)-2,3*nj+1)-1};  SpaceBar2Stiffness(Nodes[ni].Coordinates,Nodes[nj].Coordinates,Ele.E,Ele.A,Ke);  int neldof=Ke-&amp;gt;size1;  for (int i=0; i&amp;lt;=neldof-1; i++)  {   ii=eftab[i];   for (int j=i; j&amp;lt;=neldof-1; j++)   {    jj=eftab[j];    gsl_matrix_set(this-&amp;gt;Kg,ii,jj,    gsl_matrix_get(this-&amp;gt;Kg,ii,jj)    +gsl_matrix_get(Ke,i,j));    gsl_matrix_set(this-&amp;gt;Kg,jj,ii,    gsl_matrix_get(this-&amp;gt;Kg,ii,jj));   }  }  gsl_matrix_free( Ke );//  printf("Inserted!\n"); }}void Structure::ModifiedMasterStiffness(gsl_matrix *K){ int i,n,np; np=PrescDOFTable.size(); n=K-&amp;gt;size1; printf("Modifying Kg...\n"); for (int k=0;k&amp;lt;np;k++) {  i=PrescDOFTable.at(k);  for (int j=0;j&amp;lt;n;j++)  {   gsl_matrix_set(K,i,j,0);   gsl_matrix_set(K,j,i,0);   gsl_matrix_set(K,i,i,1);  } }}void Structure::ModifiedNodeForces(){ int i,np,d,n,counter(0); printf("Modifying force vector...\n"); np=PrescDOFTable.size(); n=Kg-&amp;gt;size1; int n1,n2; n1=Nodes.size(); n2=3; for (int i=0;i&amp;lt;n1;i++) {  for (int j=0;j&amp;lt;n2;j++)  {   gsl_vector_set(VectorForces,counter,Nodes[i].Forces.at(j));   counter+=1;  } } int c[n]; for (int k=0;k&amp;lt;np;k++) {  i=PrescDOFTable.at(k);  c[i]=0; } for (int k=0;k&amp;lt;np;k++) {  i=PrescDOFTable.at(k);  d=PrescForcesTable.at(k);  gsl_vector_set(VectorForces,i,d);  if (d==0)  {   continue;  }  for (int j=0;j&amp;lt;n;j++)  {   gsl_vector_set(VectorForces,j,gsl_matrix_get(Kg,i,j)*c[j]*d);  } } printf("\n");}void Structure::LinearSolve (gsl_matrix *a, gsl_vector *b){ gsl_vector *x=gsl_vector_alloc (a-&amp;gt;size1); int s; gsl_permutation *p=gsl_permutation_alloc (a-&amp;gt;size1); gsl_linalg_LU_decomp (a, p, &amp;amp;s); gsl_linalg_LU_solve (a, p, b, x); gsl_permutation_free (p);}void Structure::SpaceBar2Stiffness(vector&amp;lt;double&amp;gt; coor1,       vector&amp;lt;double&amp;gt; coor2,       double Em,       double A,       gsl_matrix *Ke){ double x21,y21,z21,EA,L,LL; x21=coor2.at(0)-coor1.at(0); y21=coor2.at(1)-coor1.at(1); z21=coor2.at(2)-coor1.at(2); EA=Em*A; LL=x21*x21+y21*y21+z21*z21; L=sqrt(LL); double Kaux[6][6] = {    { x21*x21, x21*y21, x21*z21,-x21*x21,-x21*y21,-x21*z21},    { y21*x21, y21*y21, y21*z21,-y21*x21,-y21*y21,-y21*z21},    { z21*x21, z21*y21, z21*z21,-z21*x21,-z21*y21,-z21*z21},    {-x21*x21,-x21*y21,-x21*z21, x21*x21, x21*y21, x21*z21},    {-y21*x21,-y21*y21,-y21*z21, y21*x21, y21*y21, y21*z21},    {-z21*x21,-z21*y21,-z21*z21, z21*x21, z21*y21, z21*z21}    }; for (int i=0; i&amp;lt;6;i++) {  for (int j=0; j&amp;lt;6;j++)   {    gsl_matrix_set(Ke,i,j,(EA/(L*L*L))* Kaux[i][j]);   } }}void Structure::PrescDisplacementDOFS(){ int k,index; k=0; for (int n=0;n&amp;lt;NumNodes;n++) {  for (int j=0;j&amp;lt;3;j++)  {   index=Nodes.at(n).DOF[j];   if (index&amp;gt;0)   {    PrescDOFTable.push_back(k+j);    PrescForcesTable.push_back(Nodes.at(n).Forces[j]);   }  }  k+=3; }}&lt;/textarea&gt;&lt;br /&gt;&lt;br /&gt;I have used the GSL library for everything related to maths (&lt;a href="http://www.gnu.org/software/gsl/"&gt;http://www.gnu.org/software/gsl/&lt;/a&gt;).&lt;br /&gt;This will make my life a lot easier once I manage to master it...Is fairly well documented, so it won't take long (I hope).&lt;br /&gt;Please note that to make the timer work, under Ubuntu 9.10, I've had to activate the -lrt tag in the linker.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-5165137010917529647?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/5165137010917529647/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/03/dsf-implementation.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/5165137010917529647'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/5165137010917529647'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/03/dsf-implementation.html' title='DSF Implementation'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-1941485152440052158</id><published>2010-03-03T16:51:00.000-08:00</published><updated>2010-03-05T04:51:35.210-08:00</updated><title type='text'>Direct Stiffness Method</title><content type='html'>Well...as promised, these past days I've been researching on the possiblity of efficiently use the SBRA through the application of MonteCarlo methods.&lt;br /&gt;&lt;br /&gt;I have been successful in my research and I have found this very interesting course:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.colorado.edu/engineering/cas/courses.d/IFEM.d/"&gt;http://www.colorado.edu/engineering/cas/courses.d/IFEM.d/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It is extremely complete!!&lt;br /&gt;&lt;br /&gt;I have used it to refresh my rusted matrix knowledge from my university years, and so far I have managed to implement a very simple program - though effective for my purposes - that will allow me to benchmark the most time-consuming tasks in classical analysis.&lt;br /&gt;&lt;br /&gt;This is a very brief resume of the algorithm from the course outlined above:&lt;br /&gt;&lt;br /&gt;DIRECT STIFFNESS METHOD STEPS&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Breakdown&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Disconnection&lt;/li&gt;&lt;li&gt;Localization&lt;/li&gt;&lt;li&gt;Member Formation&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Assembly&amp;nbsp;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Globalization&lt;/li&gt;&lt;li&gt;Merge&lt;/li&gt;&lt;li&gt;Application of boundary conditions&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Solution&lt;/li&gt;&lt;li&gt;Recovery of derived quantities&lt;/li&gt;&lt;/ul&gt;The code provided in the course is for Mathematica®, so all I have to do is translate it to C++.&lt;br /&gt;&lt;br /&gt;I will provide the lines of code in the following posts.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-1941485152440052158?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/1941485152440052158/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/03/direct-stiffness-method.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/1941485152440052158'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/1941485152440052158'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/03/direct-stiffness-method.html' title='Direct Stiffness Method'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-6390311073226334368</id><published>2010-02-25T11:42:00.000-08:00</published><updated>2010-02-25T12:04:28.585-08:00</updated><title type='text'>Simulation Based Reliability Assesment (SBRA)</title><content type='html'>This is the resume of the papers:&lt;br /&gt;&lt;ul&gt;&lt;li&gt; &lt;a href="http://scitation.aip.org/getabs/servlet/GetabsServlet?prog=normal&amp;amp;id=PPSCFX000015000001000063000001&amp;amp;idtype=cvips&amp;amp;gifs=yes"&gt;Safety assessment of a steel frame using LRFD and SBRA methods&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.es/url?sa=t&amp;amp;source=web&amp;amp;ct=res&amp;amp;cd=1&amp;amp;ved=0CAgQFjAA&amp;amp;url=http%3A%2F%2Fwww.maritime-conferences.com%2Fasranet2010-conference%2Fasranet2006%2FPDF%2F070_104_Marek%2BKrivy-104-Full.pdf&amp;amp;ei=P82GS6yKOISC4QbNzOioDw&amp;amp;usg=AFQjCNFTzkETL38XrUctvSlnztTd6GR2lQ&amp;amp;sig2=ivkmgj7d7T1sFRCMAyZ_VA"&gt;Probabilistic reliability assessment of a stell frame using the SBRA method&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;Both developed under supervision of Pavel Marek (see previous post about structural engineering conception).&lt;br /&gt;&lt;br /&gt;The first one is very interesting since allows comparison between the actual "State of the Art" (i.e. Limit State approach to design), and the proposed explicitly probabilistic approach.&lt;br /&gt;It describes a step-by-step process of analysis and design comparing both methods:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;Loading and load combination&lt;/b&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;LRFD/Limit States&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Each load is expressed by nominal value and its load factor&lt;/li&gt;&lt;li&gt;Load combinations are determined according to rules established in the Codes&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;SBRA&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Each load is expressed by a load duration curve and its corresponding histogram&lt;/li&gt;&lt;li&gt;Load combination employs Monte Carlo sampling over some 10 million iterations of the analysis&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;li&gt;&lt;b&gt;Resistance and reference values&lt;/b&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;LRFD/Limit States&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Resistances are combined with different resistance factors associated with failure mechanisms (yield stress, compression, flexure, shear,...) also provided by regulations&lt;/li&gt;&lt;li&gt;Design capacity=Nominal capacity x provided failure factor&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;SBRA&lt;/li&gt;&lt;ul&gt;&lt;li&gt; Reference value corresponds to the onset of the stress/deformation curve of the material when reaching yielding, or to a tolerable deformation&lt;/li&gt;&lt;li&gt;An histogram of yield stresses is used to feed each analysis iteration altogether with the histograms for the loads mentioned before&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;li&gt;&lt;b&gt;Frame analysis&lt;/b&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;LRFD/Limit States&lt;/li&gt;&lt;ul&gt;&lt;li&gt;One single iteration is made&lt;/li&gt;&lt;li&gt;Direct 2nd order analysis can be used, in order to check stabilities, but the most common approach is to do a 1st order analysis and then modificate it&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;SBRA&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Analysis is repeated 10 million times using each time the values for loads and resistances extracted from the corresponding histograms. In these histograms, the more probable a load or resistance value, the more often will be used. An histogram is also called Probability Density Function in Monte Carlo literature.&lt;/li&gt;&lt;li&gt;Initial imperfections are explicitly taken into account&lt;/li&gt;&lt;li&gt;There is no need to check individual stability of columns (2nd order)&lt;/li&gt;&lt;li&gt;Resistance is related to the onset of yielding&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;li&gt;&lt;b&gt;Safety assessment&lt;/b&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;LRDF/Limit States&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Once analysis is computed, for each element we check that the relationship Demand/Capacity is smaller than one&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;SBRA&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Probability of failure Pf is compared against target probability Pd provided by the codes&lt;/li&gt;&lt;li&gt;P[(RV-LE)&amp;lt;0]=Pf&lt;pd&gt;&lt;/pd&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;RV=yielding stress&lt;/li&gt;&lt;li&gt;LE=calculated stress&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;/ul&gt;The proposal is very interesting in terms of&amp;nbsp; providing a controlled design and an explicit probabilistic model of the structure.&lt;br /&gt;&lt;br /&gt;Nevertheless, anyone would encounter the main drawback in the need for iterating 10 million times the whole structure, specially when it comes to real-time Lagrangian dynamics, as we are aimed to.&lt;br /&gt;The steps for modelling the forces and displacements remain the same, it is, the traditional stiffness matrix.&lt;br /&gt;Further research shows that the main time-consuming step into the stiffness matrix procedure (also applicable to FEM) is that of the assembly of the stiffness matrix (60-80%).&lt;br /&gt;This means that, once a configuration is achieved and assembled, solving the matrix with different load cases should be relatively quick. Which is a relief if we want to implement SBRA.&lt;br /&gt;Nevertheless, I still feel like I should pay deeper attention to this speed subject, and obtain my own benchmarking.&lt;br /&gt;&lt;ul&gt;&lt;ul&gt;&lt;ul&gt;&lt;ul&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-6390311073226334368?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/6390311073226334368/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/02/simulation-based-reliability-assesment.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/6390311073226334368'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/6390311073226334368'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/02/simulation-based-reliability-assesment.html' title='Simulation Based Reliability Assesment (SBRA)'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-9035068361037617788</id><published>2010-02-24T17:07:00.000-08:00</published><updated>2010-02-24T17:15:30.432-08:00</updated><title type='text'>From Deterministic to Probabilistic Way of Thinking in Structural Engineering</title><content type='html'>&lt;h1 style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small; font-weight: normal;"&gt;This is a very interesting article from the AECEF (Association of European Civil Engineering Faculties)!&lt;/span&gt; &lt;/h1&gt;&lt;blockquote style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;h1&gt;&amp;nbsp;&lt;/h1&gt;&lt;h1&gt;&lt;span style="font-size: small;"&gt;From Deterministic to Probabilistic Way of Thinking in Structural Engineering&lt;/span&gt;&lt;/h1&gt;&lt;div align="center" style="margin-bottom: 0.5cm;"&gt;July 9, 2001. Adjusted Reprint: European Association of Civil Engineering Faculties - Newsletter 2001/ 1 p.  &lt;/div&gt;&lt;div align="center" style="margin-bottom: 0.5cm;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="center" style="margin-bottom: 0.5cm;"&gt;Prof. Ing. Pavel Marek, PhD., DrSc., F.ASCE, Prague &lt;a href="mailto:pmarek@noise.cz"&gt;pmarek@noise.cz&lt;/a&gt;&lt;/div&gt;&lt;div align="center" style="margin-bottom: 0.5cm;"&gt;Prof. Jacques Brozzetti, Dr.h.c., Paris&lt;/div&gt;&lt;div style="margin-bottom: 0.5cm;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;h2 style="text-align: justify;"&gt;Prestige of structural engineering&lt;/h2&gt;&lt;div style="margin-bottom: 0.5cm; text-align: justify;"&gt;One of the speakers at the 1997 Congress of the American Society of Civil Engineers pointed out a significant drop of prestige of structural engineering. In the history of engineering education at the civil engineering departments in the USA this field used to occupy the highest echelon; therefore, the speaker was trying to find the explanation of this drop. He stated among others that the number of causes might include also the preference granted to other specializations due to general interests concerned with, for example, the development of transport networks and environment protection. In his opinion, however, the said drop might be connected also with the development of computers, structural design codes and corresponding software leading sometimes to such education of structural engineers which concentrates gradually on the application of sophisticated software, requiring from the designer merely the introduction of adequate input data, while the computer spouted almost immediately the dimensions of the structure, its reliability assessment and the whole documentation required by respective standards. In such process the designers need not even know the details of dimensioning or the substance of the reliability assessment. Is this opinion justified? Does the development of computer-aided structural design really belong among the causes of the above mentioned drop of prestige observed not only in the USA, but also in other countries?&lt;/div&gt;&lt;h2 style="text-align: justify;"&gt;Is the structural engineer the creator of structures or merely an interpreter of codes?&lt;/h2&gt;&lt;div style="margin-bottom: 0.5cm; text-align: justify;"&gt;Together with the manufacturer and erector, the designer has been, and will always remain, the creator of the structure. His activities are based on professional knowledge, experience and cooperation with related professions. Although the computer revolution is providing ever more powerful instruments facilitating and accelerating his work, these instruments and how ever perfect codes can never replace the designer, responsible for effectiveness and reliability of his work.&lt;/div&gt;&lt;div style="margin-bottom: 0.5cm; text-align: justify;"&gt;The design codes and standards cannot cover all situations the designer may encounter, i.e., loading alternatives, performance conditions, etc. Often he has to decide himself on the basis of his own knowledge and experience in accordance with the „rules of the game“ of reliability assessment. In respect to safety, serviceability and durability of structures the development of codes and standards in the past few decades has resulted in a certain damping of the creative role of the designer who has become merely an interpreter of the rules and criteria formulated in the standard. The „rules of the game“ (i.e. the theoretical foundations of reliability assessment) of the Partial Factor Design (PFD, in the USA called Load and Resistance Factor Design, LRFD) are given in the codes excessively simplified and the designer during his education is not fully acquainted with their substance. The instructors often use the wording „the code states...“, thus avoiding the explanation of the problems with which they are often not thoroughly acquainted themselves. To be accurate, they cannot be thoroughly acquainted with them, as the commentaries and data explaining fully and consistently the background of the codes, various simplifications and the influence of calibration, are not available. The consequences of this development are that the students at departments of civil engineering are often educated primarily in the interpretation of codes and not in the creative engineering way of thinking. This fact must be afforded full attention.&lt;/div&gt;&lt;div style="margin-bottom: 0.5cm; text-align: justify;"&gt;Let us recall the related experience with the introduction of the PFD concept into AISC design codes in the USA In the field of steel structures a standard based on the LRFD method was issued in the USA. in 1986. This method is actually an analogy of the PFD method – see the Eurocodes. The code was introduced in order to replace the standards based on the deterministic Allowable Stress Design method (ASD). Although the issue of the LRFD standard was preceded by an extensive explanatory campaign and training courses emphasizing the advantages of the LRFD method, today – 15 years after it has been introduced – it is applied merely by one quarter of designers while the prevailing majority of designers in the country of the tallest buildings, biggest bridges and other unique structures, has remained faithful to the excessively simplified, but understandable deterministic ASD method (Iwankiw N. AISC, Chicago. Personal communication. 2000). This seemingly conservative attitude of the designers is usually explained by unsatisfactory teaching of the LRFD method at universities. However, the number of principal causes of reserve on the part of experienced USA designers may include their feeling that the LRFD method, developed in the pre-computer era, has been submitted to the designers too late and that it no longer provides qualitatively new possibilities corresponding with the computer era in respect of reliability assessment.&lt;/div&gt;&lt;h2 style="text-align: justify;"&gt;From slide-rule era to computer era in structural design&lt;/h2&gt;&lt;div style="margin-bottom: 0.5cm; text-align: justify;"&gt;In the courses of steel, concrete and timber structures the students of civil engineering faculties may hear from some of their instructors that due to the introduction of the Eurocodes „nothing much will happen in the field of reliability assessment in the next few decades“. This is the statement which must be contradicted. The expansion of fast improving computers to the desk of every structural designer has produced profound qualitative and quantitative changes which have no analogy in the whole history of this field. The growing computer potential improves the prerequisites for the „re-engineering“ of the whole design process (i.e. its fundamental re-assessment and re-working) to adapt it to entirely new conditions and possibilities. We can follow with admiration the fast development of software for the analysis and dimensioning of structures according to existing codes and the production of their respective drawings. At the same time it is necessary to emphasize that entirely unsatisfactory attention has been afforded so far to the development of concepts and corresponding codes based on the qualitatively improved method of reliability assessment corresponding to computer potential available.&lt;/div&gt;&lt;div style="margin-bottom: 0.5cm; text-align: justify;"&gt;Since the early Sixties, many national and international codes for structural design based on deterministic concept have been replaced by a “semi-probabilistic” Partial Factors Design (PFD) such as that found in the Eurocodes. The PFD concepts have been developed using statistics, reliability theory and probability, however, without considering the computer revolution. The interpretation of the assessment format in codes is similar to the fully deterministic scheme applied in earlier codes except there are applied two partial factors instead of a single factor. The application of PFD does not require the designer to understand the rules hidden in the background of the codes. The semi-probabilistic background of the reliability assessment procedure has been considered by those writing the codes, however, the calibration and numerous simplifications introduced in the final format of codes affected the concept in such a way that the concept is better to be called “prescriptive” instead of “semi-probabilistic” (Iwankiw N. AISC, Chicago. Personal communication. 2000). The designer’s activities are limited to the interpretation of equations, criteria, instructions, factors, and „black boxes“ contained in the codes. The reliability check can be conducted using a calculator, slide rule or even long-hand, while the modern computer serves only as a “fast calculator”. The actual probability of failure and the reserves in bearing capacity cannot be explicitly evaluated using PFD codes. From the designer’s point of view, the application of PFD in practice is still deterministic. A designer‘s direct involvement in the assessment process is not assumed and, therefore, his/her creativity is suppressed.&lt;/div&gt;&lt;div style="margin-bottom: 0.5cm; text-align: justify;"&gt;Has the computer potential created the prerequisites for a qualitative improvement of the partial factors method? The answer can be illustrated by the following analogy: Is it sufficient to attach a high-efficient jet engine to the gondola of a balloon in order to achieve its incomparably higher velocity and efficiency? It can be concluded that the combination of the balloon and the jet engine will not create a higher quality means of transport. Analogously it is possible to conclude that the partial factors method based on numerous limitations and simplifying assumptions cannot be raised to a qualitatively higher level of the structural reliability assessment concept by its combination with computer potential. It can be concluded that the computer revolution leads to qualitatively new fully probabilistic structural reliability assessment concepts.  &lt;/div&gt;&lt;h2 style="text-align: justify;"&gt;Application of elite research results to structural design codes&lt;/h2&gt;&lt;div style="margin-bottom: 0.5cm; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;The results of elite research are usually applied to specific fields (offshore structures, space programs) by top-level experts. The conferences, however, lack the papers by research scientists explaining their ideas of the application of their concepts to codes and standards used by hundreds of thousands of designers in their everyday work. Who will bring the message from the elite researchers to the rank and file designers? An understandable explanation of scientific methods of reliability assessment used in the standards accepted by structural designers worldwide is a highly exacting task. However, without its solution the results of elite research remain merely the object of articles in scientific periodicals and the designer remains merely an interpreter of prescriptive codes.&lt;/span&gt;&lt;/div&gt;&lt;div align="justify" style="margin-bottom: 0.5cm;"&gt;&lt;span style="font-size: small;"&gt;Research affords attention to the development of risk engineering, fuzzy sets and other methods, while the designer lacks a fundamental, understandable and consistent method of determination of failure probability. Therefore, it is necessary to reassess the rules of the game of the reliability assessment, beginning with the load definition. The present day load expression in codes by the characteristic value and load factors must be replaced with a qualitatively higher form enabling to take into account also the loading history (such as, for example, the so called &lt;i&gt;load duration&lt;/i&gt; &lt;i&gt;curves&lt;/i&gt;, see book &lt;a href="http://www.itam.cas.cz/SBRA/literature/???"&gt;Simulation-based Reliability Assessment for Structural Engineers&lt;/a&gt;). With reference to bearing capacity it is necessary to provide a reference value applicable to the computation of the failure probability. Reliability should be expressed by a comparison of the computed failure probability with design target probability.&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0.5cm; text-align: justify;"&gt;The preparedness of designer is the necessary prerequisite for the practical application of the probabilistic concept of reliability assessment. Let us turn our attention to the education of students at civil engineering departments and designers in post-graduate courses.  &lt;/div&gt;&lt;h2 style="text-align: justify;"&gt;Deterministic or probabilistic approach in education?&lt;/h2&gt;&lt;div style="margin-bottom: 0.5cm; text-align: justify;"&gt;Let us ask these questions: Is the approach applied in our courses to the solution of technical problems in structural design, deterministic or probabilistic? Are instructors infusing a deterministic understanding into the “knowledge-base” of their students, or is the fact that we are living in a world defined by random variables already accepted and applied in the educational process? In courses such as &lt;i&gt;Statistics&lt;/i&gt; and &lt;i&gt;Probability Models in Structural Engineering&lt;/i&gt;, the common textbooks are based on a “classical” approach to statistics and probability theory. Such an approach is limited to analytical and numerical solutions, and does not allow for transparent analysis of reliability functions that depend on the interaction of several random variables. The textbooks mostly remain silent on common real-world problems, such as the probability of failure of a structural component exposed to variable load combinations in which one might consider the contributions of variable yield stress, variable geometrical properties and random imperfections. In structural design courses, the interpretation and application of the existing codes are emphasized; however, students are using the codes without a full understanding of the actual reliability assessment rules and of the meanings of the factors used to express safety, durability, and serviceability of structural components.  &lt;/div&gt;&lt;h2 style="text-align: justify;"&gt;Teaching reliability&lt;/h2&gt;&lt;div style="margin-bottom: 0.5cm; text-align: justify;"&gt;Advances in computer technology allow for using simulation-based approach to solve numerous problems. The Monte Carlo simulation technique has been applied to basic problems in statistics and probability for a long time. The structural reliability assessment using direct Monte Carlo has been taught, for example, since 1989 at &lt;a href="ftp://www.itam.cas.cz/sbra/literature/2.Anagnos,%20T.,%20and%20Marek,%20P.%20Application%20of%20Simulation%20Techniques%20in%20Teaching%20Reliability%20Concepts.%20Proceedings:%20Conference%20%E2%80%9CFrontiers%20in%20Education%E2%80%9D,%20Salt%20Lake%20City.%20October%201996."&gt;San Jose State University, California&lt;/a&gt;, and since 1996 at the Department of Civil Engineering, V©B TU Ostrava, Czech Republic, at the graduate and undergraduate levels. The positive response of the students, and their understanding encouraged the instructors. A team of undergraduate students developed, for example, a study proving that the LRFD method is not leading to a balanced safety (see Probabilistic Engineering Mechanics 14 (105 – 118), USA, 1998)). The new generation of civil engineers seems to be anxious to apply advanced computer technology to its fullest including application of simulation techniques in the analysis of multi-variable problems.  &lt;/div&gt;&lt;h2 style="text-align: justify;"&gt;TeReCo project&lt;/h2&gt;&lt;div style="margin-bottom: 0.5cm; text-align: justify;"&gt;With reference to the improvements expected in the field of structural reliability assessment the training of students and designers ranks among the most important tasks. What starting point should be chosen? A transition to the qualitatively higher probabilistic concepts will require the designer to change his way of thinking, i.e. to replace his current “deterministic thought-process” with the probabilistic one. The professional EC Committees consider the training of designers in this respect highly desirable. For this reason the Leonardo da Vinci Agency in Brussels has sponsored the &lt;a href="http://www.noise.cz/sbra/doc/2001b.html???"&gt;TeReCo Project (&lt;b&gt;Te&lt;/b&gt;aching &lt;b&gt;Re&lt;/b&gt;liability &lt;b&gt;Co&lt;/b&gt;ncepts using simulation techniques&lt;/a&gt;). This long term project had resulted in the work of 33 authors from nine countries being published in the textbook &lt;a href="http://www.itam.cas.cz/SBRA/literature/???"&gt;Probabilistic Assessment of Structures Using Monte Carlo Simulation. Background, Exercises and Software.&lt;/a&gt; (it is &lt;a href="http://www.itam.cas.cz/SBRA/???"&gt;available&lt;/a&gt; since June 2001). The book acquaints the readers with the basis of a fully probabilistic structural reliability assessment concept, using as a tool the transparent SBRA method (Simulation-Based Reliability Assessment method documented in textbook &lt;a href="http://www.itam.cas.cz/SBRA/literature/???"&gt;Simulation-based Reliability Assessment for Structural Engineers&lt;/a&gt; and applied in &lt;a href="http://www.itam.cas.cz/SBRA/literature"&gt;&lt;u&gt;&lt;span style="color: blue;"&gt;about hundred papers&lt;/span&gt;&lt;/u&gt;&lt;/a&gt;). The concept allows for bypassing the „design-point” approach as well as the load and resistance factors, and leads to the reliability check expressed by P&lt;sub&gt;f&lt;/sub&gt; &amp;lt; P&lt;sub&gt;d&lt;/sub&gt; comparing the calculated probability of failure P&lt;sub&gt;f&lt;/sub&gt; with the target design probability P&lt;sub&gt;d&lt;/sub&gt; given in codes. The application of SBRA is explained in the book using 150 solved examples. On the attached CD-ROM, the reader will find the input files and computational tools enabling the duplication of the examples on a PC, the pilot data-base of mechanical properties (expressed by histograms) of selected structural steel grades, selected histograms (loads, imperfections, and more), manuals for computer programs and 55 selected presentations of examples (Microsoft PowerPoint). The book should serve as an aid in teaching undergraduate and graduate students and in introducing the designers to the strategy of the fully probabilistic reliability assessment of elements, components, members and simple systems using direct Monte Carlo simulation and modern PC computers.&lt;/div&gt;&lt;h2 style="text-align: justify;"&gt;Summary and conclusions&lt;/h2&gt;&lt;div style="margin-bottom: 0.5cm; text-align: justify;"&gt;The structural engineering profession needs new approaches if we want to provide the best possible service to society. We have to consider the transition from the deterministic „way of thinking” to open-minded probabilistic concepts accepting the random character of individual variables involved as well as their interaction. Tools such as simulation techniques and powerful personal computers will contribute to reaching such goals. Students find these techniques easy to learn and thus they do not require the instructor to take a great deal of classroom time to explain the theoretical background. Once in the computer lab, students can explore to their hearts content and gain a fuller understanding of the effects of each parameter on the variability of the final answer. With this understanding students are better informed to make decisions about tradeoffs that need to be made, for example, between service life, durability and safety. The simulation technique should be included in the program of undergraduate and graduate studies and in corresponding textbooks to prepare students for the types of problems they will encounter in the real world, especially for the application of probabilistic structural reliability assessment concepts in the new generation of codes expected to be introduced in the near future. Such approach will make the engineer the creator of the structure and may bring the prestige of structural engineering back to one of the highest positions.&lt;/div&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-9035068361037617788?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/9035068361037617788/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/02/from-deterministic-to-probabilistic-way.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/9035068361037617788'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/9035068361037617788'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/02/from-deterministic-to-probabilistic-way.html' title='From Deterministic to Probabilistic Way of Thinking in Structural Engineering'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-1996084704533222074</id><published>2010-02-23T17:03:00.000-08:00</published><updated>2010-02-24T18:08:16.960-08:00</updated><title type='text'>Limit State Design</title><content type='html'>Limit State Design is the method now used in every regulation (Eurocode, Spanish CTE, USA LRFD, ...), so I think it is a primary target in the steepy road towards stochastic simulation.&lt;br /&gt;&lt;br /&gt;Actually, a lot of bibliography points from Limit State Design to FORM (First Order Reliability Method).&lt;br /&gt;Stochastic methods are being widely used into these environments (those of FORM).&lt;br /&gt;&lt;br /&gt;But before, lets get a brief review on Limit States:&lt;br /&gt;&lt;br /&gt;Limit States Design require the designer to establish a set of performance criteria (vibration levels, deflection, strength, stability, buckling, twisting, collapse,...) for the designed piece.&lt;br /&gt;Then, according to its relevance, the variable of design enters within the area of the safety (ULS) or the comfort (SLS):&lt;br /&gt;&lt;ul&gt;&lt;li&gt;ULS (Ultimate Limit State): Satisfaction of ULS happens when all factored bending, shear, tensile and compressive stresses are below the factored resistances.&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Stresses are magnified&lt;/li&gt;&lt;li&gt;Resistances are reduced&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;SLS (Serviceability Limit State): Satisfaction of SLS happens when deflection, vibration , fissuration,...are within a certain criteria&lt;/li&gt;&lt;/ul&gt;Hence, the actual method is then called, in European regulations, Partial Factors method, and in USA LRFD (Load and Resistance Factor Design).&lt;br /&gt;Here the limits and the factors are prescripted by the regulatory organ, in a probabilistic manner, but are applied in the same deterministic way and within the same deterministic methodology as it has been for decades.&lt;br /&gt;&lt;ul&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-1996084704533222074?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/1996084704533222074/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/02/limit-state-design.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/1996084704533222074'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/1996084704533222074'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/02/limit-state-design.html' title='Limit State Design'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-3833478344061205904</id><published>2010-02-20T21:08:00.000-08:00</published><updated>2010-02-21T12:04:19.030-08:00</updated><title type='text'>Collision Detection Summary</title><content type='html'>&lt;div style="text-align: justify;"&gt;Well, well...after a whole week of intense research, I think I already have some insight on Collision Detection so as to try to condense the matter in a post.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;The following is a brief report made out of the references stated at the end:&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;b&gt;INTRODUCTION&lt;/b&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Collision detection is one of the major bottlenecks presented in any physics simulation given its computationally intensive idiosyncrasy.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;It is also one of the main sources of error given that it serves as the basis for every other step in the simulation. Calculated collision points might later be treated as constraints within our solvers, or as force accumulators, and provide a lot of instabilities if they are not precise enough.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;In general, collision detection / proximity queries / penetration depth algorithms are targeted to provide information about just that, to be used later for other things. These things are commonly physics simulations, haptic devices, or robotic simulations, and they require a real time speed of computation and robustness altogether.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;b&gt;A ROUGH REVIEW ON COLLISION DETECTION METHODOLOGIES FOR POLYGONAL MODELS&lt;/b&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;According to literature, it is possible to make an initial distinction depending on the nature of the graphic input data: polygonal models vs non-polygonal.&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_1CZ6zhe_ay0/S4C9JRo2T6I/AAAAAAAAAEI/OeeMcECl2sc/s1600-h/icos.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_1CZ6zhe_ay0/S4C9JRo2T6I/AAAAAAAAAEI/OeeMcECl2sc/s320/icos.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_1CZ6zhe_ay0/S4Emz_E8wnI/AAAAAAAAAEY/hoyJGvBZLdU/s1600-h/images.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_1CZ6zhe_ay0/S4Emz_E8wnI/AAAAAAAAAEY/hoyJGvBZLdU/s320/images.jpeg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="" style="clear: both; text-align: justify;"&gt;This separates the mostly common "soups of vertices" and triangles from solids, implicit surfaces and parametric surfaces.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Basically, all the researched collision detection methodologies focus on the first, as it is fairly easy to pre-process the others into polygon soups.&amp;nbsp;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Furthermore, algorithms for non-polygonal surfaces are very specific and then would limit the input and the end user would be forced to provide information in this "format".&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Once this distinction is made, each of the different algorithms focus on any&amp;nbsp; or some of the following issues:&lt;/div&gt;&lt;ul style="text-align: justify;"&gt;&lt;li&gt;&lt;b&gt;Pair processing vs N-processing:&lt;/b&gt; If a method emphasizes too much on improving precision in the measurement of the distance between two particular meshes, then it becomes too slow and so it has a limit to the amount of bodies the simulation can represent.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Static vs Dynamic: &lt;/b&gt;Others using the foreknown trajectories of the bodies require an amount of feedback between the dynamics engine and the collision detection package. Then the concept of &lt;i&gt;frame coherence&lt;/i&gt; appears. These methods rely on the stable consistency of every time step to make calculations.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Rigid vs Deformable: &lt;/b&gt;When the meshes represent cloths or fluids (deformable meshes), as the dynamic characteristics of their shape is often complex and essentially non-linear, robustness and efficiency are frequently affected.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Large vs Small environment: &lt;/b&gt;There is also a problem generalizing the algorithms so they can serve as well in the short as in the long range, to avoid leaps in the numerical results that lead to instabilities and affect robustness.&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;b&gt;BOUNDING VOLUME HIERARCHIES (BVHs)&lt;/b&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;a href="http://4.bp.blogspot.com/_1CZ6zhe_ay0/S4C9SppzH-I/AAAAAAAAAEQ/dFAi7bhie1o/s1600-h/HeavyHitboxes.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="200" src="http://4.bp.blogspot.com/_1CZ6zhe_ay0/S4C9SppzH-I/AAAAAAAAAEQ/dFAi7bhie1o/s200/HeavyHitboxes.jpg" width="139" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;An ubiquitous subject encountered in every researched method is that of the Bounding Volume Hierarchies.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;These are a consequence of an iterative simplification of the problem of intersection of N bodies.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;It consists in associating a simpler geometrical shape to our initial complex shape, so calculations of the distances can be made faster.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;As long as couples of shapes gets closer and closer, we iteratively subdivide those rougher representations of them.&lt;br /&gt;Many types have been devised:&lt;/div&gt;&lt;ul style="text-align: justify;"&gt;&lt;li&gt;k-DOP trees (Discrete Orientation Polytopes)&lt;/li&gt;&lt;li&gt;Octrees&lt;/li&gt;&lt;li&gt;R-trees&lt;/li&gt;&lt;li&gt;Cone trees&lt;/li&gt;&lt;li&gt;BSPs (Binary Space Partitions)&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: center;"&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_1CZ6zhe_ay0/S4C6o05vERI/AAAAAAAAAD4/-jgTi14Kb_k/s1600-h/anchor.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_1CZ6zhe_ay0/S4C6o05vERI/AAAAAAAAAD4/-jgTi14Kb_k/s320/anchor.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;These trees are conformed of different simpler geometrical shapes that would be hierarchically sorted and that would represent our shapes within the tree.&lt;br /&gt;There are various types:&lt;/div&gt;&lt;ul style="text-align: justify;"&gt;&lt;li&gt;Spheres&lt;/li&gt;&lt;li&gt;AABB (Axis Aligned Bounding Boxes)&lt;/li&gt;&lt;li&gt;OBBs (Oriented Bounding Boxes)&lt;/li&gt;&lt;li&gt;k-DOPs (Discrete Orientation Polytopes, where k means the number of faces) &lt;/li&gt;&lt;li&gt;SSV (Swept Sphere Volumes)&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_1CZ6zhe_ay0/S4C67m9geeI/AAAAAAAAAEA/kvNaUMmiyLA/s1600-h/articles215.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="118" src="http://1.bp.blogspot.com/_1CZ6zhe_ay0/S4C67m9geeI/AAAAAAAAAEA/kvNaUMmiyLA/s200/articles215.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_1CZ6zhe_ay0/S4EtPokmkFI/AAAAAAAAAEg/aQjRbsVeR4g/s1600-h/image-0" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_1CZ6zhe_ay0/S4EtPokmkFI/AAAAAAAAAEg/aQjRbsVeR4g/s320/image-0" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style="text-align: justify;"&gt;&lt;/ul&gt;&lt;ul style="text-align: justify;"&gt;&lt;/ul&gt;&lt;div class="separator" style="clear: both; text-align: justify;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: justify;"&gt;The main procedure consists of getting statistical data from all the vertices for each mesh in order to get the centroid (the mean value of all of them) and the maximum and minimum values to have the bounding volume (of whatever the chosen shape). Then it is possible to use the specific characteristics of the shape to proceed to the interference calculations.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: justify;"&gt;With spheres, it is quite straightforward, having their radius and centre. With bounding boxes it is possible to "project" the mesh vertexes coordinates against their sides. With these projections, a set of lists is made for each dimension (called intervals) and then check interference sorting the lists.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Actually these trees, or hierarchies, are just an abstraction to get different levels of definition during computation.&amp;nbsp;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;When made between objects far apart, we speak about &lt;b&gt;broadphase&lt;/b&gt;.&amp;nbsp; In this state the nested resulting bounding volumes are simpler and rougher and have little to do with the actual shape they contain.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;When objects get closer then appears the &lt;b&gt;narrowphase&lt;/b&gt;. It triggers whenever an intersection between two bounding volumes has been detected in the broadphase. Implies the iterative subdivision of the bounding volume, either until a collision point is found, or a penetration distance is calculated, or a separation distance is obtained.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;In this part many different approaches can be found, with very prolix performance results and assumptions.&lt;br /&gt;Nevertheless, particularly one sounds louder than others: the GJK algorithm. &lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;b&gt;GJK ALGORITHM AND THE MINKOWSKY SUM&lt;/b&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;A principal character in this play is the GJK (Gilbert-Johnson-Keerthy) algorithm.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;It implements an algebraic property of every pair of convex polyhedra: the Minkowsky sum.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Basically this sum (or difference, there is not much consensus but I am not a mathematician either), has the ability of returning a very important concept: when two convex polyhedra are added through it, if they share a part of the space (they intersect), the centroid of them is contained within the resulting polyhedron.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_1CZ6zhe_ay0/S4C6P8_jAyI/AAAAAAAAADw/0_QD0GaRGdc/s1600-h/morpho.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="152" src="http://1.bp.blogspot.com/_1CZ6zhe_ay0/S4C6P8_jAyI/AAAAAAAAADw/0_QD0GaRGdc/s320/morpho.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;For every pair of objects that need to have their interference checked (remember, it triggers only between those objects that are close), all that has to be done is to iteratively see whether the features (vertices, edges and faces) are getting close or far from the centroid.&lt;br /&gt;This is made using the concept of simplex, that can be applied to vertices, edges, triangles or tetrahedra (all of them known as polytopes).&lt;br /&gt;Making a single loop that iterates through the mesh geometry, it is possible to discard the interference whenever a vector points out from the direction of the centroid of the Minkowsky sum. If none appears, then objects are overlapping.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;This algorithm has an irrefutable efficiency, provided its popularity, and has proven to pass from an O(n2) complexity to O(nlogn) complexity.&lt;br /&gt;Mainly it comes from the fact that gives a true / false answer very quickly, as it does not need to iterate the whole geometry for the answer (usually comes after a few iterations over the simplex checking algorithm).&lt;br /&gt;&lt;br /&gt;The first problem one encounters is that distances are not straightforward in this method. The way to&amp;nbsp; obtain penetration distance requires further processing and affects performance negatively when implemented. An error tolerance has to be provided and then successive iterations are made in a very similar manner to&amp;nbsp; the "sweep and prune" way described above: testing that a "shrinking" polytope from the centroid is as small as this error.&lt;br /&gt;&lt;br /&gt;Another drawback of this method is its limitation to convex polyhedra. Minkowsky sum property does not apply for concave polyhedra.&lt;br /&gt;This can be tackled using a preprocessing &lt;i&gt;convex shape decomposition&lt;/i&gt; that would provide us with sets of Bounding Volume Hierarchies nested within the initial concave shape.&lt;br /&gt;&lt;br /&gt;Last but not least is the instability problem that arises when very small shapes are tested against larger ones. Due to the difference in size, the Minkowsky sum presents extremely oblong shaped facets. This commonly leads to infinite loops.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;OPEN SOURCE COLLISION DETECTION&lt;/b&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;The following is a list describing all available Open Source algorithms I have tested and helped me out to figure out the described above:&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;b&gt; &lt;/b&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.cs.unc.edu/%7Egeom/I_COLLIDE.html"&gt;I-COLLIDE collision detection system:&lt;/a&gt;&lt;span style="font-size: small;"&gt; is an interactive and exact collision-detection library for environments composed of many convex polyhedra or union of convex pieces, based on the expected constant time, incremental distance computation algorithm&amp;nbsp; and algorithms to check for collision between multiple moving objects.&amp;nbsp;&lt;/span&gt; &lt;/li&gt;&lt;li&gt;&lt;a href="http://gamma.cs.unc.edu/OBB/"&gt;RAPID interference detection system&lt;/a&gt;: is a robust and accurate polygon interference detection library for pairs of unstructured polygonal models. It is applicable to polygon soups models which contain no adjacency information and obey no topological constraints. It is most suitable for close proximity configurations between highly tesselated smooth surfaces.&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cs.unc.edu/%7Egeom/V_COLLIDE"&gt;V-COLLIDE collision detection system&lt;/a&gt;: is a collision detection library for large dynamic environments, and unites the nbody processing algorithm of I-COLLIDE and the pair processing algorithm of RAPID. It is designed to operate on large numbers of static or moving polygonal objects to allow dynamic addition or deletion of objects between timesteps.&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.win.tue.nl/%7Egino/solid/"&gt;SOLID interference detection system&lt;/a&gt;: is a library for interference detection of multiple three-dimensional polygonal objects  including polygon soups  undergoing rigid motion. Its performance and applicability is comparable to that of V-COLLIDE.&lt;/li&gt;&lt;li&gt;&lt;a href="http://gamma.cs.unc.edu/SWIFT++/"&gt;SWIFT++&lt;/a&gt;: SWIFT++ is a collision detection package capable of detecting intersection, performing tolerance verification, computing approximate and exact distance, or determining the contacts between pairs of objects in a scene composed of general rigid polyhedral models.  It is a major extension of the &lt;a href="http://gamma.cs.unc.edu/SWIFT/"&gt;SWIFT system&lt;/a&gt; previously released from UNC. Uses the convex polyhedra decompostion.&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.codercorner.com/Opcode.htm"&gt;OPCODE&lt;/a&gt;: It is similar to popular packages such as &lt;span lang="FR"&gt;&lt;a href="http://www.win.tue.nl/%7Egino/solid/index.html"&gt;&lt;span lang="EN-US"&gt;SOLID&lt;/span&gt;&lt;/a&gt;&lt;/span&gt; or &lt;span lang="FR"&gt;&lt;a href="http://www.cs.unc.edu/%7Egeom/OBB/OBBT.html"&gt;&lt;span lang="EN-US"&gt;RAPID&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;, but more memory-friendly, and often faster. Stands for OPtimized COllision Detection.&lt;/li&gt;&lt;li&gt;&lt;o:p&gt;&lt;/o:p&gt;  &lt;br /&gt;&lt;br /&gt;&lt;div class="MsoNormal"&gt;&lt;a href="http://gamma.cs.unc.edu/SSV/"&gt;PQP proximity query package&lt;/a&gt;: It pre-computes a hierarchical representation&lt;br /&gt;of models using tightting oriented bounding box trees (OBBTrees). At runtime, the algorithm traverses two such trees and tests for overlaps between oriented bounding boxes based on a separating axis theorem, which takes less than 200 operations in practice.&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-3833478344061205904?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/3833478344061205904/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/02/collision-detection-summary.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/3833478344061205904'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/3833478344061205904'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/02/collision-detection-summary.html' title='Collision Detection Summary'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_1CZ6zhe_ay0/S4C9JRo2T6I/AAAAAAAAAEI/OeeMcECl2sc/s72-c/icos.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-7586353868562186331</id><published>2010-02-19T08:23:00.000-08:00</published><updated>2010-02-19T11:23:19.927-08:00</updated><title type='text'>Collision Detection Sources</title><content type='html'>&lt;div style="text-align: justify;"&gt;Well, the last two days I've been researching on the topic of Collision Detection (as planned).&lt;/div&gt;&lt;div style="text-align: justify;"&gt;After a short fight against OPCODE (&lt;a href="http://www.codercorner.com/Opcode.htm"&gt;http://www.codercorner.com/Opcode.htm&lt;/a&gt;), which stands for OPtimized COllision DEtection, I've been forced to abandon under mere technicalities with its implementation in C++.&amp;nbsp;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Just couldn't make it compile under gcc and EasyEclipse...anyway, thanks to Pierre Terdiman (&lt;a href="http://www.codercorner.com/blog/"&gt;http://www.codercorner.com/blog/&lt;/a&gt;).&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;I have switched to PQP (&lt;a href="http://gamma.cs.unc.edu/SSV/"&gt;http://gamma.cs.unc.edu/SSV/&lt;/a&gt;), which claims to be as fast and memory efficient as OPCODE, and I have already managed to make it work...now let's strip it off!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-7586353868562186331?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/7586353868562186331/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/02/collision-detection-sources.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/7586353868562186331'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/7586353868562186331'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/02/collision-detection-sources.html' title='Collision Detection Sources'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-4124075022635511813</id><published>2010-02-18T07:12:00.000-08:00</published><updated>2010-02-21T12:07:26.265-08:00</updated><title type='text'>Working Programme</title><content type='html'>&lt;div style="text-align: justify;"&gt;Well, today is the beginning of the new approach towards the thesis!&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;According to my calendar, I still have 7,5 months here in Cercedilla (60km north of Madrid), in my parents' house, with nothing to worry about but "ora et labora"...&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;So, it seems reasonable to try to develop a full physics environment of my own, where at least I can control and understand everything that happens on it...maybe later on I can go back to ODE or Bullet!&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;According to documentation on Bullet and ODE, common physics engines implement the following:&lt;/div&gt;&lt;ul style="text-align: justify;"&gt;&lt;li&gt;Collision detection&lt;/li&gt;&lt;li&gt;Rigid body dynamics&lt;/li&gt;&lt;li&gt;Constraints&lt;/li&gt;&lt;li&gt;Soft body dynamics&lt;/li&gt;&lt;/ul&gt;The thing is that I also want to implement Finite Element Analysis and Stochastic environment...So my research timeline could be as follows:&lt;br /&gt;&lt;ul style="text-align: justify;"&gt;&lt;li&gt;February: &lt;span style="font-size: x-small;"&gt;Collision detection&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;+Stochastic environment&lt;/span&gt;&lt;/li&gt;&lt;li&gt;March: &lt;span style="font-size: x-small;"&gt;Rigid body dynamics&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;+Stochastic environment&lt;/span&gt;&lt;/li&gt;&lt;li&gt;April: &lt;span style="font-size: x-small;"&gt;Rigid body dynamics&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;+Finite Element Analysis&lt;/span&gt;&lt;/li&gt;&lt;li&gt;May: &lt;span style="font-size: x-small;"&gt;Rigid body dynamics+Constraints&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;+Finite Element Analysis&lt;/span&gt;&lt;/li&gt;&lt;li&gt;June: &lt;span style="font-size: x-small;"&gt;Rigid body dynamics+Soft body dynamics&lt;/span&gt;&lt;/li&gt;&lt;li&gt;July: &lt;span style="font-size: x-small;"&gt;Finite Element Analysis+Soft body dynamics&lt;/span&gt;&lt;/li&gt;&lt;li&gt;August: &lt;span style="font-size: x-small;"&gt;Finite Element Analysis&lt;/span&gt;&lt;/li&gt;&lt;li&gt;September: &lt;span style="font-size: x-small;"&gt;Stochastic environment&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;Of course, it is important to have in mind that everything doesn't have to be perfectly implemented. A rough and working sample of each item should be enough, as long as the whole system allows for further improvements.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;I count heavily on the already developed code (Bullet and ODE are open source) and on the extensive documentation available (which sometimes is more a burden than a relief).&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;There are also two important deadlines:&lt;/div&gt;&lt;ul style="text-align: justify;"&gt;&lt;li&gt;June for the presentation of the thesis proposal to the UPC jury&lt;/li&gt;&lt;li&gt;October for the mobility grant to Ljubljana&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;Well...time will tell! &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-4124075022635511813?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/4124075022635511813/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/02/physics-environment-for-ogre3d.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/4124075022635511813'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/4124075022635511813'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/02/physics-environment-for-ogre3d.html' title='Working Programme'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-942380121073076219</id><published>2010-02-17T17:44:00.000-08:00</published><updated>2010-02-18T07:20:38.717-08:00</updated><title type='text'>Bullet Physics Engine</title><content type='html'>&lt;div style="text-align: justify;"&gt;After a few months banging my head against Bullet (&lt;a href="http://bulletphysics.org/"&gt;http://bulletphysics.org&lt;/a&gt;), which apparently could make my life a lot easier:&lt;/div&gt;&lt;blockquote&gt;&lt;span style="font-size: x-small;"&gt;&lt;i&gt;Bullet is a Collision Detection and Rigid Body Dynamics Library. The Library is Open Source and free for commercial use, under the &lt;a class="external text" href="http://opensource.org/licenses/zlib-license.php" rel="nofollow" title="http://opensource.org/licenses/zlib-license.php"&gt;ZLib license&lt;/a&gt;. This means you can use it in commercial games, even on next-generation consoles like Sony Playstation 3. &lt;/i&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;div style="text-align: justify;"&gt;I have chosen to abandon this strategy for the time being given the following conclusions:&lt;/div&gt;&lt;ul style="text-align: justify;"&gt;&lt;li&gt;Physics engines in general try to be as general as possible, becoming extremely complex when it comes to learn how they work.&lt;/li&gt;&lt;li&gt;Physics engines are normally game-oriented, and although I haven't been able to prove it yet, their lack of precision might become an important issue when it comes to solve engineering problems.&lt;/li&gt;&lt;li&gt;There is no way around in deeply understanding the numerical methods they employ.&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;Nonetheless, this is the amount of research done so far:&lt;/div&gt;&lt;ul style="text-align: justify;"&gt;&lt;li&gt;Main available 3D physics engines are:&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Open Source &lt;/li&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size: x-small;"&gt;&lt;a href="http://en.wikipedia.org/wiki/Bullet_%28software%29" title="Bullet (software)"&gt;Bullet&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: x-small;"&gt;&lt;a href="http://en.wikipedia.org/wiki/Open_Dynamics_Engine" title="Open Dynamics Engine"&gt;Open Dynamics Engine&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: x-small;"&gt;&lt;a href="http://en.wikipedia.org/wiki/SOFA_%28Simulation_Open_Framework_Architecture%29" title="SOFA (Simulation Open Framework Architecture)"&gt;SOFA (Simulation Open Framework Architecture)&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: x-small;"&gt;&lt;a href="http://en.wikipedia.org/wiki/Tokamak_physics_engine" title="Tokamak physics engine"&gt;Tokamak physics engine&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Closed source/limited free distribution&lt;/li&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size: x-small;"&gt;&lt;a href="http://en.wikipedia.org/wiki/Havok_%28software%29" title="Havok (software)"&gt;Havok&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: x-small;"&gt;&lt;a href="http://en.wikipedia.org/wiki/Newton_Game_Dynamics" title="Newton Game Dynamics"&gt;Newton Game Dynamics&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: x-small;"&gt;&lt;a href="http://en.wikipedia.org/wiki/PhysX" title="PhysX"&gt;PhysX&lt;/a&gt; (formerly NovodeX and incorporating &lt;a class="new" href="http://en.wikipedia.org/w/index.php?title=Meqon&amp;amp;action=edit&amp;amp;redlink=1" title="Meqon (page does not exist)"&gt;Meqon&lt;/a&gt;)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: x-small;"&gt;Vortex by &lt;a class="mw-redirect" href="http://en.wikipedia.org/wiki/CMLabs_Simulations" title="CMLabs Simulations"&gt;CMLabs Simulations&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: x-small;"&gt;&lt;a class="new" href="http://en.wikipedia.org/w/index.php?title=Wild_Pockets&amp;amp;action=edit&amp;amp;redlink=1" title="Wild Pockets (page does not exist)"&gt;Wild Pockets&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;The reason why I chose Bullet was mainly that it is open source. Secondly, when compared to the others (ODE and Tokamak), I found its basis and documentation a bit more solid. Thirdly, it was the only one I could put to work altogether with Ogre3D (&lt;a href="http://www.ogre3d.org/"&gt;http://www.ogre3d.org&lt;/a&gt;), the scene graph manager of my choice, where I can make simulations visible.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;I have made a couple of videos available in youtube:&lt;/span&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;A set of bricks hit by a mass:&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://www.youtube.com/"&gt;http://www.youtube.com&lt;/a&gt;&lt;/span&gt;&lt;a href="http://www.youtube.com/"&gt;&lt;span style="font-size: small;"&gt;/watch?v=tFJu2oo18Zs&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;A peristyle hit by a ball:&lt;/span&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;(Not yet available)&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;When trying to access the Softbody module of the engine, I have found it already too complex to link with Ogre3D.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Joints make the system unstable, with frequent segmentation faults and even automatic resets of my laptop.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;With this in mind, I think the next step will be to focus on achieving the knowledge to tackle my own physics engine!&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size: x-small;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;ul style="text-align: justify;"&gt;&lt;ul&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-942380121073076219?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/942380121073076219/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/02/bullet-physics-engine.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/942380121073076219'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/942380121073076219'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/02/bullet-physics-engine.html' title='Bullet Physics Engine'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6352511023055453909.post-1005020784057034075</id><published>2010-02-14T05:41:00.000-08:00</published><updated>2010-02-14T06:03:47.382-08:00</updated><title type='text'>Thesis Proposal</title><content type='html'>&lt;style type="text/css"&gt;  &lt;!--   @page { margin: 2cm }   P { margin-bottom: 0.21cm; text-align: justify }   P.cjk { font-size: 10pt }   H1 { margin-bottom: 0.21cm }   H1.western { font-family: "Times New Roman", serif; font-size: 14pt }   H1.cjk { font-family: "DejaVu Sans"; font-size: 16pt }   H1.ctl { font-family: "DejaVu Sans"; font-size: 16pt }   H2 { margin-bottom: 0.21cm }   H2.western { font-size: 13pt }   H3 { margin-bottom: 0.21cm }   H3.western { font-size: 12pt; font-style: italic; font-weight: normal }  --&gt;  &lt;/style&gt;  &lt;br /&gt;&lt;h1 class="western"&gt;Introduction&lt;/h1&gt;&lt;h2 class="western"&gt;State-of-the-art&lt;/h2&gt;&lt;div class="western"&gt;Non-deterministic methods have been succesfully applied in science since the 50s to tackle uncertanty and to evaluate complexity.&lt;/div&gt;&lt;div class="western"&gt;Lately, these very methods, combined with modern calculus tools (Finite Elemet Method, Applied Element Method, Discrete Element Method, ...) are proving very helpful in automotive, aerospatial and naval industries to achieve sofisticated, reliable and precise designs.&lt;/div&gt;&lt;div class="western"&gt;On the other hand, new simulation tools have appeared in the last decade that were not possible before the increase in computer power and their clustering and parallelizing capabilities.&lt;/div&gt;&lt;div class="western"&gt;Videogame, film and virtual reality industries are using them and simulations flood the media with a quality that often makes it very difficult to separate fiction from truth.&lt;/div&gt;&lt;div class="western"&gt;In the building environment, perhaps given some inherent differences in the requirements of the product provided to society, we are still pretty far from those technological advances.&lt;/div&gt;&lt;div class="western"&gt;This could be seen as a disadvantegeous position but opens, in fact, a whole world of new opportunities for research.&lt;/div&gt;&lt;div class="western"&gt;The thesis proposed here aims to provide a frame where these two not so different disciplines (non-deterministic design methods and computer physics simulation) combine in order to open another path to better design tools.&lt;/div&gt;&lt;h3 class="western"&gt;The determinstic approach to structural design&lt;/h3&gt;&lt;div class="western"&gt;Modern building design and analysis is almost exclusively based on stiffnes matrix method or, in best cases, on Finite Element software.  &lt;/div&gt;&lt;div class="western"&gt;These softwares have reached today a considerable level of sophistication and versatility. However, one increasingly important aspect of analysis that these programs are unable to address is that of  uncertainty in structural parameters and in loading and boundary conditions.  &lt;/div&gt;&lt;div class="western"&gt;It is a well known fact that deterministic single- point evaluation of the response may under many circumstances produce an over-designed and excessively conservative system if the presence of parameter scatter is not taken into account.&lt;/div&gt;&lt;div class="western"&gt;International building codes, historically, have taken this procedure for granted and nowadays Limit States is the csompulsory method for evaluating any building (Eurocodes, ASCE, ACI,...).&lt;/div&gt;&lt;div class="western"&gt;These Limit States are given to the designers on a probability basis but have to be necessarily included into our deterministic analysis in the form of material strenght minoration and force majoration.&lt;/div&gt;&lt;div class="western"&gt;An stochastic approach allows us to define the reliability of our design in a different way: by calculating in an straighforward manner the probabilty of failure (or limit state achieving), and then comparing it against the standards.&lt;/div&gt;&lt;h3 class="western"&gt;Ordinary Differential Equations and physics simulation&lt;/h3&gt;&lt;div class="western"&gt;The second weakness of this deterministic approach to the design of building structures is that tackling non-linearity (buckling of columns, terrain, earthquakes, …) has become an extremely unprecise field, plenty of approximate methods.&lt;/div&gt;&lt;div class="western"&gt;Intensive particle-based Lagrangian methods, on the other hand, is a relatively recent field of research (even though it uses classical newtonian physics), where the phenomena stated above simply arises as a consequence of the simultaneous behaviour.&lt;/div&gt;&lt;h2 class="western"&gt;Thesis targets&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;Achieve a computer tool with the following  features: &lt;/li&gt;&lt;li&gt;Real-time ODE based physics. &lt;/li&gt;&lt;li&gt;Behavior-monitored structural elements and  parameters. &lt;/li&gt;&lt;li&gt;Real-time design visualization and designer  interaction. &lt;/li&gt;&lt;li&gt;Stochastic methods applied to different  structural systems and probability-based evaluation of their  reliability. &lt;/li&gt;&lt;li&gt;Building forensics of existing or failed  buildings &lt;/li&gt;&lt;li&gt;&lt;span style="font-size: 100%;"&gt;Evaluate  the adequateness of Lagrangian particle-based methods for  engineering purposes.&lt;/span&gt;&lt;div align="justify" class="western" style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="justify" class="western" style="font-weight: normal;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;a href="http://www.mnbvlabs.com/Thesis/Thesis%20proposal.pdf"&gt;http://www.mnbvlabs.com/Thesis/Thesis proposal.pdf&lt;/a&gt; &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6352511023055453909-1005020784057034075?l=stochasticandlagrangian.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stochasticandlagrangian.blogspot.com/feeds/1005020784057034075/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/02/thesis-proposal.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/1005020784057034075'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6352511023055453909/posts/default/1005020784057034075'/><link rel='alternate' type='text/html' href='http://stochasticandlagrangian.blogspot.com/2010/02/thesis-proposal.html' title='Thesis Proposal'/><author><name>Rabindranath Andujar Moreno</name><uri>http://www.blogger.com/profile/17136216048969909622</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
