[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Getfem-commits] [getfem-commits] branch master updated: Simplify exampl
From: |
Konstantinos Poulios |
Subject: |
[Getfem-commits] [getfem-commits] branch master updated: Simplify example script |
Date: |
Thu, 21 Mar 2024 09:20:49 -0400 |
This is an automated email from the git hooks/post-receive script.
logari81 pushed a commit to branch master
in repository getfem.
The following commit(s) were added to refs/heads/master by this push:
new 86286ae1 Simplify example script
86286ae1 is described below
commit 86286ae1de1fb43a59e564f64f9f190ca7a67933
Author: Konstantinos Poulios <logari81@gmail.com>
AuthorDate: Thu Mar 21 14:20:39 2024 +0100
Simplify example script
---
interface/tests/python/demo_laplacian.py | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/interface/tests/python/demo_laplacian.py
b/interface/tests/python/demo_laplacian.py
index 84493754..df100283 100644
--- a/interface/tests/python/demo_laplacian.py
+++ b/interface/tests/python/demo_laplacian.py
@@ -34,10 +34,8 @@ import getfem as gf
plot_result = False;
if plot_result:
- import vtk
- from matplotlib.pyplot import figure
- import matplotlib.pyplot as plt
import meshio
+ import matplotlib.pyplot as plt
from matplotlib import ticker
## Parameters
@@ -141,21 +139,21 @@ print('Error in H1 norm : ', H1error)
# Export data
sl4 = gf.Slice(("none",), mfu, 1)
-sl4.export_to_vtk('laplacian.vtk', "ascii", mfu, Ue,'Exact_solution', mfu,
U,'Computed_solution')
+sl4.export_to_vtu('laplacian.vtu', "ascii", mfu, Ue, 'Exact_solution', mfu,
U,'Computed_solution')
print('You can view the solution with (for example):')
-print('Paraview laplacian.vtk')
+print('paraview laplacian.vtu')
if plot_result:
- reader = meshio.read('laplacian.vtk')
+ reader = meshio.read('laplacian.vtu')
points = reader.points
cells = reader.cells[0].data
point_data = reader.point_data["Computed_solution"]
- fig = figure(figsize=(7, 7))
+ fig = plt.figure(figsize=(7, 7))
axes2 = fig.add_subplot(aspect="auto",projection='3d')
axes2.triplot(points[:, 0], points[:, 1], cells, color="gray")
contour = axes2.plot_trisurf(points[:, 0], points[:, 1],
- point_data[:,0], cmap="jet")
+ point_data, cmap="jet")
fig.colorbar(contour)
axes2.view_init(30, 100)
fig.tight_layout()
@@ -167,12 +165,6 @@ if plot_result:
plt.show()
-
-
-
-
-
-
if (H1error > 1e-3):
print('Error too large !')
exit(1)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Getfem-commits] [getfem-commits] branch master updated: Simplify example script,
Konstantinos Poulios <=