threed-beam-fea/docs/html/index.html

379 lines
37 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>3D Beam Finite Element Code: Main Page</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script><script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="logo_64x64.png"/></td>
<td style="padding-left: 0.5em;">
<div id="projectname">3D Beam Finite Element Code
&#160;<span id="projectnumber">1.0</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li class="current"><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">3D Beam Finite Element Code Documentation</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><h2>Getting started</h2>
<p>This project requires CMake to compile the code. If not installed, please install CMake before continuing. If you intend on building the GUI, Qt must be installed and the path to the Qt5WidgetsConfig.cmake file must be set when invoking CMake. Currently, the following method of building the GUI works on Mac and Linux. If running on Windows, open the fea_gui.pro file with QtCreator (included with the Qt installation) and run. Alternatively, I can package pre-built binaries if there is interest. </p><h4>To compile the code:</h4>
<ol type="1">
<li>Open the <code>threed-beam-fea</code> directory</li>
<li>Create a folder named <code>build</code></li>
<li>Open a terminal and navigate to the newly formed <code>build</code> directory</li>
<li>Execute <code>cmake ..</code><ul>
<li>Use <code>-DCMAKE_BUILD_TYPE=debug</code> if you would like to build the code for debugging purposes. By default the make files will be configured for the release build.</li>
<li>If you wish to build the GUI execute <code>cmake .. -DFEA_BUILD_GUI=ON -DCMAKE_PREFIX_PATH="/path/to/Qt"</code><ul>
<li>This requires you have Qt &gt;= 5.0 installed.</li>
<li><code>-DFEA_BUILD_GUI=ON</code> tells cmake to add the <code>../gui</code> subdirectory and adds <code>fea_gui</code> to the targets.</li>
<li><code>-DCMAKE_PREFIX_PATH="/path/to/Qt"</code> should be the path to the Qt root directory. As an example, on my computer the flag is set to "/home/ryan/Qt/5.5/gcc_64/", though this will be different on your machine.</li>
</ul>
</li>
</ul>
</li>
<li>On Linux run <code>make</code> in the terminal from the build directory to build all the targets. On Windows the solution file will be located in the build directory. Open the solution file in Visual Studio and compile.</li>
</ol>
<h2>Introduction</h2>
<p>This contains a C++ implementation of 3D Euler-Bernoulli beam element formulation. An analysis can be formulated in C++, through a command line interface via a configuration file (in JSON format), or using the graphical user interface.</p>
<h3>Method 1: Using C++</h3>
<p>An analysis consists of the <code><a class="el" href="structfea_1_1_job.html" title="Contains a node list, element list, and the properties of each element. ">fea::Job</a></code> as well as any boundary conditions (<code><a class="el" href="structfea_1_1_b_c.html" title="A boundary condition to enforce. ">fea::BC</a></code>), prescribed nodal forces (<code><a class="el" href="structfea_1_1_force.html" title="A nodal force to enforce. ">fea::Force</a></code>), ties (<code><a class="el" href="structfea_1_1_tie.html" title="Places linear springs between all degrees of freedom of 2 nodes. ">fea::Tie</a></code>) and equation constraints (<code><a class="el" href="structfea_1_1_equation.html" title="A linear multipoint constraint. ">fea::Equation</a></code>). Ties to nodes together via a linear springs between all translational and rotational degrees of freedom, and equation constraints allow linear multi-point constraints to be applied to the model. The <code><a class="el" href="structfea_1_1_options.html" title="Provides a method for customizing the finite element analysis. ">fea::Options</a></code> struct can be used to request results of the analysis be written to disk as well as modify various aspect of the analysis.</p>
<h4>Forming the job</h4>
<p>The job defines the nodal coordinates in <code>(x, y, z)</code> space, the nodes that are connected to form beam elements, and the elemental properties. The nodal coordinates are formed as a vector of <code><a class="el" href="namespacefea.html#acea7372904bb1c5f0570e9a53cf6fba9" title="A node that describes a mesh. Uses Eigen&#39;s predefined Vector class for added functionality. ">fea::Node</a></code>'s where each node simply contains the <code>(x, y, z)</code> coordinates of the point. An element contains the 2 nodal indices that are connected to form the element as well as the associated properties of the element. The properties must define the extensional stiffness, <code>EA</code>, bending stiffness parallel to the local z-axis <code>EIz</code>, bending stiffness parallel to the local y-axis <code>EIy</code>, the torsional stiffness, <code>GJ</code>, and a vector pointing along the beam elements local y-axis. An example forming a simple job with a single element is shown below.</p>
<div class="fragment"><div class="line"><span class="comment">// [form the node list</span></div>
<div class="line"><a class="code" href="namespacefea.html#acea7372904bb1c5f0570e9a53cf6fba9">fea::Node</a> node1, node2;</div>
<div class="line"></div>
<div class="line"><span class="comment">// place the first node at (0, 0, 0)</span></div>
<div class="line">node1 &lt;&lt; 0, 0, 0;</div>
<div class="line"></div>
<div class="line"><span class="comment">// place the second node at (1, 0, 0)</span></div>
<div class="line">node2 &lt;&lt; 1, 0, 0;</div>
<div class="line"></div>
<div class="line">std::vector&lt;fea::Node&gt; node_list = {node1, node2};</div>
<div class="line"><span class="comment">// ]</span></div>
<div class="line"></div>
<div class="line"><span class="comment">// [ form the element list</span></div>
<div class="line"><span class="comment">// define the indices of the node list that form the element</span></div>
<div class="line"><span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nn1 = 0;</div>
<div class="line"><span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nn2 = 1;</div>
<div class="line"></div>
<div class="line"><span class="comment">// define the properties of the element</span></div>
<div class="line"><span class="keywordtype">double</span> EA = 1000.0;</div>
<div class="line"><span class="keywordtype">double</span> EIz = 100.0;</div>
<div class="line"><span class="keywordtype">double</span> EIy = 100.0;</div>
<div class="line"><span class="keywordtype">double</span> GJ = 200.0;</div>
<div class="line">std::vector&lt;double&gt; normal_vec = {0.0, 0.0, 1.0};</div>
<div class="line"><a class="code" href="structfea_1_1_props.html">fea::Props</a> props(EA, EIz, EIy, GJ, normal_vec);</div>
<div class="line"></div>
<div class="line"><a class="code" href="structfea_1_1_elem.html">fea::Elem</a> elem(nn1, nn2, props);</div>
<div class="line"></div>
<div class="line">std::vector&lt;fea::Elem&gt; elem_list = {elem};</div>
<div class="line"><span class="comment">// ]</span></div>
<div class="line"></div>
<div class="line"><span class="comment">// a job is the combination of the node list and associated elements</span></div>
<div class="line"><a class="code" href="structfea_1_1_job.html">fea::Job</a> job(node_list, elem_list);</div>
</div><!-- fragment --><h4>Boundary conditions</h4>
<p>Boundary conditions are applied by specifying the index of the node, the degree of freedom, and the prescribed value. The index of the node is simply the index the node occurs in the node list. The degree of freedom can be defined using the <code><a class="el" href="namespacefea.html#aeaca75d33e81b79c9282f3e69a238d72" title="Convenience enumerator for specifying the active degree of freedom in a constraint. ">fea::DOF</a></code> enum or by specifying the integer associated with the degree of freedom explicitly. There are 6 degrees of freedom per node meaning valid integers associated with degrees of freedom are between 0 and 5. The associations for degrees of freedom are defined as</p>
<ul>
<li>0 = displacement along the global x-axis.</li>
<li>1 = displacement along the global y-axis.</li>
<li>2 = displacement along the global z-axis.</li>
<li>3 = rotation about the global x-axis.</li>
<li>4 = rotation about the global y-axis.</li>
<li>5 = rotation about the global z-axis.</li>
</ul>
<p>Continuing the example from above, we can fix all degrees of freedom of the node at the origin using the following code:</p>
<div class="fragment"><div class="line"><span class="comment">// fix all translational degrees of freedom using the fea::DOF enum</span></div>
<div class="line"><span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nn1 = 0;</div>
<div class="line"><span class="keywordtype">double</span> value = 0.0;</div>
<div class="line"><a class="code" href="structfea_1_1_b_c.html">fea::BC</a> bc1(nn1, <a class="code" href="namespacefea.html#aeaca75d33e81b79c9282f3e69a238d72a0bfcf6fc693c952c376a1d9eb9cf03fb">fea::DOF::DISPLACEMENT_X</a>, value);</div>
<div class="line"><a class="code" href="structfea_1_1_b_c.html">fea::BC</a> bc2(nn1, <a class="code" href="namespacefea.html#aeaca75d33e81b79c9282f3e69a238d72ad39e7a11a71cac64252cb1fb1d94c7f9">fea::DOF::DISPLACEMENT_Y</a>, value);</div>
<div class="line"><a class="code" href="structfea_1_1_b_c.html">fea::BC</a> bc3(nn1, <a class="code" href="namespacefea.html#aeaca75d33e81b79c9282f3e69a238d72a83e84bbf75a8e85c73e0fd2bb935bcf1">fea::DOF::DISPLACEMENT_Z</a>, value);</div>
<div class="line"></div>
<div class="line"><span class="comment">// fix all rotational degrees of freedom by explicitly using integer values</span></div>
<div class="line"><a class="code" href="structfea_1_1_b_c.html">fea::BC</a> bc4(nn1, 3, value); <span class="comment">// x-axis rotation</span></div>
<div class="line"><a class="code" href="structfea_1_1_b_c.html">fea::BC</a> bc5(nn1, 4, value); <span class="comment">// y-axis rotation</span></div>
<div class="line"><a class="code" href="structfea_1_1_b_c.html">fea::BC</a> bc6(nn1, 5, value); <span class="comment">// z-axis rotation</span></div>
<div class="line"></div>
<div class="line"><span class="comment">// form the list of boundary conditions</span></div>
<div class="line"><span class="comment">// this vector will later be submitted to the</span></div>
<div class="line"><span class="comment">// fea::solve function to run an analysis</span></div>
<div class="line">std::vector&lt;fea::BC&gt; bc_list = {bc1, bc2, bc3, bc4, bc5, bc6};</div>
</div><!-- fragment --><h4>Nodal forces</h4>
<p>Nodal forces are assigned in the same manner as boundary conditions, i.e. using the node number, degree of freedom, and value. We can load our cantilever at the tip with the following:</p>
<div class="fragment"><div class="line"><span class="comment">// define the node index and value</span></div>
<div class="line"><span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nn2 = 1;</div>
<div class="line"><span class="keywordtype">double</span> value = 1.0;</div>
<div class="line"></div>
<div class="line"><span class="comment">// create the force</span></div>
<div class="line"><a class="code" href="structfea_1_1_force.html">fea::Force</a> force(nn2, <a class="code" href="namespacefea.html#aeaca75d33e81b79c9282f3e69a238d72ad39e7a11a71cac64252cb1fb1d94c7f9">fea::DOF::DISPLACEMENT_Y</a>, value);</div>
<div class="line"></div>
<div class="line"><span class="comment">// add to the list of forces for the analysis</span></div>
<div class="line">std::vector&lt;fea::Force&gt; force_list</div>
</div><!-- fragment --><h4>Options</h4>
<p>By default submitting an analysis to the <code><a class="el" href="namespacefea.html#a995a678cf119fb20772312ccfdbec991" title="Solves the finite element analysis defined by the input Job, boundary conditions, and prescribed noda...">fea::solve</a></code> function will not save the results. The outputs must be requested using the <code><a class="el" href="structfea_1_1_options.html" title="Provides a method for customizing the finite element analysis. ">fea::Options</a></code> struct. Using the appropriate member variables nodal displacements, nodal forces, and the forces associated with ties can be saved to a CSV file. The name of the file the output is saved to is also set in the options as well as the delimiter used when writing the data to disk. Additionally, the <code><a class="el" href="structfea_1_1_options.html" title="Provides a method for customizing the finite element analysis. ">fea::Options</a></code> struct has the ability to set the epsilon value on nodal forces and displacements. After the analysis if the magnitude of the displacement is below the epsilon value, it will be set to 0.0. The default is <code>1.0e-14</code>. A summary of the analysis can be saved to a text file using the <code>save_report</code> and <code>report_filename</code> member variables of <code><a class="el" href="structfea_1_1_options.html" title="Provides a method for customizing the finite element analysis. ">fea::Options</a></code>. If the <code>verbose</code> member is set to <code>true</code> informational messages regarding the current step and time taken on previous steps of the analysis will be written to <code>std::cout</code>. An example of customizing the analysis with the options struct is shown below:</p>
<div class="fragment"><div class="line"><span class="comment">// create the default options</span></div>
<div class="line"><a class="code" href="structfea_1_1_options.html">fea::Options</a> opts;</div>
<div class="line"></div>
<div class="line"><span class="comment">// request nodal forces and displacements</span></div>
<div class="line">opts.<a class="code" href="structfea_1_1_options.html#a7ef9cc3bf01c181a3cf34fc4451cd4e9">save_nodal_forces</a> = <span class="keyword">true</span>;</div>
<div class="line">opts.<a class="code" href="structfea_1_1_options.html#a1d053be484e4c5a79d0eab2447883823">save_nodal_displacements</a> = <span class="keyword">true</span>;</div>
<div class="line"></div>
<div class="line"><span class="comment">// set custom name for nodal forces output</span></div>
<div class="line">opts.<a class="code" href="structfea_1_1_options.html#ad6b7ccda4984e4160c6cdbcefa496a26">nodal_forces_filename</a> = <span class="stringliteral">&quot;cantilever_beam_forces.csv&quot;</span></div>
<div class="line"></div>
<div class="line"><span class="comment">// increase tolerance on epsilon</span></div>
<div class="line">opts.<a class="code" href="structfea_1_1_options.html#ad52313d1d4af202ae7bf382c2a6bf50e">epsilon</a> = 1.0e-12;</div>
<div class="line"></div>
<div class="line"><span class="comment">// have the program output status updates</span></div>
<div class="line">opts.<a class="code" href="structfea_1_1_options.html#a7fc006a76a6edea968fb6e5b63e0b56d">verbose</a> = <span class="keyword">true</span>;</div>
</div><!-- fragment --><h4>Solving</h4>
<p>Once the analysis has been setup, it can be solved using the <code><a class="el" href="namespacefea.html#a995a678cf119fb20772312ccfdbec991" title="Solves the finite element analysis defined by the input Job, boundary conditions, and prescribed noda...">fea::solve</a></code> function. This functions takes as input the job, boundary conditions, prescribed nodal forces, ties (discussed below), and options. <code><a class="el" href="namespacefea.html#a995a678cf119fb20772312ccfdbec991" title="Solves the finite element analysis defined by the input Job, boundary conditions, and prescribed noda...">fea::solve</a></code> will solve the analysis, save the requested files, and return a summary of the analysis. The <code><a class="el" href="structfea_1_1_summary.html" title="Contains the results of an analysis after calling fea::solve. ">fea::Summary</a></code> object can return a report of the analysis in the form of a string using the <code>fea::Summary::fullReport()</code> function, and member variables <code><a class="el" href="structfea_1_1_summary.html#a9858284f86514f1d7922bc7c458da385">fea::Summary::nodal_forces</a></code>, <code><a class="el" href="structfea_1_1_summary.html#ad05822565a41e374c77f84c6c3b358b2">fea::Summary::nodal_displacements</a></code>, and <code><a class="el" href="structfea_1_1_summary.html#af1822f670a2d6bfbf76f042a0cb544ff">fea::Summary::tie_forces</a></code> contain the results of the analysis.</p>
<div class="fragment"><div class="line"><span class="comment">// form an empty vector of ties since none were prescribed</span></div>
<div class="line">std::vector&lt;fea::Tie&gt; tie_list;</div>
<div class="line"></div>
<div class="line"><span class="comment">// also create an empty list of equations as none were prescribed</span></div>
<div class="line">std::vector&lt;fea::Equation&gt; eqn_list;</div>
<div class="line"></div>
<div class="line"><a class="code" href="structfea_1_1_summary.html">fea::Summary</a> summary = <a class="code" href="namespacefea.html#a995a678cf119fb20772312ccfdbec991">fea::solve</a>(job, node_list, elem_list, bc_list, force_list, tie_list, eqn_list, opts);</div>
<div class="line"></div>
<div class="line"><span class="comment">// print a report of the analysis</span></div>
<div class="line">std::cout &lt;&lt; summary.fullReport() &lt;&lt; std::endl;</div>
</div><!-- fragment --><p>Upon successful compilation the full report printed to the command line should resemble:</p>
<div class="fragment"><div class="line">Finite Element Analysis Summary</div>
<div class="line"></div>
<div class="line">Model parameters</div>
<div class="line"> Nodes : 2</div>
<div class="line"> Elements : 1</div>
<div class="line"> BCs : 6</div>
<div class="line"> Ties : 0</div>
<div class="line"> Forces : 0</div>
<div class="line"> Equations : 0</div>
<div class="line"></div>
<div class="line">Total time 0ms</div>
<div class="line"> Assembly time : 0ms</div>
<div class="line"> Preprocessesing time : 0ms</div>
<div class="line"> Factorization time : 0ms</div>
<div class="line"> Linear <a class="code" href="namespacefea.html#a995a678cf119fb20772312ccfdbec991">solve</a> time : 0ms</div>
<div class="line"> Forces <a class="code" href="namespacefea.html#a995a678cf119fb20772312ccfdbec991">solve</a> time : 0ms</div>
<div class="line"> File save time : 0ms</div>
<div class="line"></div>
<div class="line">Nodal displacements</div>
<div class="line"> Minimum : <a class="code" href="namespacefea.html#acea7372904bb1c5f0570e9a53cf6fba9">Node</a> 0 <a class="code" href="namespacefea.html#aeaca75d33e81b79c9282f3e69a238d72">DOF</a> 0 Value 0.000</div>
<div class="line"> Maximum : <a class="code" href="namespacefea.html#acea7372904bb1c5f0570e9a53cf6fba9">Node</a> 1 <a class="code" href="namespacefea.html#aeaca75d33e81b79c9282f3e69a238d72">DOF</a> 5 Value 0.005</div>
<div class="line"></div>
<div class="line">Nodal Forces</div>
<div class="line"> Minimum : <a class="code" href="namespacefea.html#acea7372904bb1c5f0570e9a53cf6fba9">Node</a> 0 <a class="code" href="namespacefea.html#aeaca75d33e81b79c9282f3e69a238d72">DOF</a> 1 Value -1.000</div>
<div class="line"> Maximum : <a class="code" href="namespacefea.html#acea7372904bb1c5f0570e9a53cf6fba9">Node</a> 1 <a class="code" href="namespacefea.html#aeaca75d33e81b79c9282f3e69a238d72">DOF</a> 1 Value 1.000</div>
</div><!-- fragment --><h4>Ties</h4>
<p>Ties are enforced by placing linear springs between all degrees of freedom for 2 nodes. To form a tie specify the 2 nodes that will be linked as well as the spring constants for translational and rotational degrees of freedom. All translational degrees of freedom will be assigned the same spring constant. The same is true for rotational degrees of freedom, although the spring constant does not have to be the same as that used for the translational DOFs. Commonly, ties are used to model non-rigid joints. To form a joint between 2 elements, introduce a redundant node at that location and use a tie to link the to nodes together. This essentially places a spring element between the two points of the specified stiffness.</p>
<div class="fragment"><div class="line"><span class="comment">// form the job with a redundant node at (1, 0, 0)</span></div>
<div class="line"></div>
<div class="line"><a class="code" href="namespacefea.html#acea7372904bb1c5f0570e9a53cf6fba9">fea::Node</a> node1, node2, node3, node4;</div>
<div class="line">node1 &lt;&lt; 0, 0, 0;</div>
<div class="line">node2 &lt;&lt; 1, 0, 0;</div>
<div class="line">node3 &lt;&lt; 1, 0, 0;</div>
<div class="line">node4 &lt;&lt; 2, 0, 0;</div>
<div class="line">std::vector&lt;fea::Node&gt; node_list = {node1, node2, node3, node4};</div>
<div class="line"></div>
<div class="line"><span class="comment">// define the properties of the elements</span></div>
<div class="line"><span class="keywordtype">double</span> EA = 1000.0;</div>
<div class="line"><span class="keywordtype">double</span> EIz = 100.0;</div>
<div class="line"><span class="keywordtype">double</span> EIy = 100.0;</div>
<div class="line"><span class="keywordtype">double</span> GJ = 200.0;</div>
<div class="line">std::vector&lt;double&gt; normal_vec = {0.0, 0.0, 1.0};</div>
<div class="line"><a class="code" href="structfea_1_1_props.html">fea::Props</a> props(EA, EIz, EIy, GJ, normal_vec);</div>
<div class="line"></div>
<div class="line"><span class="comment">// constuct element list</span></div>
<div class="line"><a class="code" href="structfea_1_1_elem.html">fea::Elem</a> elem1(0, 1, props);</div>
<div class="line"><a class="code" href="structfea_1_1_elem.html">fea::Elem</a> elem2(2, 3, props);</div>
<div class="line">std::vector&lt;fea::Elem&gt; elem_list = {elem};</div>
<div class="line"></div>
<div class="line"><span class="comment">// create the job</span></div>
<div class="line"><a class="code" href="structfea_1_1_job.html">fea::Job</a> job(node_list, elem_list);</div>
<div class="line"></div>
<div class="line"><span class="comment">// create the tie between node2 and node3</span></div>
<div class="line"><span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nn1 = 1; <span class="comment">// i.e. the second node in the node list</span></div>
<div class="line"><span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nn2 = 2; <span class="comment">// i.e. the third node in the node list</span></div>
<div class="line"></div>
<div class="line"><span class="comment">// define the spring constant for x, y, and z translational DOFs</span></div>
<div class="line"><span class="keywordtype">double</span> lmult = 100.0;</div>
<div class="line"></div>
<div class="line"><span class="comment">// define the spring constant for x, y, and z rotational DOFs</span></div>
<div class="line"><span class="keywordtype">double</span> rmult = 100.0;</div>
<div class="line"></div>
<div class="line"><span class="comment">// form the tie</span></div>
<div class="line"><a class="code" href="structfea_1_1_tie.html">fea::Tie</a> tie1(nn1, nn2, lmult, rmult);</div>
<div class="line"></div>
<div class="line"><span class="comment">// add to list of ties</span></div>
<div class="line">std::vector&lt;fea::Tie&gt; tie_list = {tie1};</div>
</div><!-- fragment --><h4>Equations</h4>
<p>Equations are linear multi-point constraints that are applied to nodal degrees of freedom. Each equation is composed of a list of terms that sum to zero, e.g. <code>t1 + t2 + t3 ... = 0</code>, where <code>tn</code> is the <code>n</code>th term. Each term specifies the node number, degree of freedom and coefficient. The node number and degree of freedom specify which nodal variable (either nodal displacement or rotation) is involved with the equation constraint, and coefficient is multiplied by the specified nodal variable when forming the equation. Note, the equation sums to zero, so in order to specify that 2 nodal degrees of freedom are equal their coefficients should be equal and opposite.</p>
<div class="fragment"><div class="line"><span class="comment">// Create an empty equation</span></div>
<div class="line"><a class="code" href="structfea_1_1_equation.html">fea::Equation</a> eqn;</div>
<div class="line"></div>
<div class="line"><span class="comment">// Stipulate that the x and y displacement for the first node must be equal</span></div>
<div class="line"><span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> node_number = 0;</div>
<div class="line">eqn.<a class="code" href="structfea_1_1_equation.html#a270e2fc1882bbc16abb25e280d51141f">terms</a>.push_back(<a class="code" href="structfea_1_1_equation_1_1_term.html">fea::Equation::Term</a>(node_number, <a class="code" href="namespacefea.html#aeaca75d33e81b79c9282f3e69a238d72a0bfcf6fc693c952c376a1d9eb9cf03fb">fea::DOF::DISPLACEMENT_X</a>, 1.0));</div>
<div class="line">eqn.<a class="code" href="structfea_1_1_equation.html#a270e2fc1882bbc16abb25e280d51141f">terms</a>.push_back(<a class="code" href="structfea_1_1_equation_1_1_term.html">fea::Equation::Term</a>(node_number, <a class="code" href="namespacefea.html#aeaca75d33e81b79c9282f3e69a238d72ad39e7a11a71cac64252cb1fb1d94c7f9">fea::DOF::DISPLACEMENT_Y</a>, -1.0);</div>
</div><!-- fragment --><h3>Method 2: Using the command line interface</h3>
<p>After using CMake to build the targets, an executable will be created that provide a command line interface (CLI) to the beam element code. Once in the build directory, navigate to the <code>bin</code> folder containing fea_cmd. running <code>./fea_cmd -h</code> from the terminal will show the help documentation for the program. The CLI expects the <code>-c</code> flag to be set and point to the config file for the current analysis. A config file is a JSON document that contains key, value pairs pointing to the nodes, elements, properties, and other analysis options. An example is shown below.</p>
<div class="fragment"><div class="line">{</div>
<div class="line"> <span class="stringliteral">&quot;nodes&quot;</span> : <span class="stringliteral">&quot;path/to/nodes.csv&quot;</span>,</div>
<div class="line"> <span class="stringliteral">&quot;elems&quot;</span> : <span class="stringliteral">&quot;path/to/elems.csv&quot;</span>,</div>
<div class="line"> <span class="stringliteral">&quot;props&quot;</span> : <span class="stringliteral">&quot;path/to/props.csv&quot;</span>,</div>
<div class="line"> <span class="stringliteral">&quot;bcs&quot;</span> : <span class="stringliteral">&quot;path/to/bcs.csv&quot;</span>,</div>
<div class="line"> <span class="stringliteral">&quot;forces&quot;</span> : <span class="stringliteral">&quot;path/to/forces.csv&quot;</span>,</div>
<div class="line"> <span class="stringliteral">&quot;ties&quot;</span> : <span class="stringliteral">&quot;path/to/ties.csv&quot;</span>,</div>
<div class="line"> <span class="stringliteral">&quot;equations&quot;</span> : <span class="stringliteral">&quot;path/to/equations.csv&quot;</span>,</div>
<div class="line"> <span class="stringliteral">&quot;options&quot;</span> : {</div>
<div class="line"> <span class="stringliteral">&quot;epsilon&quot;</span> : 1.0E-14,</div>
<div class="line"> <span class="stringliteral">&quot;csv_delimiter&quot;</span> : <span class="stringliteral">&quot;,&quot;</span>,</div>
<div class="line"> <span class="stringliteral">&quot;csv_precision&quot;</span> : 8,</div>
<div class="line"> <span class="stringliteral">&quot;save_nodal_forces&quot;</span> : <span class="keyword">true</span>,</div>
<div class="line"> <span class="stringliteral">&quot;save_nodal_displacements&quot;</span> : <span class="keyword">true</span>,</div>
<div class="line"> <span class="stringliteral">&quot;save_tie_forces&quot;</span> : <span class="keyword">true</span>,</div>
<div class="line"> <span class="stringliteral">&quot;save_report&quot;</span> : <span class="keyword">true</span>,</div>
<div class="line"> <span class="stringliteral">&quot;nodal_forces_filename&quot;</span> : <span class="stringliteral">&quot;nodal_forces.csv&quot;</span>,</div>
<div class="line"> <span class="stringliteral">&quot;nodal_displacements_filename&quot;</span> : <span class="stringliteral">&quot;nodal_displacements.csv&quot;</span>,</div>
<div class="line"> <span class="stringliteral">&quot;tie_forces_filename&quot;</span> : <span class="stringliteral">&quot;tie_forces.csv&quot;</span>,</div>
<div class="line"> <span class="stringliteral">&quot;report_filename&quot;</span> : <span class="stringliteral">&quot;report.txt&quot;</span>,</div>
<div class="line"> <span class="stringliteral">&quot;verbose&quot;</span> : <span class="keyword">true</span></div>
<div class="line"> }</div>
<div class="line">}</div>
</div><!-- fragment --><p>The use of a JSON document avoids the need to set each of these options using command line options, which can become tedious when running multiple jobs. The "nodes", "elems", and "props" keys are required. Keys "bcs", "forces", "ties" and "equations" are optional&ndash;if not provided the analysis will assume none were prescribed. If the "options" key is not provided the analysis will run with the default options. Any of all of the "options" keys presented above can be used to customize the analysis. If a key is not provided the default value is used in its place. See the Formatting CSV Files section below for how the CSV files should be created.</p>
<h3>Method 3: Using the GUI</h3>
<p>A simple graphical user interface can be used to set up an analysis. Internally, the GUI creates the JSON file used by the CLI (see above) without the need to write the file by hand. The program then saves a temporary configuration file and submits it to the command line application. This requires that the command line application has been compiled and is located in the same directory as the GUI. To open the GUI navigate to the build folder and open the fea_gui executable located in the <code>bin</code> directory. The first set of buttons allows the path to the CSV files to be set, and the second set of controls customizes the options. Once the files and options have been configured, clicking the submit button will run the analysis.</p>
<div class="image">
<img src="assets/fea_gui_screenshot.png" alt="GUI screenshot"/>
</div>
<h2>Formatting CSV files</h2>
<p>All CSV file must be comma delimited with no spaces between values, i.e. one row of the nodal coordinates file might resemble <code>1.0,2.0,3.0</code>. The file indicated by the value of "nodes" should be in the format:</p>
<div class="fragment"><div class="line">x1,y1,z1</div>
<div class="line">x2,y2,z2</div>
<div class="line">...</div>
<div class="line">...</div>
<div class="line">...</div>
<div class="line">xN,yN,zN</div>
</div><!-- fragment --><p>where each entry is a double and every line must have 3 entries for the <code>x,y,z</code> position. The "elems" file contains (only) the node indices:</p>
<div class="fragment"><div class="line">el1_node_num_1,el1_node_num_2</div>
<div class="line">el2_node_num_1,el2_node_num_2</div>
<div class="line">...</div>
<div class="line">...</div>
<div class="line">...</div>
<div class="line">elN_node_num_1,elN_node_num_2</div>
</div><!-- fragment --><p>where each entry is an integer and must have 2 nodal indices defining the connectivity of the element. Elemental properties are defined in the "props" file as:</p>
<div class="fragment"><div class="line">el1_EA,el1_EIz,el1_EIy,el1_GJ,el1_nvec_x_comp,el1_nvec_y_comp,el1_nvec_z_comp</div>
<div class="line">el2_EA,el2_EIz,el2_EIy,el2_GJ,el2_nvec_x_comp,el2_nvec_y_comp,el2_nvec_z_comp</div>
<div class="line">...</div>
<div class="line">...</div>
<div class="line">...</div>
<div class="line">elN_EA,elN_EIz,elN_EIy,elN_GJ,elN_nvec_x_comp,elN_nvec_y_comp,elN_nvec_z_comp</div>
</div><!-- fragment --><p>where each entry is a double and each line has 7 entries. The "bcs" and "forces" CSV files have the same format as each other. Each line specifies the node number, degree of freedom, and value:</p>
<div class="fragment"><div class="line">bc1_node_num,bc1_dof,bc1_value</div>
<div class="line">bc2_node_num,bc2_dof,bc2_value</div>
<div class="line">...</div>
<div class="line">...</div>
<div class="line">...</div>
<div class="line">bcN_node_num,bcN_dof,bcN_value</div>
</div><!-- fragment --><p>where the node number is the index of the node in the node list (integer), the DOF is the degree of freedom constrained (integer between 0 and 5), and value is the value to hold the degree of freedom at relative to the starting position (double). The "ties" CSV file is specified using the format:</p>
<div class="fragment"><div class="line">tie1_node_num1,tie1_node_num2,tie1_lmult,tie1_rmult</div>
<div class="line">tie1_node_num1,tie1_node_num2,tie1_lmult,tie1_rmult</div>
<div class="line">...</div>
<div class="line">...</div>
<div class="line">...</div>
<div class="line">tieN_node_num1,tieN_node_num2,tieN_lmult,tieN_rmult</div>
</div><!-- fragment --><p>where <code>lmult</code> is the spring constant for the translational degrees of freedom and <code>rmult</code> is the spring constant for the rotational degrees of freedom. Equation constraints are specified by a series of 3 items (representing a single term) repeated until the desired number of terms are created. Each term is defined by the node index, degree of freedom for the specified node, and the coefficient that will multiply the nodal degree of freedom. For example a single equation constraint that specifies that the x and y displacements for the first node must remain equal is given by:</p>
<div class="fragment"><div class="line">0,0,1,0,1,-1</div>
</div><!-- fragment --><p>in general the equations CSV file will be resemble:</p>
<div class="fragment"><div class="line">eq1_term1_node,eq1_term1_dof,eq1_term1_coeff,...</div>
<div class="line">eq2_term1_node,eq2_term1_dof,eq2_term1_coeff,...</div>
<div class="line">...</div>
<div class="line">...</div>
<div class="line">...</div>
<div class="line">eqN_term1_node,eqN_term1_dof,eqN_term1_coeff,...</div>
</div><!-- fragment --><h2>Contact</h2>
<ul>
<li>Ryan Latture (<a href="#" onclick="location.href='mai'+'lto:'+'rya'+'n.'+'lat'+'tu'+'re@'+'gm'+'ail'+'.c'+'om'; return false;">ryan.<span style="display: none;">.nosp@m.</span>latt<span style="display: none;">.nosp@m.</span>ure@g<span style="display: none;">.nosp@m.</span>mail<span style="display: none;">.nosp@m.</span>.com</a>) </li>
</ul>
</div></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Mon Oct 3 2016 22:38:16 for 3D Beam Finite Element Code by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
</body>
</html>