Skip to content

Commit

Permalink
(physcon) move physical constants module to separate source file
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljprice committed May 29, 2024
1 parent 0b695cc commit 35cb06d
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 24 deletions.
4 changes: 2 additions & 2 deletions build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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 \
Expand Down
22 changes: 0 additions & 22 deletions src/globaldata.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
!
Expand Down
50 changes: 50 additions & 0 deletions src/physcon.f90
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 35cb06d

Please sign in to comment.