# include # include using namespace std; # include "biharmonic_exact.hpp" //****************************************************************************80 double biharmonic_exact_r1 ( double X, double Y, double a, double b, double c, double d, double e, double f, double g ) //****************************************************************************80 // // Purpose; // // biharmonic_exact_r1() evaluates exact biharmonic residual for W(X,Y) #1. // // Discussion: // // Note the formula for W: // // W = ( a * cosh ( g * X ) // + b * sinh ( g * X ) // + c * X * cosh ( g * X ) // + d * X * sinh ( g * X ) ) // * // ( e * cos ( g * Y ) // + f * sin ( g * Y ) ) // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 02 August 2024 // // Author: // // John Burkardt // // Input: // // real X, Y: the coordinates of the points. // // real a, b, c, d, e, f, g: parameters. // // Output: // // real R: the residual evaluated at the points (X,Y). // { double R; double Wxxxx; double Wxxyy; double Wyyyy; Wxxxx = pow ( g, 3 ) * ( e * cos ( g * Y ) + f * sin ( g * Y ) ) * ( a * g * cosh ( g * X ) + b * g * sinh ( g * X ) + c * g * X * cosh ( g * X ) + 4 * c * sinh ( g * X ) + d * g * X * sinh ( g * X ) + 4 * d * cosh ( g * X ) ); Wxxyy = - pow ( g, 3 ) * ( e * cos ( g * Y ) + f * sin ( g * Y ) ) * ( a * g * cosh ( g * X ) + b * g * sinh ( g * X ) + c * g * X * cosh ( g * X ) + 2 * c * sinh ( g * X ) + d * g * X * sinh ( g * X ) + 2 * d * cosh ( g * X ) ); Wyyyy = pow ( g, 4 ) * ( e * cos ( g * Y ) + f * sin ( g * Y ) ) * ( a * cosh ( g * X ) + b * sinh ( g * X ) + c * X * cosh ( g * X ) + d * X * sinh ( g * X ) ); R = Wxxxx + 2.0 * Wxxyy + Wyyyy; return R; } //****************************************************************************80 double biharmonic_exact_r2 ( double X, double Y, double a, double b, double c, double d, double e, double f, double g ) //****************************************************************************80 // // Purpose; // // biharmonic_exact_r2() evaluates exact biharmonic residual for W(X,Y) #2. // // Discussion: // // Note the formula for W: // // W = ( a * cos ( g * X ) // + b * sin ( g * X ) // + c * X * cos ( g * X ) // + d * X * sin ( g * X ) ) // * // ( e * cosh ( g * Y ) // + f * sinh ( g * Y ) ) // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 02 August 2024 // // Author: // // John Burkardt // // Input: // // real X, Y: the coordinates of the points. // // real a, b, c, d, e, f, g: parameters. // // Output: // // real R: the residual evaluated at the points (X,Y). // { double R; double Wxxxx; double Wxxyy; double Wyyyy; Wxxxx = pow ( g, 3 ) * ( e * cosh ( g * Y ) + f * sinh ( g * Y ) ) * ( a * g * cos ( g * X ) + b * g * sin ( g * X ) + c * g * X * cos ( g * X ) + 4 * c * sin ( g * X ) + d * g * X * sin ( g * X ) - 4 * d * cos ( g * X ) ); Wxxyy = - pow ( g, 3 ) * ( e * cosh ( g * Y ) + f * sinh ( g * Y ) ) * ( a * g * cos ( g * X ) + b * g * sin ( g * X ) + c * g * X * cos ( g * X ) + 2 * c * sin ( g * X ) + d * g * X * sin ( g * X ) - 2 * d * cos ( g * X ) ); Wyyyy = pow ( g, 4 ) * ( e * cosh ( g * Y ) + f * sinh ( g * Y ) ) * ( a * cos ( g * X ) + b * sin ( g * X ) + c * X * cos ( g * X ) + d * X * sin ( g * X ) ); R = Wxxxx + 2.0 * Wxxyy + Wyyyy; return R; } //****************************************************************************80 double biharmonic_exact_r3 ( double X, double Y, double a, double b, double c, double d, double e, double f ) //****************************************************************************80 // // Purpose; // // biharmonic_exact_r3() evaluates exact biharmonic residual for W(X,Y) #3. // // Discussion: // // Note the formula for W: // // R = sqrt ( ( X - e )**2 + ( Y - f )**2 ) // // W = a * R**2 * log ( R ) // + b * R**2 // + c * log ( R ) // + d // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 02 August 2024 // // Author: // // John Burkardt // // Input: // // real X, Y: the coordinates of the points. // // real a, b, c, d, e, f: parameters. // // Output: // // real R: the residual evaluated at the points (X,Y). // { double R; double S; double Wxxxx; double Wxxyy; double Wyyyy; S = pow ( e - X, 2 ) + pow ( f - Y, 2 ); Wxxxx = 2 * ( 8 * a * pow ( e - X, 4 ) / pow ( S, 2 ) - 12 * a * pow ( e - X, 2 ) / S + 3 * a - 24 * c * pow ( e - X, 4 ) / pow ( S, 3 ) + 24 * c * pow ( e - X, 2 ) / pow ( S, 2 ) - 3 * c / S ) / S; Wxxyy = 2 * ( 8 * a * pow ( e - X, 2 ) * pow ( f - Y, 2 ) / pow ( S, 2 ) - 2 * a * pow ( e - X, 2 ) / S - 2 * a * pow ( f - Y, 2 ) / S + a - 24 * c * pow ( e - X, 2 ) * pow ( f - Y, 2 ) / pow ( S, 3 ) + 4 * c * pow ( e - X, 2 ) / pow ( S, 2 ) + 4 * c * pow ( f - Y, 2 ) / pow ( S, 2 ) - c / S ) / S; Wyyyy = 2 * ( 8 * a * pow ( f - Y, 4 ) / pow ( S, 2 ) - 12 * a * pow ( f - Y, 2 ) / S + 3 * a - 24 * c * pow ( f - Y, 4 ) / pow ( S, 3 ) + 24 * c * pow ( f - Y, 2 ) / pow ( S, 2 ) - 3 * c / S ) / S; R = Wxxxx + 2.0 * Wxxyy + Wyyyy; return R; } //****************************************************************************80 double biharmonic_exact_w1 ( double X, double Y, double a, double b, double c, double d, double e, double f, double g ) //****************************************************************************80 // // Purpose; // // biharmonic_exact1() evaluates exact biharmonic solution W(X,Y) #1. // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 02 August 2024 // // Author: // // John Burkardt // // Input: // // real X, Y: the coordinates of the points. // // real a, b, c, d, e, f, g: parameters. // // Output: // // real W: the solution evaluated at the points (X,Y). // { double W; W = ( a * cosh ( g * X ) + b * sinh ( g * X ) + c * X * cosh ( g * X ) + d * X * sinh ( g * X ) ) * ( e * cos ( g * Y ) + f * sin ( g * Y ) ); return W; } //****************************************************************************80 double biharmonic_exact_w2 ( double X, double Y, double a, double b, double c, double d, double e, double f, double g ) //****************************************************************************80 // // Purpose; // // biharmonic_exact_w2() evaluates exact biharmonic solution W(X,Y) #2. // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 02 August 2024 // // Author: // // John Burkardt // // Input: // // real X, Y: the coordinates of the points. // // real a, b, c, d, e, f, g: parameters. // // Output: // // real W: the solution evaluated at the points (X,Y). // { double W; W = ( a * cos ( g * X ) + b * sin ( g * X ) + c * X * cos ( g * X ) + d * X * sin ( g * X ) ) * ( e * cosh ( g * Y ) + f * sinh ( g * Y ) ); return W; } //****************************************************************************80 double biharmonic_exact_w3 ( double X, double Y, double a, double b, double c, double d, double e, double f ) //****************************************************************************80 // // Purpose; // // biharmonic_exact_w3() evaluates exact biharmonic solution W(X,Y) #3. // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 02 August 2024 // // Author: // // John Burkardt // // Input: // // real X, Y: the coordinates of the points. // // real a, b, c, d, e, f: parameters. // // Output: // // real W: the solution evaluated at the points (X,Y). // { double R; double W; R = sqrt ( pow ( X - e, 2 ) + pow ( Y - f, 2 ) ); W = a * R * R * log ( R ) + b * R * R + c * log ( R ) + d; return W; }