Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljprice committed Dec 13, 2019
2 parents 338f9bd + 19d7c66 commit 8f7d6e8
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/main/checksetup.F90
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
! RUNTIME PARAMETERS: None
!
! DEPENDENCIES: boundary, centreofmass, dim, eos, externalforces, io,
! options, part, physcon, timestep, units
! options, part, physcon, sortutils, timestep, units
!+
!--------------------------------------------------------------------------
module checksetup
Expand Down
2 changes: 1 addition & 1 deletion src/main/eos.F90
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ subroutine init_eos(eos_type,ierr)

! Reset rhocrit0 if a warm medium is not defined
if (rhocrit0cgs > 0.0 .and. polyk2 < tiny(polyk2)) then
call warning('init_eos','warm medium defined by rho0 but not polyk2. Resetting rho0 = 0.')
call warning('init_eos','warm medium defined by critical density rho0 but not polyk2. Resetting rho0 = 0.')
drhocrit0 = 0.0
rhocritT = 0.0
rhocrit0 = 0.0
Expand Down
3 changes: 1 addition & 2 deletions src/main/force.F90
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,7 @@ module forces
!----------------------------------------------------------------
subroutine force(icall,npart,xyzh,vxyzu,fxyzu,divcurlv,divcurlB,Bevol,dBevol,dustprop,dustgasprop,&
dustfrac,ddustevol,ipart_rhomax,dt,stressmax,temperature)
use dim, only:maxvxyzu,maxneigh,maxdvdx,&
mhd,mhd_nonideal,lightcurve
use dim, only:maxvxyzu,maxneigh,mhd,mhd_nonideal,lightcurve
use io, only:iprint,fatal,iverbose,id,master,real4,warning,error,nprocs
use linklist, only:ncells,get_neighbour_list,get_hmaxcell,get_cell_location
use options, only:iresistive_heating
Expand Down
26 changes: 14 additions & 12 deletions src/setup/set_vfield.f90
Original file line number Diff line number Diff line change
Expand Up @@ -68,45 +68,47 @@ end subroutine set_vfield
! 3) RMS Mach number
!+
!------------------------------------------------------------------
subroutine normalise_vfield(npart,vxyzu,ierr,rms,ke,rmsmach)
subroutine normalise_vfield(npart,vxyzu,ierr,rms,ke,rmsmach_in)
use io, only:fatal,id,master
use energies, only:compute_energies,rmsmachn=>rmsmach,vrms,ekin
use energies, only:compute_energies,rmsmach,vrms,ekin
use mpiutils, only:bcast_mpi
integer, intent(in) :: npart
real, intent(inout) :: vxyzu(:,:)
integer, intent(out) :: ierr
real, intent(in), optional :: rms,ke,rmsmach
real :: factor
real, intent(in), optional :: rms,ke,rmsmach_in
real :: factor
integer :: i
!
!--compute the total kinetic energy, RMS Mach number and RMS velocity
!
call compute_energies(0.)
if (id==master) write(*,"(1x,3(a,es10.3))") &
'Values from original v-field: Ekin = ',ekin,' rms v = ',vrms,' rms mach = ',rmsmach
!
!--make sure these are same on all processors
!
call bcast_mpi(ekin)
call bcast_mpi(vrms)
call bcast_mpi(rmsmachn)
call bcast_mpi(rmsmach)
!
!--work out factor needed to renormalise velocity field to correct value
!
factor = -1.
if (present(rms)) then
if (vrms > 0.) factor = rms/vrms
if (present(ke) .or. present(rmsmach)) ierr = 1
if (present(ke) .or. present(rmsmach_in)) ierr = 1
elseif (present(ke)) then
if (ekin > 0.) factor = sqrt(ke/ekin)
if (present(rms) .or. present(rmsmach)) ierr = 1
elseif (present(rmsmach)) then
if (rmsmachn > 0.) factor = rmsmach/rmsmachn
if (present(rms) .or. present(rmsmach_in)) ierr = 1
elseif (present(rmsmach_in)) then
if (rmsmach > 0.) factor = rmsmach_in/rmsmach
if (present(rms) .or. present(ke)) ierr = 1
else
factor = 0.
ierr = 1
ierr = 1
endif
if (factor < 0) ierr = 2
if (ierr /= 0) return
if (ierr /= 0) return
!
!--perform renormalisation of velocity field
!
Expand All @@ -118,7 +120,7 @@ subroutine normalise_vfield(npart,vxyzu,ierr,rms,ke,rmsmach)
!
call compute_energies(0.)
if (id==master) write(*,"(1x,3(a,es10.3))") &
'Normalising v field: Ekin = ',ekin,' rms v = ',vrms,' rms mach = ',rmsmachn
'Values from normalised v-field: Ekin = ',ekin,' rms v = ',vrms,' rms mach = ',rmsmach

end subroutine normalise_vfield

Expand Down
4 changes: 2 additions & 2 deletions src/setup/setup_cluster.f90
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ module setup
!
!----------------------------------------------------------------
subroutine setpart(id,npart,npartoftype,xyzh,massoftype,vxyzu,polyk,gamma,hfact,time,fileprefix)
use physcon, only:pi,solarm,pc,years,kboltz,mass_proton_cgs,au
use velfield, only:set_velfield_from_cubes
use physcon, only:pi,solarm,pc,years,kboltz,mass_proton_cgs,au
use velfield, only:set_velfield_from_cubes
use setup_params, only:rmax,rhozero
use random, only:ran2
use part, only:igas,set_particle_type
Expand Down

0 comments on commit 8f7d6e8

Please sign in to comment.