Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make FunctionSpace objects aware of whether they are axisymmetric #75

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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