Skip to content

What is the recommended PETSc way to project a field from one DMPlex to another (same bounding box)? #6

@gthyagi

Description

@gthyagi

Hi @knepley,

I'm trying to project a field from one DMPlex to another using PETSc within Underworld3. Both meshes cover the same bounding box, but have different resolutions.

Here's a minimal example:

import underworld3 as uw

# Mesh bounding box
minX, minY, minZ = 0., 0., -40.
maxX, maxY, maxZ = 150., 150., 0.

# Create first mesh (coarser)
mesh_1 = uw.meshing.UnstructuredSimplexBox(minCoords=(minX, minY, minZ), 
                                           maxCoords=(maxX, maxY, maxZ),
                                           cellSize=16)

v_soln_1 = uw.discretisation.MeshVariable('V', mesh_1, mesh_1.data.shape[1], degree=2)

# Assign values
with mesh_1.access(v_soln_1):
    v_soln_1.data[...] = 1.

# Create second mesh (finer)
mesh_2 = uw.meshing.UnstructuredSimplexBox(minCoords=(minX, minY, minZ), 
                                           maxCoords=(maxX, maxY, maxZ),
                                           cellSize=10)

v_soln_2 = uw.discretisation.MeshVariable('V', mesh_2, mesh_2.data.shape[1], degree=2)

# Question: How do I project v_soln_1 to v_soln_2?

What is the recommended PETSc approach to project v_soln_1 onto mesh_2's v_soln_2, assuming the meshes have the same bounding box?

Thanks!
Thyagi

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions