{"id":10056,"date":"2021-03-22T08:30:47","date_gmt":"2021-03-22T12:30:47","guid":{"rendered":"https:\/\/blogs.mathworks.com\/simulink\/?p=10056"},"modified":"2021-03-22T08:30:47","modified_gmt":"2021-03-22T12:30:47","slug":"modeling-flexible-bodies-using-the-reduced-order-flexible-solid-block","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/simulink\/2021\/03\/22\/modeling-flexible-bodies-using-the-reduced-order-flexible-solid-block\/","title":{"rendered":"Modeling flexible bodies using the Reduced Order Flexible Solid block"},"content":{"rendered":"<p><em>Today I am happy to welcome guest blogger <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/15583232\">David Balbuena<\/a>. If you are getting started using the <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2020b\/physmod\/sm\/ref\/reducedorderflexiblesolid.html\">Reduced Order Flexible Solid<\/a> block from <a href=\"https:\/\/www.mathworks.com\/products\/simmechanics.html\">Simscape Multibody<\/a>, I strongly recommend that you go through David's MATLAB Central contribution. Whether you are importing your reduced-order model from the P<a href=\"https:\/\/www.mathworks.com\/products\/pde.html\">artial Differential Equation Toolbox<\/a> or any other third-party finite-element analysis software, this should help you avoid common mistakes and get you running quickly.<br>---Guy<\/em><\/p>\r\n\r\n\r\n\r\n\r\n<p>In this post, I am introducing a <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/88992-simscape-multibody-reduced-order-flexible-cylinder\">MATLAB Central submission<\/a> to help you validate your workflow for generating the data required by the <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2020b\/physmod\/sm\/ref\/reducedorderflexiblesolid.html\">Reduced Order Flexible Solid<\/a> block. <\/p>\r\n\r\n<p>Before diving in, let\u2019s review the evolution of flexible bodies in Simscape Multibody. <\/p>\r\n\r\n<p><strong>Evolution of Flexible Bodies in Simscape Multibody<\/strong><\/p>\r\n\r\n<p>Prior to R2018b, Simscape Multibody did not include built-in blocks to model flexible bodies. In those days, you had to use a series of rigid bodies connected by springs and dampers, as Guy demonstrated in a <a href=\"https:\/\/blogs.mathworks.com\/simulink\/2014\/05\/22\/flexible-bodies-in-simmechanics\/?s_tid=srchtitle\">previous post<\/a>. Since then, we've added lots of new capabilities for modeling flexible bodies! Here's a quick summary:<\/p>\r\n<table style=\"border:1px solid #000000;\">\r\n<tbody>\r\n<tr>\r\n<th style=\"border:1px solid #000000;width:8%;text-align:center;\">Release<\/th>\r\n<th style=\"border:1px solid #000000;width:12%;text-align:center;\">Block<\/th>\r\n<th style=\"border:1px solid #000000;width:20%;text-align:center;\">Description<\/th>\r\n<th style=\"border:1px solid #000000;width:60%;text-align:center;\">Image<\/th>\r\n<\/tr>\r\n<tr>\r\n<td style=\"border:1px solid #000000;vertical-align:middle;text-align:center;\">R2018b<\/td>\r\n<td style=\"border:1px solid #000000;vertical-align:middle;text-align:center;\"><a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2018b\/physmod\/sm\/ref\/generalflexiblebeam.html\">General Flexible Beam<\/a><\/td>\r\n<td style=\"border:1px solid #000000;padding:3px;vertical-align:middle;\">Flexible beams with a constant cross-section<\/td>\r\n<td style=\"border:1px solid #000000;text-align:center;;padding:1px\"><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2021Q1\/flexible_beam_cross_section_300px.png\" alt=\"General Flexible Beam\"  \/><\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"border:1px solid #000000;vertical-align:middle;text-align:center;\">R2019b<\/td>\r\n<td style=\"border:1px solid #000000;vertical-align:middle;text-align:center;\"><a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2019b\/physmod\/sm\/ref\/reducedorderflexiblesolid.html\">Reduced Order Flexible Solid<\/a><\/td>\r\n<td style=\"border:1px solid #000000;padding:3px;vertical-align:middle;\">You can start with the CAD geometry of your component, generate a finite-element mesh, apply the Craig-Bampton FEA substructuring method, and generate a reduced-order model<\/td>\r\n<td style=\"border:1px solid #000000;text-align:center;;padding:1px\"><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2021Q1\/romMesh.png\" alt=\"Cylinder Mesh\"  \/><\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"border:1px solid #000000;vertical-align:middle;text-align:center;\">R2020a<\/td>\r\n<td style=\"border:1px solid #000000;vertical-align:middle;text-align:center;\"><a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2020a\/physmod\/sm\/ug\/flexible-beam-overview.html\">Flexible Beams with standard cross sections<\/a><\/td>\r\n<td style=\"border:1px solid #000000;padding:3px;vertical-align:middle;\">Standard flexible beams added to the library<\/td>\r\n<td style=\"border:1px solid #000000;text-align:center;;padding:1px\"><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2021Q1\/beamLibBrowser2.png\" alt=\"Flexible Beam Library\"  \/><\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<p><\/p>\r\n<p>Now you can easily build and simulate cool stuff like this flexible four bar mechanism:<\/p>\r\n\r\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2021Q1\/FlexBeam3.gif\" alt=\"Flexible Four-bar mechanism\" \/><\/p>\r\n\r\n<p><strong>Reduced Order Flexible Body<\/strong><\/p>\r\n\r\n<p>\r\nThe <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2020b\/physmod\/sm\/ref\/reducedorderflexiblesolid.html\">Reduced Order Flexible Solid<\/a> block is different from the other flexible beams because it can use data generated from FEA software. It requires a reduced-order model (ROM), which you can get by taking the CAD geometry of your component, generating a finite-element mesh, applying the <a href=\"https:\/\/hal.archives-ouvertes.fr\/hal-01537654\/file\/RCMB.pdf\">Craig-Bampton FEA substructuring method<\/a>, and then generating a reduced-order model.<\/p>\r\n\r\n<p>The nature of this block comes with a challenge: since it uses data from a third-party software, it is impossible for us (MathWorks) to check that the data you provide actually represents what you intend.<\/p>\r\n\r\n<p>Once you have the ROM, you can enter the data generated in the Simscape Multibody block along with the CAD part:<\/p>\r\n\r\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2021Q1\/romdatasmall.png\" alt=\"ROM Block Parameters\"  \/><\/p>\r\n\r\n<p>The ROM data primarily consists of 3 matrices\r\n<ul>\r\n \t<li>A matrix of Interface Frame Origins<\/li>\r\n \t<li>Stiffness Matrix<\/li>\r\n \t<li>Mass Matrix<\/li>\r\n<\/ul><\/p>\r\n\r\n<p>The documentation lists out <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2020b\/physmod\/sm\/ref\/reducedorderflexiblesolid.html#mw_d65e4979-2dd1-42cd-a57e-428f4e3463bd\">requirements for the ROM<\/a>. It is important to keep those in mind if you need to manipulate the ROM data. One thing to be aware of is this line in the documentation:<\/p>\r\n\r\n<p><blockquote>\t \t \r\nThe degrees of freedom for node i must be retained in the order\t \t \r\nU<sub>i<\/sub> = [T<sub>xi<\/sub>, T<sub>yi<\/sub>, T<sub>zi<\/sub>, R<sub>xi<\/sub>, R<sub>yi<\/sub>, R<sub>zi<\/sub>]\t \t \r\n<\/blockquote><\/p>\r\n\r\n<p>It's also important to note that the <strong>boundary nodes in the reduced-order model must be in the same order as the corresponding interface frames on the block<\/strong>. If your third-party software generates the interface frames in a different order, you will need to reorder the stiffness and mass matrices to account for that difference.<\/p>\r\n\r\n<p>So, let's say you generated your ROM data, and you need to change the ordering of your frames. Assuming you have only 2 frames, and no dynamic modes, then your $U$ vector becomes:<\/p>\r\n\r\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2021Q1\/DOFVector_w200.png\" alt=\"DOF Vector\" \/><\/p>\r\n\r\n<p>And your <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2020b\/physmod\/sm\/ref\/reducedorderflexiblesolid.html#mw_b6b5852c-3779-4a32-be58-e141fe5ad534\">origins matrix<\/a> will match that ordering:<\/p>\r\n\r\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2021Q1\/originsInit.png\" alt=\"origins matrix\" \/><\/p>\r\n\r\n<p>With that ordering comes a natural structure on your stiffness and mass matrices. In this case you can think about the stiffness matrix (K) as a 2x2 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Block_matrix\">partitioned matrix<\/a>:<\/p>\r\n\r\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2021Q1\/partitionedMatrix_w500.png\"  alt=\"Partitioned stiffness matrix\" \/><\/p>\r\n\r\n<p>The mass matrix will have the same structure.<\/p>\r\n\r\n<p>With the pictures above in mind, now we can swap the two frames. That is equivalent to swapping the first 6 rows with the last 6 rows of $U$. For the origins matrix you can simply swap the rows:<\/p>\r\n\r\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2021Q1\/originsSwapped_w200.png\" alt=\"Modified Origins\" \/><\/p>\r\n\r\n<p>To correctly modify the stiffness and mass matrices, you need to permute the rows AND columns. Below is a visualization for the change you have to make to the stiffness matrix. The first partition is highlighted for clarity.<\/p>\r\n\r\n<p style=\"text-align: center;\"><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2021Q1\/permutation_visualization_w500.gif\" alt=\"Visualize the permutation\"  \/><\/p>\r\n\r\n<p>You would need to do the same thing for the mass matrix. This ensures that changing the ordering of your frames maintains the correct degrees of freedom for each frame.<\/p>\r\n\r\n<p><strong>Troubleshooting<\/strong><\/p>\r\n\r\nWhen importing the ROM, the Reduced Order Flexible Body block does some validation of the matrices you provide. If it detects something suspicious, the following warning will be thrown: \r\n\r\n<p><\/p>\r\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2021Q1\/commonROMError.png\" alt=\"Wrong data error\"\/><\/p>\r\n\r\n<p><span style=\"color: #ff0000;\">The provided reduced-order model data (mass matrix, stiffness matrix, interface frame origins) do not appear to correctly characterize the rigid-body properties of the flexible body. Check that the provided data is correct and consistent. Resolve this issue in order to remove the warning.<\/span><\/p>\r\n<p>If you are getting the warning above, keep reading, because the following steps will help you validate your ROM generation process. To do that, I like to use a simple shape because <strong>with a simple shape it is easy to see how the settings you choose in your FEA software translate into Simscape Multibody<\/strong>.<\/p>\r\n\r\n<p><strong>File Exchange Setup<\/strong><\/p>\r\n<p>I decided to use a simple system with a known solution: a cantilever beam with a circular cross section. You can go to your FEA software of choice and generate a ROM for a cylinder with these properties:<\/p>\r\n<ul>\r\n \t<li>Radius: r = 0.05 m<\/li>\r\n \t<li>Length: L = 1 m<\/li>\r\n \t<li>Density:\u00a0\u03c1 = 2700 kg\/m^3<\/li>\r\n \t<li>Young's Modulus: E = 70 GPa<\/li>\r\n \t<li>Poisson ratio: 0.33<\/li>\r\n \t<li>2 interface frames, one at each end<\/li>\r\n<\/ul>\r\n\r\n<p>Here is a picture of such a cylinder meshed using the <a href=\"https:\/\/www.mathworks.com\/products\/pde.html\">Partial Differential Equation Toolbox<\/a>. You should see something similar if you implement this cylinder in a different FEA software.<\/p>\r\n\r\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2021Q1\/fullCylinderMesh.png\" alt=\"Cylinder mesh\" \/><\/p>\r\n\r\n<p>For a beam with those properties, you can calculate by hand how it should respond to different loading conditions. The following sections walk through some basic tests I typically run:<\/p>\r\n\r\n<p><strong>Tension<\/strong><\/p>\r\nIf you apply a force $F$ along the axis of the beam, you should get a steady state deformation of\r\n\r\n<p>$$\\Delta L = \\frac{F \\cdot L}{A \\cdot E}$$<\/p>\r\n\r\n<p>where $A$ is the cross-sectional area of the beam, $E$ is the Young's Modulus, $L$ is the length of the beam.<\/p>\r\n\r\n<p><strong>Torsion<\/strong><\/p>\r\n<p>If you load the beam in torsion with some torque $T$, you should get a steady state twist angle of<\/p>\r\n\r\n<p>$$\\theta = \\frac{T \\cdot L}{G \\cdot I_P}$$<\/p>\r\n\r\n<p>where $G$ is the shear modulus, $I_p$ is the polar moment of inertia.<\/p>\r\n\r\n\r\n<p><strong>Bending<\/strong><\/p>\r\n<p>If you apply a pulse to the end of the beam in a direction perpendicular to the axis of the beam, you should get a response that oscillates at the first natural frequency of the beam<\/p>\r\n\r\n<p> $$\\omega_1 = 1.87510^2 \\sqrt{\\frac{E \\cdot I }{\\rho \\cdot A}} = 447.6 \\frac{rad}{s}$$ <\/p>\r\n\r\n<p>where $I$ is the moment of inertia, $\\rho$ is density, $A$ is cross sectional area, $E$ is Young's Modulus.<\/p>\r\n\r\n<p><strong>Validating ROM Results<\/strong><\/p>\r\n<p>Now we know how the beam should respond. In my MATLAB Central submission, there is a model that replicates the loading conditions above and compares the simulated response to the analytical solution we calculated:<\/p>\r\n\r\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2021Q1\/compareFlexibleCylinders.png\" alt=\"Model used to test loading conditions\" \/><\/p>\r\n\r\n<p>All you have to do is enter your ROM data in the model. The default data provided was generated using the <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2020b\/pde\/ug\/pde.structuralmodel.reduce.html?s_tid=doc_ta\">reduce <\/a> function in the <a href=\"https:\/\/www.mathworks.com\/products\/pde.html\">Partial Differential Equation Toolbox<\/a>. If you are interested in how I did that, the submission contains the code I wrote to do it.  The Simulink model provided compares the ROM response to a Flexible Cylindrical Beam. The links on the model canvas will open up plots so you can explore the results:<\/p>\r\n\r\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2021Q1\/MATLAB_results2_w500.png\" alt=\"MATLAB Results Plot\" \/><\/p>\r\n\r\n<p>See the <a href=\"https:\/\/github.com\/mathworks\/Simscape-Multibody-Reduced-Order-Flexible-Cylinder\/blob\/master\/README.md\"> README<\/a> file for more details on how the model is setup.<\/p>\r\n\r\n<p><strong>Now it's your turn<\/strong><\/p>\r\n\r\n<p>Here are a few more resources to get you started:\r\n<ul>\r\n \t<li><a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2020b\/physmod\/sm\/ug\/flexible-dipper-arm-example.html\">Flexible Dipper Example<\/a><\/li>\r\n \t<li><a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2020b\/physmod\/sm\/ug\/model-excavator-dipper-arm.html\">Use PDE Toolbox to generate a ROM for the dipper arm<\/a><\/li>\r\n \t<li><a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/88992-simscape-multibody-reduced-order-flexible-cylinder\">MATLAB Central submission<\/a><\/li>\r\n \t<li><a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2020b\/physmod\/sm\/ref\/reducedorderflexiblesolid.html#mw_d65e4979-2dd1-42cd-a57e-428f4e3463bd\">Reduced Order Model Requirements<\/a><\/li>\r\n<\/ul><\/p>\r\n\r\n<p>Try out the Reduced Order Flexible Solid block and let us know what you think in the comments below.<\/p>","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img src=\"https:\/\/blogs.mathworks.com\/simulink\/files\/compareFlexibleCylinders.png\" class=\"img-responsive attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"\" decoding=\"async\" loading=\"lazy\" \/><\/div><p>Today I am happy to welcome guest blogger David Balbuena. If you are getting started using the Reduced Order Flexible Solid block from Simscape Multibody, I strongly recommend that you go through... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/simulink\/2021\/03\/22\/modeling-flexible-bodies-using-the-reduced-order-flexible-solid-block\/\">read more >><\/a><\/p>","protected":false},"author":167,"featured_media":10330,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[65,39,16],"tags":[612,384,480],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/10056"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/users\/167"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/comments?post=10056"}],"version-history":[{"count":122,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/10056\/revisions"}],"predecessor-version":[{"id":10336,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/10056\/revisions\/10336"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/media\/10330"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/media?parent=10056"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/categories?post=10056"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/tags?post=10056"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}