Skip to content

Commit

Permalink
Merge pull request #290 from danieljprice/moddump-rotate
Browse files Browse the repository at this point in the history
Moddump for adding solid body rotation to gas
danieljprice authored Jun 1, 2022
2 parents b6442c8 + d727abc commit a7f2079
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions src/utils/moddump_rotate.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
!--------------------------------------------------------------------------!
! The Phantom Smoothed Particle Hydrodynamics code, by Daniel Price et al. !
! Copyright (c) 2007-2022 The Authors (see AUTHORS) !
! See LICENCE file for usage and distribution conditions !
! http://phantomsph.bitbucket.io/ !
!--------------------------------------------------------------------------!
module moddump
!
! set solid body rotation for all gas particles about the z-axis given angular frequency
!
! :References: None
!
! :Owner: Mike Lau
!
! :Runtime parameters: None
!
! :Dependencies: None
!
implicit none

contains

subroutine modify_dump(npart,npartoftype,massoftype,xyzh,vxyzu)
integer, intent(inout) :: npart
integer, intent(inout) :: npartoftype(:)
real, intent(inout) :: massoftype(:)
real, intent(inout) :: xyzh(:,:),vxyzu(:,:)
real :: omega,vphi,R
integer :: i

! Assume rotation axis is the z-axis
omega = 4.12e-2 ! Omega in code units

do i = 1,npart
R = sqrt(dot_product(xyzh(1:3,i),xyzh(1:3,i)))
vphi = omega*R
vxyzu(1,i) = -omega*xyzh(2,i)
vxyzu(2,i) = omega*xyzh(1,i)
vxyzu(3,i) = 0.
enddo

return
end subroutine modify_dump

end module moddump

0 comments on commit a7f2079

Please sign in to comment.