Skip to content

Commit

Permalink
Deploying to gh-pages from @ 6e97dda 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
timryanb committed Oct 22, 2024
1 parent 8d85735 commit 447eb67
Show file tree
Hide file tree
Showing 16 changed files with 1,688 additions and 120 deletions.
1 change: 1 addition & 0 deletions _modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ <h1>All modules for which code is available</h1>
<li><a href="tacs/constraints/adjacency.html">tacs.constraints.adjacency</a></li>
<li><a href="tacs/constraints/dv.html">tacs.constraints.dv</a></li>
<li><a href="tacs/constraints/panel_length.html">tacs.constraints.panel_length</a></li>
<li><a href="tacs/constraints/panel_width.html">tacs.constraints.panel_width</a></li>
<li><a href="tacs/constraints/volume.html">tacs.constraints.volume</a></li>
<li><a href="tacs/elements.html">tacs.elements</a></li>
<li><a href="tacs/functions.html">tacs.functions</a></li>
Expand Down
54 changes: 45 additions & 9 deletions _modules/tacs/constraints/panel_length.html
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,18 @@ <h1>Source code for tacs.constraints.panel_length</h1><div class="highlight"><pr
<span class="bp">self</span><span class="o">.</span><span class="n">constraintsUpToDate</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="kc">False</span></div>


<div class="viewcode-block" id="PanelLengthConstraint.externalClearUpToDate">
<a class="viewcode-back" href="../../../pytacs/panel_length.html#tacs.constraints.PanelLengthConstraint.externalClearUpToDate">[docs]</a>
<span class="k">def</span> <span class="nf">externalClearUpToDate</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> clear UpToDate by FUNtoFEM which sets variables into</span>
<span class="sd"> TACS through a different interface</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">constraintsUpToDate</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">constraintsUpToDate</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="kc">False</span>
<span class="k">return</span></div>


<div class="viewcode-block" id="PanelLengthConstraint.setNodes">
<a class="viewcode-back" href="../../../pytacs/panel_length.html#tacs.constraints.PanelLengthConstraint.setNodes">[docs]</a>
<span class="k">def</span> <span class="nf">setNodes</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">Xpts</span><span class="p">):</span>
Expand All @@ -295,6 +307,36 @@ <h1>Source code for tacs.constraints.panel_length</h1><div class="highlight"><pr
<span class="bp">self</span><span class="o">.</span><span class="n">constraintsSensUpToDate</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="kc">False</span></div>


<div class="viewcode-block" id="PanelLengthConstraint.computeRefAxis">
<a class="viewcode-back" href="../../../pytacs/panel_length.html#tacs.constraints.PanelLengthConstraint.computeRefAxis">[docs]</a>
<span class="k">def</span> <span class="nf">computeRefAxis</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">refAxis</span><span class="p">:</span> <span class="n">np</span><span class="o">.</span><span class="n">ndarray</span><span class="p">,</span> <span class="n">comp_bndry_node_coords</span><span class="p">:</span> <span class="n">np</span><span class="o">.</span><span class="n">ndarray</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> remove the panelNormal from the refAxis</span>

<span class="sd"> Parameters</span>
<span class="sd"> ----------</span>
<span class="sd"> refAxis : numpy.ndarray</span>
<span class="sd"> an array of size (3,) for the xyz coordinates of the original refAxis from transform object</span>
<span class="sd"> comp_bndry_node_coords : numpy.ndarray</span>
<span class="sd"> an array of size (3*N,) for the boundary nodal coordinates on the current panel / current TACS component</span>

<span class="sd"> Returns</span>
<span class="sd"> -------</span>
<span class="sd"> numpy.ndarray</span>
<span class="sd"> an array of size (3,) for xyz coords of the panel length axis after the panelNormal component has been removed</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="c1"># For a more accurate length calculation, roject the ref axis</span>
<span class="c1"># onto the &quot;average&quot; plane of the baseline panel geometry by</span>
<span class="c1"># using an SVD to compute a normal vector</span>
<span class="n">centroid</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">mean</span><span class="p">(</span><span class="n">comp_bndry_node_coords</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">keepdims</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="n">centredPoints</span> <span class="o">=</span> <span class="n">comp_bndry_node_coords</span> <span class="o">-</span> <span class="n">centroid</span>
<span class="n">_</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">VT</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">linalg</span><span class="o">.</span><span class="n">svd</span><span class="p">(</span><span class="n">centredPoints</span><span class="p">,</span> <span class="n">full_matrices</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="n">panelNormal</span> <span class="o">=</span> <span class="n">VT</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
<span class="n">refAxis</span> <span class="o">-=</span> <span class="n">np</span><span class="o">.</span><span class="n">dot</span><span class="p">(</span><span class="n">refAxis</span><span class="p">,</span> <span class="n">panelNormal</span><span class="p">)</span> <span class="o">*</span> <span class="n">panelNormal</span>
<span class="n">refAxis</span> <span class="o">/=</span> <span class="n">np</span><span class="o">.</span><span class="n">linalg</span><span class="o">.</span><span class="n">norm</span><span class="p">(</span><span class="n">refAxis</span><span class="p">)</span>
<span class="k">return</span> <span class="n">refAxis</span></div>


<div class="viewcode-block" id="PanelLengthConstraint.addConstraint">
<a class="viewcode-back" href="../../../pytacs/panel_length.html#tacs.constraints.PanelLengthConstraint.addConstraint">[docs]</a>
<span class="k">def</span> <span class="nf">addConstraint</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">conName</span><span class="p">,</span> <span class="n">compIDs</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">lower</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">upper</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dvIndex</span><span class="o">=</span><span class="mi">0</span><span class="p">):</span>
Expand Down Expand Up @@ -363,15 +405,8 @@ <h1>Source code for tacs.constraints.panel_length</h1><div class="highlight"><pr
<span class="sa">f</span><span class="s2">&quot;The elements in component </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">meshLoader</span><span class="o">.</span><span class="n">compDescripts</span><span class="p">[</span><span class="n">compID</span><span class="p">]</span><span class="si">}</span><span class="s2"> do not have a reference axis. Please define one by using the &#39;ShellRefAxisTransform&#39; class with your elements&quot;</span>
<span class="p">)</span> <span class="kn">from</span> <span class="nn">e</span>

<span class="c1"># For a more accurate length calculation, roject the ref axis</span>
<span class="c1"># onto the &quot;average&quot; plane of the baseline panel geometry by</span>
<span class="c1"># using an SVD to compute a normal vector</span>
<span class="n">centroid</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">mean</span><span class="p">(</span><span class="n">boundaryNodeCoords</span><span class="p">[</span><span class="n">compID</span><span class="p">],</span> <span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">keepdims</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="n">centredPoints</span> <span class="o">=</span> <span class="n">boundaryNodeCoords</span><span class="p">[</span><span class="n">compID</span><span class="p">]</span> <span class="o">-</span> <span class="n">centroid</span>
<span class="n">_</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">VT</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">linalg</span><span class="o">.</span><span class="n">svd</span><span class="p">(</span><span class="n">centredPoints</span><span class="p">,</span> <span class="n">full_matrices</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="n">panelNormal</span> <span class="o">=</span> <span class="n">VT</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
<span class="n">refAxis</span> <span class="o">-=</span> <span class="n">np</span><span class="o">.</span><span class="n">dot</span><span class="p">(</span><span class="n">refAxis</span><span class="p">,</span> <span class="n">panelNormal</span><span class="p">)</span> <span class="o">*</span> <span class="n">panelNormal</span>
<span class="n">refAxis</span> <span class="o">/=</span> <span class="n">np</span><span class="o">.</span><span class="n">linalg</span><span class="o">.</span><span class="n">norm</span><span class="p">(</span><span class="n">refAxis</span><span class="p">)</span>
<span class="c1"># remove the panelNormal from the adjusted ref axis</span>
<span class="n">refAxis</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">computeRefAxis</span><span class="p">(</span><span class="n">refAxis</span><span class="p">,</span> <span class="n">boundaryNodeCoords</span><span class="p">[</span><span class="n">compID</span><span class="p">])</span>
<span class="n">refAxes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">refAxis</span><span class="p">)</span>

<span class="c1"># Now figure out where the DV for this component lives</span>
Expand Down Expand Up @@ -851,6 +886,7 @@ <h1>Source code for tacs.constraints.panel_length</h1><div class="highlight"><pr
<span class="s2">&quot;constitutive object. This is not allowed. &quot;</span>
<span class="s2">&quot;This constitutive object cannot use a &quot;</span>
<span class="s2">&quot;panel-type constitutive object. &quot;</span>
<span class="sa">f</span><span class="s2">&quot;On compID </span><span class="si">{</span><span class="n">compID</span><span class="si">}</span><span class="s2">&quot;</span>
<span class="sa">f</span><span class="s2">&quot;CompIDs are: </span><span class="si">{</span><span class="nb">repr</span><span class="p">(</span><span class="n">compIDs</span><span class="p">)</span><span class="si">}</span><span class="s2">&quot;</span>
<span class="p">)</span>
<span class="n">nodeChain</span> <span class="o">=</span> <span class="n">nodeChain</span><span class="p">[:</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
Expand Down
Loading

0 comments on commit 447eb67

Please sign in to comment.