Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/underworld3/swarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -3225,7 +3225,7 @@ def advection(
else:
substeps = 1

if True or uw.mpi.rank == 0 and self.verbose:
if uw.mpi.rank == 0 and self.verbose:
print(f"Substepping {substeps} / {abs(delta_t) / dt_limit}, {delta_t} ")

# X0 holds the particle location at the start of advection
Expand Down Expand Up @@ -3578,7 +3578,7 @@ def __init__(
# Move slightly within the chosen cell to avoid edge effects
centroid_coords = self.mesh._centroids[cellid]

shift = 0.01
shift = 0.001
coords[:, :] = (1.0 - shift) * coords[:, :] + shift * centroid_coords[:, :]

nswarm.dm.restoreField("DMSwarmPIC_coor")
Expand Down
2 changes: 1 addition & 1 deletion src/underworld3/systems/ddt.py
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ def update_pre_solve(
# is required instead.

try:
with self._workVar.mesh.access():
with self.mesh.access(self.psi_star[0]):
self.psi_star[0].data[...] = uw.function.evaluate(
self.psi_fn,
self.psi_star[0].coords,
Expand Down
18 changes: 9 additions & 9 deletions src/underworld3/visualisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def initialise(jupyter_backend):
return


def mesh_to_pv_mesh(mesh0, jupyter_backend=None):
def mesh_to_pv_mesh(mesh, jupyter_backend=None):
"""Initialise pyvista engine from existing mesh"""

# # Required in notebooks
Expand Down Expand Up @@ -57,7 +57,7 @@ def mesh_to_pv_mesh(mesh0, jupyter_backend=None):

from petsc4py import PETSc

match (mesh0.dm.isSimplex(), mesh0.dim):
match (mesh.dm.isSimplex(), mesh.dim):
case (True, 2):
vtk_cell_type = pv.cell.CellType.TRIANGLE
case (True, 3):
Expand All @@ -67,16 +67,16 @@ def mesh_to_pv_mesh(mesh0, jupyter_backend=None):
case (False, 3):
vtk_cell_type = pv.cell.CellType.HEXAHEDRON

cStart, cEnd = mesh0.dm.getHeightStratum(0)
fStart, fEnd = mesh0.dm.getHeightStratum(1)
pStart, pEnd = mesh0.dm.getDepthStratum(0)
cStart, cEnd = mesh.dm.getHeightStratum(0)
fStart, fEnd = mesh.dm.getHeightStratum(1)
pStart, pEnd = mesh.dm.getDepthStratum(0)

cell_num_points = mesh0.element.entities[mesh0.dim]
face_num_points = mesh0.element.face_entities[mesh0.dim]
cell_num_points = mesh.element.entities[mesh.dim]
face_num_points = mesh.element.face_entities[mesh.dim]

cell_points_list = []
for cell_id in range(cStart, cEnd):
cell_points = mesh0.dm.getTransitiveClosure(cell_id)[0][-cell_num_points:]
cell_points = mesh.dm.getTransitiveClosure(cell_id)[0][-cell_num_points:]
cell_points_list.append(cell_points - pStart)

cells_array = np.array(cell_points_list, dtype=int)
Expand All @@ -86,7 +86,7 @@ def mesh_to_pv_mesh(mesh0, jupyter_backend=None):
cells_array = np.hstack((cells_size, cells_array), dtype=int)

pv_mesh = pv.UnstructuredGrid(
cells_array, cells_type, coords_to_pv_coords(mesh0.data)
cells_array, cells_type, coords_to_pv_coords(mesh.data)
)

return pv_mesh
Expand Down