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

Test Stokes Identities #108

Merged
merged 3 commits into from
Sep 28, 2021
Merged
Show file tree
Hide file tree
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
5 changes: 1 addition & 4 deletions pytential/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,8 @@ def norm(discr, x, p=2):
if isinstance(x, MultiVector):
x = x.as_vector(object)

from meshmode.dof_array import DOFArray
num_components = None
if (isinstance(x, np.ndarray)
and x.dtype.char == "O"
and not isinstance(x, DOFArray)):
if isinstance(x, np.ndarray) and x.dtype.char == "O":
num_components, = x.shape

if p == 2:
Expand Down
11 changes: 11 additions & 0 deletions pytential/symbolic/primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,17 @@ def h_max(ambient_dim, dim=None, dofdesc=None):
cse_scope.DISCRETIZATION)


def h_min(ambient_dim, dim=None, dofdesc=None):
"""Yields an approximate minimum element size in the discretization."""

dofdesc = as_dofdesc(dofdesc).copy(granularity=GRANULARITY_ELEMENT)
r = _quad_resolution(ambient_dim, dim=dim, dofdesc=dofdesc)

return cse(NodeMin(r),
"h_min",
cse_scope.DISCRETIZATION)


def weights_and_area_elements(ambient_dim, dim=None, dofdesc=None):
"""Combines :func:`area_element` and :class:`QWeight`."""

Expand Down
31 changes: 28 additions & 3 deletions test/extra_int_eq_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,16 @@ class CircleTestCase(EllipseTestCase):
aspect_ratio = 1.0
radius = 1.0


class StarfishTestCase(CurveTestCase):
name = "starfish"
narms = 5
amplitude = 0.25

def _curve_fn(self, t):
from meshmode.mesh.generation import NArmedStarfish
return NArmedStarfish(self.narms, self.amplitude)(t)

# }}}


Expand Down Expand Up @@ -356,17 +366,32 @@ class SphereTestCase(IntegralEquationTestCase):

# test case
resolutions = [1, 2]
inner_radius = 0.4
outer_radius = 5.0
check_gradient = False
check_tangential_deriv = False

radius = 1.0
inner_radius = 0.4
outer_radius = 5.0

def get_mesh(self, resolution, mesh_order):
from meshmode.mesh.generation import generate_sphere
return generate_sphere(1.0, mesh_order,
return generate_sphere(self.radius, mesh_order,
uniform_refinement_rounds=resolution)


class SpheroidTestCase(SphereTestCase):
name = "spheroid"
aspect_ratio = 2.0

def get_mesh(self, resolution, mesh_order):
mesh = super().get_mesh(resolution, mesh_order)

from meshmode.mesh.processing import affine_map
return affine_map(mesh, A=np.diag([
self.radius, self.radius, self.radius / self.aspect_ratio,
]))


class TorusTestCase(IntegralEquationTestCase):
ambient_dim = 3
name = "torus"
Expand Down
Loading