FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

BUG: Reflective boudary doesn't reflect correctly BX3 in 2.5D · Issue #343 · idefix-code/idefix · GitHub

Repository navigation

BUG: Reflective boudary doesn't reflect correctly BX3 in 2.5D #343

Closed

Description

Describe the issue:

Hi all,
By running MHD simulations in 2.5D (DIMENSIONS=2 and COMPONENTS=3), with the relfective boundary condition, I realised that the third component of the BX3 magnetic field is not reversed in the ghost cells as it should be (since it is tangential to the boundaries in IDIR and JDIR).
The reason seems to be that Idefix use only the cell-centered value of third component BX3 and not the face-centered one BX3s in 2.5D. So the reflective condition is applied in this loop

BoundaryForAll("BoundaryReflective", dir, side,
KOKKOS_LAMBDA (int n, int k, int j, int i) {
// ref= 2*ibound -i -1 on the left and 2*ibound-1+1 on the right
// with ibound = nghost on the left and ibount = nghost + nx -1 on the right
// So overall iref=2*nghost-i-1 pn the left and ireft=2*nghost+2*nx-i-1 on the right
const int iref = (dir==IDIR) ? 2*(ighost + side*nxi) - i - 1 : i;
const int jref = (dir==JDIR) ? 2*(jghost + side*nxj) - j - 1 : j;
const int kref = (dir==KDIR) ? 2*(kghost + side*nxk) - k - 1 : k;
const int sign = (n == VX1+dir) ? -1.0 : 1.0;
Vc(n,k,j,i) = sign * Vc(n,kref,jref,iref);
});

which does not reverse the magnetic field components. As I understand it, this is not a problem in 3D as they are overwitten later by the ReconstructVcField function, but in 2.5D, BX3 is left untouched. I fixed this by changing line 689 to

const int sign = (n == VX1+dir || (n >= BX1 && n != BX1+dir)) ? -1.0 : 1.0;

which works well in my case, but I'm not sure if it is the best way to solve the problem.

Error message:

runtime information:

Idefix V2.2.01

Activity

  1. changed the title [-]BUG: Reflective boudary don't reflect correctly the magnetic field in 2.5D[/-] [+]BUG: Reflective boudary doesn't reflect correctly BX3 in 2.5D[/+] on May 28, 2025
  2. glesur commented on Jun 16, 2025

    Contributor

    fixed and merged by #345

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL