Skip to content

Broken FEEC projections on polar domains#576

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

Broken FEEC projections on polar domains#576
alisa-kirkinskaia wants to merge 144 commits into
develfrom
polar_splines_alisa

Conversation

@alisa-kirkinskaia

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

Copy link
Copy Markdown
Contributor

This PR introduces broken FEEC projections for C0 and C1 sequences (conga_projections.py) in 2D. The formulas for the projections can be found here on pages 19-23.

  • Added projections C0PolarProjection_V0, C0PolarProjection_V1, C0PolarProjection_V2 onto C0 sequence, and analogously onto C1 sequence.

  • dot methods of the projections are implemented for parallel execution for arbitrary domain decompositions in the angular and/or radial dimensions.

  • Added 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 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

Comment thread psydac/feec/polar/examples/poisson_2d.py Outdated
Comment thread psydac/feec/polar/examples/poisson_2d.py Outdated
Comment thread psydac/feec/polar/examples/poisson_2d.py
Comment thread psydac/feec/polar/examples/poisson_2d.py Outdated
Comment thread psydac/feec/polar/examples/maxwell_2d.py Outdated
Comment thread psydac/feec/polar/examples/maxwell_2d.py
Comment thread psydac/feec/polar/examples/maxwell_2d.py Outdated
Comment thread psydac/feec/polar/examples/maxwell_2d.py
Comment thread psydac/feec/polar/examples/maxwell_2d.py Outdated
f_with_det = lambda eta1, eta2: f_log(eta1, eta2) * np.sqrt(F.metric_det(eta1, eta2))
return derham_h.V0.integral(f_with_det)

def l2_norm_of(f_log):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why is this necessary? Can you not use mass matrices instead?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As discussed, I'll look into this next week. If no "quick" solution is found, we can keep this code as it works (and is also somewhat instructive).

Comment thread psydac/feec/polar/examples/maxwell_2d.py
Comment thread psydac/feec/polar/examples/maxwell_2d.py Outdated
Comment thread psydac/feec/polar/examples/maxwell_2d.py Outdated
Comment thread psydac/feec/polar/examples/maxwell_2d.py Outdated
Comment thread psydac/feec/polar/examples/maxwell_2d.py
Comment thread psydac/feec/polar/examples/maxwell_2d.py Outdated
Comment thread psydac/feec/polar/examples/maxwell_2d.py
Comment thread psydac/feec/polar/examples/maxwell_2d.py Outdated
from scipy.sparse.linalg import LinearOperator as SparseLinearOperator


class SparseCurlAsOperator(LinearOperator):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this class worth keeping in the library? It's only used in the maxwell_2d.py example, and I'd argue that one could remove the scipy option from that file. Either way, I think one could use a MatrixFreeLinearOperator in the example instead, for example like so:

lambda_strong = lambda x : array_to_psydac(strong_curl_sp @ x.toarray(), W2.coeff_space)

weak_curl_sp = sp_inv(M1.tosparse()) @ strong_curl_sp.T @ M2.tosparse()
lambda_weak = lambda x : array_to_psydac(weak_curl_sp @ x.toarray(), W1.coeff_space)

if scipy:
   step_faraday_2d = MatrixFreeLinearOperator(W1.coeff_space, W2.coeff_space, lambda_strong)
   step_ampere_2d = MatrixFreeLinearOperator(W2.coeff_space, W1.coeff_space, lambda_weak)

Comment thread psydac/feec/polar/conga_projections.py Outdated
Comment thread psydac/feec/polar/conga_projections.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants