diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 06fe7210..726f0045 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ exclude: "^(src/kokkos)" repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v5.0.0 hooks: - id: trailing-whitespace # auto-fix trailing whitespaces - id: end-of-file-fixer # add EOF "\n" if missing @@ -23,7 +23,7 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.0.278 + rev: v0.6.9 hooks: - id: ruff args: @@ -33,14 +33,15 @@ repos: - F # pyflakes - B # flake8-bugbear - I # isort + - NPY # numpy-specific rules - repo: https://github.com/neutrinoceros/inifix - rev: v4.4.0 + rev: v5.0.2 hooks: - id: inifix-format - repo: https://github.com/Lucas-C/pre-commit-hooks - rev: v1.5.1 + rev: v1.5.5 hooks: - id: remove-tabs # auto-fix tab/space mixing - id: insert-license diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f01898d..8d791f8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,26 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.1.02] 2024-10-24 +### Changed + +- Fix a bug that could lead to corrupted VTK file when using single precision arithmetic (#255) +- Fix a bug that could lead to incorrect central mass gravitational potential upon restart (#287) +- Changed the way magnetic field is reconstructed when using grid coarsening to reduce roundoff errors on div(B). This can have an impact on the results of models using grid coarsening+MHD (#284) +- Ensure that XDMF outputs are precision agnostic (#261) +- Bump up Kokkos version to 4.4.01 (#289) +- Check that writes are successfull in serial, otherwise throw an error (#260) +- Ensure that shock flattening flags can be modified by user (#260) +- Throw an error when user enables Fargo without enough DIMENSIONS (#250) +- Fix linting errors following upgrade to cpplint 2.0 (#278, #279, #281) +- Update idfx_io to numpy 2.0 (#283) + +### Added + +- Allow the user to define the grid and boundary conditions only on active dimensions (#274) +- Configuration for Nvidia H100 on Jean Zay in the documentation + + ## [2.1.01] 2024-06-20 ### Changed - Fix a bug that could result in too restrictive timesteps when resistivity is enabled (#244) diff --git a/CMakeLists.txt b/CMakeLists.txt index b7b1d88a..8df0de73 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,12 +1,14 @@ cmake_minimum_required(VERSION 3.16) -set(CMAKE_BUILD_TYPE Release) +if (NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE) +endif() set (CMAKE_CXX_STANDARD 17) set(Idefix_VERSION_MAJOR 2) set(Idefix_VERSION_MINOR 1) -set(Idefix_VERSION_PATCH 01) +set(Idefix_VERSION_PATCH 02) -project (idefix VERSION 2.1.00) +project (idefix VERSION 2.1.02) option(Idefix_MHD "enable MHD" OFF) option(Idefix_MPI "enable Message Passing Interface parallelisation" OFF) option(Idefix_HIGH_ORDER_FARGO "Force Fargo to use a PPM reconstruction scheme" OFF) @@ -43,10 +45,12 @@ include(SetRequiredBuildSettingsForGCC8) #Idefix requires Cuda Lambdas (experimental) if(Kokkos_ENABLE_CUDA) set(Kokkos_ENABLE_CUDA_LAMBDA ON CACHE BOOL "Idefix requires lambdas on Cuda" FORCE) + set(Kokkos_ENABLE_IMPL_CUDA_MALLOC_ASYNC OFF CACHE BOOL "Disable Async malloc to avoid bugs on PSM2" FORCE) endif() # Add kokkos CMAKE files (required early since these set compiler options) add_subdirectory(src/kokkos build/kokkos) +include_directories(${Kokkos_INCLUDE_DIRS_RET}) # Add Idefix CXX Flags add_compile_options(${Idefix_CXX_FLAGS}) diff --git a/CPPLINT.cfg b/CPPLINT.cfg index 4f3e42cb..b02d056c 100644 --- a/CPPLINT.cfg +++ b/CPPLINT.cfg @@ -16,6 +16,8 @@ filter=-whitespace/comma # 6027 errors filter=-whitespace/comments # 881 errors filter=-whitespace/operators # 5240 errors filter=-whitespace/parens # 413 error +filter=-whitespace/newline +filter=-whitespace/indent_namespace filter=-readability/multiline_string filter=-build/include_subdir # 296 errors #filter=-whitespace/end_of_line diff --git a/doc/source/conf.py b/doc/source/conf.py index 9ba65d75..b712d026 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -23,7 +23,7 @@ author = 'Geoffroy Lesur' # The full version, including alpha/beta/rc tags -release = '2.1.01' +release = '2.1.02' diff --git a/doc/source/performances.rst b/doc/source/performances.rst index 2222c2e1..84042685 100644 --- a/doc/source/performances.rst +++ b/doc/source/performances.rst @@ -4,9 +4,9 @@ Performances We report below the performances obtained on various architectures using Idefix. The reference test is the 3D MHD Orszag-Tang test problem with 2nd order reconstruction and uct_contact EMFS bundled in -Idefix test suite, computed with a 128\ :sup:`3` resolution per MPI sub-domain on GPUs or 32\ :sup:`3` -per MPI sub-domain on CPUs. All of the performances measures have been obtained enabling MPI on -*one full node*, but we report here the performance *per GPU* +Idefix test suite, disabling passive tracers. The test is computed with a 128\ :sup:`3` resolution per +MPI sub-domain on GPUs or 32\ :sup:`3` per MPI sub-domain on CPUs. All of the performances measures +have been obtained enabling MPI on *one full node*, but we report here the performance *per GPU* (i.e. with 2 GCDs on AMD Mi250) or *per core* (on CPU), i.e. dividing the node performance by the number of GPU/core to simplify the comparison with other clusters. diff --git a/doc/source/reference/idefix.ini.rst b/doc/source/reference/idefix.ini.rst index 066db997..a7309f10 100644 --- a/doc/source/reference/idefix.ini.rst +++ b/doc/source/reference/idefix.ini.rst @@ -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 +----------------------------+-------------------------+------------------------------+ @@ -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 | diff --git a/doc/source/reference/makefile.rst b/doc/source/reference/makefile.rst index b015b682..4f948e5d 100644 --- a/doc/source/reference/makefile.rst +++ b/doc/source/reference/makefile.rst @@ -125,37 +125,61 @@ Finally, *Idefix* can be configured to run on Mi250 by enabling HIP and the desi .. code-block:: bash - -DKokkos_ENABLE_HIP=ON -DKokkos_ENABLE_HIP_MULTIPLE_KERNEL_INSTANTIATION=ON -DKokkos_ARCH_VEGA90A=ON + -DKokkos_ENABLE_HIP=ON -DKokkos_ENABLE_HIP_MULTIPLE_KERNEL_INSTANTIATIONS=ON -DKokkos_ARCH_VEGA90A=ON MPI (multi-GPU) can be enabled by adding ``-DIdefix_MPI=ON`` as usual. -Jean Zay at IDRIS, Nvidia V100 and A100 GPUs --------------------------------------------- +Jean Zay at IDRIS, Nvidia V100/A100/H100 GPUs +--------------------------------------------- -We recommend the following modules and environement variables on Jean Zay: +We recommend the following modules and environement variables on Jean Zay V100/A100: .. code-block:: bash + module load arch/a100 # ONLY forA100 module load cuda/12.1.0 module load gcc/12.2.0 module load openmpi/4.1.1-cuda - module load cmake/3.18.0 + module load cmake/3.25.2 + +While for H100: + +.. code-block:: bash + + module load arch/h100 + module load cmake/3.30.1 + module load cuda/12.1.0 + module load openmpi/4.1.5-cuda *Idefix* can then be configured to run on Nvidia V100 with the following options to ccmake: .. code-block:: bash - -DKokkos_ENABLE_CUDA=ON -DKokkos_ENABLE_VOLTA70=ON -DKokkos_ENABLE_IMPL_CUDA_MALLOC_ASYNC=OFF + -DKokkos_ENABLE_CUDA=ON -DKokkos_ARCH_VOLTA70=ON While Ampere A100 GPUs are enabled with .. code-block:: bash - -DKokkos_ENABLE_CUDA=ON -DKokkos_ENABLE_AMPERE80=ON -DKokkos_ENABLE_IMPL_CUDA_MALLOC_ASYNC=OFF + -DKokkos_ENABLE_CUDA=ON -DKokkos_ARCH_AMPERE80=ON + +And for H100 GPUS: + +.. code-block:: bash + + -DKokkos_ENABLE_CUDA=ON -DKokkos_ARCH_HOPPER90=ON + + +MPI (multi-GPU) can be enabled by adding ``-DIdefix_MPI=ON`` as usual. + + +.. warning:: + + As of *Idefix* 2.1.02, we automatically disable Cuda Malloc async (``-DKokkos_ENABLE_IMPL_CUDA_MALLOC_ASYNC=OFF``). However, earlier versions of + *Idefix* requires this flag when calling cmake to prevent a bug when using PSM2 with async Cuda malloc possibly leading to openmpi crash or hangs on Jean Zay. + -MPI (multi-GPU) can be enabled by adding ``-DIdefix_MPI=ON`` as usual. The malloc async option is here to prevent a bug when using PSM2 with async -Cuda malloc possibly leading to openmpi crash or hangs on Jean Zay. .. _setupSpecificOptions: diff --git a/doc/source/reference/setup.cpp.rst b/doc/source/reference/setup.cpp.rst index 2662e903..0ebe76d3 100644 --- a/doc/source/reference/setup.cpp.rst +++ b/doc/source/reference/setup.cpp.rst @@ -369,7 +369,7 @@ assuming we want to create a dump from ``mydump.dmp``: int iglob=i-2*d.beg[IDIR]+d.gbeg[IDIR]; int jglob=j-2*d.beg[JDIR]+d.gbeg[JDIR]; int kglob=k-2*d.beg[KDIR]+d.gbeg[KDIR]; - d.Vs(BX1s,k,j,i) = image->arrays["Vs-BX1s"](kglob,jglob,iglob); + d.Vs(BX1s,k,j,i) = image.arrays["Vs-BX1s"](kglob,jglob,iglob); }}} // And so on for the other components diff --git a/pytools/idfx_io.py b/pytools/idfx_io.py index 480e713d..17dc6272 100644 --- a/pytools/idfx_io.py +++ b/pytools/idfx_io.py @@ -29,7 +29,7 @@ def __init__(self, fh, byteorder="little"): dims = [] for dim in range(self.ndims): dims.append(int.from_bytes(fh.read(INT_SIZE), byteorder)) - ntot = int(np.product(dims)) + ntot = int(np.prod(dims)) raw = struct.unpack(str(ntot) + "d", fh.read(DOUBLE_SIZE * ntot)) self.array = np.asarray(raw).reshape(dims[::-1]) diff --git a/reference b/reference index 99f339c4..609a6016 160000 --- a/reference +++ b/reference @@ -1 +1 @@ -Subproject commit 99f339c43d98274a925282cc96252c5a0fa9374f +Subproject commit 609a60164461fb2d4fbeffa89ce148acf1191525 diff --git a/src/dataBlock/dataBlock.cpp b/src/dataBlock/dataBlock.cpp index c0648f92..81874cef 100644 --- a/src/dataBlock/dataBlock.cpp +++ b/src/dataBlock/dataBlock.cpp @@ -6,6 +6,8 @@ // *********************************************************************************** #include +#include +#include #include "idefix.hpp" #include "dataBlock.hpp" #include "fluid.hpp" diff --git a/src/dataBlock/dataBlock.hpp b/src/dataBlock/dataBlock.hpp index 12f0847e..89b745fa 100644 --- a/src/dataBlock/dataBlock.hpp +++ b/src/dataBlock/dataBlock.hpp @@ -12,6 +12,7 @@ #include #include #include +#include #include "idefix.hpp" #include "grid.hpp" diff --git a/src/dataBlock/dataBlockHost.cpp b/src/dataBlock/dataBlockHost.cpp index ca26e5cb..b5dff915 100644 --- a/src/dataBlock/dataBlockHost.cpp +++ b/src/dataBlock/dataBlockHost.cpp @@ -5,6 +5,7 @@ // Licensed under CeCILL 2.1 License, see COPYING for more information // *********************************************************************************** +#include #include "idefix.hpp" #include "dataBlockHost.hpp" #include "fluid.hpp" diff --git a/src/dataBlock/dumpToFile.cpp b/src/dataBlock/dumpToFile.cpp index 9980d09c..98b4a474 100644 --- a/src/dataBlock/dumpToFile.cpp +++ b/src/dataBlock/dumpToFile.cpp @@ -5,6 +5,8 @@ // Licensed under CeCILL 2.1 License, see COPYING for more information // *********************************************************************************** +#include +#include #include "../idefix.hpp" #include "dataBlock.hpp" #include "version.hpp" diff --git a/src/dataBlock/fargo.cpp b/src/dataBlock/fargo.cpp index e1878d37..a509ef88 100644 --- a/src/dataBlock/fargo.cpp +++ b/src/dataBlock/fargo.cpp @@ -65,6 +65,9 @@ Fargo::Fargo(Input &input, int nmax, DataBlock *data) { } #if GEOMETRY == CARTESIAN || GEOMETRY == POLAR + #if DIMENSIONS < 2 + IDEFIX_ERROR("Fargo should be used with DIMENSIONS >= 2 in Cartesian or Polar geometries"); + #endif // Check if there is a domain decomposition in the intended fargo direction if(data->mygrid->nproc[JDIR]>1) { haveDomainDecomposition = true; @@ -80,6 +83,9 @@ Fargo::Fargo(Input &input, int nmax, DataBlock *data) { this->meanVelocity = IdefixArray2D("FargoVelocity",data->np_tot[KDIR], data->np_tot[IDIR]); #elif GEOMETRY == SPHERICAL + #if DIMENSIONS < 3 + IDEFIX_ERROR("Fargo should be used with DIMENSIONS == 3 in Spherical geometry"); + #endif // Check if there is a domain decomposition in the intended fargo direction if(data->mygrid->nproc[KDIR]>1) { haveDomainDecomposition = true; diff --git a/src/dataBlock/planetarySystem/planetarySystem.cpp b/src/dataBlock/planetarySystem/planetarySystem.cpp index 3d18e69d..8d01118d 100644 --- a/src/dataBlock/planetarySystem/planetarySystem.cpp +++ b/src/dataBlock/planetarySystem/planetarySystem.cpp @@ -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)) { diff --git a/src/fluid/RiemannSolver/riemannSolver.hpp b/src/fluid/RiemannSolver/riemannSolver.hpp index 4b306f38..abb70eed 100644 --- a/src/fluid/RiemannSolver/riemannSolver.hpp +++ b/src/fluid/RiemannSolver/riemannSolver.hpp @@ -62,6 +62,8 @@ class RiemannSolver { template ExtrapolateToFaces* GetExtrapolator(); + std::unique_ptr> shockFlattening; + private: template friend class ExtrapolateToFaces; @@ -75,8 +77,6 @@ class RiemannSolver { Solver mySolver; - std::unique_ptr> shockFlattening; - // Because each direction is a different template, we can't use std::unique_ptr> slopeLimIDIR; std::unique_ptr> slopeLimJDIR; diff --git a/src/fluid/boundary/axis.cpp b/src/fluid/boundary/axis.cpp index ead51f4f..b77fe3b5 100644 --- a/src/fluid/boundary/axis.cpp +++ b/src/fluid/boundary/axis.cpp @@ -5,6 +5,7 @@ // Licensed under CeCILL 2.1 License, see COPYING for more information // *********************************************************************************** +#include #include "axis.hpp" #include "boundary.hpp" diff --git a/src/fluid/boundary/boundary.hpp b/src/fluid/boundary/boundary.hpp index 4a9b34ee..86909936 100644 --- a/src/fluid/boundary/boundary.hpp +++ b/src/fluid/boundary/boundary.hpp @@ -199,7 +199,7 @@ void Boundary::EnrollFluxBoundary(UserDefBoundaryFuncOld myFunc) { IDEFIX_WARNING(msg); this->fluxBoundaryFuncOld = myFunc; - this->haveUserDefBoundary = true; + this->haveFluxBoundary = true; } template diff --git a/src/fluid/checkNan.hpp b/src/fluid/checkNan.hpp index 71911c58..88e206e5 100644 --- a/src/fluid/checkNan.hpp +++ b/src/fluid/checkNan.hpp @@ -7,6 +7,7 @@ #ifndef FLUID_CHECKNAN_HPP_ #define FLUID_CHECKNAN_HPP_ +#include #include "dataBlock.hpp" #include "dataBlockHost.hpp" #include "fluid.hpp" diff --git a/src/fluid/coarsenFlow.hpp b/src/fluid/coarsenFlow.hpp index 217c7711..b1bf79ea 100644 --- a/src/fluid/coarsenFlow.hpp +++ b/src/fluid/coarsenFlow.hpp @@ -290,28 +290,52 @@ void Fluid::CoarsenMagField(IdefixArray4D &Vsin) { // We reconstruct the parrallel field component with divB=0 int factor = 1 << (coarsening-1); + + if( (index-begDir)%factor == 0) { + real qt = 0; + real qb = 0; + + // Loop forward for(int shift = 0 ; shift < factor-1 ; shift++) { - real qt = Vsin(BXt,k+kt+shift*koffset, j+jt+shift*joffset, i+it+shift*ioffset) + qt += Vsin(BXt,k+kt+shift*koffset, j+jt+shift*joffset, i+it+shift*ioffset) * At(k+kt+shift*koffset, j+jt+shift*joffset, i+it+shift*ioffset) - Vsin(BXt,k+shift*koffset, j+shift*joffset, i+shift*ioffset) * At(k+shift*koffset, j+shift*joffset, i+shift*ioffset); #if DIMENSIONS == 3 - real qb = Vsin(BXb,k+kb+shift*koffset, j+jb+shift*joffset, i+ib+shift*ioffset) + qb += Vsin(BXb,k+kb+shift*koffset, j+jb+shift*joffset, i+ib+shift*ioffset) * Ab(k+kb+shift*koffset, j+jb+shift*joffset, i+ib+shift*ioffset) - Vsin(BXb,k+shift*koffset, j+shift*joffset, i+shift*ioffset) * Ab(k+shift*koffset, j+shift*joffset, i+shift*ioffset); - #else - real qb = 0.0; #endif Vsin(BXn, k+(shift+1)*koffset, j+(shift+1)*joffset, i+(shift+1)*ioffset) = + ((real) (factor-(shift+1))) / ((real)factor) * 1.0/An(k+(shift+1)*koffset, j+(shift+1)*joffset, i+(shift+1)*ioffset) * - ( - Vsin(BXn, k+shift*koffset, j+shift*joffset, i+shift*ioffset) * - An(k+shift*koffset, j+shift*joffset, i+shift*ioffset) - - qt - qb - ); + (Vsin(BXn, k, j, i) * An(k, j, i) - qt - qb); + } + // Loop backward + qt = 0; + qb = 0; + + // Loop forward + for(int shift = factor-1 ; shift >=1 ; shift--) { + qt += Vsin(BXt,k+kt+shift*koffset, j+jt+shift*joffset, i+it+shift*ioffset) + * At(k+kt+shift*koffset, j+jt+shift*joffset, i+it+shift*ioffset) + - Vsin(BXt,k+shift*koffset, j+shift*joffset, i+shift*ioffset) + * At(k+shift*koffset, j+shift*joffset, i+shift*ioffset); + #if DIMENSIONS == 3 + qb += Vsin(BXb,k+kb+shift*koffset, j+jb+shift*joffset, i+ib+shift*ioffset) + * Ab(k+kb+shift*koffset, j+jb+shift*joffset, i+ib+shift*ioffset) + - Vsin(BXb,k+shift*koffset, j+shift*joffset, i+shift*ioffset) + * Ab(k+shift*koffset, j+shift*joffset, i+shift*ioffset); + #endif + + Vsin(BXn, k+shift*koffset, j+shift*joffset, i+shift*ioffset) += + ((real) shift) / ((real)factor) * + 1.0/An(k+shift*koffset, j+shift*joffset, i+shift*ioffset) * + (Vsin(BXn, k+factor*koffset, j+factor*joffset, i+factor*ioffset) + * An( k+factor*koffset, j+factor*joffset, i+factor*ioffset) + qt + qb); } } } diff --git a/src/global.cpp b/src/global.cpp index 1e9c11ee..4d9499d9 100644 --- a/src/global.cpp +++ b/src/global.cpp @@ -5,6 +5,7 @@ // Licensed under CeCILL 2.1 License, see COPYING for more information // *********************************************************************************** +#include #include #include #include "idefix.hpp" diff --git a/src/global.hpp b/src/global.hpp index 47fca42e..8651f974 100644 --- a/src/global.hpp +++ b/src/global.hpp @@ -7,6 +7,7 @@ #ifndef GLOBAL_HPP_ #define GLOBAL_HPP_ +#include #include #include #include "arrays.hpp" diff --git a/src/gravity/gravity.cpp b/src/gravity/gravity.cpp index 2492ce09..c0096c51 100644 --- a/src/gravity/gravity.cpp +++ b/src/gravity/gravity.cpp @@ -10,6 +10,7 @@ #include "gravity.hpp" #include "planetarySystem.hpp" #include "dataBlock.hpp" +#include "output.hpp" #include "input.hpp" Gravity::Gravity(Input &input, DataBlock *datain) { @@ -29,6 +30,7 @@ Gravity::Gravity(Input &input, DataBlock *datain) { } else if (potentialString.compare("central") == 0) { this->haveCentralMassPotential = true; this->centralMass = input.GetOrSet("Gravity","Mcentral",0, 1.0); + data->dump->RegisterVariable(&this->centralMass, "centralMass",1); } else if (potentialString.compare("selfgravity") == 0) { this->haveSelfGravityPotential = true; } else if (potentialString.compare("planet") == 0) { diff --git a/src/gravity/laplacian.hpp b/src/gravity/laplacian.hpp index 4c41842b..28572439 100644 --- a/src/gravity/laplacian.hpp +++ b/src/gravity/laplacian.hpp @@ -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, diff --git a/src/gravity/selfGravity.cpp b/src/gravity/selfGravity.cpp index 8efef800..43f76471 100644 --- a/src/gravity/selfGravity.cpp +++ b/src/gravity/selfGravity.cpp @@ -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("SelfGravity",label,0); diff --git a/src/grid.cpp b/src/grid.cpp index 14a1e174..e4c6b7b4 100644 --- a/src/grid.cpp +++ b/src/grid.cpp @@ -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("Grid",label,0); + if(dir("Grid",label,0); for(int patch = 0; patch < numPatch ; patch++) { npoints[dir] += input.Get("Grid",label,2+3*patch ); } @@ -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("Boundary",label,0); @@ -337,6 +345,9 @@ void Grid::ShowConfig() { case userdef: lboundString="userdef"; break; + case undefined: + lboundString="undefined"; + break; default: lboundString="unknown"; } @@ -362,6 +373,8 @@ void Grid::ShowConfig() { case userdef: rboundString="userdef"; break; + case undefined: + lboundString="undefined"; default: rboundString="unknown"; } diff --git a/src/gridHost.cpp b/src/gridHost.cpp index 1c48b53c..d31a232c 100644 --- a/src/gridHost.cpp +++ b/src/gridHost.cpp @@ -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("Grid",label,0); + // These are extra dimensions that are not being used. - xstart[dir] = input.Get("Grid",label,1); - xend[dir] = input.Get("Grid",label,4+(numPatch-1)*3); - - this->xbeg[dir] = xstart[dir]; - this->xend[dir] = xend[dir]; + if(dir("Grid",label,0); + xstart[dir] = input.Get("Grid",label,1); + xend[dir] = input.Get("Grid",label,4+(numPatch-1)*3); - if(dirxbeg[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]; @@ -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; } } } diff --git a/src/idefix.hpp b/src/idefix.hpp index a44bf4c2..7485f95f 100644 --- a/src/idefix.hpp +++ b/src/idefix.hpp @@ -9,6 +9,7 @@ #define IDEFIX_HPP_ #include #include +#include #include // #include // do we still need this? #ifdef WITH_MPI @@ -216,7 +217,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}; diff --git a/src/kokkos b/src/kokkos index 6ecdf605..15dc143e 160000 --- a/src/kokkos +++ b/src/kokkos @@ -1 +1 @@ -Subproject commit 6ecdf605e0f7639adec599d25cf0e206d7b8f9f5 +Subproject commit 15dc143e5f39949eece972a798e175c4b463d4b8 diff --git a/src/macros.hpp b/src/macros.hpp index 9a484c3d..2c7bda12 100644 --- a/src/macros.hpp +++ b/src/macros.hpp @@ -10,6 +10,7 @@ #ifndef MACROS_HPP_ #define MACROS_HPP_ +#include #if COMPONENTS == 1 #define EXPAND(a,b,c) a diff --git a/src/main.cpp b/src/main.cpp index 5a7f6f73..c242ccef 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include diff --git a/src/mpi.cpp b/src/mpi.cpp index ee2fdb5c..d25056fa 100644 --- a/src/mpi.cpp +++ b/src/mpi.cpp @@ -12,6 +12,7 @@ #include // NOLINT [build/c++11] #include // NOLINT [build/c++11] #include +#include #include "idefix.hpp" #include "dataBlock.hpp" diff --git a/src/output/dump.cpp b/src/output/dump.cpp index 5a27ecc2..955e06e7 100644 --- a/src/output/dump.cpp +++ b/src/output/dump.cpp @@ -8,7 +8,7 @@ #include #include #if __has_include() - #include + #include // NOLINT [build/c++17] namespace fs = std::filesystem; #elif __has_include() #include @@ -17,6 +17,8 @@ #error "Missing the header." #endif #include +#include +#include #include "dump.hpp" #include "version.hpp" #include "dataBlockHost.hpp" @@ -248,7 +250,9 @@ void Dump::WriteString(IdfxFileHandler fileHdl, char *str, int size) { } offset=offset+size; #else - fwrite (str, sizeof(char), size, fileHdl); + if(fwrite (str, sizeof(char), size, fileHdl) != size) { + IDEFIX_ERROR("Unable to write to file. Check your filesystem permissions and disk quota."); + } #endif } @@ -312,15 +316,23 @@ void Dump::WriteSerial(IdfxFileHandler fileHdl, int ndim, int *dim, #else // Write type of data - fwrite(&type, 1, sizeof(int), fileHdl); + if(fwrite(&type, sizeof(int), 1, fileHdl) != 1) { + IDEFIX_ERROR("Unable to write to file. Check your filesystem permissions and disk quota."); + } // Write dimensions of array - fwrite(&ndim, 1, sizeof(int), fileHdl); + if(fwrite(&ndim, sizeof(int), 1, fileHdl) != 1) { + IDEFIX_ERROR("Unable to write to file. Check your filesystem permissions and disk quota."); + } for(int n = 0 ; n < ndim ; n++) { - fwrite(dim+n, 1, sizeof(int), fileHdl); + if(fwrite(dim+n, sizeof(int), 1, fileHdl) != 1) { + IDEFIX_ERROR("Unable to write to file. Check your filesystem permissions and disk quota."); + } ntot = ntot * dim[n]; } // Write raw data - fwrite(data, ntot, size, fileHdl); + if(fwrite(data, size, ntot, fileHdl) != ntot) { + IDEFIX_ERROR("Unable to write to file. Check your filesystem permissions and disk quota."); + } #endif } @@ -384,18 +396,26 @@ void Dump::WriteDistributed(IdfxFileHandler fileHdl, int ndim, int *dim, int *gd #else // Write type of data - fwrite(&type, 1, sizeof(int), fileHdl); + if(fwrite(&type, sizeof(int), 1, fileHdl) != 1) { + IDEFIX_ERROR("Unable to write to file. Check your filesystem permissions and disk quota."); + } // Write dimensions of array // (in serial, dim and gdim are identical, so no need to differentiate) - fwrite(&ndim, 1, sizeof(int), fileHdl); + if(fwrite(&ndim, sizeof(int), 1, fileHdl) != 1) { + IDEFIX_ERROR("Unable to write to file. Check your filesystem permissions and disk quota."); + } for(int n = 0 ; n < ndim ; n++) { - fwrite(dim+n, 1, sizeof(int), fileHdl); + if(fwrite(dim+n, sizeof(int), 1, fileHdl) != 1) { + IDEFIX_ERROR("Unable to write to file. Check your filesystem permissions and disk quota."); + } ntot = ntot * dim[n]; } // Write raw data - fwrite(data, ntot, sizeof(real), fileHdl); + if(fwrite(data, sizeof(real), ntot, fileHdl) != ntot) { + IDEFIX_ERROR("Unable to write to file. Check your filesystem permissions and disk quota."); + } #endif } @@ -836,6 +856,12 @@ int Dump::Write(Output& output) { this->offset = 0; #else fileHdl = fopen(filename.c_str(),"wb"); + if(fileHdl == NULL) { + std::stringstream msg; + msg << "Unable to open file " << filename << std::endl; + msg << "Check that you have write access and that you don't exceed your quota." << std::endl; + IDEFIX_ERROR(msg); + } #endif // File is open // First thing we need are coordinates: init a host mirror and sync it diff --git a/src/output/dump.hpp b/src/output/dump.hpp index a9a52554..d823ddca 100644 --- a/src/output/dump.hpp +++ b/src/output/dump.hpp @@ -11,7 +11,7 @@ #include #include #if __has_include() - #include + #include // NOLINT [build/c++17] namespace fs = std::filesystem; #elif __has_include() #include diff --git a/src/output/output.cpp b/src/output/output.cpp index 30a85039..658e1cdd 100644 --- a/src/output/output.cpp +++ b/src/output/output.cpp @@ -5,6 +5,7 @@ // Licensed under CeCILL 2.1 License, see COPYING for more information // *********************************************************************************** +#include #include "output.hpp" #include "dataBlock.hpp" #include "fluid.hpp" diff --git a/src/output/slice.cpp b/src/output/slice.cpp index 3f971932..98caa5c2 100644 --- a/src/output/slice.cpp +++ b/src/output/slice.cpp @@ -7,6 +7,7 @@ #include #include +#include #include "slice.hpp" #include "input.hpp" #include "physics.hpp" diff --git a/src/output/vtk.cpp b/src/output/vtk.cpp index 559f00c8..ae4a4c60 100644 --- a/src/output/vtk.cpp +++ b/src/output/vtk.cpp @@ -8,10 +8,11 @@ #include "vtk.hpp" #include #include +#include #include #include #if __has_include() - #include + #include // NOLINT [build/c++17] namespace fs = std::filesystem; #elif __has_include() #include @@ -53,7 +54,9 @@ void Vtk::WriteHeaderNodes(IdfxFileHandler fvtk) { MPI_FLOAT, MPI_STATUS_IGNORE)); this->offset += sizeof(float)*(nx1+ioffset)*(nx2+joffset)*(nx3+koffset)*3; #else - fwrite(node_coord.data(),sizeof(float),size,fvtk); + if(fwrite(node_coord.data(),sizeof(float),size,fvtk) != size) { + IDEFIX_ERROR("Unable to write to file. Check your filesystem permissions and disk quota."); + } #endif } @@ -124,21 +127,21 @@ Vtk::Vtk(Input &input, DataBlock *datain, std::string filebase) { for (int32_t i = 0; i < nx1 + ioffset; i++) { if(grid.np_tot[IDIR] == 1) // only one dimension in this direction - xnode[i] = BigEndian(static_cast(grid.x[IDIR](i))); + xnode[i] = bigEndian(static_cast(grid.x[IDIR](i))); else - xnode[i] = BigEndian(static_cast(grid.xl[IDIR](i + grid.nghost[IDIR]))); + xnode[i] = bigEndian(static_cast(grid.xl[IDIR](i + grid.nghost[IDIR]))); } for (int32_t j = 0; j < nx2 + joffset; j++) { if(grid.np_tot[JDIR] == 1) // only one dimension in this direction - ynode[j] = BigEndian(static_cast(grid.x[JDIR](j))); + ynode[j] = bigEndian(static_cast(grid.x[JDIR](j))); else - ynode[j] = BigEndian(static_cast(grid.xl[JDIR](j + grid.nghost[JDIR]))); + ynode[j] = bigEndian(static_cast(grid.xl[JDIR](j + grid.nghost[JDIR]))); } for (int32_t k = 0; k < nx3 + koffset; k++) { if(grid.np_tot[KDIR] == 1) - znode[k] = BigEndian(static_cast(grid.x[KDIR](k))); + znode[k] = bigEndian(static_cast(grid.x[KDIR](k))); else - znode[k] = BigEndian(static_cast(grid.xl[KDIR](k + grid.nghost[KDIR]))); + znode[k] = bigEndian(static_cast(grid.xl[KDIR](k + grid.nghost[KDIR]))); } #if VTK_FORMAT == VTK_STRUCTURED_GRID // VTK_FORMAT /* -- Allocate memory for node_coord which is later used -- */ @@ -191,35 +194,35 @@ Vtk::Vtk(Input &input, DataBlock *datain, std::string filebase) { for (int32_t k = 0; k < nodesubsize[0]; k++) { for (int32_t j = 0; j < nodesubsize[1]; j++) { for (int32_t i = 0; i < nodesubsize[2]; i++) { - // BigEndian allows us to get back to little endian when needed + // bigEndian allows us to get back to little endian when needed x1 = grid.xl[IDIR](i + data->gbeg[IDIR]); x2 = grid.xl[JDIR](j + data->gbeg[JDIR]); x3 = grid.xl[KDIR](k + data->gbeg[KDIR]); #if (GEOMETRY == CARTESIAN) || (GEOMETRY == CYLINDRICAL) - node_coord(k,j,i,0) = BigEndian(x1); - node_coord(k,j,i,1) = BigEndian(x2); - node_coord(k,j,i,2) = BigEndian(x3); + node_coord(k,j,i,0) = bigEndian(x1); + node_coord(k,j,i,1) = bigEndian(x2); + node_coord(k,j,i,2) = bigEndian(x3); #elif GEOMETRY == POLAR - node_coord(k,j,i,0) = BigEndian(x1 * cos(x2)); - node_coord(k,j,i,1) = BigEndian(x1 * sin(x2)); - node_coord(k,j,i,2) = BigEndian(x3); + node_coord(k,j,i,0) = bigEndian(x1 * std::cos(x2)); + node_coord(k,j,i,1) = bigEndian(x1 * std::sin(x2)); + node_coord(k,j,i,2) = bigEndian(x3); #elif GEOMETRY == SPHERICAL #if DIMENSIONS == 1 - node_coord(k,j,i,0) = BigEndian(x1); - node_coord(k,j,i,1) = BigEndian(0.0); - node_coord(k,j,i,2) = BigEndian(0.0); + node_coord(k,j,i,0) = bigEndian(x1); + node_coord(k,j,i,1) = bigEndian(0.0f); + node_coord(k,j,i,2) = bigEndian(0.0f); #elif DIMENSIONS == 2 - node_coord(k,j,i,0) = BigEndian(x1 * sin(x2)); - node_coord(k,j,i,1) = BigEndian(x1 * cos(x2)); - node_coord(k,j,i,2) = BigEndian(0.0); + node_coord(k,j,i,0) = bigEndian(x1 * std::sin(x2)); + node_coord(k,j,i,1) = bigEndian(x1 * std::cos(x2)); + node_coord(k,j,i,2) = bigEndian(0.0f); #elif DIMENSIONS == 3 - node_coord(k,j,i,0) = BigEndian(x1 * sin(x2) * cos(x3)); - node_coord(k,j,i,1) = BigEndian(x1 * sin(x2) * sin(x3)); - node_coord(k,j,i,2) = BigEndian(x1 * cos(x2)); + node_coord(k,j,i,0) = bigEndian(x1 * std::sin(x2) * std::cos(x3)); + node_coord(k,j,i,1) = bigEndian(x1 * std::sin(x2) * std::sin(x3)); + node_coord(k,j,i,2) = bigEndian(x1 * std::cos(x2)); #endif // DIMENSIONS #endif // GEOMETRY } @@ -290,6 +293,13 @@ int Vtk::Write() { this->offset = 0; #else fileHdl = fopen(filename.c_str(),"wb"); + + if(fileHdl == NULL) { + std::stringstream msg; + msg << "Unable to open file " << filename << std::endl; + msg << "Check that you have write access and that you don't exceed your quota." << std::endl; + IDEFIX_ERROR(msg); + } #endif WriteHeader(fileHdl, this->data->t); @@ -301,7 +311,7 @@ int Vtk::Write() { for(int j = data->beg[JDIR]; j < data->end[JDIR] ; j++ ) { for(int i = data->beg[IDIR]; i < data->end[IDIR] ; i++ ) { vect3D[i-data->beg[IDIR] + (j-data->beg[JDIR])*nx1loc + (k-data->beg[KDIR])*nx1loc*nx2loc] - = BigEndian(static_cast(Vcin(k,j,i))); + = bigEndian(static_cast(Vcin(k,j,i))); } } } @@ -379,7 +389,7 @@ void Vtk::WriteHeader(IdfxFileHandler fvtk, real time) { ssheader.str(std::string()); // convert time to single precision big endian - int32_t geoBig = BigEndian(this->geometry); + int32_t geoBig = bigEndian(this->geometry); WriteHeaderBinary(&geoBig, 1, fvtk); // Done, add cariage return for next ascii write @@ -396,7 +406,7 @@ void Vtk::WriteHeader(IdfxFileHandler fvtk, real time) { int32_t perBig{-1}; for (int dir=0; dir<3; dir++) { - perBig = BigEndian(this->periodicity[dir]); + perBig = bigEndian(this->periodicity[dir]); WriteHeaderBinary(&perBig, 1, fvtk); } // Done, add cariage return for next ascii write @@ -410,7 +420,7 @@ void Vtk::WriteHeader(IdfxFileHandler fvtk, real time) { ssheader.str(std::string()); // convert time to single precision big endian - float timeBE = BigEndian(static_cast(time)); + float timeBE = bigEndian(static_cast(time)); WriteHeaderBinary(&timeBE, 1, fvtk); // Done, add cariage return for next ascii write @@ -502,6 +512,8 @@ void Vtk::WriteScalar(IdfxFileHandler fvtk, float* Vin, const std::string &var_ this->offset = this->offset + sizeof(float)*nx1*nx2*nx3; #else - fwrite(Vin,sizeof(float),nx1loc*nx2loc*nx3loc,fvtk); + if(fwrite(Vin,sizeof(float),nx1loc*nx2loc*nx3loc,fvtk) != nx1loc*nx2loc*nx3loc) { + IDEFIX_ERROR("Unable to write to file. Check your filesystem permissions and disk quota."); + } #endif } diff --git a/src/output/vtk.hpp b/src/output/vtk.hpp index 4857f19d..a9503a5a 100644 --- a/src/output/vtk.hpp +++ b/src/output/vtk.hpp @@ -10,7 +10,7 @@ #include #include #if __has_include() - #include + #include // NOLINT [build/c++17] namespace fs = std::filesystem; #elif __has_include() #include @@ -18,28 +18,22 @@ #else error "Missing the header." #endif +#include #include "idefix.hpp" #include "input.hpp" #include "dataBlock.hpp" +#include "bigEndian.hpp" #include "scalarField.hpp" + // Forward class declaration class Output; class DataBlock; class BaseVtk { - private: - // Endianness swaping function and variable - bool shouldSwapEndian {true}; - protected: BaseVtk() { - // Test endianness - int tmp1 = 1; - unsigned char *tmp2 = (unsigned char *) &tmp1; - if (*tmp2 == 0) - this->shouldSwapEndian = false; // Initialise the root tag (used for MPI non-collective I/Os) this->isRoot = idfx::prank == 0; } @@ -68,25 +62,9 @@ class BaseVtk { // DataBlock parent DataBlock *data; - /* ****************************************************************************/ - /** Determines if the machine is little-endian. If so, - it will force the data to be big-endian. - @param in_number floating point number to be converted in big endian */ - /* *************************************************************************** */ + // BigEndian conversion + BigEndian bigEndian; - template - T BigEndian(T in_number) { - if (shouldSwapEndian) { - unsigned char *bytes = (unsigned char*) &in_number; - unsigned char tmp = bytes[0]; - bytes[0] = bytes[3]; - bytes[3] = tmp; - tmp = bytes[1]; - bytes[1] = bytes[2]; - bytes[2] = tmp; - } - return(in_number); - } void WriteHeaderString(const char* header, IdfxFileHandler fvtk) { #ifdef WITH_MPI @@ -98,7 +76,10 @@ class BaseVtk { } offset=offset+strlen(header); #else - fprintf (fvtk, "%s", header); + int rc = fprintf (fvtk, "%s", header); + if(rc<0) { + IDEFIX_ERROR("Unable to write to file. Check your filesystem permissions and disk quota."); + } #endif } @@ -113,7 +94,9 @@ class BaseVtk { } offset=offset+nelem*sizeof(T); #else - fwrite(buffer, sizeof(T), nelem, fvtk); + if(fwrite(buffer, sizeof(T), nelem, fvtk) != nelem) { + IDEFIX_ERROR("Unable to write to file. Check your filesystem permissions and disk quota."); + } #endif } }; diff --git a/src/output/xdmf.cpp b/src/output/xdmf.cpp index 7f2baf7d..23ddaa03 100644 --- a/src/output/xdmf.cpp +++ b/src/output/xdmf.cpp @@ -10,6 +10,16 @@ #include #include #include +#if __has_include() + #include // NOLINT [build/c++17] + namespace fs = std::filesystem; +#elif __has_include() + #include + namespace fs = std::experimental::filesystem; +#else + #error "Missing the header." +#endif + #include "xdmf.hpp" #include "version.hpp" #include "idefix.hpp" @@ -39,9 +49,9 @@ Xdmf::Xdmf(Input &input, DataBlock *datain) { } if(idfx::prank==0) { - if(!std::filesystem::is_directory(outputDirectory)) { + if(!fs::is_directory(outputDirectory)) { try { - if(!std::filesystem::create_directory(outputDirectory)) { + if(!fs::create_directory(outputDirectory)) { std::stringstream msg; msg << "Cannot create directory " << outputDirectory << std::endl; IDEFIX_ERROR(msg); @@ -165,7 +175,7 @@ Xdmf::Xdmf(Input &input, DataBlock *datain) { cellsubsize[3]); */ // Temporary storage on host for 3D arrays - this->vect3D = new float[nx1loc*nx2loc*nx3loc]; + this->vect3D = new DUMP_DATATYPE[nx1loc*nx2loc*nx3loc]; // fill the node_coord array DUMP_DATATYPE x1 = 0.0; @@ -274,8 +284,8 @@ Xdmf::Xdmf(Input &input, DataBlock *datain) { int Xdmf::Write() { idfx::pushRegion("Xdmf::Write"); - std::filesystem::path filename; - std::filesystem::path filename_xmf; + fs::path filename; + fs::path filename_xmf; hid_t err; idfx::cout << "Xdmf: Write file n " << xdmfFileNumber << "..." << std::flush; timer.reset(); diff --git a/src/output/xdmf.hpp b/src/output/xdmf.hpp index b2fb6628..6c6fc15c 100644 --- a/src/output/xdmf.hpp +++ b/src/output/xdmf.hpp @@ -8,7 +8,15 @@ #ifndef OUTPUT_XDMF_HPP_ #define OUTPUT_XDMF_HPP_ #include -#include +#if __has_include() + #include // NOLINT [build/c++17] + namespace fs = std::filesystem; +#elif __has_include() + #include + namespace fs = std::experimental::filesystem; +#else + error "Missing the header." +#endif #include #include "idefix.hpp" #include "input.hpp" diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt index ff971569..b36f8a08 100644 --- a/src/utils/CMakeLists.txt +++ b/src/utils/CMakeLists.txt @@ -1,6 +1,7 @@ add_subdirectory(iterativesolver) target_sources(idefix + PUBLIC ${CMAKE_CURRENT_LIST_DIR}/bigEndian.hpp PUBLIC ${CMAKE_CURRENT_LIST_DIR}/dumpImage.cpp PUBLIC ${CMAKE_CURRENT_LIST_DIR}/dumpImage.hpp PUBLIC ${CMAKE_CURRENT_LIST_DIR}/lookupTable.hpp diff --git a/src/utils/bigEndian.hpp b/src/utils/bigEndian.hpp new file mode 100644 index 00000000..08bd73c0 --- /dev/null +++ b/src/utils/bigEndian.hpp @@ -0,0 +1,63 @@ +// *********************************************************************************** +// Idefix MHD astrophysical code +// Copyright(C) Geoffroy R. J. Lesur +// and other code contributors +// Licensed under CeCILL 2.1 License, see COPYING for more information +// *********************************************************************************** + +#ifndef UTILS_BIGENDIAN_HPP_ +#define UTILS_BIGENDIAN_HPP_ + +#include +#include +#include "idefix.hpp" + +/* ****************************************************************************/ +/** Determines if the machine is little-endian. If so, + it will force the data to be big-endian. +@param in_number floating point number to be converted in big endian */ +/* *************************************************************************** */ + +class BigEndian { + public: + BigEndian() { + // Test endianness + union { + uint32_t i; + char c[4]; + } bint = {0x01020304}; + + if(bint.c[0] == 1) + this->shouldSwapEndian = false; + else + this->shouldSwapEndian = true; + } + + // Swap when needed + template + T operator() (T in_number) { + static_assert(std::is_arithmetic_v == true); + T out_number; + if (this->shouldSwapEndian) { + constexpr int size = sizeof(T); + union { + T u; + unsigned char byte[size]; + } in, out; + in.u = in_number; + for(int n = 0 ; n < size ; n++) { + out.byte[size-n-1] = in.byte[n]; + } + out_number = out.u; + } else { + out_number = in_number; + } + return(out_number); + } + + private: + // Endianness swaping flag + bool shouldSwapEndian; +}; + +#endif // UTILS_BIGENDIAN_HPP_ diff --git a/src/utils/dumpImage.cpp b/src/utils/dumpImage.cpp index 03a456e1..04f413a7 100644 --- a/src/utils/dumpImage.cpp +++ b/src/utils/dumpImage.cpp @@ -5,6 +5,8 @@ // Licensed under CeCILL 2.1 License, see COPYING for more information // *********************************************************************************** +#include +#include #include "dumpImage.hpp" #include "dataBlock.hpp" #include "idefix.hpp" diff --git a/src/utils/npy.hpp b/src/utils/npy.hpp index 34b7c724..edae82ee 100644 --- a/src/utils/npy.hpp +++ b/src/utils/npy.hpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include diff --git a/test/HD/FargoPlanet/setup.cpp b/test/HD/FargoPlanet/setup.cpp index 125834a4..314858ba 100644 --- a/test/HD/FargoPlanet/setup.cpp +++ b/test/HD/FargoPlanet/setup.cpp @@ -43,7 +43,6 @@ void UserdefBoundary(Hydro *hydro, int dir, BoundarySide side, real t) { IdefixArray4D Vc = hydro->Vc; auto *data = hydro->data; IdefixArray1D x1 = data->x[IDIR]; - IdefixArray1D x3 = data->x[KDIR]; if(dir==IDIR) { int ighost,ibeg,iend; if(side == left) { @@ -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); @@ -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); diff --git a/test/HD/VSI/idefix.ini b/test/HD/VSI/idefix.ini index bc728eac..f0ce6a4d 100644 --- a/test/HD/VSI/idefix.ini +++ b/test/HD/VSI/idefix.ini @@ -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 @@ -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 diff --git a/test/HD/ViscousDisk/idefix-rkl.ini b/test/HD/ViscousDisk/idefix-rkl.ini index 63888492..207f3abe 100644 --- a/test/HD/ViscousDisk/idefix-rkl.ini +++ b/test/HD/ViscousDisk/idefix-rkl.ini @@ -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 @@ -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 diff --git a/test/HD/ViscousDisk/idefix.ini b/test/HD/ViscousDisk/idefix.ini index 673d4be7..dbe8a499 100644 --- a/test/HD/ViscousDisk/idefix.ini +++ b/test/HD/ViscousDisk/idefix.ini @@ -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 @@ -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 diff --git a/test/HD/ViscousFlowPastCylinder/idefix-rkl.ini b/test/HD/ViscousFlowPastCylinder/idefix-rkl.ini index 8b8b33e3..73b8722b 100644 --- a/test/HD/ViscousFlowPastCylinder/idefix-rkl.ini +++ b/test/HD/ViscousFlowPastCylinder/idefix-rkl.ini @@ -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 @@ -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 diff --git a/test/HD/ViscousFlowPastCylinder/idefix.ini b/test/HD/ViscousFlowPastCylinder/idefix.ini index 33793490..de1cd417 100644 --- a/test/HD/ViscousFlowPastCylinder/idefix.ini +++ b/test/HD/ViscousFlowPastCylinder/idefix.ini @@ -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 @@ -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 diff --git a/test/HD/sod-iso/idefix-hll.ini b/test/HD/sod-iso/idefix-hll.ini index cb6ab432..f7b36503 100644 --- a/test/HD/sod-iso/idefix-hll.ini +++ b/test/HD/sod-iso/idefix-hll.ini @@ -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 @@ -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 diff --git a/test/HD/sod-iso/idefix-hllc-rk3.ini b/test/HD/sod-iso/idefix-hllc-rk3.ini index 7606c7fc..161237da 100644 --- a/test/HD/sod-iso/idefix-hllc-rk3.ini +++ b/test/HD/sod-iso/idefix-hllc-rk3.ini @@ -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 @@ -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 diff --git a/test/HD/sod-iso/idefix-hllc.ini b/test/HD/sod-iso/idefix-hllc.ini index 751f5e86..a5d3eea8 100644 --- a/test/HD/sod-iso/idefix-hllc.ini +++ b/test/HD/sod-iso/idefix-hllc.ini @@ -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 @@ -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 diff --git a/test/HD/sod-iso/idefix-rk3.ini b/test/HD/sod-iso/idefix-rk3.ini index e913683d..498a24f3 100644 --- a/test/HD/sod-iso/idefix-rk3.ini +++ b/test/HD/sod-iso/idefix-rk3.ini @@ -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 @@ -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 diff --git a/test/HD/sod-iso/idefix-tvdlf.ini b/test/HD/sod-iso/idefix-tvdlf.ini index f6c7e57d..ecb0b07d 100644 --- a/test/HD/sod-iso/idefix-tvdlf.ini +++ b/test/HD/sod-iso/idefix-tvdlf.ini @@ -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 @@ -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 diff --git a/test/HD/sod-iso/idefix.ini b/test/HD/sod-iso/idefix.ini index 564286e3..2477fa6d 100644 --- a/test/HD/sod-iso/idefix.ini +++ b/test/HD/sod-iso/idefix.ini @@ -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 @@ -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 diff --git a/test/HD/sod/idefix-hll.ini b/test/HD/sod/idefix-hll.ini index 0bfb03ce..e515254d 100644 --- a/test/HD/sod/idefix-hll.ini +++ b/test/HD/sod/idefix-hll.ini @@ -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 @@ -16,10 +14,6 @@ gamma 1.4 [Boundary] X1-beg outflow X1-end outflow -X2-beg outflow -X2-end outflow -X3-beg outflow -X3-end outflow [Output] vtk 0.1 diff --git a/test/HD/sod/idefix-hllc-rk3.ini b/test/HD/sod/idefix-hllc-rk3.ini index 68a97c55..0c73d838 100644 --- a/test/HD/sod/idefix-hllc-rk3.ini +++ b/test/HD/sod/idefix-hllc-rk3.ini @@ -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 @@ -16,10 +14,6 @@ gamma 1.4 [Boundary] X1-beg outflow X1-end outflow -X2-beg outflow -X2-end outflow -X3-beg outflow -X3-end outflow [Output] vtk 0.1 diff --git a/test/HD/sod/idefix-hllc.ini b/test/HD/sod/idefix-hllc.ini index 3db50c3c..1acedec1 100644 --- a/test/HD/sod/idefix-hllc.ini +++ b/test/HD/sod/idefix-hllc.ini @@ -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 @@ -16,10 +14,6 @@ gamma 1.4 [Boundary] X1-beg outflow X1-end outflow -X2-beg outflow -X2-end outflow -X3-beg outflow -X3-end outflow [Output] vtk 0.1 diff --git a/test/HD/sod/idefix-rk3.ini b/test/HD/sod/idefix-rk3.ini index 7fe738ed..96675389 100644 --- a/test/HD/sod/idefix-rk3.ini +++ b/test/HD/sod/idefix-rk3.ini @@ -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 @@ -16,10 +14,6 @@ gamma 1.4 [Boundary] X1-beg outflow X1-end outflow -X2-beg outflow -X2-end outflow -X3-beg outflow -X3-end outflow [Output] vtk 0.1 diff --git a/test/HD/sod/idefix-tvdlf.ini b/test/HD/sod/idefix-tvdlf.ini index 36133b9b..ef465164 100644 --- a/test/HD/sod/idefix-tvdlf.ini +++ b/test/HD/sod/idefix-tvdlf.ini @@ -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 @@ -16,10 +14,6 @@ gamma 1.4 [Boundary] X1-beg outflow X1-end outflow -X2-beg outflow -X2-end outflow -X3-beg outflow -X3-end outflow [Output] vtk 0.1 diff --git a/test/HD/sod/idefix.ini b/test/HD/sod/idefix.ini index b34a23c3..8e089ef6 100644 --- a/test/HD/sod/idefix.ini +++ b/test/HD/sod/idefix.ini @@ -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 @@ -16,10 +14,6 @@ gamma 1.4 [Boundary] X1-beg outflow X1-end outflow -X2-beg outflow -X2-end outflow -X3-beg outflow -X3-end outflow [Output] vtk 0.1 diff --git a/test/MHD/AmbipolarCshock/idefix-rkl.ini b/test/MHD/AmbipolarCshock/idefix-rkl.ini index e02b3415..76a21a44 100644 --- a/test/MHD/AmbipolarCshock/idefix-rkl.ini +++ b/test/MHD/AmbipolarCshock/idefix-rkl.ini @@ -1,7 +1,5 @@ [Grid] X1-grid 1 0.0 100 u 50.0 -X2-grid 1 0.0 1 u 1.0 -X3-grid 1 0.0 1 u 1.0 [TimeIntegrator] CFL 0.9 @@ -17,10 +15,6 @@ csiso constant 0.1 [Boundary] X1-beg userdef X1-end userdef -X2-beg periodic -X2-end periodic -X3-beg periodic -X3-end periodic [Output] vtk 100.0 diff --git a/test/MHD/AmbipolarWind/idefix.ini b/test/MHD/AmbipolarWind/idefix.ini index 22d8006a..24dd839f 100644 --- a/test/MHD/AmbipolarWind/idefix.ini +++ b/test/MHD/AmbipolarWind/idefix.ini @@ -1,7 +1,6 @@ [Grid] X1-grid 1 1.0 768 l 100.0 X2-grid 3 0.0 64 s+ 1.28 96 u 1.861592653589 64 s- 3.141592653589793 -X3-grid 1 0.0 0 u 1.0 [TimeIntegrator] CFL 0.9 @@ -25,8 +24,6 @@ X1-beg userdef X1-end userdef X2-beg axis X2-end axis -X3-beg periodic -X3-end periodic [Setup] epsilon 0.05 diff --git a/test/MHD/MTI/idefix-rkl.ini b/test/MHD/MTI/idefix-rkl.ini index 2eeb7615..1b9b11eb 100644 --- a/test/MHD/MTI/idefix-rkl.ini +++ b/test/MHD/MTI/idefix-rkl.ini @@ -1,7 +1,6 @@ [Grid] X1-grid 1 0. 32 u 0.1 X2-grid 1 0. 32 u 0.1 -X3-grid 1 0. 1 u 1. [TimeIntegrator] CFL 0.7 @@ -24,8 +23,6 @@ X1-beg periodic X1-end periodic X2-beg userdef X2-end userdef -X3-beg userdef -X3-end userdef [Setup] ksi 5e-4 diff --git a/test/MHD/MTI/idefix-sl.ini b/test/MHD/MTI/idefix-sl.ini index de020034..f2c9deb2 100644 --- a/test/MHD/MTI/idefix-sl.ini +++ b/test/MHD/MTI/idefix-sl.ini @@ -1,7 +1,6 @@ [Grid] X1-grid 1 0. 32 u 0.1 X2-grid 1 0. 32 u 0.1 -X3-grid 1 0. 1 u 1. [TimeIntegrator] CFL 0.7 @@ -24,8 +23,6 @@ X1-beg periodic X1-end periodic X2-beg userdef X2-end userdef -X3-beg userdef -X3-end userdef [Setup] ksi 5e-4 diff --git a/test/MHD/MTI/idefix.ini b/test/MHD/MTI/idefix.ini index b54bedb0..7a09c406 100644 --- a/test/MHD/MTI/idefix.ini +++ b/test/MHD/MTI/idefix.ini @@ -1,7 +1,6 @@ [Grid] X1-grid 1 0. 32 u 0.1 X2-grid 1 0. 32 u 0.1 -X3-grid 1 0. 1 u 1. [TimeIntegrator] CFL 0.7 @@ -24,8 +23,6 @@ X1-beg periodic X1-end periodic X2-beg userdef X2-end userdef -X3-beg userdef -X3-end userdef [Setup] ksi 5e-4 diff --git a/test/MHD/OrszagTang/idefix-hll.ini b/test/MHD/OrszagTang/idefix-hll.ini index 3dd96a58..4f13fd97 100644 --- a/test/MHD/OrszagTang/idefix-hll.ini +++ b/test/MHD/OrszagTang/idefix-hll.ini @@ -1,7 +1,6 @@ [Grid] X1-grid 1 0.0 128 u 1.0 X2-grid 1 0.0 128 u 1.0 -X3-grid 1 0.0 1 u 1.0 [TimeIntegrator] CFL 0.6 @@ -17,8 +16,6 @@ X1-beg periodic X1-end periodic X2-beg periodic X2-end periodic -X3-beg outflow -X3-end outflow [Output] vtk 0.5 diff --git a/test/MHD/OrszagTang/idefix-hlld-arithmetic.ini b/test/MHD/OrszagTang/idefix-hlld-arithmetic.ini index b8549db5..8a656d7b 100644 --- a/test/MHD/OrszagTang/idefix-hlld-arithmetic.ini +++ b/test/MHD/OrszagTang/idefix-hlld-arithmetic.ini @@ -1,7 +1,6 @@ [Grid] X1-grid 1 0.0 128 u 1.0 X2-grid 1 0.0 128 u 1.0 -X3-grid 1 0.0 1 u 1.0 [TimeIntegrator] CFL 0.6 @@ -18,8 +17,6 @@ X1-beg periodic X1-end periodic X2-beg periodic X2-end periodic -X3-beg outflow -X3-end outflow [Output] vtk 0.5 diff --git a/test/MHD/OrszagTang/idefix-hlld-hll.ini b/test/MHD/OrszagTang/idefix-hlld-hll.ini index 8c3e4ef9..b396e991 100644 --- a/test/MHD/OrszagTang/idefix-hlld-hll.ini +++ b/test/MHD/OrszagTang/idefix-hlld-hll.ini @@ -1,7 +1,6 @@ [Grid] X1-grid 1 0.0 128 u 1.0 X2-grid 1 0.0 128 u 1.0 -X3-grid 1 0.0 1 u 1.0 [TimeIntegrator] CFL 0.6 @@ -18,8 +17,6 @@ X1-beg periodic X1-end periodic X2-beg periodic X2-end periodic -X3-beg outflow -X3-end outflow [Output] vtk 0.5 diff --git a/test/MHD/OrszagTang/idefix-hlld-hlld.ini b/test/MHD/OrszagTang/idefix-hlld-hlld.ini index 50e15897..5e158b93 100644 --- a/test/MHD/OrszagTang/idefix-hlld-hlld.ini +++ b/test/MHD/OrszagTang/idefix-hlld-hlld.ini @@ -1,7 +1,6 @@ [Grid] X1-grid 1 0.0 128 u 1.0 X2-grid 1 0.0 128 u 1.0 -X3-grid 1 0.0 1 u 1.0 [TimeIntegrator] CFL 0.6 @@ -18,8 +17,6 @@ X1-beg periodic X1-end periodic X2-beg periodic X2-end periodic -X3-beg outflow -X3-end outflow [Output] vtk 0.5 diff --git a/test/MHD/OrszagTang/idefix-hlld-uct0.ini b/test/MHD/OrszagTang/idefix-hlld-uct0.ini index fc32e81b..23646b96 100644 --- a/test/MHD/OrszagTang/idefix-hlld-uct0.ini +++ b/test/MHD/OrszagTang/idefix-hlld-uct0.ini @@ -1,7 +1,6 @@ [Grid] X1-grid 1 0.0 128 u 1.0 X2-grid 1 0.0 128 u 1.0 -X3-grid 1 0.0 1 u 1.0 [TimeIntegrator] CFL 0.6 @@ -18,8 +17,6 @@ X1-beg periodic X1-end periodic X2-beg periodic X2-end periodic -X3-beg outflow -X3-end outflow [Output] vtk 0.5 diff --git a/test/MHD/OrszagTang/idefix-hlld.ini b/test/MHD/OrszagTang/idefix-hlld.ini index cf0b0c09..cf6d5cbf 100644 --- a/test/MHD/OrszagTang/idefix-hlld.ini +++ b/test/MHD/OrszagTang/idefix-hlld.ini @@ -1,7 +1,6 @@ [Grid] X1-grid 1 0.0 128 u 1.0 X2-grid 1 0.0 128 u 1.0 -X3-grid 1 0.0 1 u 1.0 [TimeIntegrator] CFL 0.6 @@ -17,8 +16,6 @@ X1-beg periodic X1-end periodic X2-beg periodic X2-end periodic -X3-beg outflow -X3-end outflow [Output] vtk 0.5 diff --git a/test/MHD/OrszagTang/idefix-tvdlf.ini b/test/MHD/OrszagTang/idefix-tvdlf.ini index 47a05bb9..ec9ffe85 100644 --- a/test/MHD/OrszagTang/idefix-tvdlf.ini +++ b/test/MHD/OrszagTang/idefix-tvdlf.ini @@ -1,7 +1,6 @@ [Grid] X1-grid 1 0.0 128 u 1.0 X2-grid 1 0.0 128 u 1.0 -X3-grid 1 0.0 1 u 1.0 [TimeIntegrator] CFL 0.6 @@ -17,8 +16,6 @@ X1-beg periodic X1-end periodic X2-beg periodic X2-end periodic -X3-beg outflow -X3-end outflow [Output] vtk 0.5 diff --git a/test/MHD/OrszagTang/idefix.ini b/test/MHD/OrszagTang/idefix.ini index e3afb65b..0e742184 100644 --- a/test/MHD/OrszagTang/idefix.ini +++ b/test/MHD/OrszagTang/idefix.ini @@ -1,7 +1,6 @@ [Grid] X1-grid 1 0.0 128 u 1.0 X2-grid 1 0.0 128 u 1.0 -X3-grid 1 0.0 1 u 1.0 [TimeIntegrator] CFL 0.6 @@ -17,8 +16,6 @@ X1-beg periodic X1-end periodic X2-beg periodic X2-end periodic -X3-beg outflow -X3-end outflow [Output] vtk 0.5 diff --git a/test/MHD/ResistiveAlfvenWave/idefix-rkl.ini b/test/MHD/ResistiveAlfvenWave/idefix-rkl.ini index 29299b06..eed2139f 100644 --- a/test/MHD/ResistiveAlfvenWave/idefix-rkl.ini +++ b/test/MHD/ResistiveAlfvenWave/idefix-rkl.ini @@ -1,7 +1,5 @@ [Grid] X1-grid 1 0.0 128 u 1.0 -X2-grid 1 0.0 1 u 1.0 -X3-grid 1 0.0 1 u 1.0 [TimeIntegrator] CFL 0.9 @@ -16,10 +14,6 @@ resistivity rkl constant 0.05 [Boundary] X1-beg periodic X1-end periodic -X2-beg periodic -X2-end periodic -X3-beg periodic -X3-end periodic [Output] # vtk 0.1 diff --git a/test/MHD/ResistiveAlfvenWave/idefix.ini b/test/MHD/ResistiveAlfvenWave/idefix.ini index 60873036..b09cb0a6 100644 --- a/test/MHD/ResistiveAlfvenWave/idefix.ini +++ b/test/MHD/ResistiveAlfvenWave/idefix.ini @@ -1,7 +1,5 @@ [Grid] X1-grid 1 0.0 128 u 1.0 -X2-grid 1 0.0 1 u 1.0 -X3-grid 1 0.0 1 u 1.0 [TimeIntegrator] CFL 0.9 @@ -16,10 +14,6 @@ resistivity explicit constant 0.05 [Boundary] X1-beg periodic X1-end periodic -X2-beg periodic -X2-end periodic -X3-beg periodic -X3-end periodic [Output] # vtk 0.1 diff --git a/test/MHD/RotorCartesian/idefix.ini b/test/MHD/RotorCartesian/idefix.ini index ecac9205..54d785ab 100644 --- a/test/MHD/RotorCartesian/idefix.ini +++ b/test/MHD/RotorCartesian/idefix.ini @@ -1,7 +1,6 @@ [Grid] X1-grid 1 -0.5 512 u 0.5 X2-grid 1 -0.5 512 u 0.5 -X3-grid 1 0.0 1 u 1.0 [TimeIntegrator] CFL 0.2 @@ -19,8 +18,6 @@ X1-beg outflow X1-end outflow X2-beg outflow X2-end outflow -X3-beg outflow -X3-end outflow [Output] vtk 0.01 -1 single_file diff --git a/test/MHD/RotorPolar/idefix.ini b/test/MHD/RotorPolar/idefix.ini index b893ed12..ca88369b 100644 --- a/test/MHD/RotorPolar/idefix.ini +++ b/test/MHD/RotorPolar/idefix.ini @@ -1,7 +1,6 @@ [Grid] X1-grid 1 0.05 256 u 0.5 X2-grid 1 0.0 1024 u 6.283185307179586 -X3-grid 1 0.0 1 u 1.0 [TimeIntegrator] CFL 0.2 @@ -19,8 +18,6 @@ X1-beg userdef X1-end outflow X2-beg periodic X2-end periodic -X3-beg outflow -X3-end outflow [Output] uservar Vx Vy diff --git a/test/MHD/sod-iso/idefix-hll.ini b/test/MHD/sod-iso/idefix-hll.ini index be20a405..52af4cfe 100644 --- a/test/MHD/sod-iso/idefix-hll.ini +++ b/test/MHD/sod-iso/idefix-hll.ini @@ -1,7 +1,5 @@ [Grid] X1-grid 1 0.0 800 u 100.0 -X2-grid 1 0.0 1 u 1.0 -X3-grid 1 0.0 1 u 1.0 [TimeIntegrator] CFL 0.8 @@ -16,10 +14,6 @@ csiso constant 1.0 [Boundary] X1-beg outflow X1-end outflow -X2-beg periodic -X2-end periodic -X3-beg periodic -X3-end periodic [Output] vtk 10.0 diff --git a/test/MHD/sod-iso/idefix-hlld-rk3.ini b/test/MHD/sod-iso/idefix-hlld-rk3.ini index aa0723e7..2390b88f 100644 --- a/test/MHD/sod-iso/idefix-hlld-rk3.ini +++ b/test/MHD/sod-iso/idefix-hlld-rk3.ini @@ -1,7 +1,5 @@ [Grid] X1-grid 1 0.0 800 u 100.0 -X2-grid 1 0.0 1 u 1.0 -X3-grid 1 0.0 1 u 1.0 [TimeIntegrator] CFL 0.8 @@ -16,10 +14,6 @@ csiso constant 1.0 [Boundary] X1-beg outflow X1-end outflow -X2-beg periodic -X2-end periodic -X3-beg periodic -X3-end periodic [Output] vtk 10.0 diff --git a/test/MHD/sod-iso/idefix-hlld.ini b/test/MHD/sod-iso/idefix-hlld.ini index f9acb7aa..1a8cfee9 100644 --- a/test/MHD/sod-iso/idefix-hlld.ini +++ b/test/MHD/sod-iso/idefix-hlld.ini @@ -1,7 +1,5 @@ [Grid] X1-grid 1 0.0 800 u 100.0 -X2-grid 1 0.0 1 u 1.0 -X3-grid 1 0.0 1 u 1.0 [TimeIntegrator] CFL 0.8 @@ -16,10 +14,6 @@ csiso constant 1.0 [Boundary] X1-beg outflow X1-end outflow -X2-beg periodic -X2-end periodic -X3-beg periodic -X3-end periodic [Output] vtk 10.0 diff --git a/test/MHD/sod-iso/idefix-rk3.ini b/test/MHD/sod-iso/idefix-rk3.ini index 6e6cd525..602f3492 100644 --- a/test/MHD/sod-iso/idefix-rk3.ini +++ b/test/MHD/sod-iso/idefix-rk3.ini @@ -1,7 +1,5 @@ [Grid] X1-grid 1 0.0 800 u 100.0 -X2-grid 1 0.0 1 u 1.0 -X3-grid 1 0.0 1 u 1.0 [TimeIntegrator] CFL 0.8 @@ -16,10 +14,6 @@ csiso constant 1.0 [Boundary] X1-beg outflow X1-end outflow -X2-beg periodic -X2-end periodic -X3-beg periodic -X3-end periodic [Output] vtk 10.0 diff --git a/test/MHD/sod-iso/idefix-tvdlf.ini b/test/MHD/sod-iso/idefix-tvdlf.ini index 32a33959..97195411 100644 --- a/test/MHD/sod-iso/idefix-tvdlf.ini +++ b/test/MHD/sod-iso/idefix-tvdlf.ini @@ -1,7 +1,5 @@ [Grid] X1-grid 1 0.0 800 u 100.0 -X2-grid 1 0.0 1 u 1.0 -X3-grid 1 0.0 1 u 1.0 [TimeIntegrator] CFL 0.8 @@ -16,10 +14,6 @@ csiso constant 1.0 [Boundary] X1-beg outflow X1-end outflow -X2-beg periodic -X2-end periodic -X3-beg periodic -X3-end periodic [Output] vtk 10.0 diff --git a/test/MHD/sod-iso/idefix.ini b/test/MHD/sod-iso/idefix.ini index 075eb2ae..134359d5 100644 --- a/test/MHD/sod-iso/idefix.ini +++ b/test/MHD/sod-iso/idefix.ini @@ -1,7 +1,5 @@ [Grid] X1-grid 1 0.0 800 u 100.0 -X2-grid 1 0.0 1 u 1.0 -X3-grid 1 0.0 1 u 1.0 [TimeIntegrator] CFL 0.8 @@ -16,10 +14,6 @@ csiso constant 1.0 [Boundary] X1-beg outflow X1-end outflow -X2-beg periodic -X2-end periodic -X3-beg periodic -X3-end periodic [Output] vtk 10.0 diff --git a/test/MHD/sod/idefix-hll.ini b/test/MHD/sod/idefix-hll.ini index c6c5dbb1..e353fa75 100644 --- a/test/MHD/sod/idefix-hll.ini +++ b/test/MHD/sod/idefix-hll.ini @@ -1,7 +1,5 @@ [Grid] X1-grid 1 0.0 800 u 100.0 -X2-grid 1 0.0 1 u 1.0 -X3-grid 1 0.0 1 u 1.0 [TimeIntegrator] CFL 0.8 @@ -18,10 +16,6 @@ gamma 1.66666666666667 # not used X1-beg outflow X1-end outflow -X2-beg periodic -X2-end periodic -X3-beg periodic -X3-end periodic [Output] vtk 10.0 diff --git a/test/MHD/sod/idefix-hlld-rk3.ini b/test/MHD/sod/idefix-hlld-rk3.ini index 68aeee11..02925c52 100644 --- a/test/MHD/sod/idefix-hlld-rk3.ini +++ b/test/MHD/sod/idefix-hlld-rk3.ini @@ -1,7 +1,5 @@ [Grid] X1-grid 1 0.0 800 u 100.0 -X2-grid 1 0.0 1 u 1.0 -X3-grid 1 0.0 1 u 1.0 [TimeIntegrator] CFL 0.8 @@ -18,10 +16,6 @@ gamma 1.66666666666667 # not used X1-beg outflow X1-end outflow -X2-beg periodic -X2-end periodic -X3-beg periodic -X3-end periodic [Output] vtk 10.0 diff --git a/test/MHD/sod/idefix-hlld.ini b/test/MHD/sod/idefix-hlld.ini index cfbd486e..d8111420 100644 --- a/test/MHD/sod/idefix-hlld.ini +++ b/test/MHD/sod/idefix-hlld.ini @@ -1,7 +1,5 @@ [Grid] X1-grid 1 0.0 800 u 100.0 -X2-grid 1 0.0 1 u 1.0 -X3-grid 1 0.0 1 u 1.0 [TimeIntegrator] CFL 0.8 @@ -18,10 +16,6 @@ gamma 1.66666666666667 # not used X1-beg outflow X1-end outflow -X2-beg periodic -X2-end periodic -X3-beg periodic -X3-end periodic [Output] vtk 10.0 diff --git a/test/MHD/sod/idefix-rk3.ini b/test/MHD/sod/idefix-rk3.ini index c1926956..b074218e 100644 --- a/test/MHD/sod/idefix-rk3.ini +++ b/test/MHD/sod/idefix-rk3.ini @@ -1,7 +1,5 @@ [Grid] X1-grid 1 0.0 800 u 100.0 -X2-grid 1 0.0 1 u 1.0 -X3-grid 1 0.0 1 u 1.0 [TimeIntegrator] CFL 0.8 @@ -16,10 +14,6 @@ gamma 1.66666666666667 [Boundary] X1-beg outflow X1-end outflow -X2-beg periodic -X2-end periodic -X3-beg periodic -X3-end periodic [Output] vtk 10.0 diff --git a/test/MHD/sod/idefix-tvdlf.ini b/test/MHD/sod/idefix-tvdlf.ini index 4bbc10c4..305cc2fc 100644 --- a/test/MHD/sod/idefix-tvdlf.ini +++ b/test/MHD/sod/idefix-tvdlf.ini @@ -1,7 +1,5 @@ [Grid] X1-grid 1 0.0 800 u 100.0 -X2-grid 1 0.0 1 u 1.0 -X3-grid 1 0.0 1 u 1.0 [TimeIntegrator] CFL 0.8 @@ -18,10 +16,6 @@ gamma 1.66666666666667 # not used X1-beg outflow X1-end outflow -X2-beg periodic -X2-end periodic -X3-beg periodic -X3-end periodic [Output] vtk 10.0 diff --git a/test/MHD/sod/idefix.ini b/test/MHD/sod/idefix.ini index 67741314..39c846dc 100644 --- a/test/MHD/sod/idefix.ini +++ b/test/MHD/sod/idefix.ini @@ -1,7 +1,5 @@ [Grid] X1-grid 1 0.0 800 u 100.0 -X2-grid 1 0.0 1 u 1.0 -X3-grid 1 0.0 1 u 1.0 [TimeIntegrator] CFL 0.8 @@ -16,10 +14,6 @@ gamma 1.66666666666667 [Boundary] X1-beg outflow X1-end outflow -X2-beg periodic -X2-end periodic -X3-beg periodic -X3-end periodic [Output] vtk 10.0 diff --git a/test/Planet/Planet3Body/idefix.ini b/test/Planet/Planet3Body/idefix.ini index a8b7bea0..4e354bf9 100644 --- a/test/Planet/Planet3Body/idefix.ini +++ b/test/Planet/Planet3Body/idefix.ini @@ -1,7 +1,6 @@ [Grid] -X1-grid 1 0.042 64 u 2.3 -X2-grid 1 0.0 32 u 6.283185307179586 -X3-grid 1 -0.00125 1 u 0.00125 +X1-grid 1 0.042 64 u 2.3 +X2-grid 1 0.0 32 u 6.283185307179586 [TimeIntegrator] CFL 0.5 @@ -26,8 +25,6 @@ X1-beg userdef X1-end userdef X2-beg periodic X2-end periodic -X3-beg outflow -X3-end outflow [Setup] sigma0 0.001 diff --git a/test/Planet/PlanetMigration2D/idefix.ini b/test/Planet/PlanetMigration2D/idefix.ini index 2be56b1a..04259b9e 100644 --- a/test/Planet/PlanetMigration2D/idefix.ini +++ b/test/Planet/PlanetMigration2D/idefix.ini @@ -1,7 +1,6 @@ [Grid] -X1-grid 1 0.42 192 u 2.14 -X2-grid 1 0.0 768 u 6.283185307179586 -X3-grid 1 -0.0125 1 u 0.0125 +X1-grid 1 0.42 192 u 2.14 +X2-grid 1 0.0 768 u 6.283185307179586 [TimeIntegrator] CFL 0.5 @@ -29,8 +28,6 @@ X1-beg userdef X1-end userdef X2-beg periodic X2-end periodic -X3-beg outflow -X3-end outflow [Setup] sigma0 0.001 diff --git a/test/Planet/PlanetPlanetRK42D/idefix.ini b/test/Planet/PlanetPlanetRK42D/idefix.ini index cbcf3c29..bf9a6bda 100644 --- a/test/Planet/PlanetPlanetRK42D/idefix.ini +++ b/test/Planet/PlanetPlanetRK42D/idefix.ini @@ -1,7 +1,6 @@ [Grid] -X1-grid 1 0.42 96 u 2.14 -X2-grid 1 0.0 384 u 6.283185307179586 -X3-grid 1 -0.0125 1 u 0.0125 +X1-grid 1 0.42 96 u 2.14 +X2-grid 1 0.0 384 u 6.283185307179586 [TimeIntegrator] CFL 0.5 @@ -24,8 +23,6 @@ X1-beg userdef X1-end userdef X2-beg periodic X2-end periodic -X3-beg outflow -X3-end outflow [Setup] sigma0 0.001 diff --git a/test/Planet/PlanetSpiral2D/idefix.ini b/test/Planet/PlanetSpiral2D/idefix.ini index 9864a223..b030e4a4 100644 --- a/test/Planet/PlanetSpiral2D/idefix.ini +++ b/test/Planet/PlanetSpiral2D/idefix.ini @@ -1,7 +1,6 @@ [Grid] -X1-grid 1 0.42 128 u 2.14 -X2-grid 1 0.0 512 u 6.283185307179586 -X3-grid 1 -0.0125 1 u 0.0125 +X1-grid 1 0.42 128 u 2.14 +X2-grid 1 0.0 512 u 6.283185307179586 [TimeIntegrator] CFL 0.5 @@ -28,8 +27,6 @@ X1-beg userdef X1-end userdef X2-beg periodic X2-end periodic -X3-beg outflow -X3-end outflow [Setup] sigma0 1.0 diff --git a/test/Planet/PlanetsIsActiveRK52D/idefix-rk4.ini b/test/Planet/PlanetsIsActiveRK52D/idefix-rk4.ini index c714362f..7fbedc65 100644 --- a/test/Planet/PlanetsIsActiveRK52D/idefix-rk4.ini +++ b/test/Planet/PlanetsIsActiveRK52D/idefix-rk4.ini @@ -1,7 +1,6 @@ [Grid] -X1-grid 1 0.42 48 u 2.14 -X2-grid 1 0.0 192 u 6.283185307179586 -X3-grid 1 -0.0125 1 u 0.0125 +X1-grid 1 0.42 48 u 2.14 +X2-grid 1 0.0 192 u 6.283185307179586 [TimeIntegrator] CFL 0.5 @@ -24,8 +23,6 @@ X1-beg userdef X1-end userdef X2-beg periodic X2-end periodic -X3-beg outflow -X3-end outflow [Setup] sigma0 0.001 diff --git a/test/Planet/PlanetsIsActiveRK52D/idefix-rk5.ini b/test/Planet/PlanetsIsActiveRK52D/idefix-rk5.ini index 8f1f8a11..44b22327 100644 --- a/test/Planet/PlanetsIsActiveRK52D/idefix-rk5.ini +++ b/test/Planet/PlanetsIsActiveRK52D/idefix-rk5.ini @@ -1,7 +1,6 @@ [Grid] -X1-grid 1 0.42 48 u 2.14 -X2-grid 1 0.0 192 u 6.283185307179586 -X3-grid 1 -0.0125 1 u 0.0125 +X1-grid 1 0.42 48 u 2.14 +X2-grid 1 0.0 192 u 6.283185307179586 [TimeIntegrator] CFL 0.5 @@ -24,8 +23,6 @@ X1-beg userdef X1-end userdef X2-beg periodic X2-end periodic -X3-beg outflow -X3-end outflow [Setup] sigma0 0.001 diff --git a/test/SelfGravity/DustyCollapse/idefix.ini b/test/SelfGravity/DustyCollapse/idefix.ini index 37976368..d650cc88 100644 --- a/test/SelfGravity/DustyCollapse/idefix.ini +++ b/test/SelfGravity/DustyCollapse/idefix.ini @@ -1,7 +1,5 @@ [Grid] X1-grid 1 0.1 4096 l 3e4 -X2-grid 1 0 64 u 3.14159265358979 -X3-grid 1 0 64 u 6.28318530717958 [TimeIntegrator] CFL 0.2 @@ -25,18 +23,10 @@ targetError 1e-7 maxIter 10000 boundary-X1-beg nullgrad boundary-X1-end nullpot -boundary-X2-beg axis -boundary-X2-end axis -boundary-X3-beg periodic -boundary-X3-end periodic [Boundary] X1-beg outflow X1-end outflow -X2-beg periodic -X2-end periodic -X3-beg periodic -X3-end periodic [Output] dmp 1 diff --git a/test/SelfGravity/JeansInstability/idefix-cg.ini b/test/SelfGravity/JeansInstability/idefix-cg.ini index 97f1e6c9..3b40ba82 100644 --- a/test/SelfGravity/JeansInstability/idefix-cg.ini +++ b/test/SelfGravity/JeansInstability/idefix-cg.ini @@ -1,7 +1,5 @@ [Grid] X1-grid 1 0.0 1000 u 10.0 -X2-grid 1 0.0 100 u 10.0 -X3-grid 1 0.0 100 u 10.0 [TimeIntegrator] CFL 0.8 @@ -24,18 +22,10 @@ solver CG targetError 1e-6 boundary-X1-beg periodic boundary-X1-end periodic -boundary-X2-beg periodic -boundary-X2-end periodic -boundary-X3-beg periodic -boundary-X3-end periodic [Boundary] X1-beg periodic X1-end periodic -X2-beg periodic -X2-end periodic -X3-beg periodic -X3-end periodic [Output] vtk 0.1 diff --git a/test/SelfGravity/JeansInstability/idefix.ini b/test/SelfGravity/JeansInstability/idefix.ini index 47101406..c21b52b5 100644 --- a/test/SelfGravity/JeansInstability/idefix.ini +++ b/test/SelfGravity/JeansInstability/idefix.ini @@ -1,7 +1,5 @@ [Grid] X1-grid 1 0.0 1000 u 10.0 -X2-grid 1 0.0 100 u 10.0 -X3-grid 1 0.0 100 u 10.0 [TimeIntegrator] CFL 0.8 @@ -24,18 +22,10 @@ targetError 1e-6 # skip 2 boundary-X1-beg periodic boundary-X1-end periodic -boundary-X2-beg periodic -boundary-X2-end periodic -boundary-X3-beg periodic -boundary-X3-end periodic [Boundary] X1-beg periodic X1-end periodic -X2-beg periodic -X2-end periodic -X3-beg periodic -X3-end periodic [Output] vtk 0.1 diff --git a/test/SelfGravity/UniformCollapse/idefix.ini b/test/SelfGravity/UniformCollapse/idefix.ini index d5f8e4a4..e0e74a36 100644 --- a/test/SelfGravity/UniformCollapse/idefix.ini +++ b/test/SelfGravity/UniformCollapse/idefix.ini @@ -1,7 +1,5 @@ [Grid] X1-grid 1 .01 100 l 1000. -X2-grid 1 0.0 20 u 3.141592653589793 -X3-grid 1 0.0 20 u 6.283185307179586 [TimeIntegrator] CFL 0.8 @@ -25,18 +23,10 @@ skip 5 targetError 1e-6 boundary-X1-beg origin boundary-X1-end nullpot -boundary-X2-beg periodic -boundary-X2-end periodic -boundary-X3-beg periodic -boundary-X3-end periodic [Boundary] X1-beg userdef X1-end outflow -X2-beg periodic -X2-end periodic -X3-beg periodic -X3-end periodic [Output] analysis 10.