From d727abc5616a264361b34b49b4e089897ffe2c8c Mon Sep 17 00:00:00 2001 From: Mike Lau Date: Tue, 3 May 2022 16:42:42 -0400 Subject: [PATCH] add moddump that sets solid body rotation --- src/utils/moddump_rotate.f90 | 46 ++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/utils/moddump_rotate.f90 diff --git a/src/utils/moddump_rotate.f90 b/src/utils/moddump_rotate.f90 new file mode 100644 index 000000000..ef21d875c --- /dev/null +++ b/src/utils/moddump_rotate.f90 @@ -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 +