Skip to content

Commit

Permalink
Merge pull request #75 from btalamini/axisymmetric_functionspace_flag
Browse files Browse the repository at this point in the history
Make FunctionSpace objects aware of whether they are axisymmetric
  • Loading branch information
btalamini authored Dec 27, 2023
2 parents d23dc34 + 3aa453b commit ea24f41
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions optimism/FunctionSpace.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from optimism import Mesh


FunctionSpace = namedtuple('FunctionSpace', ['shapes', 'vols', 'shapeGrads', 'mesh', 'quadratureRule'])
FunctionSpace = namedtuple('FunctionSpace', ['shapes', 'vols', 'shapeGrads', 'mesh', 'quadratureRule', 'isAxisymmetric'])
FunctionSpace.__doc__ = \
"""Data needed for calculus on functions in the discrete function space.
Expand All @@ -29,6 +29,8 @@
mesh: The ``Mesh`` object of the domain.
quadratureRule: The ``QuadratureRule`` on which to sample the shape
functions.
isAxisymmetric: boolean indicating if the function space data are
axisymmetric.
"""

EssentialBC = namedtuple('EssentialBC', ['nodeSet', 'component'])
Expand Down Expand Up @@ -95,11 +97,13 @@ def construct_function_space_from_parent_element(mesh, shapeOnRef, quadratureRul

if mode2D == 'cartesian':
el_vols = compute_element_volumes
isAxisymmetric = False
elif mode2D == 'axisymmetric':
el_vols = compute_element_volumes_axisymmetric
isAxisymmetric = True
vols = jax.vmap(el_vols, (None, 0, None, 0, None))(mesh.coords, mesh.conns, mesh.parentElement, shapes, quadratureRule.wgauss)

return FunctionSpace(shapes, vols, shapeGrads, mesh, quadratureRule)
return FunctionSpace(shapes, vols, shapeGrads, mesh, quadratureRule, isAxisymmetric)


def map_element_shape_grads(coordField, nodeOrdinals, parentElement, shapeGradients):
Expand Down Expand Up @@ -165,7 +169,7 @@ def compute_elem_linear_shape_gradient(coordField, vol, elem):
vols = np.reshape( vols, (vols.shape[0], 1) )
vols = vols * quadratureWeights

return FunctionSpace(shapes, vols, shapeGrads, mesh, quadratureRule)
return FunctionSpace(shapes, vols, shapeGrads, mesh, quadratureRule, isAxisymmetric=False)


def default_modify_element_gradient(elemGrads, elemShapes, elemVols, elemNodalDisps, elemNodalCoords):
Expand Down

0 comments on commit ea24f41

Please sign in to comment.