Sei sulla pagina 1di 10

4.

5 Program LABECON for Solving the Laplace Equation 73

4. Boundary conditions. N pairs of prescribed values consisting either of


INDEX 5 0 and u, or INDEX 5 1 and @u=@n.
5. Internal points. IN pairs of values consisting of the coordinates ΧIN and
YIN of the internal points at which the values of u is computed.
Finally, the subroutine INPUT writes the data in OUTPUTFILE, to which
the user assigns a specific name.

4.5.3 GMATR subroutine


The GMATR subroutine forms the matrix G defined in Eq. (4.3) by using
the subroutines RLINTC and SLINTC. These subroutines perform the follow-
ing tasks:
The RLINTC, (R)egular (L)ine (In)tegral for (C)onstant Elements,
computes the off-diagonal elements of the G matrix.
The SLINTC, (S)ingular (L)ine (In)tegral for (C)onstant Elements,
computes the diagonal elements of the G matrix.

4.5.4 RLINTC subroutine


The RLINTC subroutine computes regular line integrals on constant elements
employing a four-point Gaussian integration scheme (see Appendix B).
It uses the coordinates of the i-th nodal point and those of the extreme points
of the j-th element (points j and j 1 1), it renames them to 0, 1, and 2
(see Fig. 4.8), respectively, and then it evaluates the integral of Eq. (4.22).

4.5.5 SLINTC subroutine


The SLINTC subroutine uses the coordinates of the extreme points of the
j-th element (points j and j 1 1), it renames them to 1 and 2, respectively,
and then calculates the integral on the basis of Eq. (4.28a).

FIGURE 4.8 Four-point Gaussian quadrature and point numbering for subroutine
RLINTC.
74 Numerical Implementation of the BEM

4.5.6 HMATR subroutine


The HMATR subroutine forms the matrix H defined in Eq. (4.5). The diago-
nal elements of the matrix H^ are H^ ii 5 0 (see Eq. 4.28b), while the off-
diagonal elements are calculated using the DALPHA subroutine.

4.5.7 DALPHA subroutine


The DALPHA subroutine uses the coordinates of the i-th nodal point and
those of the extreme points of the j-th element (points j and j 1 1), it renames
them to 0, 1, and 2 (see Fig. 4.8), respectively, and then calculates the off-
diagonal elements Hij according to Eq. (4.24).

4.5.8 ABMATR subroutine


The ABMATR subroutine generates the matrix A and the vector B of
Eq. (4.9) from the columns of matrices G and H . The j-th column of matrix A
consists of the corresponding column of H , if u is unknown (INDEX(J) 5 1),
or that of 2G, if un is unknown (INDEX(J) 5 0). The vector B results as the
sum of the columns of 2H multiplied by the corresponding known values of
u (INDEX(J) 5 0) and the columns of G multiplied by the corresponding
known values of un (INDEX(J) 5 1). It should be noted that in the con-
struction of A and B a change of sign occurs, when columns of H or G
are shifted, respectively, to the left- or to the right-hand side of the equation
(see Eq. 4.10).

4.5.9 SOLVEQ subroutine


The SOLVEQ subroutine employs the matrix A and the vector Bð5 UNBÞ
and calls the subroutine LEQS, which solves the system of linear equations.
The solution is stored in the vector UNB.

4.5.10 LEQS subroutine


The LEQS subroutine uses the matrix A, the vector B and the parameter N
to solve the system of equations AX 5 B by Gauss elimination. The solution
is stored in the vector B. The output parameter LSING takes the value
LSING 5 0, when the matrix A is regular, or LSING 5 1, when the matrix A
is singular.

4.5.11 REORDER subroutine


The REORDER subroutine rearranges the vectors UB and UNB on the basis
of the boundary condition vector INDEX. At output UB contains all the
values of u and UNB all the values of its normal derivative @u=@n.
4.5 Program LABECON for Solving the Laplace Equation 75

4.5.12 UINTER subroutine


The UINTER subroutine uses the boundary values of the vectors UB and
UNB to compute the values of u at the specified internal points on the basis
of Eq. (4.11).
The evaluation of derivatives u;x and u;y at the internal points is left as an
exercise to the reader (see Problem 4.1).

4.5.13 OUTPUT subroutine


The OUTPUT subroutine writes all the results in the OUTPUTFILE to which
the user gives a specific name. First, it lists the coordinates of the boundary
nodal points along with the corresponding nodal values of u and @u=@n, and
then the coordinates of the internal points and the computed values of u at
those points.
In the sequel, we provide the listing of program LABECON. The elec-
tronic version of the code is available on this book’s companion website.
76 Numerical Implementation of the BEM
4.5 Program LABECON for Solving the Laplace Equation 77
78 Numerical Implementation of the BEM
4.5 Program LABECON for Solving the Laplace Equation 79
80 Numerical Implementation of the BEM
4.5 Program LABECON for Solving the Laplace Equation 81
82 Numerical Implementation of the BEM

Potrebbero piacerti anche