Skip to content

Commit

Permalink
Add changes for e69610b
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Jan 15, 2025
1 parent 2c78128 commit f0f18fc
Show file tree
Hide file tree
Showing 9 changed files with 797 additions and 391 deletions.
12 changes: 9 additions & 3 deletions _modules/mphys/core/builder.html
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ <h1>Source code for mphys.core.builder</h1><div class="highlight"><pre>
<span class="sd"> number_of_nodes : int</span>
<span class="sd"> number of nodes in the computational domain</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s1">&#39;Function get_number_of_nodes has not been implemented in the builder.&#39;</span><span class="p">)</span></div>
<span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span>
<span class="s2">&quot;Function get_number_of_nodes has not been implemented in the builder.&quot;</span>
<span class="p">)</span></div>


<div class="viewcode-block" id="Builder.get_ndof">
Expand All @@ -169,7 +171,9 @@ <h1>Source code for mphys.core.builder</h1><div class="highlight"><pre>
<span class="sd"> ndof : int</span>
<span class="sd"> number of degrees of freedom of each node in the domain</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s1">&#39;Function get_ndof has not been implemented in the builder.&#39;</span><span class="p">)</span></div>
<span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span>
<span class="s2">&quot;Function get_ndof has not been implemented in the builder.&quot;</span>
<span class="p">)</span></div>


<div class="viewcode-block" id="Builder.get_tagged_indices">
Expand All @@ -187,7 +191,9 @@ <h1>Source code for mphys.core.builder</h1><div class="highlight"><pre>
<span class="sd"> grid_ids : list</span>
<span class="sd"> list of grid IDs that correspond to given body/boundary tags</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s1">&#39;Function get_tagged_indices has not been implemented in the builder.&#39;</span><span class="p">)</span></div>
<span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span>
<span class="s2">&quot;Function get_tagged_indices has not been implemented in the builder.&quot;</span>
<span class="p">)</span></div>
</div>

</pre></div>
Expand Down
1 change: 1 addition & 0 deletions _modules/mphys/core/coupling_group.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ <h3>Navigation</h3>
<h1>Source code for mphys.core.coupling_group</h1><div class="highlight"><pre>
<span></span><span class="kn">from</span><span class="w"> </span><span class="nn">.mphys_group</span><span class="w"> </span><span class="kn">import</span> <span class="n">MPhysGroup</span>


<div class="viewcode-block" id="CouplingGroup">
<a class="viewcode-back" href="../../../developers/new_multiphysics_problems.html#mphys.CouplingGroup">[docs]</a>
<span class="k">class</span><span class="w"> </span><span class="nc">CouplingGroup</span><span class="p">(</span><span class="n">MPhysGroup</span><span class="p">):</span>
Expand Down
19 changes: 10 additions & 9 deletions _modules/mphys/core/mphys_group.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ <h1>Source code for mphys.core.mphys_group</h1><div class="highlight"><pre>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> A OpenMDAO class for automated promotion of MPhys variables</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="k">def</span><span class="w"> </span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

Expand Down Expand Up @@ -76,29 +77,29 @@ <h1>Source code for mphys.core.mphys_group</h1><div class="highlight"><pre>
<span class="k">def</span><span class="w"> </span><span class="nf">_mphys_promote_by_tag</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">iotype</span><span class="p">,</span> <span class="n">tag</span><span class="p">):</span>
<span class="k">for</span> <span class="n">subsystem</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">mphys_subsystems</span><span class="p">:</span>
<span class="n">promoted</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">tagged_variables</span> <span class="o">=</span> <span class="n">subsystem</span><span class="o">.</span><span class="n">get_io_metadata</span><span class="p">(</span><span class="n">iotypes</span><span class="o">=</span><span class="n">iotype</span><span class="p">,</span>
<span class="n">metadata_keys</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;tags&#39;</span><span class="p">],</span>
<span class="n">tags</span><span class="o">=</span><span class="n">tag</span><span class="p">)</span>
<span class="n">tagged_variables</span> <span class="o">=</span> <span class="n">subsystem</span><span class="o">.</span><span class="n">get_io_metadata</span><span class="p">(</span>
<span class="n">iotypes</span><span class="o">=</span><span class="n">iotype</span><span class="p">,</span> <span class="n">metadata_keys</span><span class="o">=</span><span class="p">[</span><span class="s2">&quot;tags&quot;</span><span class="p">],</span> <span class="n">tags</span><span class="o">=</span><span class="n">tag</span>
<span class="p">)</span>
<span class="k">for</span> <span class="n">val</span> <span class="ow">in</span> <span class="n">tagged_variables</span><span class="o">.</span><span class="n">values</span><span class="p">():</span>
<span class="n">variable</span> <span class="o">=</span> <span class="n">val</span><span class="p">[</span><span class="s1">&#39;prom_name&#39;</span><span class="p">]</span>
<span class="n">variable</span> <span class="o">=</span> <span class="n">val</span><span class="p">[</span><span class="s2">&quot;prom_name&quot;</span><span class="p">]</span>
<span class="k">if</span> <span class="n">variable</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">promoted</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">promotes</span><span class="p">(</span><span class="n">subsystem</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="nb">any</span><span class="o">=</span><span class="p">[</span><span class="n">variable</span><span class="p">])</span>
<span class="n">promoted</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">variable</span><span class="p">)</span>

<span class="k">def</span><span class="w"> </span><span class="nf">_mphys_promote_time_derivatives</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_mphys_promote_by_tag</span><span class="p">([</span><span class="s1">&#39;input&#39;</span><span class="p">,</span> <span class="s1">&#39;output&#39;</span><span class="p">],</span> <span class="s1">&#39;mphys_time_derivative&#39;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_mphys_promote_by_tag</span><span class="p">([</span><span class="s2">&quot;input&quot;</span><span class="p">,</span> <span class="s2">&quot;output&quot;</span><span class="p">],</span> <span class="s2">&quot;mphys_time_derivative&quot;</span><span class="p">)</span>

<span class="k">def</span><span class="w"> </span><span class="nf">_mphys_promote_coupling_variables</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_mphys_promote_by_tag</span><span class="p">([</span><span class="s1">&#39;input&#39;</span><span class="p">,</span> <span class="s1">&#39;output&#39;</span><span class="p">],</span> <span class="s1">&#39;mphys_coupling&#39;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_mphys_promote_by_tag</span><span class="p">([</span><span class="s2">&quot;input&quot;</span><span class="p">,</span> <span class="s2">&quot;output&quot;</span><span class="p">],</span> <span class="s2">&quot;mphys_coupling&quot;</span><span class="p">)</span>

<span class="k">def</span><span class="w"> </span><span class="nf">_mphys_promote_inputs</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_mphys_promote_by_tag</span><span class="p">(</span><span class="s1">&#39;input&#39;</span><span class="p">,</span> <span class="s1">&#39;mphys_input&#39;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_mphys_promote_by_tag</span><span class="p">(</span><span class="s2">&quot;input&quot;</span><span class="p">,</span> <span class="s2">&quot;mphys_input&quot;</span><span class="p">)</span>

<span class="k">def</span><span class="w"> </span><span class="nf">_mphys_promote_mesh_coordinates</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_mphys_promote_by_tag</span><span class="p">([</span><span class="s1">&#39;input&#39;</span><span class="p">,</span> <span class="s1">&#39;output&#39;</span><span class="p">],</span> <span class="s1">&#39;mphys_coordinates&#39;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_mphys_promote_by_tag</span><span class="p">([</span><span class="s2">&quot;input&quot;</span><span class="p">,</span> <span class="s2">&quot;output&quot;</span><span class="p">],</span> <span class="s2">&quot;mphys_coordinates&quot;</span><span class="p">)</span>

<span class="k">def</span><span class="w"> </span><span class="nf">_mphys_promote_results</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_mphys_promote_by_tag</span><span class="p">(</span><span class="s1">&#39;output&#39;</span><span class="p">,</span> <span class="s1">&#39;mphys_result&#39;</span><span class="p">)</span></div>
<span class="bp">self</span><span class="o">.</span><span class="n">_mphys_promote_by_tag</span><span class="p">(</span><span class="s2">&quot;output&quot;</span><span class="p">,</span> <span class="s2">&quot;mphys_result&quot;</span><span class="p">)</span></div>

</pre></div>

Expand Down
19 changes: 15 additions & 4 deletions _modules/mphys/core/multipoint.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ <h3>Navigation</h3>
<h1>Source code for mphys.core.multipoint</h1><div class="highlight"><pre>
<span></span><span class="kn">import</span><span class="w"> </span><span class="nn">openmdao.api</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="nn">om</span>


<span class="k">def</span><span class="w"> </span><span class="nf">set_coupling_algorithms_in_scenarios</span><span class="p">(</span><span class="n">multipoint_group</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Set the stored linear and nonlinear solver into the coupling group if the</span>
Expand Down Expand Up @@ -65,8 +66,13 @@ <h1>Source code for mphys.core.multipoint</h1><div class="highlight"><pre>

<div class="viewcode-block" id="Multipoint.mphys_add_scenario">
<a class="viewcode-back" href="../../../basics/model_hierarchy.html#mphys.Multipoint.mphys_add_scenario">[docs]</a>
<span class="k">def</span><span class="w"> </span><span class="nf">mphys_add_scenario</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">scenario</span><span class="p">,</span> <span class="n">coupling_nonlinear_solver</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">coupling_linear_solver</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="k">def</span><span class="w"> </span><span class="nf">mphys_add_scenario</span><span class="p">(</span>
<span class="bp">self</span><span class="p">,</span>
<span class="n">name</span><span class="p">,</span>
<span class="n">scenario</span><span class="p">,</span>
<span class="n">coupling_nonlinear_solver</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">coupling_linear_solver</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Add an MPhys scenario</span>

Expand Down Expand Up @@ -105,8 +111,13 @@ <h1>Source code for mphys.core.multipoint</h1><div class="highlight"><pre>

<div class="viewcode-block" id="MultipointParallel.mphys_add_scenario">
<a class="viewcode-back" href="../../../basics/model_hierarchy.html#mphys.MultipointParallel.mphys_add_scenario">[docs]</a>
<span class="k">def</span><span class="w"> </span><span class="nf">mphys_add_scenario</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">scenario</span><span class="p">,</span> <span class="n">coupling_nonlinear_solver</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">coupling_linear_solver</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="k">def</span><span class="w"> </span><span class="nf">mphys_add_scenario</span><span class="p">(</span>
<span class="bp">self</span><span class="p">,</span>
<span class="n">name</span><span class="p">,</span>
<span class="n">scenario</span><span class="p">,</span>
<span class="n">coupling_nonlinear_solver</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">coupling_linear_solver</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Add an MPhys scenario</span>

Expand Down
Loading

0 comments on commit f0f18fc

Please sign in to comment.