diff --git a/CMakeLists.txt b/CMakeLists.txt index 62cc7cc..f77a884 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,7 +66,7 @@ if(ENABLE_MPI) endif() endif() -option(ENABLE_OPENMP "Enable OpenMP support." ON) +option(ENABLE_OPENMP "Enable OpenMP support." OFF) if(ENABLE_OPENMP) find_package(OpenMP COMPONENTS Fortran) if(OpenMP_Fortran_FOUND) diff --git a/python/amunpy/setup.py b/python/amunpy/setup.py index 1bb900b..bb1e62d 100644 --- a/python/amunpy/setup.py +++ b/python/amunpy/setup.py @@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh: setuptools.setup( name="amunpy", - version="0.9.7", + version="0.9.8", author="Grzegorz Kowal", author_email="grzegorz@amuncode.org", description="Python Interface for the AMUN code's snapshots", diff --git a/python/amunpy/src/amunpy/__init__.py b/python/amunpy/src/amunpy/__init__.py index 84ac54c..3ead146 100644 --- a/python/amunpy/src/amunpy/__init__.py +++ b/python/amunpy/src/amunpy/__init__.py @@ -21,6 +21,6 @@ __all__ = [ 'AmunXML', 'AmunH5', 'WriteVTK', \ __author__ = "Grzegorz Kowal" __copyright__ = "Copyright 2018-2022 Grzegorz Kowal " -__version__ = "0.9.7" +__version__ = "0.9.8" __maintainer__ = "Grzegorz Kowal" __email__ = "grzegorz@amuncode.org" diff --git a/python/amunpy/src/amunpy/amun.py b/python/amunpy/src/amunpy/amun.py index 1442334..962dcb4 100644 --- a/python/amunpy/src/amunpy/amun.py +++ b/python/amunpy/src/amunpy/amun.py @@ -177,14 +177,18 @@ class Amun: """ Add derived variables. """ + denflag = 'dens' in self.variables + preflag = 'pres' in self.variables + velflag = all(v in self.variables for v in ['velx','vely','velz']) + magflag = all(v in self.variables for v in ['magx','magy','magz']) self.variables['refinement level'] = 'mlev' - if 'dens' in self.variables: + if denflag: self.variables['density'] = 'dens' self.variables['logarithm of density'] = 'logd' - if 'pres' in self.variables or self.attributes['eos'] == 'iso': + if preflag or self.attributes['eos'] == 'iso': self.variables['pressure'] = 'pres' self.variables['logarithm of pressure'] = 'logp' - if all(v in self.variables for v in ['velx','vely','velz']): + if velflag: self.variables['velocity'] = 'vvec' self.variables['velocity magnitude'] = 'velo' self.variables['x-velocity'] = 'velx' @@ -196,7 +200,7 @@ class Amun: self.variables['z-vorticity'] = 'vorz' self.variables['vorticity'] = 'wvec' self.variables['vorticity magnitude'] = 'vort' - if all(v in self.variables for v in ['magx','magy','magz']): + if magflag: self.variables['magnetic field'] = 'bvec' self.variables['magnetic field magnitude'] = 'magn' self.variables['x-magnetic field'] = 'magx' @@ -210,28 +214,25 @@ class Amun: self.variables['current density magnitude'] = 'curr' if 'bpsi' in self.variables: self.variables['magnetic divergence potential'] = 'bpsi' - if 'pres' in self.variables and 'adiabatic_index' in self.attributes: + if preflag and 'adiabatic_index' in self.attributes: self.variables['internal energy'] = 'eint' - if all(v in self.variables for v in ['dens', 'pres']): + if denflag and preflag: self.variables['temperature'] = 'temp' - if self.attributes['eqsys'] in [ 'hd', 'mhd' ] \ - and all(v in self.variables for v in ['dens','velx','vely','velz']): + if self.attributes['eqsys'] in ['hd','mhd'] and denflag and velflag: self.variables['kinetic energy'] = 'ekin' - if self.attributes['eqsys'] in [ 'mhd', 'srmhd' ] \ - and all(v in self.variables for v in ['magx','magy','magz']): + if self.attributes['eqsys'] in ['mhd','srmhd'] and magflag: self.variables['magnetic energy'] = 'emag' self.variables['magnetic pressure'] = 'emag' - if all(v in self.variables for v in ['velx','vely','velz', 'magx','magy','magz']) in self.variables: + if velflag and magflag: self.variables['electric field'] = 'evec' self.variables['electric field magnitude'] = 'elec' self.variables['x-electric field'] = 'elex' self.variables['y-electric field'] = 'eley' self.variables['z-electric field'] = 'elez' - if self.attributes['eqsys'] in [ 'srhd', 'srmhd' ] \ - and all(v in self.variables for v in ['velx','vely','velz']): + if self.attributes['eqsys'] in ['srhd','srmhd'] and velflag: self.variables['Lorentz factor'] = 'lore' - delete_datasets = [ 'dens', 'pres', 'velx', 'vely', 'velz', 'magx','magy','magz', 'bpsi' ] + delete_datasets = ['dens','pres','velx','vely','velz','magx','magy','magz','bpsi'] for v in delete_datasets: if v in self.variables: del self.variables[v] diff --git a/sources/boundaries.F90 b/sources/boundaries.F90 index 44a49e0..f698f9d 100644 --- a/sources/boundaries.F90 +++ b/sources/boundaries.F90 @@ -316,7 +316,7 @@ module boundaries #ifdef MPI use blocks , only : block_info, pointer_info #endif /* MPI */ - use blocks , only : ndims, nsides + use blocks , only : nsides use coordinates, only : minlev, maxlev use coordinates, only : nh => ncells_half use coordinates, only : nb, ne, nbm, nbp, nem, nep @@ -862,7 +862,6 @@ module boundaries ! subroutine boundary_variables(t, dt, status) - use blocks , only : ndims use coordinates, only : minlev, maxlev implicit none diff --git a/sources/equations.F90 b/sources/equations.F90 index ce7bef0..ba96e78 100644 --- a/sources/equations.F90 +++ b/sources/equations.F90 @@ -1391,7 +1391,11 @@ module equations use blocks , only : block_data use coordinates, only : nn => bcells use helpers , only : print_message +#if NDIMS == 3 use coordinates, only : ax, ay, az +#else /* NDIMS == 3 */ + use coordinates, only : ax, ay +#endif /* NDIMS == 3 */ implicit none