Skip to content

Commit 95f47db

Browse files
committed
Prevent memory leak (yaks warning from dolfinx)
1 parent 7c2cc5b commit 95f47db

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

Dockerfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ FROM dolfinx/dolfinx:v0.7.3
55
RUN mkdir -p /home/app
66
WORKDIR /home/app
77

8-
# Copy package files
9-
COPY demo .
10-
118
# Install MDFEniCSx
129
RUN pip install git+https://github.com/niravshah241/MDFEniCSx.git
1310

demo/0_fundamental_deformation/0_fundamentals.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ def bc_side(x):
9191
ksp.getPC().setFactorSolverType("mumps")
9292
ksp.setFromOptions()
9393
ksp.solve(F, uh.vector)
94+
ksp.destroy()
95+
A.destroy()
96+
F.destroy()
9497
uh.x.scatter_forward()
9598

9699
# uh now corresponds to the displacement of each node.

mdfenicsx/mesh_motion_classes.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ def solve(self):
109109
ksp.getPC().setFactorSolverType("mumps")
110110
ksp.setFromOptions()
111111
ksp.solve(F, uh.vector)
112+
ksp.destroy()
113+
A.destroy()
114+
F.destroy()
112115
uh.x.scatter_forward()
113116
return uh
114117

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

0 commit comments

Comments
 (0)