Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weakphys #41

Merged
merged 84 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
9a2cd8d
work
mewesv Aug 20, 2021
57dbfcb
using wlKindModule instead of the kind module provided by Chimera
mewesv Aug 20, 2021
5282188
u
mewesv Aug 20, 2021
5266cb5
more work
mewesv Aug 20, 2021
2d34d32
more work
mewesv Aug 24, 2021
22a5375
more work, hdf5 attributes for tabulated opacities
mewesv Dec 13, 2021
5d0ec06
added attribute for Scat_Iso, got to check if we have the full opacit…
mewesv Dec 13, 2021
170cab6
changed name of attribute routine
mewesv Dec 13, 2021
7983035
adding git hash and git date to Makefile to be later stored as metada…
mewesv Dec 14, 2021
099d2b6
moved opacity descriptions to kernel group attributes, added git hash…
mewesv Dec 14, 2021
768266a
Makefile cleanup
mewesv Dec 14, 2021
a8d2ca8
forgot file and more makefile cleanup
mewesv Dec 20, 2021
80dc29f
more work
mewesv Mar 9, 2022
859db26
removing Brem rho min and max cutoff in table
mewesv Mar 9, 2022
9c122f3
merged master into weakphys
mewesv Mar 9, 2022
dc5f8ca
renamed two files to be able to use the git version flags
mewesv Mar 9, 2022
d76a44a
added changes to coeficcients in TableCreator/OpacitySource/Bruenn85/…
mewesv Mar 9, 2022
8e2946d
getting more fixes to FullWeakPhysics/wlCreateOpacityTable.F90
mewesv Mar 9, 2022
f6e3846
use wlIOModuleHDF.F90 in library
mewesv Mar 9, 2022
501e290
change name of field in wl read Brem op table
mewesv Mar 17, 2022
2007469
some clean up
mewesv Mar 21, 2022
2e3ee98
Merge branch 'dogpu_checks' of github.com:starkiller-astro/weaklib in…
mewesv Mar 21, 2022
5d254c9
actually read keys for EmAb
mewesv Mar 22, 2022
9d9fbf5
enabling EmAb on nuclei for B85 table
mewesv Mar 22, 2022
33a28b1
more work on newer opacities
mewesv Aug 19, 2022
7cbb283
Merge branch 'master' into weakphys
mewesv Aug 19, 2022
830331e
starting to get full energy grid resolution EC table into wl
mewesv Oct 1, 2022
1088739
more work on hi res EC table
mewesv Oct 5, 2022
e81e04d
corrections to Iso, safety checks for hdf5 Scat_Iso and Scat_NES exte…
mewesv Oct 11, 2022
705abdd
taking care of more legacy fields
mewesv Oct 11, 2022
e701ca8
undoing the introduction of new energygridtype
mewesv Oct 12, 2022
62ebe11
more info about EC table in hdf5 attributes
mewesv Oct 12, 2022
ab02eb5
changing makefiles in TableCreator/EOSSource/EquationsOfState/Lattime…
mewesv Oct 13, 2022
dbe5d7e
starting to add more meaningful error messages to LS table builder
mewesv Oct 13, 2022
e068b5b
Building low res SFHo Op tables with latest physics
mewesv Feb 18, 2023
3e18396
fix flashx makefile for weakphys
mewesv Feb 20, 2023
fa2daa6
actually fixing makefile for flash
mewesv Feb 20, 2023
d51c8c9
TableCreator makefile sanitising
mewesv Feb 21, 2023
3a937a4
fixing bug in interface to non-isoenergetic EmAb on nucleons routine
mewesv Mar 9, 2023
aab9159
added openmp parallelisation for Reddy et al EmAb on nucleons
mewesv Mar 10, 2023
d6681f2
Merge branch 'master' into weakphys
mewesv Mar 10, 2023
eaadead
makefile shenanigans
mewesv Mar 10, 2023
83c4566
some fixes regarding file paths
mewesv Mar 10, 2023
3612341
fixing the use of fexp vs dexp or exp which led to silent problems
mewesv Mar 14, 2023
cb002b9
cleaning up messages about legacy tables when running with MPI
mewesv Mar 14, 2023
70ae8fc
building some tables for testing
mewesv Mar 16, 2023
bf9d1d9
Merge branch 'master' into weakphys
mewesv Apr 10, 2023
56825e9
Merge branch 'master' into weakphys
mewesv Apr 14, 2023
be8ec57
build B85 tables again
mewesv Apr 14, 2023
f7e0507
now actually with FFN
mewesv Apr 14, 2023
c7c042b
tables with full opacities up to now
mewesv Apr 14, 2023
4b664f8
Merge branch 'frontier_workaround' into weakphys
mewesv May 12, 2023
64bd637
XL could not compile the src file due to the block construct within t…
mewesv May 17, 2023
9a38a43
Merge branch 'master' into weakphys
mewesv Jul 13, 2023
61f80f1
redundant private variable declaration
mewesv Aug 22, 2023
b38a1ae
move dealloc of ec table spec and rate to DeAllocateOpacityTable
mewesv Aug 25, 2023
f743f80
fix
mewesv Aug 25, 2023
a09c2b0
Adding delta-cyc_gcc (Christian Cardall's laptop)
ccardall May 18, 2023
977f5b0
Adding geometric grid to wlGridModule.f90.
ccardall Oct 5, 2023
e3f57b4
Using geometric energy grid in wlCreateOpacityTable.F90.
ccardall Oct 5, 2023
ad4b813
Restoring previous EmAb flags, which had been changed for runtime speed.
ccardall Oct 5, 2023
684cb8e
Merge branch 'master' into weakphys
jaharris87 Nov 17, 2023
0458f9b
updating my local compilers
mewesv Jan 12, 2024
a48551e
Merge branch 'weakphys' of github.com:starkiller-astro/weaklib into w…
mewesv Jan 12, 2024
cd71310
add strange quark contirbution to Iso
mewesv Jan 16, 2024
580aec5
update ga
mewesv Jan 16, 2024
a915fff
fix missing makefile dependency
mewesv Jan 30, 2024
1e93fb8
vass hdf5 update
mewesv May 13, 2024
53e254b
actually build the new EmAb table..
mewesv May 16, 2024
6e855b4
allow for extrapolation in Ye when we interpolate the EC table to the…
mewesv May 16, 2024
78a9044
Merge branch 'weakphys' of github.com:starkiller-astro/weaklib into w…
mewesv May 16, 2024
37a6f64
undo extrapolation when interpolation the EC table to the weaklib tab…
mewesv May 21, 2024
7ed5226
When using EmAb_np_non_isoenergetic, use Reddy et al 1998 routines at…
mewesv Jul 23, 2024
7522b60
extrapolation in Ye in EC table build is needed still
mewesv Jul 23, 2024
ab6dcb9
Allow for extrapolation of EC rate and spectrum at lower density end …
mewesv Jul 23, 2024
a1d55d6
Solving for Zoom factor that gives desired min energy bin width.
ccardall Jan 25, 2024
183f667
Using geometric energy grid.
ccardall Jul 25, 2024
a1dd7b7
Writing and reading new members of GridType.
ccardall Aug 8, 2024
2a6b460
Adding new members minEdge and maxEdge to GridType so as not to have …
ccardall Aug 15, 2024
601274f
Moving instances of resetting HDF5 error handling outside of IF blocks.
ccardall Aug 15, 2024
92c9fd5
Separating Scat_Iso (elastic scattering on nucleons and nuclei) from …
ccardall Aug 29, 2024
96b850d
Merge branch 'weakphys' of github.com:starkiller-astro/weaklib into w…
mewesv Oct 18, 2024
9f957f5
change hdf5 version for vass
mewesv Oct 18, 2024
4c91736
Merge branch 'weakphys' of github.com:starkiller-astro/weaklib into w…
mewesv Oct 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading