Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Floquet periodic boundary conditions #314

Open
wants to merge 64 commits into
base: main
Choose a base branch
from

Conversation

simlapointe
Copy link
Contributor

@simlapointe simlapointe commented Dec 13, 2024

Add support for Floquet periodic boundary conditions and improve flexibility of periodic boundary conditions specifications.

  • Support Floquet boundary conditions by incorporating the phase delay into Maxwell's equations and solving the modified PDE with periodic boundary conditions.
  • Automatically detect periodic boundary transformations.
  • Support both translation and rotation transformations.

@simlapointe simlapointe linked an issue Dec 13, 2024 that may be closed by this pull request
@simlapointe simlapointe added the enhancement New feature or request label Dec 13, 2024
@simlapointe simlapointe marked this pull request as ready for review December 31, 2024 01:55
@simlapointe simlapointe requested a review from hughcars December 31, 2024 01:55
Copy link
Collaborator

@hughcars hughcars left a comment

Choose a reason for hiding this comment

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

Looking pretty good, I think there are a few larger changes to take care of first

  1. FP should be part of K, given it has no omega dependence in its construction unlike A2. This will simplify loads of things
  2. The muinv kx should be in the MaterialOperator, (doing this neatly will mean adding the ability to use transpose coefficients in the ceed context)
  3. The geodata.cpp can be shortened and simplified some, I have some initial work on doing this in hughcars/periodic-bc, but I'm sure once you get started you'll probably see even more things to do. The basic thing is a mixing assumptions on sdim and no assumptions on sdim.

Comment on lines +554 to +555
attribute to the receiver attribute in mesh units. If neither `"Translation"` or
`"AffineTransformation"` are specified, the transformation between donor and receiver boundaries
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: neither "Translation" nor "AffineTransformation"

Comment on lines +435 to +437
eigenmode simulation type. Ignored if non-zero Floquet wave vector is specified in
[`config["Boundaries"]["Periodic"]["FloquetWaveVector"]`](boundaries.md##boundaries%5B%%22Periodic%22%5D%22FloquetWaveVector%22%5D)
or [`config["Boundaries"]["FloquetWaveVector"]`](boundaries.md##boundaries%5B%%22FloquetWaveVector%22%5D).
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is also necessary for London equations, so you'll need to reconcile this.

Comment on lines +266 to +268
distance between them is given by the `"Translation"` vector in mesh units. In `floquet.json`,
an additional `"FloquetWaveVector"` specifies the phase delay between the donor and receiver
boundaries in the X/Y/Z directions.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Given the relative simplicity of this example, it would be great if we can derive the expected modes analytically. I suspect it'll be possible to map them to an equivalent set of modes on a full length cylinder without phase shift, at which point analytic results can be compared against like for the waveguide case.

@@ -74,7 +74,7 @@ Periodic boundary conditions on an existing mesh can be specified using the
["Periodic"](../config/boundaries.md#boundaries%5B%22Periodic%22%5D) boundary keyword. This
boundary condition enforces that the solution on the specified boundaries be exactly equal,
and requires that the surface meshes on the donor and receiver boundaries be identical up to
translation. Periodicity in *Palace* is also supported through meshes generated
translation or rotation. Periodicity in *Palace* is also supported through meshes generated
Copy link
Collaborator

Choose a reason for hiding this comment

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

How have you tested the rotational case? Might make for a cool example, thinking plausibly the waveguide cylinder could be split into wedges maybe and analyzed.

Comment on lines +45 to +47

CeedOperator GetTranspose(std::size_t i) const { return op_t[i]; }

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not seeing any use of this so far, why did you need?

Comment on lines +1080 to +1094
auto trslt = it->find("Translation");
if (trslt != it->end())
{
MFEM_VERIFY(trslt->is_array(),
"\"Translation\" should specify an array in the configuration file!");
data.translation = trslt->get<std::array<double, 3>>();
}
auto trsfr = it->find("AffineTransformation");
if (trsfr != it->end())
{
MFEM_VERIFY(
trsfr->is_array(),
"\"AffineTransformation\" should specify an array in the configuration file!");
data.affine_transform = trsfr->get<std::array<double, 16>>();
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use full names for the variables.

Comment on lines 473 to 474
// Vector defining the direction and distance for this periodic boundary condition.
std::array<double, 3> translation = {0.0, 0.0, 0.0};
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can this be encoded into the affine transformation? Given it's going to overlap with the final column in terms of data. I.e. if there's a translation, set the rotation piece to identity and fill the translation in.

Comment on lines +2131 to +2151
if (translation.Norml2() > mesh_tol)
{
// Use user-provided translation.
for (int i = 0; i < 3; i++)
{
transformation(i, i) = 1.0;
transformation(i, 3) = translation[i];
}
transformation(3, 3) = 1.0;
}
else if (affine_vec.Norml2() > mesh_tol)
{
// Use user-provided affine transformation matrix.
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j++)
{
transformation(i, j) = affine_vec[i * 4 + j];
}
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

If the translation is written to the affine transformation variable in configfile.cpp, this can be shortened to

mfem::DenseMatrix transformation(4);
std::copy(data.affine_transform.begin(), data.affine_transform.end(), transformation.begin());
transformation.Transpose();
if (transformation.Norml2() == 0.0)
{
  ...

@@ -8,6 +8,7 @@
#include "fem/errorindicator.hpp"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Missing the correction on the adaptive branch.

Comment on lines +90 to +91
template class FloquetCorrSolver<Vector>;
template class FloquetCorrSolver<ComplexVector>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this ever going to be applied to a real valued case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Periodic boundary conditions
2 participants