Convert position to Cartesian coordinates
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| double precision, | intent(in) | :: | xp(1:3) | |||
| double precision, | intent(out) | :: | xpcart(1:3) |
subroutine partcoord_to_cartesian(xp,xpcart) ! conversion of particle coordinate from cylindrical/spherical to cartesian coordinates done here use mod_global_parameters use mod_geometry double precision, intent(in) :: xp(1:3) double precision, intent(out) :: xpcart(1:3) select case (coordinate) case (Cartesian,Cartesian_stretched,Cartesian_expansion) xpcart(1:3) = xp(1:3) case (cylindrical) xpcart(1) = xp(r_)*cos(xp(phi_)) xpcart(2) = xp(r_)*sin(xp(phi_)) xpcart(3) = xp(z_) case (spherical) xpcart(1) = xp(1)*sin(xp(2))*cos(xp(3)) xpcart(2) = xp(1)*sin(xp(2))*sin(xp(3)) xpcart(3) = xp(1)*cos(xp(2)) case default write(*,*) "No converter for coordinate=",coordinate end select end subroutine partcoord_to_cartesian