From 35cb06d99ad3fb032506c7b1499e155fa53d64e0 Mon Sep 17 00:00:00 2001 From: Daniel Price Date: Wed, 29 May 2024 11:34:30 +1000 Subject: [PATCH] (physcon) move physical constants module to separate source file --- build/Makefile | 4 ++-- src/globaldata.f90 | 22 -------------------- src/physcon.f90 | 50 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 24 deletions(-) create mode 100644 src/physcon.f90 diff --git a/build/Makefile b/build/Makefile index 360ae2cc..b46278e4 100644 --- a/build/Makefile +++ b/build/Makefile @@ -409,7 +409,7 @@ ifdef H5PART_DIR endif -SOURCES= $(PLOTLIB) globaldata.f90 utils_vectors.f90 \ +SOURCES= $(PLOTLIB) globaldata.f90 physcon.f90 utils_vectors.f90 \ asciiutils.f90 byteswap.f90 \ labels.f90 partutils.f90 transform.f90 setpage.f90 sort.f90 \ prompting.f90 promptlist.f90 map_columns.f90 geometry.f90 kernels.f90 \ @@ -549,7 +549,7 @@ libexact: checksystem $(OBJLIBEXACTALL) # # libread: data read library # -SRCLIBREAD= globaldata.f90 asciiutils.f90 libutils.f90 labels.f90 allocate.f90 byteswap.f90 $(SYSTEMFILE)\ +SRCLIBREAD= globaldata.f90 physcon.f90 asciiutils.f90 libutils.f90 labels.f90 allocate.f90 byteswap.f90 $(SYSTEMFILE)\ system_utils.f90 geometry.f90 prompting.f90 fparser.f90 units.f90 timing.f90\ sort.f90 geomutils.f90 partutils.f90 calc_quantities.f90 dataread_utils.f90 \ utils_vectors.f90 lightcurve_utils.f90 read_kepler.f90 $(READFILES) read_data.F90 \ diff --git a/src/globaldata.f90 b/src/globaldata.f90 index e65a6a45..f50646b8 100644 --- a/src/globaldata.f90 +++ b/src/globaldata.f90 @@ -42,28 +42,6 @@ module params public end module params - -module physcon - use params, only:doub_prec - implicit none - real, parameter :: pi = 4.*atan(1.) - real(doub_prec), parameter :: solarrcgs = 6.955d10 ! cm - real(doub_prec), parameter :: solarmcgs = 1.989d33 ! g - real(doub_prec), parameter :: steboltz = 5.67e-5 ! erg cm^-2 K^-4 s-1 - real(doub_prec), parameter :: radconst = 7.5646d-15 ! Radiation constant erg cm^-3 K^-4 - real(doub_prec), parameter :: kboltz = 1.38066d-16 - real(doub_prec), parameter :: mh = 1.67262158d-24 ! g - real(doub_prec), parameter :: au = 1.496d13 ! cm - real(doub_prec), parameter :: c = 2.997924d10 ! Speed of light cm/s - real(doub_prec), parameter :: hplanck = 6.6260755d-27 ! Planck's Constant erg/s - real(doub_prec), parameter :: kb_on_mh = kboltz/mh - real(doub_prec), parameter :: Lsun = 3.839d33 ! Solar luminosity, erg/s - real(doub_prec), parameter :: cm_to_nm = 1.d7 - real(doub_prec), parameter :: keV_to_erg = 1.6022d-9 ! k_eV to erg - real(doub_prec), parameter :: keV_to_Hz = keV_to_erg/hplanck ! k_eV to erg - - public -end module physcon ! !--particle data ! diff --git a/src/physcon.f90 b/src/physcon.f90 new file mode 100644 index 00000000..58c77e11 --- /dev/null +++ b/src/physcon.f90 @@ -0,0 +1,50 @@ +!----------------------------------------------------------------- +! +! This file is (or was) part of SPLASH, a visualisation tool +! for Smoothed Particle Hydrodynamics written by Daniel Price: +! +! http://users.monash.edu.au/~dprice/splash +! +! SPLASH comes with ABSOLUTELY NO WARRANTY. +! This is free software; and you are welcome to redistribute +! it under the terms of the GNU General Public License +! (see LICENSE file for details) and the provision that +! this notice remains intact. If you modify this file, please +! note section 2a) of the GPLv2 states that: +! +! a) You must cause the modified files to carry prominent notices +! stating that you changed the files and the date of any change. +! +! Copyright (C) 2005-2023 Daniel Price. All rights reserved. +! Contact: daniel.price@monash.edu +! +!----------------------------------------------------------------- +!---------------------------------------------------------------------------- +! +! modules containing physical constants +! +!---------------------------------------------------------------------------- +module physcon + use params, only:doub_prec + implicit none + real, parameter :: pi = 4.*atan(1.) + real(doub_prec), parameter :: solarrcgs = 6.955d10 ! cm + real(doub_prec), parameter :: solarmcgs = 1.989d33 ! g + real(doub_prec), parameter :: steboltz = 5.67e-5 ! erg cm^-2 K^-4 s-1 + real(doub_prec), parameter :: radconst = 7.5646d-15 ! Radiation constant erg cm^-3 K^-4 + real(doub_prec), parameter :: kboltz = 1.38066d-16 + real(doub_prec), parameter :: mh = 1.67262158d-24 ! g + real(doub_prec), parameter :: au = 1.496d13 ! cm + real(doub_prec), parameter :: c = 2.997924d10 ! Speed of light cm/s + real(doub_prec), parameter :: hplanck = 6.6260755d-27 ! Planck's Constant erg/s + real(doub_prec), parameter :: kb_on_mh = kboltz/mh + real(doub_prec), parameter :: Lsun = 3.839d33 ! Solar luminosity, erg/s + real(doub_prec), parameter :: cm_to_nm = 1.d7 + real(doub_prec), parameter :: keV_to_erg = 1.6022d-9 ! k_eV to erg + real(doub_prec), parameter :: keV_to_Hz = keV_to_erg/hplanck ! k_eV to erg + real(doub_prec), parameter :: mass_electron_cgs = 9.10938291d-28 !Electron mass in g + real(doub_prec), parameter :: qe = 4.8032068d-10 !charge on electron esu + real(doub_prec), parameter :: sigma_e = 6.652e-25 ! Thomson cross section + + public +end module physcon