Skip to content

Commit

Permalink
Deployed from seahorce-scidac/ROMSX
Browse files Browse the repository at this point in the history
  • Loading branch information
asalmgren committed Dec 19, 2023
1 parent b3751d3 commit 1ef5a85
Showing 1 changed file with 30 additions and 69 deletions.
99 changes: 30 additions & 69 deletions classROMSXPhysBCFunct.html
Original file line number Diff line number Diff line change
Expand Up @@ -1254,7 +1254,6 @@ <h2 class="memtitle"><span class="permalink"><a href="#ad4ca48208e725399634dfa7e
</tr>
</table>
</div><div class="memdoc">
<p>if there are cells not in the valid + periodic grown box we need to fill them here</p>
<div class="fragment"><div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;{</div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160; <span class="keywordflow">if</span> (<a class="code" href="classROMSXPhysBCFunct.html#ab3ec985809c2d3e49c2d797994968ab5">m_geom</a>.isAllPeriodic()) <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160; </div>
Expand All @@ -1276,76 +1275,38 @@ <h2 class="memtitle"><span class="permalink"><a href="#ad4ca48208e725399634dfa7e
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160;<span class="preprocessor">#pragma omp parallel if (Gpu::notInLaunchRegion())</span></div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160; {</div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160; Vector&lt;BCRec&gt; bcrs(ncomp);</div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160; <span class="keywordflow">if</span> (mf.boxArray()[0].ixType() == IndexType(IntVect(0,0,0))) {</div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160; </div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160; <span class="comment">// Do all BCs except MOST</span></div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160; <span class="keywordflow">for</span> (MFIter mfi(mf); mfi.isValid(); ++mfi)</div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160; {</div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160; <span class="keyword">const</span> Array4&lt;Real&gt;&amp; dest_arr = mf.array(mfi);</div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160; Box bx = mfi.validbox(); bx.grow(nghost);</div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160; <span class="comment">// Cell-centered arrays only</span></div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160; <span class="keywordflow">for</span> (MFIter mfi(mf); mfi.isValid(); ++mfi)</div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160; {</div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160; <span class="keyword">const</span> Array4&lt;Real&gt;&amp; dest_arr = mf.array(mfi);</div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160; Box bx = mfi.validbox(); bx.grow(nghost);</div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160; </div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160; Array4&lt;const Real&gt; velx_arr;</div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160; Array4&lt;const Real&gt; vely_arr;</div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160;<span class="comment"> //! if there are cells not in the valid + periodic grown box</span></div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160;<span class="comment"> //! we need to fill them here</span></div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160;<span class="comment"> //!</span></div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160;<span class="comment"></span> <span class="keywordflow">if</span> (!gdomain.contains(bx) || (mf.boxArray()[0].ixType() == IndexType(IntVect(0,0,1))) )</div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160; {</div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160; <span class="keywordflow">if</span> (mf.boxArray()[0].ixType() == IndexType(IntVect(1,0,0)))</div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160; {</div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160; <span class="comment">// AMREX_ALWAYS_ASSERT(ncomp == 1 &amp;&amp; icomp == 0);</span></div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160; <a class="code" href="classROMSXPhysBCFunct.html#a4f7aafa8569836b0bc7f5641eaf8ad1b">impose_xvel_bcs</a>(dest_arr,bx,domain,dxInv,time,bccomp);</div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160; </div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160; } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (mf.boxArray()[0].ixType() == IndexType(IntVect(0,1,0)))</div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160; {</div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160; <span class="comment">// AMREX_ALWAYS_ASSERT(ncomp == 1 &amp;&amp; icomp == 0);</span></div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160; <a class="code" href="classROMSXPhysBCFunct.html#a1e2e601f3307e8b45ae3a4ee2d3a1e6b">impose_yvel_bcs</a>(dest_arr,bx,domain,dxInv,time,bccomp);</div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160; </div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160; } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (mf.boxArray()[0].ixType() == IndexType(IntVect(0,0,1)))</div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160; {</div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160; AMREX_ALWAYS_ASSERT(ncomp == 1 &amp;&amp; icomp == 0);</div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160; <span class="comment">// amrex::Warning(&quot;Dont know what to do with zvel in FillPatch!&quot;);</span></div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160; <span class="comment">// impose_zvel_bcs(dest_arr,bx,domain,velx_arr,vely_arr,dx,dxInv,</span></div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160; <span class="comment">// time,bccomp);</span></div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160; </div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160; } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (mf.boxArray()[0].ixType() == IndexType(IntVect(0,0,0)))</div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160; {</div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160; AMREX_ALWAYS_ASSERT(icomp == 0 &amp;&amp; icomp+ncomp &lt;= <a class="code" href="IndexDefines_8H.html#ae3f12540307d28407f8d7dd4a169e325">NCONS</a>);</div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160; <a class="code" href="classROMSXPhysBCFunct.html#adba4872aa8251e61cc5ee08aee724857">impose_cons_bcs</a>(dest_arr,bx,domain,</div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160; dxInv,icomp,ncomp,time,bccomp);</div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160; } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160; amrex::Abort(<span class="stringliteral">&quot;Dont know this box type in ROMSX_PhysBC&quot;</span>);</div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160; }</div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160; </div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160; <span class="comment">// ****************************************************************************</span></div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160; <span class="comment">// Based on BCRec for the domain, we need to make BCRec for this Box</span></div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160; <span class="comment">// bccomp is used as starting index for m_domain_bcs_type</span></div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160; <span class="comment">// 0 is used as starting index for bcrs</span></div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160; <span class="comment">// ****************************************************************************</span></div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>&#160; amrex::setBC(bx, domain, bccomp, 0, ncomp, <a class="code" href="classROMSXPhysBCFunct.html#a1016f2d4f5c13c179f4f59bf93049d6c">m_domain_bcs_type</a>, bcrs);</div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160; </div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>&#160; <span class="comment">// xlo: ori = 0</span></div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>&#160; <span class="comment">// ylo: ori = 1</span></div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>&#160; <span class="comment">// zlo: ori = 2</span></div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>&#160; <span class="comment">// xhi: ori = 3</span></div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>&#160; <span class="comment">// yhi: ori = 4</span></div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>&#160; <span class="comment">// zhi: ori = 5</span></div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>&#160; </div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>&#160; amrex::Gpu::DeviceVector&lt;BCRec&gt; bcrs_d(ncomp);</div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>&#160;<span class="preprocessor">#ifdef AMREX_USE_GPU</span></div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>&#160; Gpu::htod_memcpy_async</div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160; (bcrs_d.data(), bcrs.data(), <span class="keyword">sizeof</span>(BCRec)*ncomp);</div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160;<span class="preprocessor">#else</span></div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>&#160; std::memcpy</div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160; (bcrs_d.data(), bcrs.data(), <span class="keyword">sizeof</span>(BCRec)*ncomp);</div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160; </div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160; Gpu::streamSynchronize(); <span class="comment">// because of bcrs_d</span></div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160; } <span class="comment">// !gdomain.contains(bx)</span></div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160; } <span class="comment">// MFIter</span></div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160; } <span class="comment">// OpenMP</span></div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160;} <span class="comment">// operator()</span></div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160; <span class="keywordflow">if</span> (!gdomain.contains(bx)) {</div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160; AMREX_ALWAYS_ASSERT(icomp == 0 &amp;&amp; icomp+ncomp &lt;= <a class="code" href="IndexDefines_8H.html#ae3f12540307d28407f8d7dd4a169e325">NCONS</a>);</div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160; <a class="code" href="classROMSXPhysBCFunct.html#adba4872aa8251e61cc5ee08aee724857">impose_cons_bcs</a>(dest_arr,bx,domain,</div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160; dxInv,icomp,ncomp,time,bccomp);</div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160; }</div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160; } <span class="comment">// mfi</span></div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160; </div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160; } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160; </div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160; <span class="comment">// Face-based arrays only</span></div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160; <span class="keywordflow">for</span> (MFIter mfi(mf); mfi.isValid(); ++mfi)</div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160; {</div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160; Box bx = mfi.validbox(); bx.grow(nghost);</div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160; </div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160; <span class="keywordflow">if</span> (!gdomain.contains(bx)) {</div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160; <span class="keywordflow">for</span> (<span class="keywordtype">int</span> nn = 0; nn &lt; ncomp; nn++) {</div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160; <span class="keyword">const</span> Array4&lt;Real&gt;&amp; dest_arr = mf.array(mfi,nn);</div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160; <a class="code" href="classROMSXPhysBCFunct.html#a4f7aafa8569836b0bc7f5641eaf8ad1b">impose_xvel_bcs</a>(dest_arr,bx,domain,dxInv,time,bccomp);</div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160; }</div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160; }</div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160; } <span class="comment">// mfi</span></div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160; } <span class="comment">// box type</span></div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160; } <span class="comment">// OpenMP</span></div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160;} <span class="comment">// operator()</span></div>
</div><!-- fragment -->
<p class="reference">Referenced by <a class="el" href="classROMSXPhysBCFunct.html#a55040a762000240bfabb9a27b03fcc04">FillBoundary()</a>.</p>
<div class="dynheader">
Expand Down

0 comments on commit 1ef5a85

Please sign in to comment.