Skip to content

Commit

Permalink
added minor fix to ex23 and ex39p. Ex23 should pass with 4.7 release.…
Browse files Browse the repository at this point in the history
… 39p should generate the same file
  • Loading branch information
sshiraiwa committed Aug 6, 2024
1 parent 083cd06 commit 79341e5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
7 changes: 4 additions & 3 deletions examples/ex23.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import numpy as np
from numpy import sin, cos, exp, sqrt, pi, abs, array, floor, log, sum

mfem_version = mfem.MFEM_VERSION_MAJOR*10 + mfem.MFEM_VERSION_MINOR
mfem_version = (mfem.MFEM_VERSION_MAJOR*100 + mfem.MFEM_VERSION_MINOR*10+
mfem.MFEM_VERSION_PATCH)


def run(mesh_file="",
Expand Down Expand Up @@ -46,7 +47,7 @@ def __init__(self, fespace, ess_bdr, speed):
M.AddDomainIntegrator(mfem.MassIntegrator())
M.Assemble()

if mfem_version < 47:
if mfem_version < 471:
dummy = mfem.intArray()
self.Kmat0 = mfem.SparseMatrix()
K.FormSystemMatrix(dummy, self.Kmat0)
Expand Down Expand Up @@ -115,7 +116,7 @@ def ImplicitSolve(self, fac0, fac1, u, dudt, d2udt2):

self.T_solver.Mult(z, d2udt2)

if mfem_version >= 47:
if mfem_version >= 471:
d2udt2.SetSubVector(self.ess_tdof_list, 0.0)

def SetParameters(self, u):
Expand Down
12 changes: 7 additions & 5 deletions examples/ex39p.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
from mpi4py import MPI
num_procs = MPI.COMM_WORLD.size
myid = MPI.COMM_WORLD.rank

smyid = '.'+'{:0>6d}'.format(myid)

def run(order=1,
meshfile='',
Expand Down Expand Up @@ -254,10 +254,12 @@ def run(order=1,
# local finite element solution on each processor.
a.RecoverFEMSolution(X, b, x)

# 15. Save the refined mesh and the solution in parallel. This output can
# be viewed later using GLVis: "glvis -np <np> -m mesh -g sol".
pmesh.Save('mesh')
x.Save('sol')
# 15. Save the refined mesh and the solution in parallel.
# This output can be viewed later using GLVis: "glvis -np <np> -m mesh -g sol".
#
# Python note: In Python, suffix based on myid needs to be added explicitly.
pmesh.Print('mesh'+smyid)
x.Save('sol'+smyid)

# 16. Send the solution by socket to a GLVis server.
if visualization:
Expand Down

0 comments on commit 79341e5

Please sign in to comment.