Coder Social home page Coder Social logo

Comments (2)

colinjcotter avatar colinjcotter commented on July 25, 2024

You can do this by remapping the function to the enclosing DG space and transferring that, then remapping back to BDM.

from firedrake.

zhyxue0 avatar zhyxue0 commented on July 25, 2024

You can do this by remapping the function to the enclosing DG space and transferring that, then remapping back to BDM.

Thanks. @colinjcotter It works. But there also seemed to be new issues with reading the mesh when running in parallel on multiple cores.

Here is my code:

from firedrake import *


num_refs = 3
Lx = 2 
Ly = 2


mesh_table = []
for i in range(num_refs):

    Nx = 4*2**(i)
    Ny = Nx
    mesh_1 = RectangleMesh(Nx, Ny, Lx, Ly)
    V_1 = VectorFunctionSpace(mesh_1, "DG", 1)
    
    u_1 = Function(V_1)
 
    mesh_table.append(mesh_1)


V_DG = VectorFunctionSpace(mesh_table[0], "DG", 1)
u_2 = project(u_1, V_DG)
    

Here is the report:

Traceback (most recent call last):
  File "/home/text_1.py", line 31, in <module>
Traceback (most recent call last):
  File "/home/text_1.py", line 31, in <module>
    u_2 = project(u_1, V_DG)
  File "petsc4py/PETSc/Log.pyx", line 115, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
    u_2 = project(u_1, V_DG)
  File "petsc4py/PETSc/Log.pyx", line 115, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "petsc4py/PETSc/Log.pyx", line 116, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "petsc4py/PETSc/Log.pyx", line 116, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "/home/firedrake/firedrake/src/firedrake/firedrake/adjoint/projection.py", line 34, in wrapper
  File "/home/firedrake/firedrake/src/firedrake/firedrake/adjoint/projection.py", line 34, in wrapper
    output = project(*args, **kwargs)
  File "/home/firedrake/firedrake/src/firedrake/firedrake/projection.py", line 78, in project
    output = project(*args, **kwargs)
  File "/home/firedrake/firedrake/src/firedrake/firedrake/projection.py", line 78, in project
    use_slate_for_inverse=use_slate_for_inverse).project()
  File "/home/firedrake/firedrake/src/firedrake/firedrake/projection.py", line 181, in projecTraceback (most recent call last):
  File "/home/text_1.py", line 19, in <module>
Traceback (most recent call last):
  File "/home/text_1.py", line 19, in <module>
    u_2 = project(u_1, V_DG)
  File "petsc4py/PETSc/Log.pyx", line 115, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
    u_2 = project(u_1, V_DG)
  File "petsc4py/PETSc/Log.pyx", line 115, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "petsc4py/PETSc/Log.pyx", line 116, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "petsc4py/PETSc/Log.pyx", line 116, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "/home/firedrake/firedrake/src/firedrake/firedrake/adjoint/projection.py", line 34, in wrapper
  File "/home/firedrake/firedrake/src/firedrake/firedrake/adjoint/projection.py", line 34, in wrapper
    output = project(*args, **kwargs)
  File "/home/firedrake/firedrake/src/firedrake/firedrake/projection.py", line 78, in project
    output = project(*args, **kwargs)
  File "/home/firedrake/firedrake/src/firedrake/firedrake/projection.py", line 78, in project
    use_slate_for_inverse=use_slate_for_inverse).project()
  File "/home/firedrake/firedrake/src/firedrake/firedrake/projection.py", line 181, in project
    use_slate_for_inverse=use_slate_for_inverse).project()
  File "/home/firedrake/firedrake/src/firedrake/firedrake/projection.py", line 181, in project
    self.apply_massinv(self.target, self.rhs)
  File "/home/firedrake/firedrake/src/firedrake/firedrake/projection.py", line 240, in rhs
    self.apply_massinv(self.target, self.rhs)
  File "/home/firedrake/firedrake/src/firedrake/firedrake/projection.py", line 240, in rhs
    self.mixed_mass.mult(u, v)
  File "/home/firedrake/firedrake/src/PyOP2/pyop2/utils.py", line 62, in __get__
    self.mixed_mass.mult(u, v)
  File "/home/firedrake/firedrake/src/PyOP2/pyop2/utils.py", line 62, in __get__
    obj.__dict__[self.__name__] = result = self.fget(obj)
  File "/home/firedrake/firedrake/src/firedrake/firedrake/projection.py", line 234, in mixed_mass
    obj.__dict__[self.__name__] = result = self.fget(obj)
  File "/home/firedrake/firedrake/src/firedrake/firedrake/projection.py", line 234, in mixed_mass
    return assemble_mixed_mass_matrix(self.source.function_space(),
  File "petsc4py/PETSc/Log.pyx", line 115, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
    return assemble_mixed_mass_matrix(self.source.function_space(),
  File "petsc4py/PETSc/Log.pyx", line 115, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "petsc4py/PETSc/Log.pyx", line 116, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "petsc4py/PETSc/Log.pyx", line 116, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "/home/firedrake/firedrake/src/firedrake/firedrake/supermeshing.py", line 97, in assemble_mixed_mass_matrix
  File "/home/firedrake/firedrake/src/firedrake/firedrake/supermeshing.py", line 97, in assemble_mixed_mass_matrix
    intersections = intersection_finder(mesh_A, mesh_B)
  File "firedrake/cython/supermeshimpl.pyx", line 132, in firedrake.cython.supermeshimpl.intersection_finder
    intersections = intersection_finder(mesh_A, mesh_B)
  File "firedrake/cython/supermeshimpl.pyx", line 132, in firedrake.cython.supermeshimpl.intersection_finder
AssertionError: Whoever made mesh_B should explicitly mark mesh_A as having a compatible parallel layout.
application called MPI_Abort(PYOP2_COMM_WORLD, 1) - process 0
AssertionError: Whoever made mesh_B should explicitly mark mesh_A as having a compatible parallel layout.
application called MPI_Abort(PYOP2_COMM_WORLD, 1) - process 1

from firedrake.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.