Skip to content

Broken FEEC projections on polar domains - #576

Open
alisa-kirkinskaia wants to merge 210 commits into
develfrom
polar_splines_alisa
Open

alisa-kirkinskaia wants to merge 210 commits into
develfrom
polar_splines_alisa

Conversation

@alisa-kirkinskaia

@alisa-kirkinskaia alisa-kirkinskaia commented Feb 18, 2026

Copy link
Copy Markdown
Member

This PR implements broken FEEC projections for the $C^0$ and $C^1$ sequences in 2D (conga_projections.py). The formulas for the projections can be found on pages 19-23 of the arXiv preprint https://arxiv.org/pdf/2505.15996.

Main additions

Broken FEEC polar projections

  • Create new module psydac.feec.polar.conga_projections.
  • Add LinearOperator subclasses C0PolarProjection_V0/1/2 acting on the coefficients of scalar- or vector-valued tensor-product splines defined on the logical domain. The tensor-product splines are projected onto the subspaces $\{V_h^0, V_h^1, V_h^2\}$ of pre-polar 0/1/2-form splines with $C^0$ smoothness after the push-forward.u
  • Add LinearOperator subclasses C1PolarProjection_U0/1/2 acting on the coefficients of scalar- or vector-valued tensor-product splines defined on the logical domain. The tensor-product splines are projected onto the subspaces $\{U_h^0, U_h^1, U_h^2\}$ of pre-polar 0/1/2-form splines with $C^1$ smoothness after the push-forward.
  • Make sure that the dot methods of the new projection operators correctly execute in parallel for arbitrary domain decompositions in both the angular and radial dimensions.

Tests

  • Add unit tests for the projections checking:
    • the projection property P(P(x)) = P(x)
    • tosparse methods against reference matrix operators
    • consistency between dot and tosparse methods

Poisson and Maxwell examples

  • Add 2D Poisson example in script psydac/feec/polar/examples/poisson_2d.py for solving manufactured Poisson problems on polar mapped domains. The script supports disk, target, and Czarny domains, analytical or spline mappings, and different treatments of the polar singularity (polar-spec, polar-std, C0conga, and C1conga).
  • Add time-dependent 2D Maxwell example for TE (transverse electric) wave in script psydac/feec/polar/examples/maxwell_2d.py. The script provides two field configurations defined in psydac/feec/polar/examples/analytical_solutions.py:
    • CircularCavitySolution: Time-harmonic solution of Maxwell's equations in a disk-like domain with
      perfectly conducting walls
    • GaussianInitialCondition: localized rotational Gaussian initial condition for the electric field, with the magnetic field initialized from $B_z = \mathrm{curl} E$

Further changes

  • Use latest version of Igakit (commit dalcinl/igakit@92ee097 of 2026/07/24) which supports NumPy >= 2.4
  • Use SymPDE version 0.19.3 which fixes a bug in the linearity checks
  • Fix a bug in eval_field and eval_field_gradient of TensorFemSpace related to floating point round-off at MPI subdomain boundaries. Add a unit test in psydac/fem/tests/test_eval_fields_parallel.py

Additional info

  • Poisson example
    Example of run: mpirun -n 2 python poisson_2d.py -S -n 16 24 -d 2 2 -t disk -D 0.2 -m 'C0conga'
    Exact solution, approximate solution and error plot:
Screenshot 2026-03-24 at 09 32 20
  • TE Maxwell example
    Example of run: mpirun -n 2 python maxwell_2d.py -S -n 16 20 -d 2 2 -T 1 -D 0.2 -s 1
    Plot of exact solution and approximate solution at final time T = 1:
Screenshot 2026-03-24 at 09 50 04

TODO

  • Add missing class C1PolarProjection_V2 and test it
  • Rename C1PolarProjection_V0/1/2 to C1PolarProjection_U0/1/2 (i.e. replace V with U)
  • Put analytical solutions in a single module (instead of two) given the amount of duplicated code
  • Mention analytical solutions in PR description
  • Speed up help messages in example scripts
  • Reduce size of output figures so that they fit on a laptop screen
  • Provide utility function(s) to handle parallel scripts
  • Collect MPI utilities in a single module
  • Address TODOs in Maxwell script
  • Replace sympy.lambdify with pyccel.lambdify
  • Add license header to all new files
  • Investigate crash when running maxwell_2d.py in parallel for a certain combination of degree and ncells
  • Savage main function in waveTE.py
  • Update PR description
  • Update CHANGELOG.md

@alisa-kirkinskaia
alisa-kirkinskaia marked this pull request as draft August 18, 2026 14:40
@alisa-kirkinskaia
alisa-kirkinskaia marked this pull request as ready for review August 18, 2026 14:40
@alisa-kirkinskaia
alisa-kirkinskaia marked this pull request as draft August 18, 2026 15:03
@alisa-kirkinskaia
alisa-kirkinskaia marked this pull request as ready for review August 18, 2026 15:03
The folder 'subprojects/igakit' was accidentally deleted in commit
c51b81b
@yguclu
yguclu marked this pull request as draft August 19, 2026 15:08
@yguclu
yguclu marked this pull request as ready for review August 19, 2026 15:08
@alisa-kirkinskaia
alisa-kirkinskaia marked this pull request as draft August 20, 2026 10:16
@alisa-kirkinskaia
alisa-kirkinskaia marked this pull request as ready for review August 20, 2026 10:16

@yguclu yguclu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job addressing my previous review comments, @alisa-kirkinskaia!

I have gone through the whole PR once again

Comment thread psydac/feec/polar/examples/polar_model_2d.py
Comment thread psydac/feec/polar/examples/polar_model_2d.py Outdated
Comment thread psydac/feec/polar/examples/utils_congapol.py
Comment thread psydac/feec/polar/examples/utils_congapol.py
Comment thread psydac/feec/polar/examples/utils_congapol.py
Comment on lines +956 to +958
@property
def T(self):
return self.transpose()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The base class LinearOperator already provides an identical implementation for this property. Hence, there is no reason to repeat it here

Comment on lines +1017 to +1024
Parameters:
-----------

W1 : VectorFemSpace (former ProductFemSpace)
Full tensor product spline space of the 1-forms S^{p1-1, p2} x S^{p1, p2-1}

transposed : Boolean
Switch between P1 and P1 transposed (default is False)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As in a previous comment

Suggested change
Parameters:
-----------
W1 : VectorFemSpace (former ProductFemSpace)
Full tensor product spline space of the 1-forms S^{p1-1, p2} x S^{p1, p2-1}
transposed : Boolean
Switch between P1 and P1 transposed (default is False)
Parameters:
-----------
W1 : VectorFemSpace
Full tensor product spline space of 1-forms S^{p1-1, p2} x S^{p1, p2-1}.
transposed : bool, default=False
Switch between P1 and P1 transposed.

Comment on lines +1123 to +1125
@property
def T(self):
return self.transpose()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The base class LinearOperator already provides an identical implementation for this property. Hence, there is no reason to repeat it here

Comment on lines +1181 to +1194
Parameters:
-----------

W1 : VectorFemSpace (ProductFemSpace)
Full tensor product spline space of the 1-forms S^{p1-1, p2} x S^{p1, p2-1}

transposed : Boolean
Switch between P1 and P1 transposed (default is False)

hbc : Boolean
Switch on and off the imposition of homogeneous Dirichlet boundary
conditions on the tangential (angular) direction (default is False)
"""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See a previous comment about ProductFemSpace. Further, I believe that the homogeneous Dirichlet BCs are imposed along the radial direction for the tangential component of the field. Is that right?

Suggested change
Parameters:
-----------
W1 : VectorFemSpace (ProductFemSpace)
Full tensor product spline space of the 1-forms S^{p1-1, p2} x S^{p1, p2-1}
transposed : Boolean
Switch between P1 and P1 transposed (default is False)
hbc : Boolean
Switch on and off the imposition of homogeneous Dirichlet boundary
conditions on the tangential (angular) direction (default is False)
"""
Parameters:
-----------
W1 : VectorFemSpace
Full tensor product spline space of 1-forms S^{p1-1, p2} x S^{p1, p2-1}.
transposed : bool, default=False
Switch between P1 and P1 transposed.
hbc : bool, default=False
If True, impose homogeneous Dirichlet boundary conditions on the
tangential (angular) component of the field.
"""

Comment on lines +1223 to +1232
Parameters:
-----------

W2 : TensorFemSpace
Full tensor product spline space of the 2-forms S^{p1-1, p2-1}

transposed : Boolean
Switch between P2 and P2 transposed (default is False)
"""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Parameters:
-----------
W2 : TensorFemSpace
Full tensor product spline space of the 2-forms S^{p1-1, p2-1}
transposed : Boolean
Switch between P2 and P2 transposed (default is False)
"""
Parameters:
-----------
W2 : TensorFemSpace
Full tensor product spline space of 2-forms S^{p1-1, p2-1}.
transposed : bool, default=False
Switch between P2 and P2 transposed.
"""

@yguclu yguclu added the Next Release Must be in next release label Sep 9, 2026

@yguclu yguclu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the latest changes @alisa-kirkinskaia!


Attributes
----------
logical_bounds : tuple

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If these are tuples of Python floats:

Suggested change
logical_bounds : tuple
logical_bounds : tuple[tuple[float, ...], ...]

Comment on lines +24 to +26
mapping : sympde.topology.mapping.Mapping
Mapping used by the solver. It is either the analytical mapping or
its spline approximation. Initialized by calling ``build_geometry``.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the PSYDAC class SplineMapping currently subclass the SymPDE class Mapping? @campospinto

Comment on lines +24 to +33
mapping : sympde.topology.mapping.Mapping
Mapping used by the solver. It is either the analytical mapping or
its spline approximation. Initialized by calling ``build_geometry``.

analytical_mapping : sympde.topology.mapping.Mapping
Original analytical mapping from the logical to the physical domain.

domain : sympde.topology.Domain
Physical domain associated with ``mapping``. Initialized by
calling ``build_geometry``.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the double tick marks around build_geometry and mapping really needed? I would expect single ticks to be sufficient

:code
$(\partial^2_{xx} + \partial^2_{yy}) \phi(x,y) = -\rho(x,y)$

"""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent, thanks! Could you please mention the new module psydac.utilities.operators in the file CHANGELOG.md?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you checked that this script still runs after removing the local class Laplacian? I think you are missing an import statement

----------
solution_name : str
Name of the analytical solution to visualize.
Must be either ``cavity`` or ``gaussian``.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are double tick marks needed for generating the documentation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Next Release Must be in next release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants