kumiori / irrevolutions

Computing Irreversible Evolutions
GNU General Public License v3.0
11 stars 5 forks source link

Rayleigh ratio test #62

Closed jorgensd closed 4 weeks ago

jorgensd commented 1 month ago

Ref: https://github.com/openjournals/joss-reviews/issues/6897

Looking through the test_rayleigh.py code, one thing springs to mind: R is computed as R = assemble_scalar(form(numerator)) / assemble_scalar(form(denominator))

However, this is not going to be consistent in parallel, as you would need something along the lines of


def parallel_assemble_scalar(ufl_form):
      compiled_form = dolfinx.fem.form(ufl_form)
      comm = compiled_form.mesh.comm
      local_scalar = dolfinx.fem.assemble_scalar(compiled_form)
      return comm.allreduce(local_scalar, op=MPI.SUM)

and then the aforementioned call would be R= parallel_assemble_scalar(numerator)/parallel_assemble_scalar(denominator)

jorgensd commented 1 month ago

Same note for R_support

kumiori commented 4 weeks ago

Thank you for pointing out and providing the snippet. We have implemented the changes, all the collected tests passed.