Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moddump for adding solid body rotation to gas #290

Merged
merged 5 commits into from
Jun 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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