Skip to content

Commit

Permalink
ABC type class
Browse files Browse the repository at this point in the history
  • Loading branch information
niravshah241 committed Jan 30, 2024
1 parent f1d3617 commit 17ca322
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions mdfenicsx/mesh_motion_classes.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import dolfinx
from dolfinx.fem.petsc import *
from dolfinx.fem.petsc import apply_lifting, assemble_matrix, \
assemble_vector, set_bc
import ufl

from mpi4py import MPI
import numpy as np
from petsc4py import PETSc

from abc import abstractmethod
from abc import ABC, abstractmethod


class MeshDeformation(object):
class MeshDeformation(ABC):
def __init__(self, mesh, boundaries, bc_markers_list, bc_function_list,
reset_reference=False, is_deformation=True):
'''
Expand Down Expand Up @@ -93,13 +94,13 @@ def solve(self):
bcs = self.assemble_bcs()
a_form = self.bilinear_form()
l_form = self.linear_form()
A = dolfinx.fem.petsc.assemble_matrix(a_form, bcs=bcs)
A = assemble_matrix(a_form, bcs=bcs)
A.assemble()
F = dolfinx.fem.petsc.assemble_vector(l_form)
dolfinx.fem.petsc.apply_lifting(F, [a_form], [bcs])
F = assemble_vector(l_form)
apply_lifting(F, [a_form], [bcs])
F.ghostUpdate(addv=PETSc.InsertMode.ADD,
mode=PETSc.ScatterMode.REVERSE)
dolfinx.fem.petsc.set_bc(F, bcs)
set_bc(F, bcs)
ksp = PETSc.KSP()
ksp.create(self._mesh.comm)
ksp.setOperators(A)
Expand Down

0 comments on commit 17ca322

Please sign in to comment.