Skip to content

Commit

Permalink
Merge pull request #41 from starkiller-astro/weakphys
Browse files Browse the repository at this point in the history
Weakphys
  • Loading branch information
jaharris87 authored Nov 18, 2024
2 parents 418c1f6 + 4c91736 commit 7cf4918
Show file tree
Hide file tree
Showing 89 changed files with 110,901 additions and 2,117 deletions.
28 changes: 18 additions & 10 deletions Distributions/Build/Makefile_Compilers
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
GIT_HASH := $(shell git --no-pager describe --tags --always --dirty)
GIT_DATE := $(firstword $(shell git --no-pager show --date=short --format="%ad" --name-only))
GIT_BRANCH := $(shell git branch | grep "^\*" | sed 's/^..//')
GIT_URL :=$(shell git config --get remote.origin.url)

VERSION_FLAGS := -DGIT_HASH="\"$(GIT_HASH)\"" -DGIT_DATE="\"$(GIT_DATE)\"" -DGIT_BRANCH="\"$(GIT_BRANCH)\"" -DGIT_URL="\"$(GIT_URL)\""

OPENMP_summit_gcc = -fopenmp
OPENMP_summit_pgi = -mp
OPENMP_summit_nvhpc = -mp
Expand All @@ -20,6 +27,7 @@ OPENMP_OL_birch_cce = -fopenmp
OPENMP_OL_birch_gcc = -fopenmp
OPENMP_OL_spock_cce = -fopenmp
OPENMP_OL_spock_gcc = -fopenmp
OPENMP_vass = -fopenmp
ifeq ($(USE_OMP),TRUE)
OPENMP = $(OPENMP_$(MACHINE))
else ifeq ($(USE_OMP_OL),TRUE)
Expand All @@ -43,17 +51,17 @@ ifeq ($(USE_OACC),TRUE)
OPENACC = $(OPENACC_$(MACHINE))
endif

FORTRAN_sn1987b = mpif90
FORTRAN_ranchu = mpif90
FORTRAN_ranchuair = mpif90
FORTRAN_vass = mpif90
FORTRAN_sjdunham = mpif90
FORTRAN_sn1987b = mpif90 -cpp
FORTRAN_ranchu = mpif90 -cpp
FORTRAN_ranchuair = mpif90 -cpp
FORTRAN_vass = mpif90 -cpp
FORTRAN_sjdunham = mpif90 -cpp
FORTRAN_titan_gnu = ftn -cpp
FORTRAN_titan_cray = ftn
FORTRAN_titan_pgi = ftn -Mpreprocess
FORTRAN_darter_gnu = ftn
FORTRAN_darter_cray = ftn
FORTRAN_beacon_intel = mpiifort
FORTRAN_beacon_intel = mpifort
FORTRAN_paullaiu_gnu = mpif90
FORTRAN_summitdev_gcc= mpifort -cpp
FORTRAN_summitdev_pgi= mpifort -Mpreprocess
Expand All @@ -71,7 +79,7 @@ FORTRAN_spock_cce = ftn
FORTRAN_spock_gcc = ftn
FORTRAN_corigpu_pgi = mpifort -Mpreprocess
FORTRAN_ubuntu = mpif90 -cpp
FORTRAN = $(FORTRAN_$(MACHINE))
FORTRAN = $(FORTRAN_$(MACHINE)) $(VERSION_FLAGS)

SUFFIX_f90_sn1987b =
SUFFIX_f90_ranchu =
Expand Down Expand Up @@ -159,7 +167,7 @@ FLAGS_OPTIMIZE = $(OPTIMIZE) $(OPENMP) $(OPENACC)
OPTIMIZE_sn1987b = -O2 -framework Accelerate
OPTIMIZE_ranchu = -O2
OPTIMIZE_ranchuair = -O2
OPTIMIZE_vass = -O2 -framework Accelerate
OPTIMIZE_vass = -O3 -framework Accelerate -march=native
OPTIMIZE_sjdunham = -O2
OPTIMIZE_titan_gnu = -O3 -march=bdver1
OPTIMIZE_titan_cray =
Expand Down Expand Up @@ -189,7 +197,7 @@ OPTIMIZE = $(OPTIMIZE_$(MACHINE))
INCLUDE_HDF5_sn1987b = -I/usr/local/Cellar/hdf5/1.10.5/include
INCLUDE_HDF5_ranchu = -I/usr/local/hdf5/include
INCLUDE_HDF5_ranchuair = -I/usr/local/Cellar/hdf5/1.12.0/include
INCLUDE_HDF5_vass = -I/usr/local/Cellar/hdf5/1.12.1/include
INCLUDE_HDF5_vass = -I/usr/local/Cellar/hdf5/1.14.4.3/include
INCLUDE_HDF5_sjdunham =
INCLUDE_HDF5_titan_gnu = # Use Module Load
INCLUDE_HDF5_titan_cray = # Use Module Load
Expand Down Expand Up @@ -242,7 +250,7 @@ INCLUDE = $(INCLUDE_HDF5)
LIBRARIES_HDF5_sn1987b = -L/usr/local/Cellar/hdf5/1.10.5/lib -lhdf5_fortran -lhdf5
LIBRARIES_HDF5_ranchu = -L/usr/local/hdf5/lib -lhdf5_fortran -lhdf5
LIBRARIES_HDF5_ranchuair = -L/usr/local/Cellar/hdf5/1.12.0/lib -lhdf5_fortran -lhdf5
LIBRARIES_HDF5_vass = -L/usr/local/Cellar/hdf5/1.12.1/lib -lhdf5_fortran -lhdf5
LIBRARIES_HDF5_vass = -L/usr/local/Cellar/hdf5/1.14.4.3/lib -lhdf5_fortran -lhdf5
LIBRARIES_HDF5_sjdunham =
LIBRARIES_HDF5_titan_gnu = # Use Module Load
LIBRARIES_HDF5_titan_cray = # Use Module Load
Expand Down
13 changes: 11 additions & 2 deletions Distributions/EOSSource/Makefile_Depend
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
wlEquationOfStateTableModule.o: wlKindModule.o wlThermoStateModule.o wlDependentVariablesModule.o
wlEOSIOModuleHDF.o: wlKindModule.o wlThermoStateModule.o wlDependentVariablesModule.o wlEquationOfStateTableModule.o wlIOModuleHDF.o
wlEquationOfStateTableModule.o: \
wlKindModule.o \
wlThermoStateModule.o \
wlDependentVariablesModule.o

wlEOSIOModuleHDF.o: \
wlKindModule.o \
wlThermoStateModule.o \
wlDependentVariablesModule.o \
wlEquationOfStateTableModule.o \
wlIOModuleHDF.o

8 changes: 4 additions & 4 deletions Distributions/EOSSource/wlEOSInterpolationModule.f90
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,9 @@ SUBROUTINE MonotonicityCheck( Table, Nrho, NT, NYe, Axis, Repaired )
END DO

CASE( 2 )
DO k = 1, NYe
DO k = 2, NYe - 1
DO j = 2, NT - 1
DO i = 1, Nrho
DO i = 2, Nrho - 1

IF ( ( ( Table(i, j+1, k) - Table(i, j, k) ) * &
( Table(i, j, k) - Table(i, j-1, k) ) ) < 0.) THEN
Expand All @@ -489,8 +489,8 @@ SUBROUTINE MonotonicityCheck( Table, Nrho, NT, NYe, Axis, Repaired )

CASE( 3 )
DO k = 2, NYe - 1
DO j = 1, NT
DO i = 1, Nrho
DO j = 2, NT - 1
DO i = 2, Nrho - 1

IF ( ( ( Table(i, j, k+1) - Table(i, j, k) ) * &
( Table(i, j, k) - Table(i, j, k-1) ) ) < 0. ) &
Expand Down
9 changes: 9 additions & 0 deletions Distributions/ExternalLibrary/Makefile.Flash
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
GIT_HASH := $(shell git --no-pager describe --tags --always --dirty)
GIT_DATE := $(firstword $(shell git --no-pager show --date=short --format="%ad" --name-only))
GIT_BRANCH := $(shell git branch | grep "^\*" | sed 's/^..//')
GIT_URL :=$(shell git config --get remote.origin.url)

VERSION_FLAGS := -DGIT_HASH="\"$(GIT_HASH)\"" -DGIT_DATE="\"$(GIT_DATE)\"" -DGIT_BRANCH="\"$(GIT_BRANCH)\"" -DGIT_URL="\"$(GIT_URL)\""

# name of the library -- make sure it is in the object directory
LIBNAME = libweaklib.a
LIBDIR = ../../../object
Expand Down Expand Up @@ -40,6 +47,8 @@ ifeq ($(USE_OMP),TRUE)
FFLAGS += $(OPENMP)
endif

FFLAGS += $(VERSION_FLAGS)

# command for generating a library
MKLIB = ar -r

Expand Down
28 changes: 22 additions & 6 deletions Distributions/Library/Makefile_Depend
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
wlThermoStateModule.o: wlKindModule.o
wlDependentVariablesModule.o: wlKindModule.o
wlGridModule.o: wlKindModule.o
wlIOModuleHDF.o: wlKindModule.o wlThermoStateModule.o wlDependentVariablesModule.o
wlInterpolationUtilitiesModule.o: wlKindModule.o
wlInterpolationModule.o: wlKindModule.o wlThermoStateModule.o wlDependentVariablesModule.o wlEquationOfStateTableModule.o wlInterpolationUtilitiesModule.o
wlThermoStateModule.o: \
wlKindModule.o

wlDependentVariablesModule.o: \
wlKindModule.o

wlGridModule.o: \
wlKindModule.o

wlIOModuleHDF.o: \
wlKindModule.o \
wlThermoStateModule.o \
wlDependentVariablesModule.o

wlInterpolationUtilitiesModule.o: \
wlKindModule.o

wlInterpolationModule.o: \
wlKindModule.o \
wlThermoStateModule.o \
wlDependentVariablesModule.o \
wlEquationOfStateTableModule.o \
wlInterpolationUtilitiesModule.o
2 changes: 1 addition & 1 deletion Distributions/Library/Makefile_Library_Dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ wlIOModuleHDF.o: \
wlKindModule.o \
wlThermoStateModule.o \
wlDependentVariablesModule.o \
wlIOModuleHDF.f90
wlIOModuleHDF.F90
136 changes: 132 additions & 4 deletions Distributions/Library/wlGridModule.f90
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,28 @@ MODULE wlGridModule
CHARACTER(LEN=32) :: Name
CHARACTER(LEN=32) :: Unit
INTEGER :: nPoints
INTEGER :: LogInterp
REAL(dp) :: minValue
REAL(dp) :: maxValue
INTEGER :: LogInterp = 0
REAL(dp) :: minValue = 0.0d0
REAL(dp) :: maxValue = 0.0d0
REAL(dp) :: minEdge = 0.0d0 !-- only applies with Zoom
REAL(dp) :: maxEdge = 0.0d0 !-- only applies with Zoom
REAL(dp) :: minWidth = 0.0d0 !-- only applies with Zoom
REAL(dp) :: Zoom = 0.0d0 !-- non-zero value means geometric spacing
REAL(dp), DIMENSION(:), ALLOCATABLE :: Values
REAL(dp), DIMENSION(:), ALLOCATABLE :: Edge !-- only applies with Zoom
REAL(dp), DIMENSION(:), ALLOCATABLE :: Width !-- only applies with Zoom
END TYPE

PUBLIC :: MakeLinearGrid
PUBLIC :: MakeLogGrid
PUBLIC :: MakeGeometricGrid
PUBLIC :: AllocateGrid
PUBLIC :: DeallocateGrid
PUBLIC :: DeAllocateGrid
PUBLIC :: DescribeGrid

PRIVATE :: ComputeZoom
PRIVATE :: ZeroZoom

CONTAINS

SUBROUTINE MakeLinearGrid( LowerBound, UpperBound, nPoints, Grid )
Expand Down Expand Up @@ -76,6 +86,47 @@ SUBROUTINE MakeLogGrid( LowerBound, UpperBound, nPoints, Grid )

END SUBROUTINE MakeLogGrid


SUBROUTINE MakeGeometricGrid( LowerEdge, UpperEdge, MinWidth, nPoints, &
Grid, Width, Edge, Zoom, MinCenter, MaxCenter )

INTEGER, INTENT(in) :: nPoints
REAL(dp), INTENT(in) :: LowerEdge
REAL(dp), INTENT(in) :: UpperEdge
REAL(dp), INTENT(in) :: MinWidth
REAL(dp), DIMENSION(nPoints), INTENT(out) :: Grid
REAL(dp), DIMENSION(nPoints), INTENT(out) :: Width
REAL(dp), DIMENSION(nPoints+1), INTENT(out) :: Edge
REAL(dp), INTENT(out) :: Zoom
REAL(dp), INTENT(out) :: MinCenter
REAL(dp), INTENT(out) :: MaxCenter

INTEGER :: i

ASSOCIATE &
( N => nPoints, &
xL => LowerEdge, &
xR => UpperEdge )

call ComputeZoom( LowerEdge, UpperEdge, MinWidth, nPoints, Zoom )

Width(1) = ( xR - xL ) * ( Zoom - 1.0_DP ) / ( Zoom**N - 1.0_DP )
Grid (1) = xL + 0.5_DP * Width(1)
Edge (1) = xL
Edge (2) = xL + Width(1)
DO i = 2, N
Width(i) = Width(i-1) * Zoom
Grid (i) = xL + SUM( Width(1:i-1) ) + 0.5_DP * Width(i)
Edge (i+1) = xL + SUM( Width(1:i) )
END DO
MinCenter = Grid(1)
MaxCenter = Grid(N)

END ASSOCIATE !-- N, etc.

END SUBROUTINE MakeGeometricGrid


SUBROUTINE AllocateGrid( Grid, nPoints )

TYPE(GridType), INTENT(inout) :: Grid
Expand All @@ -84,13 +135,17 @@ SUBROUTINE AllocateGrid( Grid, nPoints )
Grid % nPoints = nPoints

ALLOCATE( Grid % Values(nPoints) )
ALLOCATE( Grid % Width(nPoints) )
ALLOCATE( Grid % Edge(nPoints+1) )

END SUBROUTINE AllocateGrid

SUBROUTINE DeAllocateGrid( Grid )

TYPE(GridType), INTENT(inout) :: Grid

DEALLOCATE( Grid % Edge )
DEALLOCATE( GRID % Width )
DEALLOCATE( Grid % Values )

END SUBROUTINE DeAllocateGrid
Expand All @@ -113,11 +168,18 @@ SUBROUTINE DescribeGrid( Grid )
' ', 'Min Value = ', Grid % minValue
WRITE(*,'(A6,A12,ES10.3E2)') &
' ', 'Max Value = ', Grid % maxValue
WRITE(*,'(A6,A12,ES10.3E2)') &
' ', 'Min Width = ', Grid % minWidth
WRITE(*,'(A6,A12,ES10.3E2)') &
' ', 'Zoom = ', Grid % Zoom
WRITE(*,'(A6,A12,I4.4)') &
' ', 'nPoints = ', Grid % nPoints
IF ( Grid % LogInterp == 1 ) THEN
WRITE (*,'(A6,A27)') &
' ', 'Grid Logarithmically Spaced'
ELSE IF ( Grid % Zoom >= 1.0d0 ) THEN
WRITE (*,'(A6,A25)') &
' ', 'Grid Geometrically Spaced'
ELSE
WRITE (*,'(A6,A20)') &
' ', 'Grid Linearly Spaced'
Expand All @@ -128,8 +190,74 @@ SUBROUTINE DescribeGrid( Grid )
WRITE(*,'(A8,A6,I4.4,A4,ES10.3E2)') &
' ','Value(', i, ') = ', Grid % Values(i)
END DO
WRITE(*,*)

IF ( Grid % Zoom >= 1.0d0 ) THEN
DO i = 1, size ( Grid % Width )
WRITE(*,'(A8,A6,I4.4,A4,ES10.3E2)') &
' ','Width(', i, ') = ', Grid % Width(i)
END DO
WRITE(*,*)
DO i = 1, size ( Grid % Edge )
WRITE(*,'(A8,A5,I4.4,A4,ES10.3E2)') &
' ','Edge(', i, ') = ', Grid % Edge(i)
END DO
END IF

END SUBROUTINE DescribeGrid

SUBROUTINE ComputeZoom( LowerEdge, UpperEdge, MinWidth, nPoints, Zoom )

REAL(dp), INTENT(in) :: LowerEdge
REAL(dp), INTENT(in) :: UpperEdge
REAL(dp), INTENT(in) :: MinWidth
INTEGER, INTENT(in) :: nPoints
REAL(dp), INTENT(out) :: Zoom

INTEGER :: i
REAL(dp) :: a, b, c
REAL(dp) :: fa, fb, fc

a = 1.000001_dp
b = 2.0_dp
fa = ZeroZoom ( a, LowerEdge, UpperEdge, MinWidth, nPoints )
fb = ZeroZoom ( b, LowerEdge, UpperEdge, MinWidth, nPoints )

!-- Bisection
do i = 1, 100
c = 0.5_dp * ( a + b )
if ( ( b - a ) / c < 1.0e-12_dp ) then
Zoom = c
return
end if
fc = ZeroZoom ( c, LowerEdge, UpperEdge, MinWidth, nPoints )
if ( sign ( 1.0_dp, fc ) == sign ( 1.0_dp, fa ) ) then
a = c
fa = fc
else
b = c
fb = fc
end if
end do !-- i

END SUBROUTINE ComputeZoom

FUNCTION ZeroZoom &
( Zoom, LowerEdge, UpperEdge, MinWidth, nPoints ) &
result ( ZZ )

REAL(dp), INTENT(in) :: Zoom
REAL(dp), INTENT(in) :: LowerEdge
REAL(dp), INTENT(in) :: UpperEdge
REAL(dp), INTENT(in) :: MinWidth
INTEGER, INTENT(in) :: nPoints
REAL(dp) :: ZZ

ZZ = ( UpperEdge - LowerEdge ) * ( Zoom - 1.0_dp ) &
/ ( Zoom ** nPoints - 1.0_dp ) &
- MinWidth

END FUNCTION ZeroZoom


END MODULE wlGridModule
Loading

0 comments on commit 7cf4918

Please sign in to comment.