Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions doc/source/reference/idefix.ini.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ allows for comments, which should start with ``#``.

``Grid`` section
--------------------
The grid section defines the grid total dimension. It consists of 3 entries ``X1-grid``, ``X2-grid`` and ``X3-grid``. Each entry defines the repartition of the grid points in the corresponding direction (the grid is always rectilinear).
The grid section defines the grid total dimension. It consists of 3 entries ``X1-grid``, ``X2-grid`` (when DIMENSIONS>=2) and ``X3-grid`` (when DIMENSIONS=3). Each entry defines the repartition of the grid points in the corresponding direction (the grid is always rectilinear).
Each entry defines a series of grid blocks which are concatenated along the direction. Each block in a direction can have a different spacing rule (uniform, log or stretched). The definition of the Grid entries is as follows

+----------------------------+-------------------------+------------------------------+
Expand Down Expand Up @@ -332,8 +332,8 @@ this block is simply ignored.
------------------------

This section describes the boundary conditions used by the code. There are 6 entries
which need to be defined: ``X1-beg``, ``X2-beg``, ``X3-beg`` for the left boundaries in the direction X1, X2, X3,
and ``X1-end``, ``X2-end``, ``X3-end`` for the right boundaries. Each boundary can be assigned the following types of conditions
that need to be defined: ``X1-beg``, ``X2-beg``, ``X3-beg`` for the left boundaries in the direction X1, X2, X3,
and ``X1-end``, ``X2-end``, ``X3-end`` for the right boundaries. ``X2`` boundaries are mandatory only when DIMENSIONS>=2 and ``X3`` when DIMENSIONS=3. Each boundary can be assigned the following types of conditions

+----------------+------------------------------------------------------------------------------------------------------------------+
| Boundary type | Comment |
Expand Down
14 changes: 9 additions & 5 deletions src/dataBlock/planetarySystem/planetarySystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,16 @@ indirect term, with multiple planets that don't feel each others.");
IDEFIX_ERROR("need to define a planet-to-primary mass ratio via planetToPrimary");
}
#if GEOMETRY == POLAR || GEOMETRY == CARTESIAN
if ((this->data->mygrid->xbeg[KDIR] == 0)
|| (this->data->mygrid->xend[KDIR] == 0)) {
this->halfdisk = true;
} else {
#if DIMENSIONS == 3
if ((this->data->mygrid->xbeg[KDIR] == 0)
|| (this->data->mygrid->xend[KDIR] == 0)) {
this->halfdisk = true;
} else {
this->halfdisk = false;
}
#else // DIMENSIONS == 3
this->halfdisk = false;
}
#endif // DIMENSIONS == 3
#elif GEOMETRY == SPHERICAL
if ( (this->data->mygrid->xbeg[JDIR] == M_PI/2.0)
|| (this->data->mygrid->xend[JDIR] == M_PI/2.0)) {
Expand Down
9 changes: 8 additions & 1 deletion src/gravity/laplacian.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@ class DataBlock;
class Laplacian {
public:
// Types of boundary which can be treated
enum LaplacianBoundaryType {internalgrav, periodic, nullgrad, nullpot, userdef, axis, origin};
enum LaplacianBoundaryType {internalgrav,
periodic,
nullgrad,
nullpot,
userdef,
axis,
origin,
undefined};

Laplacian() = default;
Laplacian(DataBlock *, std::array<LaplacianBoundaryType,3>,
Expand Down
6 changes: 5 additions & 1 deletion src/gravity/selfGravity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ void SelfGravity::Init(Input &input, DataBlock *datain) {
}

// Get the gravity-related boundary conditions
for(int dir = 0 ; dir < 3 ; dir++) {
for (int dir = 0 ; dir < 3 ; dir++) {
this->lbound[dir] = Laplacian::LaplacianBoundaryType::undefined;
this->rbound[dir] = Laplacian::LaplacianBoundaryType::undefined;
}
for(int dir = 0 ; dir < DIMENSIONS ; dir++) {
std::string label = std::string("boundary-X")+std::to_string(dir+1)+std::string("-beg");
std::string boundary = input.Get<std::string>("SelfGravity",label,0);

Expand Down
15 changes: 14 additions & 1 deletion src/grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Grid::Grid(Input &input) {
npoints[dir] = 1;
nghost[dir] = 0;
std::string label = std::string("X")+std::to_string(dir+1)+std::string("-grid");
int numPatch = input.Get<int>("Grid",label,0);


if(dir<DIMENSIONS) {
#if ORDER < 4
Expand All @@ -64,6 +64,7 @@ Grid::Grid(Input &input) {
nghost[dir] = 3;
#endif
npoints[dir] = 0;
int numPatch = input.Get<int>("Grid",label,0);
for(int patch = 0; patch < numPatch ; patch++) {
npoints[dir] += input.Get<int>("Grid",label,2+3*patch );
}
Expand All @@ -73,7 +74,14 @@ Grid::Grid(Input &input) {
for(int dir = 0 ; dir < 3 ; dir++) {
np_tot[dir] = npoints[dir] + 2*nghost[dir];
np_int[dir] = npoints[dir];
lbound[dir] = undefined;
rbound[dir] = undefined;
}

// Default boundary conditions on each axis


for(int dir = 0 ; dir < DIMENSIONS ; dir++) {
std::string label = std::string("X")+std::to_string(dir+1)+std::string("-beg");
std::string boundary = input.Get<std::string>("Boundary",label,0);

Expand Down Expand Up @@ -337,6 +345,9 @@ void Grid::ShowConfig() {
case userdef:
lboundString="userdef";
break;
case undefined:
lboundString="undefined";
break;
default:
lboundString="unknown";
}
Expand All @@ -362,6 +373,8 @@ void Grid::ShowConfig() {
case userdef:
rboundString="userdef";
break;
case undefined:
lboundString="undefined";
default:
rboundString="unknown";
}
Expand Down
30 changes: 18 additions & 12 deletions src/gridHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ void GridHost::MakeGrid(Input &input) {

// Get grid parameters from input file, block [Grid]
for(int dir = 0 ; dir < 3 ; dir++) {
std::string label = std::string("X")+std::to_string(dir+1)+std::string("-grid");
int numPatch = input.Get<int>("Grid",label,0);
// These are extra dimensions that are not being used.

xstart[dir] = input.Get<real>("Grid",label,1);
xend[dir] = input.Get<real>("Grid",label,4+(numPatch-1)*3);

this->xbeg[dir] = xstart[dir];
this->xend[dir] = xend[dir];
if(dir<DIMENSIONS) {
std::string label = std::string("X")+std::to_string(dir+1)+std::string("-grid");
int numPatch = input.Get<int>("Grid",label,0);

xstart[dir] = input.Get<real>("Grid",label,1);
xend[dir] = input.Get<real>("Grid",label,4+(numPatch-1)*3);

if(dir<DIMENSIONS) {
this->xbeg[dir] = xstart[dir];
this->xend[dir] = xend[dir];
// First, we fill cells for any non strecthed patch
// Loop on all the patches
int idxstart = nghost[dir];
Expand Down Expand Up @@ -200,10 +200,16 @@ void GridHost::MakeGrid(Input &input) {
} else {
// dir >= DIMENSIONS/ Init simple uniform grid
for(int i = 0 ; i < np_tot[dir] ; i++) {
dx[dir](i) = (xend[dir]-xstart[dir])/(np_int[dir]);
x[dir](i)=xstart[dir] + (i-nghost[dir]+HALF_F)*dx[dir](i);
xl[dir](i)=xstart[dir] + (i-nghost[dir])*dx[dir](i);
xr[dir](i)=xstart[dir] + (i-nghost[dir]+1)*dx[dir](i);
// Initialize to default values
xstart[dir] = -0.5;
xend[dir] = 0.5;

this->xbeg[dir] = xstart[dir];
this->xend[dir] = xend[dir];
dx[dir](i) = 1.0;
x[dir](i)=0.0;
xl[dir](i)=-0.5;
xr[dir](i)=0.5;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/idefix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ using IdfxFileHandler = FILE*;
#endif

// Types of boundary which can be treated
enum BoundaryType { internal, periodic, reflective, outflow, shearingbox, axis, userdef};
enum BoundaryType { internal, periodic, reflective, outflow, shearingbox, axis, userdef, undefined};
enum BoundarySide { left, right};
enum class SliceType {Cut, Average};

Expand Down
3 changes: 0 additions & 3 deletions test/HD/FargoPlanet/setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ void UserdefBoundary(Hydro *hydro, int dir, BoundarySide side, real t) {
IdefixArray4D<real> Vc = hydro->Vc;
auto *data = hydro->data;
IdefixArray1D<real> x1 = data->x[IDIR];
IdefixArray1D<real> x3 = data->x[KDIR];
if(dir==IDIR) {
int ighost,ibeg,iend;
if(side == left) {
Expand All @@ -56,7 +55,6 @@ void UserdefBoundary(Hydro *hydro, int dir, BoundarySide side, real t) {
ibeg, iend,
KOKKOS_LAMBDA (int k, int j, int i) {
real R=x1(i);
real z=x3(k);
real Vk = 1.0/sqrt(R);

Vc(RHO,k,j,i) = Vc(RHO,k,j,2*ighost - i +1);
Expand All @@ -75,7 +73,6 @@ void UserdefBoundary(Hydro *hydro, int dir, BoundarySide side, real t) {
ibeg, iend,
KOKKOS_LAMBDA (int k, int j, int i) {
real R=x1(i);
real z=x3(k);
real Vk = 1.0/sqrt(R);

Vc(RHO,k,j,i) = Vc(RHO,k,j,ighost);
Expand Down
3 changes: 0 additions & 3 deletions test/HD/VSI/idefix.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[Grid]
X1-grid 1 1.0 1024 l 3.0
X2-grid 1 1.2707963267948965 512 u 1.8707963267948966
X3-grid 1 0.0 1 u 6.283185307179586

[TimeIntegrator]
CFL 0.8
Expand All @@ -22,8 +21,6 @@ X1-beg userdef
X1-end outflow
X2-beg outflow
X2-end outflow
X3-beg periodic
X3-end periodic

[Setup]
epsilon 0.1
Expand Down
3 changes: 0 additions & 3 deletions test/HD/ViscousDisk/idefix-rkl.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[Grid]
X1-grid 1 1.0 64 u 3.0
X2-grid 1 1.2707963267948965 64 u 1.8707963267948966
X3-grid 1 0.0 1 u 6.283185307179586

[TimeIntegrator]
CFL 0.5
Expand All @@ -23,8 +22,6 @@ X1-beg userdef
X1-end userdef
X2-beg userdef
X2-end userdef
X3-beg periodic
X3-end periodic

[Setup]
epsilon 0.1
Expand Down
3 changes: 0 additions & 3 deletions test/HD/ViscousDisk/idefix.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[Grid]
X1-grid 1 1.0 64 u 3.0
X2-grid 1 1.2707963267948965 64 u 1.8707963267948966
X3-grid 1 0.0 1 u 6.283185307179586

[TimeIntegrator]
CFL 0.5
Expand All @@ -23,8 +22,6 @@ X1-beg userdef
X1-end userdef
X2-beg userdef
X2-end userdef
X3-beg periodic
X3-end periodic

[Setup]
epsilon 0.1
Expand Down
5 changes: 0 additions & 5 deletions test/HD/ViscousFlowPastCylinder/idefix-rkl.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[Grid]
X1-grid 1 1.0 128 l 10.0
# X2-grid 3 -3.141592653589793 64 s+ -0.2 128 u 0.2 64 s- 3.141592653589793
# X2-grid 1 -3.141592653589793 256 u 3.141592653589793
X2-grid 1 0.0 64 u 6.28318530717958
X3-grid 1 0.0 1 u 1.0

[TimeIntegrator]
CFL 0.4
Expand All @@ -21,8 +18,6 @@ X1-beg userdef
X1-end userdef
X2-beg periodic
X2-end periodic
X3-beg outflow
X3-end outflow

[Output]
vtk 1.0
Expand Down
5 changes: 0 additions & 5 deletions test/HD/ViscousFlowPastCylinder/idefix.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[Grid]
X1-grid 1 1.0 128 l 10.0
# X2-grid 3 -3.141592653589793 64 s+ -0.2 128 u 0.2 64 s- 3.141592653589793
# X2-grid 1 -3.141592653589793 256 u 3.141592653589793
X2-grid 1 0.0 64 u 6.28318530717958
X3-grid 1 0.0 1 u 1.0

[TimeIntegrator]
CFL 0.4
Expand All @@ -21,8 +18,6 @@ X1-beg userdef
X1-end userdef
X2-beg periodic
X2-end periodic
X3-beg outflow
X3-end outflow

[Output]
vtk 1.0
Expand Down
6 changes: 0 additions & 6 deletions test/HD/sod-iso/idefix-hll.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
[Grid]
X1-grid 1 0.0 500 u 1.0
X2-grid 1 0.0 1 u 1.0
X3-grid 1 0.0 1 u 1.0

[TimeIntegrator]
CFL 0.8
Expand All @@ -16,10 +14,6 @@ csiso constant 1.0
[Boundary]
X1-beg outflow
X1-end outflow
X2-beg outflow
X2-end outflow
X3-beg outflow
X3-end outflow

[Output]
vtk 0.1
Expand Down
6 changes: 0 additions & 6 deletions test/HD/sod-iso/idefix-hllc-rk3.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
[Grid]
X1-grid 1 0.0 500 u 1.0
X2-grid 1 0.0 1 u 1.0
X3-grid 1 0.0 1 u 1.0

[TimeIntegrator]
CFL 0.8
Expand All @@ -16,10 +14,6 @@ csiso constant 1.0
[Boundary]
X1-beg outflow
X1-end outflow
X2-beg outflow
X2-end outflow
X3-beg outflow
X3-end outflow

[Output]
vtk 0.1
Expand Down
6 changes: 0 additions & 6 deletions test/HD/sod-iso/idefix-hllc.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
[Grid]
X1-grid 1 0.0 500 u 1.0
X2-grid 1 0.0 1 u 1.0
X3-grid 1 0.0 1 u 1.0

[TimeIntegrator]
CFL 0.8
Expand All @@ -16,10 +14,6 @@ csiso constant 1.0
[Boundary]
X1-beg outflow
X1-end outflow
X2-beg outflow
X2-end outflow
X3-beg outflow
X3-end outflow

[Output]
vtk 0.1
Expand Down
6 changes: 0 additions & 6 deletions test/HD/sod-iso/idefix-rk3.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
[Grid]
X1-grid 1 0.0 500 u 1.0
X2-grid 1 0.0 1 u 1.0
X3-grid 1 0.0 1 u 1.0

[TimeIntegrator]
CFL 0.8
Expand All @@ -16,10 +14,6 @@ csiso constant 1.0
[Boundary]
X1-beg outflow
X1-end outflow
X2-beg outflow
X2-end outflow
X3-beg outflow
X3-end outflow

[Output]
vtk 0.1
Expand Down
6 changes: 0 additions & 6 deletions test/HD/sod-iso/idefix-tvdlf.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
[Grid]
X1-grid 1 0.0 500 u 1.0
X2-grid 1 0.0 1 u 1.0
X3-grid 1 0.0 1 u 1.0

[TimeIntegrator]
CFL 0.8
Expand All @@ -16,10 +14,6 @@ csiso constant 1.0
[Boundary]
X1-beg outflow
X1-end outflow
X2-beg outflow
X2-end outflow
X3-beg outflow
X3-end outflow

[Output]
vtk 0.1
Loading