Skip to content

Commit

Permalink
Deploying to gh-pages from @ 1a3720d 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
holl- committed Dec 6, 2024
1 parent 484244a commit 62d0a54
Show file tree
Hide file tree
Showing 21 changed files with 194 additions and 191 deletions.
108 changes: 54 additions & 54 deletions Cookbook.html

Large diffs are not rendered by default.

82 changes: 41 additions & 41 deletions FLIP.html

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions Fluid_Simulation.html

Large diffs are not rendered by default.

14 changes: 7 additions & 7 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"> 1354</span> results<span style="color: rgb(98,98,98)">.</span>append(f_output)
<span class="ansi-green-intense-fg ansi-bold"> 1355</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.7/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>
File <span class="ansi-green-fg">/opt/hostedtoolcache/Python/3.12.7/x64/lib/python3.12/site-packages/phi/geom/_mesh.py:488</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"> 474</span> <span style="color: rgb(175,0,0)">&#34;&#34;&#34;</span>
<span class="ansi-green-intense-fg ansi-bold"> 475</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"> 476</span>
<span class="ansi-green-fg"> (...)</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-green-intense-fg ansi-bold"> 485</span> <span style="color: rgb(175,0,0)"> `Mesh`</span>
<span class="ansi-green-intense-fg ansi-bold"> 486</span> <span style="color: rgb(175,0,0)">&#34;&#34;&#34;</span>
<span class="ansi-green-intense-fg ansi-bold"> 487</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; 488</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"> 489</span> mesh <span style="color: rgb(98,98,98)">=</span> import_from_file(file_or_mesh)
<span class="ansi-green-intense-fg ansi-bold"> 490</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.8061959147453308,
0.5076926350593567,
0.6010867357254028,
0.8142030835151672
0.2324673980474472,
0.016804978251457214,
0.7554008960723877,
0.01973273791372776
]
},
"__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.8061959147453308
"smoothness": 0.2324673980474472
}
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.5076926350593567
"smoothness": 0.016804978251457214
}
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.6010867357254028
"smoothness": 0.7554008960723877
}
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.8142030835151672
"smoothness": 0.01973273791372776
}
2 changes: 1 addition & 1 deletion phi/field/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,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 0x7f97b02a3380></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 0x7f1a98492700></span>
</code></dt>
<dd>
<div class="desc"><p>Computes the divergence of a grid using finite differences.</p>
Expand Down
61 changes: 32 additions & 29 deletions phi/geom/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ <h2 id="returns">Returns</h2>
<p>Rotated <code><a title="phi.geom.Geometry" href="#phi.geom.Geometry">Geometry</a></code></p></div>
</dd>
<dt id="phi.geom.stack"><code class="name flex">
<span>def <span class="ident">stack</span></span>(<span>values: Sequence[~PhiTreeNodeType] | Dict[str, ~PhiTreeNodeType],<br>dim: phiml.math._shape.Shape | str,<br>expand_values=False,<br>simplify=False,<br>**kwargs) ‑> ~PhiTreeNodeType</span>
<span>def <span class="ident">stack</span></span>(<span>values: Sequence[~PhiTreeNodeType] | Dict[str, ~PhiTreeNodeType],<br>dim: phiml.math._shape.Shape | str,<br>expand_values=False,<br>simplify=False,<br>layout_non_matching=False,<br>**kwargs) ‑> ~PhiTreeNodeType</span>
</code></dt>
<dd>
<div class="desc"><p>Stacks <code>values</code> along the new dimension <code>dim</code>.
Expand All @@ -742,6 +742,8 @@ <h2 id="args">Args</h2>
If <code>False</code>, this may return a non-numeric object instead.</dd>
<dt><strong><code>simplify</code></strong></dt>
<dd>If <code>True</code> and all values are equal, returns one value without adding the dimension.</dd>
<dt><strong><code>layout_non_matching</code></strong></dt>
<dd>If non-matching values should be stacked using a Layout object, i.e. should be put into a named list instead.</dd>
<dt><strong><code>**kwargs</code></strong></dt>
<dd>Additional keyword arguments required by specific implementations.
Adding spatial dimensions to fields requires the <code>bounds: Box</code> argument specifying the physical extent of the new dimensions.
Expand Down Expand Up @@ -948,6 +950,8 @@ <h2 class="section-title" id="header-classes">Classes</h2>
max_sgn_dist = math.max(sgn_surf_delta, &#39;vector&#39;)
normal_axis = max_sgn_dist == sgn_surf_delta # ToDo only one if inside
normal = math.vec_normalize(normal_axis * math.sign(loc_to_center))
if self.rotation_matrix is not None:
normal = rotate(normal, self.rotation_matrix)
surf_to_center = math.where(normal_axis, math.sign(loc_to_center) * self.half_size, loc_to_center)
closest_to_center = math.clip(surf_to_center, -self.half_size, self.half_size)
surface_pos = self.local_to_global(closest_to_center, scale=False, origin=&#39;center&#39;)
Expand Down Expand Up @@ -1884,7 +1888,7 @@ <h2 id="args">Args</h2>
if &#39;vector&#39; not in center.shape or center.shape.get_item_names(&#39;vector&#39;) is None:
center = math.expand(center, channel(self._half_size))
self._center = center
self._rotation_matrix = None if rotation is None else rotation_matrix(rotation)
self._rotation_matrix = None if rotation is None else rotation_matrix(rotation, matrix_dim=center.shape[&#39;vector&#39;])
self._size_variable = size_variable

def __repr__(self):
Expand Down Expand Up @@ -2285,7 +2289,7 @@ <h2 id="returns">Returns</h2>
if self.rotation is not None:
tip = abs(self.up) * .5 * self.depth
return tip + self.radius * sqrt(maximum(epsilon, 1 - self.up**2))
return ncat([.5*self.depth, expand(self.radius, channel(vector=self.radial_axes))], self._center.shape[&#39;vector&#39;])
return ncat([.5*self.depth, expand(self.radius, channel(vector=self.radial_axes))], self._center.shape[&#39;vector&#39;], expand_values=True)

def at(self, center: Tensor) -&gt; &#39;Geometry&#39;:
return Cylinder(center, self.radius, self.depth, self.rotation, self.axis, self.variable_attrs, self.value_attrs)
Expand Down Expand Up @@ -5277,15 +5281,13 @@ <h2 id="args">Args</h2>

@cached_property
def _faces(self) -&gt; Dict[str, Any]:
if self.element_rank == 2:
centers, normals, areas, boundary_slices = build_faces(self.vertices.center, self.elements, self.boundaries, self.element_rank, self.periodic, self._vertex_mean, self.face_format)
return {
&#39;center&#39;: centers,
&#39;normal&#39;: normals,
&#39;area&#39;: areas,
&#39;boundary_slices&#39;: boundary_slices,
}
return None
centers, normals, areas, boundary_slices = build_faces(self.vertices.center, self.elements, self.boundaries, self.element_rank, self.periodic, self._vertex_mean, self.face_format)
return {
&#39;center&#39;: centers,
&#39;normal&#39;: normals,
&#39;area&#39;: areas,
&#39;boundary_slices&#39;: boundary_slices,
}

@property
def face_shape(self) -&gt; Shape:
Expand Down Expand Up @@ -5380,7 +5382,8 @@ <h2 id="args">Args</h2>
@cached_property
def _cell_deltas(self):
bounds = bounding_box(self.vertices)
is_periodic = dim_mask(self.vector.item_names, self.periodic)
periodic = {dim[:-len(&#39;[::-1]&#39;)] if dim.endswith(&#39;[::-1]&#39;) else dim: dim.endswith(&#39;[::-1]&#39;) for dim in self.periodic}
is_periodic = dim_mask(self.vector.item_names, tuple(periodic))
return pairwise_distances(self.center, format=self.cell_connectivity, periodic=is_periodic, domain=(bounds.lower, bounds.upper))

@cached_property
Expand Down Expand Up @@ -5483,11 +5486,13 @@ <h2 id="args">Args</h2>

@property
def volume(self) -&gt; Tensor:
if isinstance(self.elements, CompactSparseTensor) and self.element_rank == 2:
if instance(self.vertices).volume &gt; 0:
A, B, C, *_ = unstack(self.vertices.center[self.elements._indices], dual)
cross_area = vec_length(cross(B - A, C - A))
fac = {3: 0.5, 4: 1}[dual(self.elements._indices).size] # tri, quad, ...
if self.element_rank == 2:
if instance(self.elements).volume &gt; 0:
three_vertices = nonzero(self.elements, 3, list_dims=dual)
v1, v2, v3 = unstack(self.vertices.center[{instance: three_vertices}], dual)
cross_area = vec_length(cross(v2-v1, v3-v1))
vertex_count = math.sum(self.elements, dual)
fac = where(vertex_count == 3, 0.5, 1) # tri, quad, ...
return fac * cross_area
else:
return zeros(instance(self.vertices)) # empty mesh
Expand All @@ -5502,9 +5507,7 @@ <h2 id="args">Args</h2>
&#34;&#34;&#34;Extrinsic element normal space. This is a 0D vector for solid elements and 1D for surface elements.&#34;&#34;&#34;
if self.element_rank == 2:
three_vertices = nonzero(self.elements, 3, list_dims=dual)
corners = self.vertices.center[{instance: three_vertices}]
assert dual(corners).size == 3, f&#34;signed distance currently only supports triangles&#34;
v1, v2, v3 = unstack(corners, dual)
v1, v2, v3 = unstack(self.vertices.center[{instance: three_vertices}], dual)
return vec_normalize(cross(v2 - v1, v3 - v1))
raise NotImplementedError

Expand Down Expand Up @@ -6206,9 +6209,7 @@ <h2 id="returns">Returns</h2>
&#34;&#34;&#34;Extrinsic element normal space. This is a 0D vector for solid elements and 1D for surface elements.&#34;&#34;&#34;
if self.element_rank == 2:
three_vertices = nonzero(self.elements, 3, list_dims=dual)
corners = self.vertices.center[{instance: three_vertices}]
assert dual(corners).size == 3, f&#34;signed distance currently only supports triangles&#34;
v1, v2, v3 = unstack(corners, dual)
v1, v2, v3 = unstack(self.vertices.center[{instance: three_vertices}], dual)
return vec_normalize(cross(v2 - v1, v3 - v1))
raise NotImplementedError</code></pre>
</details>
Expand Down Expand Up @@ -6405,11 +6406,13 @@ <h2 id="returns">Returns</h2>
</summary>
<pre><code class="python">@property
def volume(self) -&gt; Tensor:
if isinstance(self.elements, CompactSparseTensor) and self.element_rank == 2:
if instance(self.vertices).volume &gt; 0:
A, B, C, *_ = unstack(self.vertices.center[self.elements._indices], dual)
cross_area = vec_length(cross(B - A, C - A))
fac = {3: 0.5, 4: 1}[dual(self.elements._indices).size] # tri, quad, ...
if self.element_rank == 2:
if instance(self.elements).volume &gt; 0:
three_vertices = nonzero(self.elements, 3, list_dims=dual)
v1, v2, v3 = unstack(self.vertices.center[{instance: three_vertices}], dual)
cross_area = vec_length(cross(v2-v1, v3-v1))
vertex_count = math.sum(self.elements, dual)
fac = where(vertex_count == 3, 0.5, 1) # tri, quad, ...
return fac * cross_area
else:
return zeros(instance(self.vertices)) # empty mesh
Expand Down
4 changes: 2 additions & 2 deletions phi/physics/fluid.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,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 0x7f97b032c540>,<br>obstacles: tuple,<br>separation: float = 0.5) ‑> <function PointCloud at 0x7f97b032c540></span>
<span>def <span class="ident">boundary_push</span></span>(<span>particles: <function PointCloud at 0x7f1a98493880>,<br>obstacles: tuple,<br>separation: float = 0.5) ‑> <function PointCloud at 0x7f1a98493880></span>
</code></dt>
<dd>
<div class="desc"><p>Enforces boundary conditions by correcting possible errors of the advection step and shifting particles out of
Expand Down Expand Up @@ -104,7 +104,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 0x7f97b02a3380> = 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 0x7f1a98492700> = 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>
<div class="desc"><p>Projects the given velocity field by solving for the pressure and subtracting its spatial_gradient.</p>
Expand Down

0 comments on commit 62d0a54

Please sign in to comment.