awslabs / palace

3D finite element solver for computational electromagnetics
https://awslabs.github.io/palace/dev
Apache License 2.0
246 stars 50 forks source link

Simulation of bent / non-planar Geometries #276

Closed nico-arnold closed 3 months ago

nico-arnold commented 3 months ago

Hey,

I need to simulate the RF parameters of bent circuits. I just started palace with the model depicted here (a coplanar waveguide with 2 ports on each end for excitation / measurement), but palace won't start because of the following error:

Verification failed: (bounding_box.planar) is false: --> Boundary elements must be coplanar to define a uniform lumped element! ... in function: palace::UniformElementData::UniformElementData(const std::array<double, 3>&, const mfem::Array<int>&, const mfem::ParMesh&) ... in file: /tmp/root/spack-stage/spack-stage-palace-0.13.0-i5ftsdnmoqoe5jmrsxt3w7ic2vdndov3/spack-src/palace/fem/lumpedelement.cpp:23

As it seems, this error only appears for the bounding box and not the ports. Would it be possible to simulate that model even with the conductor, substrate and ports being bent?

For clarity: This model was created by geometric transformation of a planar model I used before for experimentation that worked pretty well. For bending purposes, ALL coordinates were transformed, including the ones of the air cube and its boundary surface (the radiation boundary) as seen it picture 2. It should be possible to re-generate the whole model inside a fitting box that is completely coplanar; but as this involves some work, I want to make sure if it's possible to simulate bent models or if your work is (maybe after modification) usable just for flat geometries.

Thanks a lot in advance and have a great day! (:

Without air layer + radiation boundary: image

With air layer + radiation boundary: image

Planar model: image

JSON file: (Parameters and coordinates here are not adjusted yet)

{
  "Problem":
  {
    "Type": "Driven",
    "Verbose": 2,
    "Output": "postpro/nognd_flat"
  },
  "Model":
  {
    "Mesh": "Mesh_Bent_Short_Fine.msh",
    "L0": 1.0e-6,  // μm
    "Refinement": {}
  },
  "Domains":
  {
    "Materials":
    [
      {
        "Attributes": [1],  // Air
        "Permeability": 1.0,
        "Permittivity": 1.0,
        "LossTan": 0.0
      },
      {
        "Attributes": [2],  // Polyimide
        "Permeability": [0.99999975, 0.99999975, 0.99999979],
        "Permittivity": [9.3, 9.3, 11.5],
        "LossTan": [3.0e-5, 3.0e-5, 8.6e-5],
        "MaterialAxes": [[0.8, 0.6, 0.0], [-0.6, 0.8, 0.0], [0.0, 0.0, 1.0]]
      }
    ],
    "Postprocessing":
    {
      "Energy":
      [
        {
          "Index": 1,
          "Attributes": [2]
        }
      ]
    }
  },
  "Boundaries":
  {
    "PEC":
    {
      "Attributes": [8]  // Metal trace
    },
    "Absorbing":
    {
      "Attributes": [3],
      "Order": 1
    },
    "LumpedPort":
    [
      {
        "Index": 1,
        "R": 86.62,  // Ω, 2-element uniform
        "Excitation": true,
        "Elements":
        [
          {
            "Attributes": [4],
            "Direction": "-Y"
          },
          {
            "Attributes": [5],
            "Direction": "+Y"
          }
        ]
      },
      {
        "Index": 2,
        "R": 86.62,
        "Elements":
        [
          {
            "Attributes": [6],
            "Direction": "-Y"
          },
          {
            "Attributes": [7],
            "Direction": "+Y"
          }
        ]
      }
    ],
    "Postprocessing":
    {
      "SurfaceFlux":
      [
        {
          "Index": 1,
          "Attributes": [8],
          "Type": "Electric",
          "TwoSided": true
        },
        {
          "Index": 2,
          "Attributes": [3],
          "Type": "Power"
        }
      ],
      "Dielectric":
      [
        {
          "Index": 1,
          "Attributes": [9],
          "Type": "SA",
          "Thickness": 2.0e-3,  // μm
          "Permittivity": 10.0,
          "LossTan": 1.0
        },
        {
          "Index": 2,
          "Attributes": [8],
          "Type": "MS",
          "Thickness": 2.0e-3,  // μm
          "Permittivity": 10.0,
          "LossTan": 1.0,
          "Side": "LargerRefractiveIndex"
        },
        {
          "Index": 3,
          "Attributes": [8],
          "Type": "MA",
          "Thickness": 2.0e-3,  // μm
          "Permittivity": 10.0,
          "LossTan": 1.0,
          "Side": "SmallerRefractiveIndex"
        }
      ]
    }
  },
  "Solver":
  {
    "Order": 2,
    "Device": "CPU",
    "Driven":
    {
      "MinFreq": 2.0,  // GHz
      "MaxFreq": 30.0,  // GHz
      "FreqStep": 0.1,  // GHz
      "SaveStep": 40,
      "AdaptiveTol": 1.0e-3
    },
    "Linear":
    {
      "Type": "Default",
      "KSPType": "GMRES",
      "Tol": 1.0e-8,
      "MaxIts": 200
    }
  }
}
hughcars commented 3 months ago

Hi Nico,

Which version of Palace are you using? There were recently a few updates to the lumped element process to support more geometries (https://github.com/awslabs/palace/pull/248, https://github.com/awslabs/palace/pull/268), and it's possible that might have addressed your issues so if you pull from main 🤞 that fixes things for you. The reason being the usage of the bounding box calculation is now robust to any transformation that does not alter the lumped element direction, and if I understand you correctly, I believe your bending should not alter that length.

Hugh

sebastiangrimberg commented 3 months ago

From looking at the visualizations Nico provided (cool model, by the way), I think this is actually an expected error. If you are bending the lumped port itself then you will not be able to correctly infer the geometric parameters (length, width) of the rectangular port from its bounding box. What I would suggest, if possible, is to consider the bending function as starting some nonzero distance down the transmission line so you have a planar segment at the start and end which keeps the lumped ports planar. Could this work?

EDIT: Actually, as Hugh noted to me offline, if the bending direction doesn't affect the port "length" (distance between the conductors neighboring the port), then this model should be supported as is. Updating to main should resolve the error message and give the correct results.

nico-arnold commented 3 months ago

Hey Hugh, hey Sebastian

I used 0.13.0; but you two were right, switching to the main branch via spack install palace@develop did the trick. Thank you very much! I got the very same results as in the flat state. The fields also make sense.

image

Still, I will try to keep the lumped elements flat next time. Better safe then sorry.

@Sebastian: Thanks for the compliment! The only thing here is still that I don't get different results from the flat state, but that should be because of the radiation boundary that is also bent "shielding" the model from itself. I will try to create another model soon where I test this.

I'm so happy to finally have found something to simulate this stuff via FEM so I can also use bent structures. I will take a look into compiling the code, maybe I can get everything to work and make a PR for the impedance calculation.

best wishes, Nico

sebastiangrimberg commented 3 months ago

Great! I will go ahead and close this issue for now, feel free to reopen or open a new issue with further questions! Thank you Nico.