Skip to content

Nodal point swarm not working on cubed sphere mesh #310

@bknight1

Description

@bknight1

Discussed in https://github.com/underworldcode/underworld3/discussions/307

Originally posted by chenxi-kong April 20, 2025
Hi! When I was trying to solve the advection-diffusion equation on a cubed sphere mesh (which by default is using the semi Lagrangian method), I found that the nodal point swarm can not be constructed if its tracked variable is defined on this type of mesh. This issue can be reproduced by running:

import underworld3 as uw
import numpy as np
import sympy

mesh = uw.meshing.uw.meshing.CubedSphere(
    radiusOuter=1.0,
    radiusInner=0.547,
    numElements=10,
    refinement=0,
    simplex=False,
    verbose=False,
)

t_soln = uw.discretisation.MeshVariable("T", mesh, 1, degree=3)
nswarm = uw.swarm.NodalPointSwarm(t_soln, True)

and it says:

ValueError                                Traceback (most recent call last)
Cell In[39], line 1
----> 1 nswarm = uw.swarm.NodalPointSwarm(t_soln, True)

File [~/miniconda3/envs/uw3p/lib/python3.11/site-packages/underworld3/swarm.py:2035](http://localhost:8083/home/ckong/miniconda3/envs/uw3p/lib/python3.11/site-packages/underworld3/swarm.py#line=2034), in NodalPointSwarm.__init__(self, trackedVariable, verbose)
   2032 nswarm.dm.migrate(remove_sent_points=True)
   2034 with nswarm.access(nX0, nI0):
-> 2035     nX0.data[:, :] = coords
   2036     nI0.data[:, 0] = range(0, coords.shape[0])
   2038 self._nswarm = nswarm

ValueError: could not broadcast input array from shape (50442,3) into shape (43710,3)

I am wondering if there is an problem with using semi Lagrangian method for variables on cubed sphere mesh, or it is just because I am not doing it right somewhere?

Thanks!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions