Open manauref opened 1 month ago
Can you say a little more about this operation: "The boundary-dir-flipping in the last step is to ensure that the jacobians in (jacobgeof)_skin and (jacobgeof)_ghost have the same value on the skin-ghost boundary."
My understanding of the problem is that because the normalization of the Jacobian is changing block to block (because we normalize by the arc length) we need to take into account the different Jacobians across block boundaries (this will be especially important for insuring the characteristics are continuous for computing fluxes in the skin-ghost regions of block boundaries).
But I'm trying to understand what the boundary-dir-flip is for; if I understand the operation you are flipping all the odd coefficients, but I can't quite visualize why flipping the odd coefficients of the Jacobian from the other block is the correct thing to do (instead of just taking the Jacobian from the other block and performing the desired weak operations).
Ok, let me see if I can explain it more clearly. Let's suppose we have 2 blocks, b0 and b1, and we want to fill in the ghost cells of b0.
b0,skin b0,ghost b1,ghost b1,skin
o---------------o---------------o o---------------o---------------o
| | | | | |
| J_b0,skin | | | | J_b1,skin |
| | | | | |
o---------------o---------------o o---------------o---------------o
sync it to get
b0,skin b0,ghost b1,ghost b1,skin
o---------------o---------------o o---------------o---------------o
| | | | | |
| J_b0,skin | J_b1,skin | | J_b0,skin | J_b1,skin |
| | | | | |
o---------------o---------------o o---------------o---------------o
b0,skin b0,ghost b1,ghost b1,skin
o---------------o---------------o o---------------o---------------o
| | | | | |
| Jf_b0,skin | | | | Jf_b1,skin |
| | | | | |
o---------------o---------------o o---------------o---------------o
sync it to get
b0,skin b0,ghost b1,ghost b1,skin
o---------------o---------------o o---------------o---------------o
| | | | | |
| Jf_b0,skin | Jf_b1,skin | | Jf_b0,skin | Jf_b1,skin |
| | | | | |
o---------------o---------------o o---------------o---------------o
b0,skin b0,ghost b1,ghost b1,skin
o---------------o---------------o o---------------o---------------o
| | | | | |
| Jf_b0,skin | f_b1,skin | | f_b0,skin | Jf_b1,skin |
| | | | | |
o---------------o---------------o o---------------o---------------o
J_b#,skin,fl = basis.flipp_odd_sign(J_b#,skin)
and then multiply the ghost cells so we end up with
b0,skin b0,ghost b1,ghost b1,skin
o---------------o-------------------------o o-------------------------o---------------o
| | | | | |
| Jf_b0,skin | J_b0,skin,fl*f_b1,skin | | J_b1,skin,fl*f_b0,skin | Jf_b1,skin |
| | | | | |
o---------------o-------------------------o o-------------------------o---------------o
Hope that answers your comment/clarifies things.
The gyrokinetic (GK) multiblock (MB) app requires a sync method to transfer cons-space quantities and distributions between blocks. Fortunately previous work has been done to provide the connections (multib_comm_conn) needed to orchestrate this. So to utilize those connections we need to perform a set of steps outlined below.
which performs the sends and recvs necessary to sync the array, in a manner similar to the single block array sync. There are 3 implementations of this function, for null/mpi/nccl communicators and we select from each of those based on the
id
inside of the communicator. In the case of null_comm, we just perform local copies; for nccl we do something similar to nccl except that we perform local copies if the send/recv rank is the same as my rank.In the case of conf-space arrays the above is all that is needed to sync. In the case of the distribution function what we actually have in the array is
jacobgeo*f
wherejacobgeo
is the conf-space Jacobian. What we'll actually do is, the following: suppose block0 and block1 are neighborsdg_ghost_div_mult_op
(or please recommend a better name).The first set of operations (i.e.
gkyl_multib_comm_conn_array_transfer
) are being prototyped in the gk-g0-app_blocked_sol_comms branch.Additional note:
gkyl_multib_comm_conn_array_transfer
function, just with different connections and different input/output arrays.