From b2cc87d0aa8bd103f6adb020fded8d46874b7a27 Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal Date: Fri, 14 Oct 2022 12:34:30 -0300 Subject: [PATCH 1/7] PYTHON: Fix __complete_variables__(). Signed-off-by: Grzegorz Kowal --- python/amunpy/src/amunpy/amun.py | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) 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] From a09bcfeccb28557e424ef0cc4fdab1226fdaa190 Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal Date: Fri, 14 Oct 2022 12:41:12 -0300 Subject: [PATCH 2/7] PYTHON: Increase amunpy version to 0.9.8. Signed-off-by: Grzegorz Kowal --- python/amunpy/setup.py | 2 +- python/amunpy/src/amunpy/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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" From 64c58bb4bdf7e86deac9d9c10cb15a3b7317851d Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal Date: Mon, 17 Oct 2022 11:26:19 -0300 Subject: [PATCH 3/7] EQUATIONS: Make compiler happy with imported variables. Signed-off-by: Grzegorz Kowal --- sources/equations.F90 | 4 ++++ 1 file changed, 4 insertions(+) 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 From 336a04377bef02c5bf3c4741323720b33e9c48e7 Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal Date: Mon, 17 Oct 2022 11:29:58 -0300 Subject: [PATCH 4/7] BOUNDARIES: Remove unused variables. Signed-off-by: Grzegorz Kowal --- sources/boundaries.F90 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 From 5952bcdb34d42223221c31916a881550a3068cbd Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal Date: Mon, 17 Oct 2022 11:31:30 -0300 Subject: [PATCH 5/7] CMAKE: Turn off OpenMP by default. Signed-off-by: Grzegorz Kowal --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) From 94ad4878502dcbd23945dbd03790504989b63c79 Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal Date: Mon, 17 Oct 2022 11:32:27 -0300 Subject: [PATCH 6/7] CMAKE: Disable FMA optimizations by default. Signed-off-by: Grzegorz Kowal --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f77a884..e7e936a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,7 +76,7 @@ if(ENABLE_OPENMP) endif() endif() -option(DISABLE_FMA "Disable FMA operations for slightly slower, but symmetric floating-point arithmetics." OFF) +option(DISABLE_FMA "Disable FMA operations for slightly slower, but symmetric floating-point arithmetics." ON) if(DISABLE_FMA) if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") target_compile_options(amun.x PRIVATE "-mno-fma;-mno-fma4") From a70a74d2313a2c3eac27ee7b69843196498f93be Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal Date: Mon, 17 Oct 2022 11:35:03 -0300 Subject: [PATCH 7/7] Revert "CMAKE: Disable FMA optimizations by default." This reverts commit 94ad4878502dcbd23945dbd03790504989b63c79. It breaks CI on ARM64 machine. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e7e936a..f77a884 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,7 +76,7 @@ if(ENABLE_OPENMP) endif() endif() -option(DISABLE_FMA "Disable FMA operations for slightly slower, but symmetric floating-point arithmetics." ON) +option(DISABLE_FMA "Disable FMA operations for slightly slower, but symmetric floating-point arithmetics." OFF) if(DISABLE_FMA) if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") target_compile_options(amun.x PRIVATE "-mno-fma;-mno-fma4")