subroutine minimal_surface_catenoid_exact ( n, X, Y, a, U, Ux, Uy, Uxx, & Uxy, Uyy ) !*****************************************************************************80 ! !! minimal_surface_catenoid_exact() evaluates catenoid minimal surface solution U(X,Y). ! ! Discussion: ! ! The minimal surface equation describes a function with zero mean curvature. ! ! The equation is: ! (1+Ux**2) Uyy - 2 Ux Uy Uxy + (1+Uy**2) Uxx = 0 ! ! The helicoid solution is: ! U(X,Y) = acosh ( a sqrt(X**2+Y**2) ) / a ! ! Licensing: ! ! This code is distributed under the MIT license. ! ! Modified: ! ! 31 May 2025 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! John D Cook, ! Closed-form minimal surface solutions, ! https://www.johndcook.com/blog/2025/03/31/minimal-surface-solutions/ ! Posted 31 March 2025. ! ! Input: ! ! integer n: the number of points. ! ! real X(n), Y(n): the coordinates of the points. ! ! real a: a shape parameter. ! ! Output: ! ! real U(n), Ux(n), Uy(n), Uxx(n), Uxy(n), Uyy(n): ! the solution, first and second partial derivatives evaluated at (X,Y). ! implicit none integer, parameter :: rk8 = kind ( 1.0D+00 ) integer n real ( kind = rk8 ) a real ( kind = rk8 ) U(n) real ( kind = rk8 ) Ux(n) real ( kind = rk8 ) Uxx(n) real ( kind = rk8 ) Uxy(n) real ( kind = rk8 ) Uy(n) real ( kind = rk8 ) Uyy(n) real ( kind = rk8 ) X(n) real ( kind = rk8 ) Y(n) U = acosh ( a * sqrt ( X**2 + Y**2 ) ) / a Ux = X / ( sqrt ( X**2 + Y**2 ) * sqrt ( a**2 * ( X**2 + Y**2 ) - 1 ) ) Uy = Y / ( sqrt ( X**2 + Y**2 ) * sqrt ( a**2 * ( X**2 + Y**2 ) - 1 ) ) Uxx = - ( a**2 * X**2 / ( a**2 * ( X**2 + Y**2 ) - 1 ) & + X**2 / ( X**2 + Y**2 ) - 1 ) / ( sqrt ( X**2 + Y**2 ) & * sqrt ( a**2 * ( X**2 + Y**2 ) - 1 ) ) Uxy = - X * Y * ( a**2 / ( a**2 * ( X**2 + Y**2 ) - 1 ) & + 1 / ( X**2 + Y**2 ) ) / ( sqrt ( X**2 + Y**2 ) & * sqrt ( a**2 * ( X**2 + Y**2 ) - 1 ) ) Uyy = - ( a**2 * Y**2 / ( a**2 * ( X**2 + Y**2 ) - 1 ) & + Y**2 / ( X**2 + Y**2 ) - 1 ) / ( sqrt ( X**2 + Y**2 ) & * sqrt ( a**2 * ( X**2 + Y**2 ) - 1 ) ) return end subroutine minimal_surface_catenoid_residual ( n, X, Y, a, R ) !*****************************************************************************80 ! !! minimal_surface_catenoid_residual(): minimal surface residual for catenoid solution. ! ! Discussion: ! ! The equation is: ! (1+Ux**2) Uyy - 2 Ux Uy Uxy + (1+Uy**2) Uxx = 0 ! ! The catenoid solution is: ! U(X,Y) = acosh ( a * sqrt ( X**2 + Y**2 ) ) / a ! ! Licensing: ! ! This code is distributed under the MIT license. ! ! Modified: ! ! 31 May 2025 ! ! Author: ! ! John Burkardt ! ! Input: ! ! integer n: the number of points. ! ! real X(n), Y(n): the coordinates of the points. ! ! real a: a shape parameter. ! ! Output: ! ! real R(n): the residual evaluated at the points (X,Y). ! implicit none integer, parameter :: rk8 = kind ( 1.0D+00 ) integer n real ( kind = rk8 ) a real ( kind = rk8 ) R(n) real ( kind = rk8 ) U(n) real ( kind = rk8 ) Ux(n) real ( kind = rk8 ) Uxx(n) real ( kind = rk8 ) Uxy(n) real ( kind = rk8 ) Uy(n) real ( kind = rk8 ) Uyy(n) real ( kind = rk8 ) X(n) real ( kind = rk8 ) Y(n) call minimal_surface_catenoid_exact ( n, X, Y, a, U, Ux, Uy, Uxx, Uxy, Uyy ) R = ( 1.0 + Ux**2 ) * Uyy & - 2.0 * Ux * Uxy * Uy & + ( 1.0 + Uy**2 ) * Uxx return end subroutine minimal_surface_helicoid_exact ( n, X, Y, U, Ux, Uy, Uxx, Uxy, Uyy ) !*****************************************************************************80 ! !! minimal_surface_helicoid_exact() evaluates helicoid minimal surface solution U(X,Y). ! ! Discussion: ! ! The minimal surface equation describes a function with zero mean curvature. ! ! The equation is: ! (1+Ux**2) Uyy - 2 Ux Uy Uxy + (1+Uy**2) Uxx = 0 ! ! The helicoid solution is: ! U(X,Y) = arctan ( X / Y ) ! ! Licensing: ! ! This code is distributed under the MIT license. ! ! Modified: ! ! 29 May 2025 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! John D Cook, ! Closed-form minimal surface solutions, ! https://www.johndcook.com/blog/2025/03/31/minimal-surface-solutions/ ! Posted 31 March 2025. ! ! Input: ! ! integer n: the number of points. ! ! real X(n), Y(n): the coordinates of the points. ! ! Output: ! ! real U(n), Ux(n), Uy(n), Uxx(n), Uxy(n), Uyy(n): ! the solution, first and second partial derivatives evaluated at (X,Y). ! implicit none integer, parameter :: rk8 = kind ( 1.0D+00 ) integer n real ( kind = rk8 ) U(n) real ( kind = rk8 ) Ux(n) real ( kind = rk8 ) Uxx(n) real ( kind = rk8 ) Uxy(n) real ( kind = rk8 ) Uy(n) real ( kind = rk8 ) Uyy(n) real ( kind = rk8 ) X(n) real ( kind = rk8 ) Y(n) U = atan ( X / Y ) Ux = 1 / ( Y * ( X**2 / Y**2 + 1 ) ) Uy = - X / ( Y**2 * ( X**2 / Y**2 + 1 ) ) Uxx = - 2 * X / ( Y**3 * ( X**2 / Y**2 + 1 )**2 ) Uxy = ( 2 * X**2 / ( Y**2 * ( X**2 / Y**2 + 1 ) ) - 1 ) & / ( Y**2 * ( X**2 / Y**2 + 1 ) ) Uyy = 2 * X * ( - X**2 / ( Y**2 * ( X**2 / Y**2 + 1 ) ) + 1 ) & / ( Y**3 * ( X**2 / Y**2 + 1 ) ) return end subroutine minimal_surface_helicoid_residual ( n, X, Y, R ) !*****************************************************************************80 ! !! minimal_surface_helicoid_residual(): minimal surface residual for helicoid solution. ! ! Discussion: ! ! The equation is: ! (1+Ux**2) Uyy - 2 Ux Uy Uxy + (1+Uy**2) Uxx = 0 ! ! The helicoid solution is: ! U(X,Y) = arctan ( X / Y ) ! ! Licensing: ! ! This code is distributed under the MIT license. ! ! Modified: ! ! 29 May 2025 ! ! Author: ! ! John Burkardt ! ! Input: ! ! integer n: the number of points. ! ! real X(n), Y(n): the coordinates of the points. ! ! Output: ! ! real R(n): the residual evaluated at the points (X,Y). ! implicit none integer, parameter :: rk8 = kind ( 1.0D+00 ) integer n real ( kind = rk8 ) R(n) real ( kind = rk8 ) U(n) real ( kind = rk8 ) Ux(n) real ( kind = rk8 ) Uxx(n) real ( kind = rk8 ) Uxy(n) real ( kind = rk8 ) Uy(n) real ( kind = rk8 ) Uyy(n) real ( kind = rk8 ) X(n) real ( kind = rk8 ) Y(n) call minimal_surface_helicoid_exact ( n, X, Y, U, Ux, Uy, Uxx, Uxy, Uyy ) R = ( 1.0 + Ux**2 ) * Uyy & - 2.0 * Ux * Uxy * Uy & + ( 1.0 + Uy**2 ) * Uxx return end subroutine minimal_surface_linear_exact ( n, X, Y, a, b, c, U, Ux, Uy, Uxx, & Uxy, Uyy ) !*****************************************************************************80 ! !! minimal_surface_linear_exact() evaluates linear minimal surface solution U(X,Y). ! ! Discussion: ! ! The minimal surface equation describes a function with zero mean curvature. ! ! The equation is: ! (1+Ux**2) Uyy - 2 Ux Uy Uxy + (1+Uy**2) Uxx = 0 ! ! The linear solution is: ! U(X,Y) = a * X + b * Y + C ! ! Licensing: ! ! This code is distributed under the MIT license. ! ! Modified: ! ! 29 May 2025 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! John D Cook, ! Closed-form minimal surface solutions, ! https://www.johndcook.com/blog/2025/03/31/minimal-surface-solutions/ ! Posted 31 March 2025. ! ! Input: ! ! integer n: the number of points. ! ! real X(n), Y(n): the coordinates of the points. ! ! real a, b, c: parameters. ! ! Output: ! ! real U(n), Ux(n), Uy(n), Uxx(n), Uxy(n), Uyy(n): ! the solution, first and second partial derivatives evaluated at (X,Y). ! implicit none integer, parameter :: rk8 = kind ( 1.0D+00 ) integer n real ( kind = rk8 ) a real ( kind = rk8 ) b real ( kind = rk8 ) c real ( kind = rk8 ) U(n) real ( kind = rk8 ) Ux(n) real ( kind = rk8 ) Uxx(n) real ( kind = rk8 ) Uxy(n) real ( kind = rk8 ) Uy(n) real ( kind = rk8 ) Uyy(n) real ( kind = rk8 ) X(n) real ( kind = rk8 ) Y(n) U = a * X + b * Y + c Ux = a Uy = b Uxx = 0.0D+00 Uxy = 0.0D+00 Uyy = 0.0D+00 return end subroutine minimal_surface_linear_residual ( n, X, Y, a, b, c, R ) !*****************************************************************************80 ! !! minimal_surface_linear_residual(): minimal surface residual for linear solution. ! ! Discussion: ! ! The equation is: ! (1+Ux**2) Uyy - 2 Ux Uy Uxy + (1+Uy**2) Uxx = 0 ! ! The linear solution is: ! U(X,Y) = a * X + b * Y + C ! ! Licensing: ! ! This code is distributed under the MIT license. ! ! Modified: ! ! 29 May 2025 ! ! Author: ! ! John Burkardt ! ! Input: ! ! integer n: the number of points. ! ! real X(n), Y(n): the coordinates of the points. ! ! real a, b, c: parameters. ! ! Output: ! ! real R(n): the residual evaluated at the points (X,Y). ! implicit none integer, parameter :: rk8 = kind ( 1.0D+00 ) integer n real ( kind = rk8 ) a real ( kind = rk8 ) b real ( kind = rk8 ) c real ( kind = rk8 ) R(n) real ( kind = rk8 ) U(n) real ( kind = rk8 ) Ux(n) real ( kind = rk8 ) Uxx(n) real ( kind = rk8 ) Uxy(n) real ( kind = rk8 ) Uy(n) real ( kind = rk8 ) Uyy(n) real ( kind = rk8 ) X(n) real ( kind = rk8 ) Y(n) call minimal_surface_linear_exact ( n, X, Y, a, b, c, U, Ux, Uy, Uxx, Uxy, & Uyy ) R = ( 1.0 + Ux**2 ) * Uyy & - 2.0 * Ux * Uxy * Uy & + ( 1.0 + Uy**2 ) * Uxx return end subroutine minimal_surface_scherk_exact ( n, X, Y, a, U, Ux, Uy, Uxx, Uxy, Uyy ) !*****************************************************************************80 ! !! minimal_surface_scherk_exact() evaluates Scherk minimal surface solution U(X,Y). ! ! Discussion: ! ! The minimal surface equation describes a function with zero mean curvature. ! ! The equation is: ! (1+Ux**2) Uyy - 2 Ux Uy Uxy + (1+Uy**2) Uxx = 0 ! ! The Scherk solution is: ! U(X,Y) = log ( cos ( a Y ) / cos ( a X ) ) / a ! ! Licensing: ! ! This code is distributed under the MIT license. ! ! Modified: ! ! 31 May 2025 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! John D Cook, ! Closed-form minimal surface solutions, ! https://www.johndcook.com/blog/2025/03/31/minimal-surface-solutions/ ! Posted 31 March 2025. ! ! Input: ! ! integer n: the number of points. ! ! real X(n), Y(n): the coordinates of the points. ! ! real a: a shape parameter. ! ! Output: ! ! real U(n), Ux(n), Uy(n), Uxx(n), Uxy(n), Uyy(n): ! the solution, first and second partial derivatives evaluated at (X,Y). ! implicit none integer, parameter :: rk8 = kind ( 1.0D+00 ) integer n real ( kind = rk8 ) a real ( kind = rk8 ) U(n) real ( kind = rk8 ) Ux(n) real ( kind = rk8 ) Uxx(n) real ( kind = rk8 ) Uxy(n) real ( kind = rk8 ) Uy(n) real ( kind = rk8 ) Uyy(n) real ( kind = rk8 ) X(n) real ( kind = rk8 ) Y(n) U = log ( cos ( a * Y ) / cos ( a * X ) ) / a Ux = sin ( a * X ) / cos ( a * X ) Uy = - sin ( a * Y ) / cos ( a * Y ) Uxx = a * ( sin ( a * X )**2 / cos ( a * X )**2 + 1 ) Uxy = 0 Uyy = - a * ( sin ( a * Y )**2 / cos ( a * Y )**2 + 1 ) return end subroutine minimal_surface_scherk_residual ( n, X, Y, a, R ) !*****************************************************************************80 ! !! minimal_surface_scherk_residual(): minimal surface residual for Scherk solution. ! ! Discussion: ! ! The equation is: ! (1+Ux**2) Uyy - 2 Ux Uy Uxy + (1+Uy**2) Uxx = 0 ! ! The Scherk solution is: ! U(X,Y) = log ( cos ( a * Y ) / cos ( a * X ) ) / a ! ! Licensing: ! ! This code is distributed under the MIT license. ! ! Modified: ! ! 31 May 2025 ! ! Author: ! ! John Burkardt ! ! Input: ! ! integer n: the number of points. ! ! real X(n), Y(n): the coordinates of the points. ! ! real a: a shape parameter. ! ! Output: ! ! real R(n): the residual evaluated at the points (X,Y). ! implicit none integer, parameter :: rk8 = kind ( 1.0D+00 ) integer n real ( kind = rk8 ) a real ( kind = rk8 ) R(n) real ( kind = rk8 ) U(n) real ( kind = rk8 ) Ux(n) real ( kind = rk8 ) Uxx(n) real ( kind = rk8 ) Uxy(n) real ( kind = rk8 ) Uy(n) real ( kind = rk8 ) Uyy(n) real ( kind = rk8 ) X(n) real ( kind = rk8 ) Y(n) call minimal_surface_scherk_exact ( n, X, Y, a, U, Ux, Uy, Uxx, Uxy, Uyy ) R = ( 1.0 + Ux**2 ) * Uyy & - 2.0 * Ux * Uxy * Uy & + ( 1.0 + Uy**2 ) * Uxx return end