Skip to content

Commit

Permalink
Prevent memory leak (yaks warning from dolfinx)
Browse files Browse the repository at this point in the history
  • Loading branch information
niravshah241 committed Aug 30, 2024
1 parent 7c2cc5b commit 95f47db
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 0 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ FROM dolfinx/dolfinx:v0.7.3
RUN mkdir -p /home/app
WORKDIR /home/app

# Copy package files
COPY demo .

# Install MDFEniCSx
RUN pip install git+https://github.com/niravshah241/MDFEniCSx.git

Expand Down
3 changes: 3 additions & 0 deletions demo/0_fundamental_deformation/0_fundamentals.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ def bc_side(x):
ksp.getPC().setFactorSolverType("mumps")
ksp.setFromOptions()
ksp.solve(F, uh.vector)
ksp.destroy()
A.destroy()
F.destroy()
uh.x.scatter_forward()

# uh now corresponds to the displacement of each node.
Expand Down
5 changes: 4 additions & 1 deletion mdfenicsx/mesh_motion_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ def solve(self):
ksp.getPC().setFactorSolverType("mumps")
ksp.setFromOptions()
ksp.solve(F, uh.vector)
ksp.destroy()
A.destroy()
F.destroy()
uh.x.scatter_forward()
return uh

Expand Down Expand Up @@ -166,7 +169,7 @@ def sigma(self, u_func):
("DG", 0))
# Function for Lam\'e parameter lambda = E / (2 * (1 + \nu))
lambda_ = dolfinx.fem.Function(material_function_space)
# Function for Lam\'e parameter mu = (E * \nu) / ((1-2*\nu) * (1+\nu))
# Function for Lam\'e parameter mu_ = (E * \nu) / ((1-2*\nu) * (1+\nu))
mu_ = dolfinx.fem.Function(material_function_space)
# Assemble discontinuous material property functions
for i in range(len(self._young_modulus_list)):
Expand Down

0 comments on commit 95f47db

Please sign in to comment.