| 1 |
!----------------------------------------------------------------- |
| 2 |
! |
| 3 |
! This file is (or was) part of SPLASH, a visualisation tool |
| 4 |
! for Smoothed Particle Hydrodynamics written by Daniel Price: |
| 5 |
! |
| 6 |
! http://users.monash.edu.au/~dprice/splash |
| 7 |
! |
| 8 |
! SPLASH comes with ABSOLUTELY NO WARRANTY. |
| 9 |
! This is free software; and you are welcome to redistribute |
| 10 |
! it under the terms of the GNU General Public License |
| 11 |
! (see LICENSE file for details) and the provision that |
| 12 |
! this notice remains intact. If you modify this file, please |
| 13 |
! note section 2a) of the GPLv2 states that: |
| 14 |
! |
| 15 |
! a) You must cause the modified files to carry prominent notices |
| 16 |
! stating that you changed the files and the date of any change. |
| 17 |
! |
| 18 |
! Copyright (C) 2005-2009 Daniel Price. All rights reserved. |
| 19 |
! Contact: [email protected] |
| 20 |
! |
| 21 |
!----------------------------------------------------------------- |
| 22 |
|
| 23 |
!---------------------------------------------------------- |
| 24 |
! plots the relation between smoothing length and density |
| 25 |
! |
| 26 |
! ie. h = h_fact*(pmass/rho)^(1/ndim) |
| 27 |
! |
| 28 |
!---------------------------------------------------------- |
| 29 |
module rhoh |
| 30 |
implicit none |
| 31 |
public :: exact_rhoh |
| 32 |
|
| 33 |
contains |
| 34 |
|
| 35 |
subroutine exact_rhoh(iplot,ndim,hfact,pmassval,xplot,yplot,ierr) |
| 36 |
integer, intent(in) :: iplot,ndim |
| 37 |
integer, intent(out) :: ierr |
| 38 |
real, intent(in) :: hfact,pmassval |
| 39 |
real, dimension(:), intent(in) :: xplot |
| 40 |
real, dimension(size(xplot)), intent(out) :: yplot |
| 41 |
|
| 42 |
if (hfact > 0.01) then |
| 43 |
ierr = 0 |
| 44 |
|
| 45 |
if (iplot==2) then ! x axis is h |
| 46 |
where (xplot > tiny(xplot)) |
| 47 |
yplot(:) = pmassval*(hfact/xplot(:))**ndim |
| 48 |
elsewhere |
| 49 |
yplot(:) = huge(yplot) |
| 50 |
end where |
| 51 |
else ! y axis is h |
| 52 |
where (xplot > tiny(xplot)) |
| 53 |
yplot(:) = hfact*(pmassval/xplot(:))**(1./FLOAT(ndim)) |
| 54 |
elsewhere |
| 55 |
yplot(:) = huge(yplot) |
| 56 |
end where |
| 57 |
endif |
| 58 |
write(*,"(a,f5.2,a,es9.2,a,i1,a)") ' plotting h = ',hfact, & |
| 59 |
'*(',pmassval,'/rho)**(1/',ndim,')' |
| 60 |
else |
| 61 |
print "(a)",'error: hfact = 0: can''t plot h vs rho exact solution' |
| 62 |
ierr = 1 |
| 63 |
endif |
| 64 |
|
| 65 |
return |
| 66 |
end subroutine exact_rhoh |
| 67 |
|
| 68 |
end module rhoh |