-
Notifications
You must be signed in to change notification settings - Fork 267
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #290 from danieljprice/moddump-rotate
Moddump for adding solid body rotation to gas
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|