Skip to content

Commit

Permalink
Deploying to gh-pages from @ 4e5d3b2 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
holl- committed Jan 4, 2025
1 parent 5c161d0 commit 30b73ba
Show file tree
Hide file tree
Showing 21 changed files with 211 additions and 144 deletions.
8 changes: 4 additions & 4 deletions Billiards.html
Original file line number Diff line number Diff line change
Expand Up @@ -15300,7 +15300,7 @@ <h1 id="Billiards-in-%CE%A6Flow">Billiards in &#934;<sub>Flow</sub><a class="anc


<div class="jp-RenderedText jp-OutputArea-output" data-mime-type="application/vnd.jupyter.stderr">
<pre>/tmp/ipykernel_1938/1958517515.py:4: DeprecationWarning: phiml.math.length is deprecated in favor of phiml.math.norm
<pre>/tmp/ipykernel_1934/1958517515.py:4: DeprecationWarning: phiml.math.length is deprecated in favor of phiml.math.norm
dist_norm = math.vec_length(dist, eps=1e-4) # eps to avoid NaN during backprop of sqrt
</pre>
</div>
Expand Down Expand Up @@ -15580,7 +15580,7 @@ <h1 id="Billiards-in-%CE%A6Flow">Billiards in &#934;<sub>Flow</sub><a class="anc


<div class="jp-RenderedText jp-OutputArea-output" data-mime-type="application/vnd.jupyter.stderr">
<pre>/tmp/ipykernel_1938/1958517515.py:4: DeprecationWarning: phiml.math.length is deprecated in favor of phiml.math.norm
<pre>/tmp/ipykernel_1934/1958517515.py:4: DeprecationWarning: phiml.math.length is deprecated in favor of phiml.math.norm
dist_norm = math.vec_length(dist, eps=1e-4) # eps to avoid NaN during backprop of sqrt
</pre>
</div>
Expand Down Expand Up @@ -16556,7 +16556,7 @@ <h1 id="Billiards-in-%CE%A6Flow">Billiards in &#934;<sub>Flow</sub><a class="anc


<div class="jp-RenderedText jp-OutputArea-output" data-mime-type="application/vnd.jupyter.stderr">
<pre>/tmp/ipykernel_1938/1958517515.py:4: DeprecationWarning: phiml.math.length is deprecated in favor of phiml.math.norm
<pre>/tmp/ipykernel_1934/1958517515.py:4: DeprecationWarning: phiml.math.length is deprecated in favor of phiml.math.norm
dist_norm = math.vec_length(dist, eps=1e-4) # eps to avoid NaN during backprop of sqrt
</pre>
</div>
Expand Down Expand Up @@ -16651,7 +16651,7 @@ <h1 id="Billiards-in-%CE%A6Flow">Billiards in &#934;<sub>Flow</sub><a class="anc
<div class="jp-RenderedText jp-OutputArea-output" data-mime-type="application/vnd.jupyter.stderr">
<pre>/opt/hostedtoolcache/Python/3.12.8/x64/lib/python3.12/site-packages/phiml/math/_functional.py:628: RuntimeWarning: Using torch for gradient computation because numpy does not support jacobian()
warnings.warn(f&#34;Using {math.default_backend()} for gradient computation because {key.backend} does not support jacobian()&#34;, RuntimeWarning)
/tmp/ipykernel_1938/1958517515.py:4: DeprecationWarning: phiml.math.length is deprecated in favor of phiml.math.norm
/tmp/ipykernel_1934/1958517515.py:4: DeprecationWarning: phiml.math.length is deprecated in favor of phiml.math.norm
dist_norm = math.vec_length(dist, eps=1e-4) # eps to avoid NaN during backprop of sqrt
</pre>
</div>
Expand Down
108 changes: 54 additions & 54 deletions Cookbook.html

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions Fluid_Simulation.html

Large diffs are not rendered by default.

39 changes: 25 additions & 14 deletions Heightmaps.html

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions IO_with_Scenes.html

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions Math_Introduction.html

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions Unstructured.html
Original file line number Diff line number Diff line change
Expand Up @@ -15210,17 +15210,17 @@ <h2 id="Loading-an-Unstructured-Mesh">Loading an Unstructured Mesh<a class="anch
<span class="ansi-green-intense-fg ansi-bold"> 1357</span> results<span style="color: rgb(98,98,98)">.</span>append(f_output)
<span class="ansi-green-intense-fg ansi-bold"> 1358</span> <span class="ansi-bold" style="color: rgb(0,135,0)">if</span> <span style="color: rgb(0,135,0)">isinstance</span>(results[<span style="color: rgb(98,98,98)">0</span>], <span style="color: rgb(0,135,0)">tuple</span>):

File <span class="ansi-green-fg">/opt/hostedtoolcache/Python/3.12.8/x64/lib/python3.12/site-packages/phi/geom/_mesh.py:486</span>, in <span class="ansi-cyan-fg">load_su2</span><span class="ansi-blue-fg">(file_or_mesh, cell_dim, face_format)</span>
<span class="ansi-green-intense-fg ansi-bold"> 472</span> <span style="color: rgb(175,0,0)">&#34;&#34;&#34;</span>
<span class="ansi-green-intense-fg ansi-bold"> 473</span> <span style="color: rgb(175,0,0)">Load an unstructured mesh from a `.su2` file.</span>
<span class="ansi-green-intense-fg ansi-bold"> 474</span>
File <span class="ansi-green-fg">/opt/hostedtoolcache/Python/3.12.8/x64/lib/python3.12/site-packages/phi/geom/_mesh.py:489</span>, in <span class="ansi-cyan-fg">load_su2</span><span class="ansi-blue-fg">(file_or_mesh, cell_dim, face_format)</span>
<span class="ansi-green-intense-fg ansi-bold"> 475</span> <span style="color: rgb(175,0,0)">&#34;&#34;&#34;</span>
<span class="ansi-green-intense-fg ansi-bold"> 476</span> <span style="color: rgb(175,0,0)">Load an unstructured mesh from a `.su2` file.</span>
<span class="ansi-green-intense-fg ansi-bold"> 477</span>
<span class="ansi-green-fg"> (...)</span>
<span class="ansi-green-intense-fg ansi-bold"> 483</span> <span style="color: rgb(175,0,0)"> `Mesh`</span>
<span class="ansi-green-intense-fg ansi-bold"> 484</span> <span style="color: rgb(175,0,0)">&#34;&#34;&#34;</span>
<span class="ansi-green-intense-fg ansi-bold"> 485</span> <span class="ansi-bold" style="color: rgb(0,135,0)">if</span> <span style="color: rgb(0,135,0)">isinstance</span>(file_or_mesh, <span style="color: rgb(0,135,0)">str</span>):
<span class="ansi-green-fg">--&gt; 486</span> <span class="ansi-bold" style="color: rgb(0,135,0)">from</span> <span class="ansi-bold" style="color: rgb(0,0,255)">ezmesh</span> <span class="ansi-bold" style="color: rgb(0,135,0)">import</span> import_from_file
<span class="ansi-green-intense-fg ansi-bold"> 487</span> mesh <span style="color: rgb(98,98,98)">=</span> import_from_file(file_or_mesh)
<span class="ansi-green-intense-fg ansi-bold"> 488</span> <span class="ansi-bold" style="color: rgb(0,135,0)">else</span>:
<span class="ansi-green-intense-fg ansi-bold"> 486</span> <span style="color: rgb(175,0,0)"> `Mesh`</span>
<span class="ansi-green-intense-fg ansi-bold"> 487</span> <span style="color: rgb(175,0,0)">&#34;&#34;&#34;</span>
<span class="ansi-green-intense-fg ansi-bold"> 488</span> <span class="ansi-bold" style="color: rgb(0,135,0)">if</span> <span style="color: rgb(0,135,0)">isinstance</span>(file_or_mesh, <span style="color: rgb(0,135,0)">str</span>):
<span class="ansi-green-fg">--&gt; 489</span> <span class="ansi-bold" style="color: rgb(0,135,0)">from</span> <span class="ansi-bold" style="color: rgb(0,0,255)">ezmesh</span> <span class="ansi-bold" style="color: rgb(0,135,0)">import</span> import_from_file
<span class="ansi-green-intense-fg ansi-bold"> 490</span> mesh <span style="color: rgb(98,98,98)">=</span> import_from_file(file_or_mesh)
<span class="ansi-green-intense-fg ansi-bold"> 491</span> <span class="ansi-bold" style="color: rgb(0,135,0)">else</span>:

<span class="ansi-red-fg">ModuleNotFoundError</span>: No module named &#39;ezmesh&#39;</pre>
</div>
Expand Down
Binary file modified data/sim_000000/batched_noise_data_000000.npz
Binary file not shown.
8 changes: 4 additions & 4 deletions data/sim_000000/description.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
null
],
"data": [
0.7326365113258362,
0.7110546827316284,
0.13950075209140778,
0.14038680493831635
0.06428778916597366,
0.6195746660232544,
0.07410836964845657,
0.9235832691192627
]
},
"__tensors__": [
Expand Down
Binary file modified data/sim_000000/noise_data_000000.npz
Binary file not shown.
Binary file modified data/sim_000001/batched_noise_data_000000.npz
Binary file not shown.
2 changes: 1 addition & 1 deletion data/sim_000001/description.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"smoothness": 0.7326365113258362
"smoothness": 0.06428778916597366
}
Binary file modified data/sim_000002/batched_noise_data_000000.npz
Binary file not shown.
2 changes: 1 addition & 1 deletion data/sim_000002/description.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"smoothness": 0.7110546827316284
"smoothness": 0.6195746660232544
}
Binary file modified data/sim_000003/batched_noise_data_000000.npz
Binary file not shown.
2 changes: 1 addition & 1 deletion data/sim_000003/description.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"smoothness": 0.13950075209140778
"smoothness": 0.07410836964845657
}
Binary file modified data/sim_000004/batched_noise_data_000000.npz
Binary file not shown.
2 changes: 1 addition & 1 deletion data/sim_000004/description.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"smoothness": 0.14038680493831635
"smoothness": 0.9235832691192627
}
2 changes: 1 addition & 1 deletion phi/field/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ <h2 id="args">Args</h2>
</dl></div>
</dd>
<dt id="phi.field.divergence"><code class="name flex">
<span>def <span class="ident">divergence</span></span>(<span>field: phi.field._field.Field,<br>order=2,<br>implicit: phiml.math._optimize.Solve = None,<br>upwind: phi.field._field.Field = None,<br>implicitness: int = None) ‑> <function <a title="phi.field.CenteredGrid" href="#phi.field.CenteredGrid">CenteredGrid()</a> at 0x7fedc4e3c9a0></span>
<span>def <span class="ident">divergence</span></span>(<span>field: phi.field._field.Field,<br>order=2,<br>implicit: phiml.math._optimize.Solve = None,<br>upwind: phi.field._field.Field = None,<br>implicitness: int = None) ‑> <function <a title="phi.field.CenteredGrid" href="#phi.field.CenteredGrid">CenteredGrid()</a> at 0x7f54fc1f82c0></span>
</code></dt>
<dd>
<details class="source">
Expand Down
80 changes: 68 additions & 12 deletions phi/geom/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1112,13 +1112,30 @@ <h2 id="returns">Returns</h2>
Returns:
`Mesh` with `spatial_rank=3` and `element_rank=2`.
&#34;&#34;&#34;
import stl
model = stl.mesh.Mesh.from_file(file)
points = np.reshape(model.points, (-1, 3))
vertices, indices = np.unique(points, axis=0, return_inverse=True)
indices = np.reshape(indices, (-1, 3))
mesh = mesh_from_numpy(vertices, indices, element_rank=2, cell_dim=face_dim)
return mesh</code></pre>
import trimesh
mesh = trimesh.load(file)
if isinstance(mesh, trimesh.Scene): # STL contains multiple parts -&gt; merge
vertices = []
v_count = 0
faces = []
for geometry in mesh.geometry.values():
assert isinstance(geometry, trimesh.Trimesh)
vertices.append(geometry.vertices)
faces.append(geometry.faces + v_count)
v_count += geometry.vertices.shape[0]
vertices = np.concatenate(vertices)
faces = np.concatenate(faces)
else:
assert isinstance(mesh, trimesh.Trimesh), f&#34;Unexpected content of STL: {mesh}&#34;
vertices, faces = mesh.vertices, mesh.faces
return mesh_from_numpy(vertices, faces, None, 2, None, face_dim)
# import stl # this only loads the first part of multi-part STL files
# model = stl.mesh.Mesh.from_file(file, calculate_normals=False, )
# points = np.reshape(model.points, (-1, 3))
# vertices, indices = np.unique(points, axis=0, return_inverse=True)
# indices = np.reshape(indices, (-1, 3))
# mesh = mesh_from_numpy(vertices, indices, element_rank=2, cell_dim=face_dim)
# return mesh</code></pre>
</details>
<div class="desc"><p>Load a triangle <code><a title="phi.geom.Mesh" href="#phi.geom.Mesh">Mesh</a></code> from an STL file.</p>
<h2 id="args">Args</h2>
Expand Down Expand Up @@ -7896,6 +7913,7 @@ <h2 id="args">Args</h2>

@cached_property
def element_connectivity(self) -&gt; Tensor:
&#34;&#34;&#34;Neighbor element connectivity, excluding diagonal.&#34;&#34;&#34;
if self.element_rank == self.spatial_rank:
if is_sparse(self.face_areas):
return tensor_like(self.face_areas, True)
Expand All @@ -7904,6 +7922,8 @@ <h2 id="args">Args</h2>
else: # fallback with no boundaries
coo = to_format(self.elements, &#39;coo&#39;).numpy()
connected_elements = coo @ coo.T
connected_elements.setdiag(0)
connected_elements.eliminate_zeros()
connected_elements.data = np.ones_like(connected_elements.data)
element_connectivity = wrap(connected_elements, instance(self.elements), instance(self.elements).as_dual())
return element_connectivity
Expand Down Expand Up @@ -8315,6 +8335,7 @@ <h2 id="returns">Returns</h2>
</summary>
<pre><code class="python">@cached_property
def element_connectivity(self) -&gt; Tensor:
&#34;&#34;&#34;Neighbor element connectivity, excluding diagonal.&#34;&#34;&#34;
if self.element_rank == self.spatial_rank:
if is_sparse(self.face_areas):
return tensor_like(self.face_areas, True)
Expand All @@ -8323,11 +8344,13 @@ <h2 id="returns">Returns</h2>
else: # fallback with no boundaries
coo = to_format(self.elements, &#39;coo&#39;).numpy()
connected_elements = coo @ coo.T
connected_elements.setdiag(0)
connected_elements.eliminate_zeros()
connected_elements.data = np.ones_like(connected_elements.data)
element_connectivity = wrap(connected_elements, instance(self.elements), instance(self.elements).as_dual())
return element_connectivity</code></pre>
</details>
<div class="desc"></div>
<div class="desc"><p>Neighbor element connectivity, excluding diagonal.</p></div>
</dd>
<dt id="phi.geom.Mesh.face_areas"><code class="name">prop <span class="ident">face_areas</span> : phiml.math._tensors.Tensor</code></dt>
<dd>
Expand Down Expand Up @@ -11188,6 +11211,17 @@ <h2 id="returns">Returns</h2>
else:
raise NotImplementedError(f&#34;spatial_rank&gt;3 not supported, got {spatial_rank}&#34;)

@staticmethod
def area_from_radius(radius: Union[float, Tensor], spatial_rank: int):
if spatial_rank == 1:
return 0
elif spatial_rank == 2:
return 2*PI * radius
elif spatial_rank == 3:
return 4*PI * radius**2
else:
raise NotImplementedError(f&#34;spatial_rank&gt;3 not supported, got {spatial_rank}&#34;)

def lies_inside(self, location):
distance_squared = math.sum((location - self.center) ** 2, dim=&#39;vector&#39;)
return math.any(distance_squared &lt;= self.radius ** 2, self.shape.instance) # union for instance dimensions
Expand Down Expand Up @@ -11265,7 +11299,7 @@ <h2 id="returns">Returns</h2>

@property
def face_areas(self) -&gt; Tensor:
return math.zeros(self.face_shape)
return expand(Sphere.area_from_radius(self._radius, self.spatial_rank), instance(self) + dual(shell=1))

@property
def face_normals(self) -&gt; Tensor:
Expand All @@ -11281,7 +11315,7 @@ <h2 id="returns">Returns</h2>

@property
def face_shape(self) -&gt; Shape:
return self.shape.without(&#39;vector&#39;) &amp; dual(shell=0)
return self.shape.without(&#39;vector&#39;) &amp; dual(shell=1)

@property
def corners(self) -&gt; Tensor:
Expand All @@ -11306,6 +11340,27 @@ <h3>Ancestors</h3>
</ul>
<h3>Static methods</h3>
<dl>
<dt id="phi.geom.Sphere.area_from_radius"><code class="name flex">
<span>def <span class="ident">area_from_radius</span></span>(<span>radius: phiml.math._tensors.Tensor | float, spatial_rank: int)</span>
</code></dt>
<dd>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">@staticmethod
def area_from_radius(radius: Union[float, Tensor], spatial_rank: int):
if spatial_rank == 1:
return 0
elif spatial_rank == 2:
return 2*PI * radius
elif spatial_rank == 3:
return 4*PI * radius**2
else:
raise NotImplementedError(f&#34;spatial_rank&gt;3 not supported, got {spatial_rank}&#34;)</code></pre>
</details>
<div class="desc"></div>
</dd>
<dt id="phi.geom.Sphere.radius_from_volume"><code class="name flex">
<span>def <span class="ident">radius_from_volume</span></span>(<span>volume: phiml.math._tensors.Tensor | float, spatial_rank: int)</span>
</code></dt>
Expand Down Expand Up @@ -11421,7 +11476,7 @@ <h2 id="returns">Returns</h2>
</summary>
<pre><code class="python">@property
def face_areas(self) -&gt; Tensor:
return math.zeros(self.face_shape)</code></pre>
return expand(Sphere.area_from_radius(self._radius, self.spatial_rank), instance(self) + dual(shell=1))</code></pre>
</details>
<div class="desc"><p>Area of face connecting a pair of cells. Shape <code>(elements, ~)</code>.
Returns 0 for unconnected cells.</p></div>
Expand Down Expand Up @@ -11462,7 +11517,7 @@ <h2 id="returns">Returns</h2>
</summary>
<pre><code class="python">@property
def face_shape(self) -&gt; Shape:
return self.shape.without(&#39;vector&#39;) &amp; dual(shell=0)</code></pre>
return self.shape.without(&#39;vector&#39;) &amp; dual(shell=1)</code></pre>
</details>
<div class="desc"><h2 id="returns">Returns</h2>
<p>Full Shape to identify each face of this <code><a title="phi.geom.Geometry" href="#phi.geom.Geometry">Geometry</a></code>, including instance/spatial dimensions for the elements and dual dimensions listing the faces per element.
Expand Down Expand Up @@ -12922,6 +12977,7 @@ <h4><code><a title="phi.geom.Sphere" href="#phi.geom.Sphere">Sphere</a></code></
<ul class="">
<li><code><a title="phi.geom.Sphere.approximate_closest_surface" href="#phi.geom.Sphere.approximate_closest_surface">approximate_closest_surface</a></code></li>
<li><code><a title="phi.geom.Sphere.approximate_signed_distance" href="#phi.geom.Sphere.approximate_signed_distance">approximate_signed_distance</a></code></li>
<li><code><a title="phi.geom.Sphere.area_from_radius" href="#phi.geom.Sphere.area_from_radius">area_from_radius</a></code></li>
<li><code><a title="phi.geom.Sphere.at" href="#phi.geom.Sphere.at">at</a></code></li>
<li><code><a title="phi.geom.Sphere.boundary_elements" href="#phi.geom.Sphere.boundary_elements">boundary_elements</a></code></li>
<li><code><a title="phi.geom.Sphere.boundary_faces" href="#phi.geom.Sphere.boundary_faces">boundary_faces</a></code></li>
Expand Down
4 changes: 2 additions & 2 deletions phi/physics/fluid.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ <h2 id="returns">Returns</h2>
<p>Velocity of same type as <code>velocity</code></p></div>
</dd>
<dt id="phi.physics.fluid.boundary_push"><code class="name flex">
<span>def <span class="ident">boundary_push</span></span>(<span>particles: <function PointCloud at 0x7fedc4e3db20>,<br>obstacles: tuple,<br>separation: float = 0.5) ‑> <function PointCloud at 0x7fedc4e3db20></span>
<span>def <span class="ident">boundary_push</span></span>(<span>particles: <function PointCloud at 0x7f54fc1f9440>,<br>obstacles: tuple,<br>separation: float = 0.5) ‑> <function PointCloud at 0x7f54fc1f9440></span>
</code></dt>
<dd>
<details class="source">
Expand Down Expand Up @@ -222,7 +222,7 @@ <h2 id="returns">Returns</h2>
</dl></div>
</dd>
<dt id="phi.physics.fluid.make_incompressible"><code class="name flex">
<span>def <span class="ident">make_incompressible</span></span>(<span>velocity: phi.field._field.Field,<br>obstacles: <a title="phi.physics.fluid.Obstacle" href="#phi.physics.fluid.Obstacle">Obstacle</a> = (),<br>solve: phiml.math._optimize.Solve = auto with tolerance None (rel), None (abs), max_iterations=1000,<br>active: <function CenteredGrid at 0x7fedc4e3c9a0> = None,<br>order: int = 2,<br>correct_skew=False,<br>wide_stencil: bool = None) ‑> Tuple[phi.field._field.Field, phi.field._field.Field]</span>
<span>def <span class="ident">make_incompressible</span></span>(<span>velocity: phi.field._field.Field,<br>obstacles: <a title="phi.physics.fluid.Obstacle" href="#phi.physics.fluid.Obstacle">Obstacle</a> = (),<br>solve: phiml.math._optimize.Solve = auto with tolerance None (rel), None (abs), max_iterations=1000,<br>active: <function CenteredGrid at 0x7f54fc1f82c0> = None,<br>order: int = 2,<br>correct_skew=False,<br>wide_stencil: bool = None) ‑> Tuple[phi.field._field.Field, phi.field._field.Field]</span>
</code></dt>
<dd>
<details class="source">
Expand Down

0 comments on commit 30b73ba

Please sign in to comment.