Merge branch 'master' into reconnection

This commit is contained in:
Grzegorz Kowal 2022-01-25 09:14:57 -03:00
commit f71d6aba91
5 changed files with 1715 additions and 1836 deletions

View File

@ -15,25 +15,22 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
endif()
if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
add_compile_options("$<$<CONFIG:RELEASE>:-march=native;-pipe;-fno-tree-vectorize;-fno-unsafe-math-optimizations;-frounding-math;-fsignaling-nans;-finline-limit=10000;-fdiagnostics-color=always>")
add_compile_options("$<$<CONFIG:DEBUG>:-Og;-pedantic;-fcheck=all;-W;-Wall;-Wno-unused-dummy-argument>")
endif()
if(CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
add_compile_options("$<$<CONFIG:RELEASE>:-xHost;-fp-model=source;-heap-arrays;-ip;-unroll-aggressive;-simd;-qopt-prefetch;-use-intel-optimized-headers;-finline-limit=1000;-fno-omit-frame-pointer>")
add_compile_options("$<$<CONFIG:DEBUG>:-O>")
add_compile_options(-assume byterecl)
endif()
if(CMAKE_Fortran_COMPILER_ID MATCHES "PGI")
add_compile_options("$<$<CONFIG:RELEASE>:-fastsse;-O4;-Mvect=simd;-Minline=maxsize:1000>")
add_compile_options("$<$<CONFIG:DEBUG>:-O;-Minfo=all>")
endif()
if(CMAKE_Fortran_COMPILER_ID MATCHES "NVHPC")
add_compile_options("$<$<CONFIG:RELEASE>:-fast;-O4;-Minline>")
add_compile_options("$<$<CONFIG:DEBUG>:-Mbounds;-Mchkptr;-Minfo=all>")
@ -42,14 +39,14 @@ endif()
file(GLOB_RECURSE sources sources/*.F90)
add_executable(amun.x ${sources})
option(ENABLE_3D "Enables 3D domains" OFF)
option(ENABLE_3D "Enables 3D domains." OFF)
if(ENABLE_3D)
target_compile_definitions(amun.x PRIVATE NDIMS=3)
else()
target_compile_definitions(amun.x PRIVATE NDIMS=2)
endif()
option(ENABLE_HDF5 "Enable HDF5 support" OFF)
option(ENABLE_HDF5 "Enable HDF5 support." OFF)
if(ENABLE_HDF5)
find_package(HDF5 COMPONENTS Fortran)
if(HDF5_Fortran_FOUND)
@ -59,7 +56,7 @@ if(ENABLE_HDF5)
endif()
endif()
option(ENABLE_MPI "Enable MPI support" ON)
option(ENABLE_MPI "Enable MPI support." ON)
if(ENABLE_MPI)
find_package(MPI COMPONENTS Fortran)
if(MPI_Fortran_FOUND)
@ -69,7 +66,7 @@ if(ENABLE_MPI)
endif()
endif()
option(ENABLE_OPENMP "Enable OpenMP support" ON)
option(ENABLE_OPENMP "Enable OpenMP support." ON)
if(ENABLE_OPENMP)
find_package(OpenMP COMPONENTS Fortran)
if(OpenMP_Fortran_FOUND)
@ -79,12 +76,28 @@ if(ENABLE_OPENMP)
endif()
endif()
option(ENABLE_SIGNALS "Enables signal handler support" 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")
endif()
if(CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
target_compile_options(amun.x PRIVATE "-no-fma")
endif()
if(CMAKE_Fortran_COMPILER_ID MATCHES "PGI")
target_compile_options(amun.x PRIVATE "-Mnofma")
endif()
if(CMAKE_Fortran_COMPILER_ID MATCHES "NVHPC")
target_compile_options(amun.x PRIVATE "-Mnofma")
endif()
endif()
option(ENABLE_SIGNALS "Enables signal handler support." ON)
if(ENABLE_SIGNALS)
target_compile_definitions(amun.x PRIVATE SIGNALS)
endif()
option(ENABLE_ZSTD "Enable Zstandard compression support" ON)
option(ENABLE_ZSTD "Enable Zstandard compression support." ON)
if(ENABLE_ZSTD)
include(FindPkgConfig)
pkg_search_module(ZSTD QUIET libzstd)
@ -94,7 +107,7 @@ if(ENABLE_ZSTD)
endif()
endif()
option(ENABLE_LZ4 "Enable LZ4 compression support" ON)
option(ENABLE_LZ4 "Enable LZ4 compression support." ON)
if(ENABLE_LZ4)
include(FindPkgConfig)
pkg_search_module(LZ4 QUIET liblz4)
@ -104,7 +117,7 @@ if(ENABLE_LZ4)
endif()
endif()
option(ENABLE_LZMA "Enable LZMA compression support" ON)
option(ENABLE_LZMA "Enable LZMA compression support." ON)
if(ENABLE_LZMA)
include(FindPkgConfig)
pkg_search_module(LZMA QUIET liblzma)
@ -114,7 +127,7 @@ if(ENABLE_LZMA)
endif()
endif()
option(ENABLE_XXHASH "Enable system's XXHASH library" ON)
option(ENABLE_XXHASH "Enable system's XXHASH library." ON)
if(ENABLE_XXHASH)
include(FindPkgConfig)
pkg_search_module(XXHASH QUIET libxxhash)

View File

@ -600,12 +600,16 @@ module io
!
subroutine read_restart_snapshot(status)
use blocks , only : build_leaf_list, build_datablock_list
use evolution, only : time
use helpers , only : print_message
implicit none
integer, intent(out) :: status
character(len=*), parameter :: loc = 'IO::read_restart_snapshot()'
!-------------------------------------------------------------------------------
!
call start_timer(iio)
@ -621,6 +625,14 @@ module io
call read_restart_snapshot_xml(status)
end select
call build_leaf_list(status)
if (status /= 0) &
call print_message(loc, "Could not build the list of leafs!")
call build_datablock_list(status)
if (status /= 0) &
call print_message(loc, "Could not build the list of data blocks!")
! calculate the shift of the snapshot counter, and the next snapshot time
!
ishift = int(time / hsnap) - isnap + 1

File diff suppressed because it is too large Load Diff

View File

@ -572,12 +572,17 @@ module sources
!
call divergence(dh(:), pdata%q(ibx:ibz,:,:,:), db(:,:,:))
! update the momentum component increments, i.e.
! update the momentum component increments (only in the adiabatic case for
! KEPES), i.e.
! d/dt (ρv) + .F = - (.B)B
!
du(imx,:,:,:) = du(imx,:,:,:) - db(:,:,:) * pdata%q(ibx,:,:,:)
du(imy,:,:,:) = du(imy,:,:,:) - db(:,:,:) * pdata%q(iby,:,:,:)
du(imz,:,:,:) = du(imz,:,:,:) - db(:,:,:) * pdata%q(ibz,:,:,:)
if (glm_type < 3 .or. ien > 0) then
du(imx,:,:,:) = du(imx,:,:,:) - db(:,:,:) * pdata%q(ibx,:,:,:)
du(imy,:,:,:) = du(imy,:,:,:) - db(:,:,:) * pdata%q(iby,:,:,:)
du(imz,:,:,:) = du(imz,:,:,:) - db(:,:,:) * pdata%q(ibz,:,:,:)
end if ! ien > 0
! add the HEGLM-MHD and KEPES source terms
!
@ -608,40 +613,40 @@ module sources
end if ! glm_type > 1
if (ibp > 0 .and. (ien > 0 .or. glm_type == 3)) then
if (ibp > 0) then
if (glm_type == 3) then
! calculate the gradient of divergence correcting field
! calculate the divergence of velocity
!
call gradient(dh(:), pdata%q(ibp,:,:,:), tmp(inx:inz,inx,:,:,:))
db(:,:,:) = sum(pdata%q(ivx:ivz,:,:,:) * tmp(inx:inz,inx,:,:,:), 1)
! update the divergence correcting field
! d/dt ψ+ .F = - (v.)ψ
!
du(ibp,:,:,:) = du(ibp,:,:,:) - db(:,:,:)
! update the energy equation
!
if (ien > 0) then
if (glm_type == 3) then
call divergence(dh(:), pdata%q(ivx:ivz,:,:,:), db(:,:,:))
! add the divergence potential source term to the energy equation, i.e.
! d/dt E + .F = - ψ(v.)ψ
! d/dt ψ + .F = ½ψ(.v)
!
du(ien,:,:,:) = du(ien,:,:,:) - pdata%q(ibp,:,:,:) * db(:,:,:)
du(ibp,:,:,:) = du(ibp,:,:,:) &
+ 5.0d-01 * pdata%q(ibp,:,:,:) * db(:,:,:)
else
else if (ien > 0) then
! calculate the gradient of the divergence correcting field
!
call gradient(dh(:), pdata%q(ibp,:,:,:), tmp(inx:inz,inx,:,:,:))
db(:,:,:) = sum(pdata%q(ivx:ivz,:,:,:) * tmp(inx:inz,inx,:,:,:), 1)
! update the divergence correcting field
! d/dt ψ + .F = - (v.)ψ
!
du(ibp,:,:,:) = du(ibp,:,:,:) - db(:,:,:)
! add the divergence potential source term to the energy equation, i.e.
! d/dt E + .F = - B.(ψ)
!
du(ien,:,:,:) = du(ien,:,:,:) &
- sum(pdata%q(ibx:ibz,:,:,:) * tmp(inx:inz,inx,:,:,:), 1)
du(ien,:,:,:) = du(ien,:,:,:) &
- sum(pdata%q(ibx:ibz,:,:,:) * tmp(inx:inz,inx,:,:,:), 1)
end if
end if ! ien > 0
end if ! glm_type == 3
end if ! glm == 3
end if ! ibp
end if ! glm_type > 0
! if anomalous resistivity is enabled

View File

@ -348,7 +348,6 @@ module system
!
subroutine prepare_system(status)
use blocks , only : build_leaf_list
use boundaries, only : boundary_variables
use evolution , only : initialize_time_step, time
use helpers , only : print_message
@ -373,12 +372,6 @@ module system
return
end if
call build_leaf_list(status)
if (status /= 0) then
call print_message(loc, "Could not build the list of leafs!")
return
end if
call boundary_variables(time, 0.0d+00, status)
if (status /= 0) then
call print_message(loc, "Could not update variable boundaries!")