-
Notifications
You must be signed in to change notification settings - Fork 22
Closed
Labels
bugSomething isn't workingSomething isn't working
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
idefix/src/fluid/boundary/boundary.hpp
Lines 680 to 692 in ede2e1f
| 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
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working