subroutine laplace_radial_2d_exact ( n, x, y, a, b, u, ux, uy, uxx, uxy, uyy ) !*****************************************************************************80 ! !! laplace_radial_2d_exact() evaluates an exact radial solution of the Laplace equation. ! ! Discussion: ! ! The equation is: ! Uxx + Uyy = 0 ! ! The radial solution in 2D, with parameters a and b, is: ! R = sqrt ( X^2 + Y^2 ) ! U(X,Y) = a * log ( R ) + b ! ! Licensing: ! ! This code is distributed under the MIT license. ! ! Modified: ! ! 03 June 2025 ! ! Author: ! ! John Burkardt ! ! Input: ! ! real X, Y: the coordinates of the points. ! ! real a, b: parameters. ! ! Output: ! ! real U, Ux, Uy, Uxx, Uxy, Uyy: the solution and first and second ! partial derivatives evaluated at the points (X,Y). ! implicit none integer, parameter :: rk8 = kind ( 1.0D+00 ) integer n real ( kind = 8 ) a real ( kind = 8 ) b real ( kind = 8 ) r(n) real ( kind = 8 ) u(n) real ( kind = 8 ) ux(n) real ( kind = 8 ) uxx(n) real ( kind = 8 ) uxy(n) real ( kind = 8 ) uy(n) real ( kind = 8 ) uyy(n) real ( kind = 8 ) x(n) real ( kind = 8 ) y(n) r = sqrt ( x**2 + y**2 ) u = a * log ( r ) + b ux = a * x / ( x**2 + y**2 ) uy = a * y / ( x**2 + y**2 ) uxx = a * ( - 2 * x**2 / ( x**2 + y**2 ) + 1 ) / ( x**2 + y**2 ) uxy = - 2 * a * x * y / ( x**2 + y**2 )**2 uyy = a * ( - 2 * y**2 / ( x**2 + y**2 ) + 1 ) / ( x**2 + y**2 ) return end subroutine laplace_radial_3d_exact ( n, x, y, z, a, b, u, ux, uy, uz, uxx, & uxy, uxz, uyy, uyz, uzz ) !*****************************************************************************80 ! !! laplace_radial_3d_exact() evaluates an exact radial solution of the Laplace equation. ! ! Discussion: ! ! The equation is: ! Uxx + Uyy = 0 ! ! The radial solution in 3D, with parameters a and b, is: ! R = sqrt ( X^2 + Y^2 + Z^2 ) ! U(X,Y,Z) = a * log ( R ) + b ! ! Licensing: ! ! This code is distributed under the MIT license. ! ! Modified: ! ! 03 June 2025 ! ! Author: ! ! John Burkardt ! ! Input: ! ! real X, Y, Z: the coordinates of the points. ! ! real a, b: shape parameters. ! ! Output: ! ! real U, Ux, Uy, Uz, Uxx, Uxy, Uxz, Uyy, Uyz, Uzz: ! the solution and first and second partial derivatives evaluated ! at the points (X,Y). ! real ( kind = 8 ) a real ( kind = 8 ) b real ( kind = 8 ) r(n) real ( kind = 8 ) u(n) real ( kind = 8 ) ux(n) real ( kind = 8 ) uxx(n) real ( kind = 8 ) uxy(n) real ( kind = 8 ) uxz(n) real ( kind = 8 ) uy(n) real ( kind = 8 ) uyy(n) real ( kind = 8 ) uyz(n) real ( kind = 8 ) uz(n) real ( kind = 8 ) uzz(n) real ( kind = 8 ) x(n) real ( kind = 8 ) y(n) real ( kind = 8 ) z(n) r = sqrt ( x**2 + y**2 + z**2 ) u = - a / r + b ux = a * x / ( x**2 + y**2 + z**2 )**(1.5D+00) uy = a * y / ( x**2 + y**2 + z**2 )**(1.5D+00) uz = a * z / ( x**2 + y**2 + z**2 )**(1.5D+00) uxx = a * ( - 3 * x**2 / ( x**2 + y**2 + z**2 ) + 1 ) & / ( x**2 + y**2 + z**2 )**(1.5D+00) uxy = - 3 * a * x * y / ( x**2 + y**2 + z**2 )**(2.5D+00) uxz = - 3 * a * x * z / ( x**2 + y**2 + z**2 )**(2.5D+00) uyy = a * ( - 3 * y**2 / ( x**2 + y**2 + z**2 ) + 1 ) & / ( x**2 + y**2 + z**2 )**(1.5D+00) uyz = - 3 * a * y * z / ( x**2 + y**2 + z**2 )**(2.5D+00) uzz = a * ( - 3 * z**2 / ( x**2 + y**2 + z**2 ) + 1 ) & / ( x**2 + y**2 + z**2 )**(1.5D+00) return end