Skip to content

Instantly share code, notes, and snippets.

@dutta-alankar
Last active April 10, 2024 09:22
Show Gist options
  • Save dutta-alankar/4e3e34d4baa525e38e85d2adfd71f41e to your computer and use it in GitHub Desktop.
Save dutta-alankar/4e3e34d4baa525e38e85d2adfd71f41e to your computer and use it in GitHub Desktop.
Boundary condition in `PLUTO`
// Following must be put in `definitions.h` for this to work
/* #define INTERNAL_BOUNDARY YES */
if (side == 0) { // -- select active cells --
RBox dom_box;
int convert_to_cons = 0;
DOM_LOOP(k,j,i) {
int num_cells = 1;
// IDIR --> x-dirction
if ( (grid->xgc[IDIR][i] >= (grid->xl_glob[IDIR][grid->gend[IDIR]-num_cells+1]))
&& (grid->xgc[IDIR][i] <= (grid->xr_glob[IDIR][grid->gend[IDIR]])) ){
/* Put your conditions in here */
// d-Vc[RHO][k][j][i] =
convert_to_cons = 1;
}
if (convert_to_cons) {
RBoxDefine (i, i, j, j, k, k, CENTER, &dom_box);
PrimToCons3D(d->Vc, d->Uc, &dom_box);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment