Module 4
Module 4
have been expressed as functions of the physical coordinate x . The evaluation of element stiffness matrix and the right side vector involves the integration of shape functions or their derivatives. For computer implementation of the finite element method, this integration needs to be done numerically. For the ease of numerical integration, we map each element onto a standard element of size two (which is called as Master Element) . Further, the coordinate employed on the master element varies from minus one to plus one. This coordinate is called as the Natural Coordinate. To carry out the numerical integration, the shape functions need to be expressed in terms of the natural coordinate. This gives a generic definition of the shape functions. We first discuss the mapping function between the physical coordinate x and the natural coordinate. Mapping Function Figure 11.1 shows a mapping of a typical element k (of p th order) to the master element.
Fig 11.1 Mapping from physical element to master element The figure also shows the local node numbering system on both the physical element and the master element. The local notation for x -coordinate of the nodes is shown on the physical element. The coordinate used for the master element is denoted by x . Over the master element, it varies from -1 to 1. It is called as the natural coordinate. The x - coordinate of the nodes is also indicated on the master element.
Note that, we wish to map a physical element of length onto the master element of size two. Further the origin of the coordinate system on the master element is at its center. Thus, mapping of the physical element onto the master element involves the following : Translation of the physical element till its center coincides with the origin of the coordinate system. Stretching or compression of the element till its length becomes two. This kind of mapping can always be expressed by the following linear relationship between x and : (11.1) where a and b are constants. This mapping is called as the linear or affine mapping. The constants a and b are determined from the condition that the end points of the physical element map onto the end points of the master element. Thus, (11.2) and (11.3)
= -1 and
Solution of these equations is (11.6) Substituting the above expressions for a and b into equation (11.1) and rearranging the resulting equation, we get (11.7) This is the mapping function which maps a physical element of length onto the master element. It is a relationship between the physical coordinate x and the natural coordinate .
Shape Functions in Natural Coordinate Using the mapping function of section 11.1, shape functions functions of the natural coordinate x . Thus of any order can be expressed as (11.8) Since the mapping function is linear in , a polynomial of degree p in coordinate x will get converted to the polynomial of the same degree in . Next paragraph describes the derivation of the shape functions in terms of for the approximations of various orders. Linear Approximation (p = 1) Quadratic Approximation ( p = 2) Approximation of Order p We'll discuss them in the following three slides Linear Approximation (p = 1): Shape functions , i = 1,2 for the linear approximation are given by (equations 6.1 and 6.2) : (11.9)
(11.10) Since p = 1, the mapping function (equation 11.7) becomes: (11.11) One can obtain the shape functions in terms of by using either the expression (11.1) or expression (11.11) for the mapping function. For the present case of linear approximation, we use expression (11.11). For the next case, we shall show how to use the expression (11.1). Using expression (11.11), we get
(11.12) (11.13) Substituting these expressions in equations (11.9-11.10) and canceling out the factor from both the numerator and denominator, we get the following expressions for the shape functions: (11.14) (11.15) The shape functions are shown in Fig. 11.2. The quantity h k denotes the element length The nodes are marked by the symbol x. .
Fig. 11.2 Shape functions for linear approximation (p = 1) (a) for physical element k (b) For master element Quadratic Approximation ( p = 2 ) Shape functions , i = 1,2,3 for this case are given by (equation 8.6): (11.16)
(11.17)
(11.18) Since p = 2, the mapping function (equation 11.7) becomes: (11.19) Note that the nodes 1 and 3 are at the end points of the element. Let us choose node 2 at the midpoint. Then (11.20) One can obtain the shape functions in terms of x by substituting equations (11.19-11.20) into the expressions (11.16-11.18). But this procedure is cumbersome. Therefore, we follow an alternate
procedure which is more convenient. This procedure involves the use of expression (11.1) for the mapping function. It is described in the next paragraph. Let , and be the natural coordinates of the nodes 1, 2 and 3 respectively. Note that node 1 = -1) and the node 3 is at the right end ( = 1). Further, the node 2 is at the (11.21) The relation between the physical coordinate obtained from equation (11.1) as follows: , , , Therefore, combining equations (11.1) and (11.22), we get Further, from equation (11.22), we get , , (11.24) (11.25) (11.22) of the node i and its natural coordinate (
i
= 0). Thus,
) can be
(11.23)
(11.26) , Substituting equations (11.23 -11.26) in expressions (11.16 -11.18) and canceling out the factor a2 from the numerator and denominator, we get (11.27) , (11.28) , (11.29) , Using the values of , , , , These shape functions are shown in Fig 11.3. The quantity hk denotes the element length . The nodes are marked by the symbol x . (11.31) (11.32) and (equation 11.21), the above expressions can be simplified to (11.30)
Fig. 11.3 Shape functions for quadratic approximation (p = 2) (a) For physical element k (b) For master element
Approximation of Order p
Shape functions
(11.33)
If we use equation (11.7) as the expression of mapping function to represent these shape functions in terms of the natural coordinate , Then the corresponding procedure is quite cumbersome. Therefore, we follow a simpler procedure which involves the use of expression (11.1) for the mapping function. This procedure is described in the next paragraph.
Fig. 11.4 Nodal coordinates for approximation of order p (a) For physical element k (b) For master element Figure 11.4 shows the nodal coordinates for the physical element k and the master element. We choose the nodes to be equidistant. There are p+1 nodes . Thus, the nodes divide the element length into p equal intervals. For the physical element k , the x -coordinates of the nodes can be expressed as (11.34) where hk is the element length. For the master element, the element length is 2. Further since the node
-coordinate of node 1 (
) is 1. Therefore, the
(11.35)
Note that the relation between the physical coordinate can be obtained from equation (11.1) as follows:
(11.36) Then, subtracting equation (11.36) from equation (11.1) we get (11.37) Similar to expression (11.36), we can write (11.38) Subtracting equation (11.36) from equation (11.38), we get (11.39) Substituting equations (11.37) and (11.39) into the expression (11.33) and canceling out the factor a p both from the numerator and denominator, we get the following expression for the shape functions:
(11.40)
Here,
= -1 and the remaining nodal coordinates are given by the expression (11.35).
Note that, we get expressions (11.14 - 11.15) for the linear shape functions when we substitute p = 1, = -1 and = +1 in equation (11.40). Similarly, we get the expressions (11.30 -11.32) for the = -1, = 0, = + 1 in equation (11.40).
Derivatives of Shape Functions Evaluation of the element stiffness matrix [k]k involves x -derivative of the shape functions (equation 9.8). Now, we have expressed the shape functions as functions of the natural coordinate . Therefore, x -derivative of these shape functions can be obtained by the chain rule. Thus,
(11.41)
To evaluate
(11.42)
Using the following expression for the element length (11.43) we get
(11.44)
Then, the expression (11.41) for the x-derivation of the shape function becomes
(11.45)
(equation 9.8) is
(11.46)
Now, we change the variable of integration from x to Therefore, the limits of integration change from
= +1 (Fig. 11.4), the limits of integration became (-1 ,1 ). Further, when we substitute the expression (11.7) for the mapping function and the expression (11.45) for the shape function derivatives, the integrand becomes
p+1
(11.47)
Substituting expression (11.47) for the integrand and expression (11.44) for dx in equation (11.46) and changing the limits of integration as explained above, we get
(11.48)
(equation 9.9) is
(11.49)
earlier, the limits of integration change from to (-1, 1). Further, when the expressions (11.7) and (11.8) for the mapping function and the shape functions are substituted, the integrand becomes
(11.50)
Substituting expression (11.50) for the integrand and expression (11.44) for dx in equation (11.49) and changing the limits of integration to (-1 ,1 ), we get
(11.51)
We use expressions (11.48) and (11.51) for evaluating the element stiffness matrix
and the
element force vector instead of the expressions (11.46) and (11.49). For developing a computer code for the finite element method, the new expressions (11.48) and (11.51) have the following advantages over the older expressions (11.46) and (11.49)
For using the expressions (11.48) and (11.51), the shape functions need to be defined over the master element. Hence, they need to be defined only once. Expressions (11.48) and (11.51) are more convenient for using a numerical integration scheme.
A commonly used numerical integration scheme, namely the Gauss-Legendre numerical integration scheme, is discussed in the next lecture.
Subroutine SHAPE
This subroutine calculates the values of shape functions Ni and their derivatives at the given value of natural coordinate for the given order (p) of approximation. Since is a natural coordinate its value lies between -1 to 1. Further, we restrict the value of p to only 1, 2 and 3. Note that when the order of approximation is p , the number of nodes per element is p +1. This is also the number of degrees of freedom per element or the number of shape functions. We use the following notation for the variables. Scalar Variables: deno1, deno2, deno3, deno4 : temporary variables (real) i : index for do loop (integer) ndofel : number of degrees of freedom per element (integer) p : order of the approximation (p) psi : natural coordinate (real) Array Variables : dshap (ndofel) : values of the shape function derivatives at given psin (ndofel) : natural coordinates of nodes (real) shap (ndofel) : shape function values at given x INPUT Variables : p, psi OUTPUT Variables : ndofel, shap (ndofel), dshap (ndofel) Now, the subroutine SHAPE can be written as follows. Subroutine SHAPE (p, psi, ndofel, shap, dshap) ndofel = p+1 do i =1, ndofel psin( i) = -1 + (i-1) * 2/p enddo If p = 1, then shap (1) = (psi - psin(2))/(psin(1) - psin(2)) shap( 2) = (psi - psin(1)) / (psin(2) - psin(1)) dshap (1) = 1 / (psin (1) - p sin(2)) dshap (2) =1/(psin(2) - psin(1)) end if If p = 2, then shap (1) = (psi -psin(2)) * (psi - psin(3))/((psin(1)-psin(2)) * (psin(1) - psin(3))) shap (2) = (psi -psin(3)) * (psi - psin(1))/((psin(2)-psin(3)) * (psin(2) - psin(1))) shap (3) = (psi -psin(1)) * (psi - psin(2))/((psin(3)-psin(1)) * (psin(3) - psin(2)))
dshap (1) = (psi -psin(3))+(psi - psin(2))/((psin(1)-psin(2)) * (psin(1) - psin(3))) dshap (2) = (psi -psin(1))+(psi - psin(3))/((psin(2)-psin(3)) * (psin(2) - psin(1))) dshap (3) = (psi -psin(2))+ (psi - psin(1))/((psin(3)-psin(1)) * (psin(3) - psin(2))) end if If p = 3, then deno 1 = (psin(1) - psin(2)) * (psin(1) - psin(3)) * (psin(1) - psin(4) deno 2 = (psin(2) - psin(3)) * (psin(2) - psin(4)) * (psin(2) - psin(1) deno 3 = (psin(3) - psin(4)) * (psin(3) - psin(1)) * (psin(3) - psin(2) deno 4 = (psin(4) - psin(1)) * (psin(4) - psin(2)) * (psin(4) - psin(3) shap (1) = (psi -psin(2)) * (psi - psin(3))*(psi-psin(4)) /deno 1 shap (2) = (psi -psin(3)) * (psi - psin(4))*(psi-psin(1)) /deno 2 shap (3) = (psi -psin(4)) * (psi - psin(1))*(psi-psin(2)) /deno 3 shap (4) = (psi -psin(1)) * (psi - psin(2))*(psi-psin(3)) /deno 4 dshap (1) = ((psi -psin(3))*(psi - psin(4))+(psi-psin(2))*(psi-psin(4)) +(psi-psin(2))*(psi-psin(3)))/deno 1 dshap (2) = ((psi -psin(4))*(psi - psin(1))+(psi-psin(3))*(psi-psin(1)) +(psi-psin(3))*(psi-psin(4)))/deno 2 dshap (3) = ((psi -psin(1))*(psi - psin(2))+(psi-psin(4))*(psi-psin(2)) +(psi-psin(4))*(psi-psin(1)))/deno 3 dshap (4) = ((psi -psin(2))*(psi - psin(3))+(psi-psin(1))*(psi-psin(3)) +(psi-psin(1))*(psi-psin(2)))/deno 4 end if Note that the following things should be kept in mind while writing the computer codes : Meaningful symbols should be used to denote the variables. For example ndofel for denoting the number of degrees of freedom per element A group of statements should be indented to identify various steps and sub steps. A generous amount of comment statements should be inserted to provide explanation for the following group of statements.
Introduction For computer implementation of the finite element method, the integration involved in the element stiffness matrix and the element force vector needs to be done numerically. Typical numerical integration formulas are available for the master element, i.e., the standard element of size two. In the last lecture, we discussed the mapping function that maps an arbitrary - sized element to the master element. We also transformed the expressions for the element stiffness matrix and the element force vector into the integrals over the master element. In this lecture, we shall discuss how to evaluate these integrals numerically. Before that, we discuss the Gauss quadrature rule, which is the commonly used numerical integration scheme in finite element method. This rule is presented in section 12.1.
Gauss Quadrature Rule Consider a function defined over the master element. Note that, as stated in the last lecture, is called as the natural coordinate and varies from -1 to 1. In any numerical integration scheme, the integral is expressed as a sum over certain points of the domain of integration called as sampling points . A typical term in the sum consists of the value of the function at that point multiplied by a suitable number called as the weight . Thus,
(12.1)
Here,
are the weights. In case of Gauss quadrature rule, the sampling points
are called as the Gauss points and are called as Gauss points coordinates. They are shown in Fig. 12.1, In case of Gauss quadrature rule, the Gauss points are symmetrically located about the origin (see Fig. 12.1). Further, the weights corresponding to a pair of symmetrically located Gauss points are the same.
Figure 12.1 Gauss points used in Gauss quadrature rule In some numerical integration schemes like the Newton-Cotes formulas, the sampling points are chosen a priori .Then the weights are determined by approximating the function by a polynomial of degree where is the number of sampling points. In Gauss quadrature rule, the sampling points (called as the Gauss points) are chosen so as to minimize the error between the exact and approximate values. Therefore, the Gauss point coordinates become the roots of the Legendre polynomials . As a result, this numerical integration scheme is also called as the Gauss-Legendre quadrature rule. In this lecture, we do not present the exact derivation of the Gauss point coordinates and the corresponding weights. Instead, we provide a simpler derivation. In this derivation, we use the following observation. If is a polynomial in , then there exists a degree of for which the Gauss quadrature rule is exact. We find the values of the Gauss point coordinates and weights and the corresponding value of rule successively for
by trial and error method. In this method, we try the Gauss quadrature using the polynomials of various degrees starting from one. )
Since the Gauss points are symmetrically located, for a one point rule, the Gauss point has to be at the centre. Thus, (12.2) The one point Gauss quadrature rule is
(12.3)
We find
by assuming that one point rule is exact for the polynomial of degree 0: (12.4)
(12.6a) , where , (12.6b) (12.6c) Next, we try the one point rule for a polynomial of degree 1: (12.7) We find that the above rule gives
(12.8) , that is the exact value. However, when we apply the one point rule to the polynomial of degree 2: , we get (12.9)
, which is different from the exact value Thus, two point rule for which we first try the polynomial of degree 2.
(12.10)
for
Because of the symmetrical location of the Gauss points, for a two point rule, the Gauss point coordinates must satisfy the relation (12.11) Further, the weights corresponding to these two symmetrically located Gauss points are equal. Thus, (12.12) Thus, the two point Gauss quadrature rule becomes: (12.13) Substituting the polynomial of degree 2 (expression 12.9) into equation (12.13), we get (12.14)
and
We choose the negative sign for the square-root in the expression (12.15b), because is negative. Using the expressions (12.11),(12.12) and (12.15),the two point Gauss quadrature rule becomes:
Note that the sum of the weights is two. Next, we try the two point rule for the polynomial of degree 3: (12.17) Substituting this expression for in the two point rule (equation 12.16), we get
(12.18) , that is the exact value. However, when we apply the two point rule to the polynomial of degree 4: , we get (12.19)
(12.20) , that is different than the exact value Thus, for consider the three point rule for which we first try the polynomial of degree 4.
. Next, we
Since the Gauss points are symmetrically located, for a three point rule, the Gauss points must satisfy the relations: (12.21) Further, the weights corresponding to the symmetrically located Gauss points must be equal. Thus, (12.22) Thus, the three point Gauss quadrature rule becomes: (12.23) Substituting the polynomial of degree 4 (expression 12.19) into equation (12.23) we get
(12.24)
and
, we get
(12.25a) , (12.25b) , (12.25c) . The solution of these three non linear equations is
(12.26a) , (12.26b) . We choose the negative sign for the square-root in the expression (12.26b), because is negative. Using the expressions (12.21),(12.22) and (12.26), the three point Gauss quadrature rule becomes:
(12.27a) , Where
(12.27b) (12.27c) . Note that the sum of the weights is two. It can be easily verified that the three point rule gives the exact value when degree 5 is but not 6. a polynomial of
In this way, we can find the Gauss point coordinates and the corresponding weight for can also determine the degree of polynomial
We
for which this rule gives the exact value. The It also
following table gives the Gauss point coordinates and the corresponding weights upto indicates the value of for which the rule is exact.
n 1 2 0 -0.57735 0.57735 -0.77460 0 0.77460 -0.86114 -0.33998 0.33998 0.86114 -0.90618 -0.53847 0 0.53847 0.90618 2 1 1 0.55556 0.88889 0.55556 0.34786 0.65215 0.65215 0.34786 0.23693 0.47863 0.56889 0.47863 0.23693 Table 12.1 Gauss point coordinates and weights for various values of n. The formula is exact if the function is a polynomial of degree . This data is from the "Handbook of Mathematical Functions with Formulas, Graphs and Mathematical Tables" by M. Abramowitz and I.A. Stegun, National Bureau of Standards, U.S.A. , 1964 From the above table, we find that the n-point Gauss quadrature rule is exact if the function is a polynomial of degree . Alternately, if we want to integrate a polynomial of degree the Gauss quadrature rule where where is given by (12.28) , then, we get the exact value if we use 1 3
for odd
for even
and
Now, we apply the Gauss quadrature rule (equation 12.1) to the expressions (11.48) and (11.51) for the element coefficient matrix and the element force vector . To select the number of Gauss point, we used to evaluate the degree of the integrands. For this purpose, we rewrite these expressions as:
(12.32) , and
is a constant function of x (constant Young's modulus) is a linear function of x (tapered bar) is a quadratic function of x (quadratic loading) The order of approximation is p . Thus, degree of is is p and that of its derivative
becomes , (12.34)
and that of
is given by . (12.35)
and
be
. Thus, . (12.36)
Now, we use equation (12.29) to select the number of Gauss points. Using equations (12.34) and (12.36), we get the following values of n for ; ; . Similarly, we can obtain n for . (12.37)
Application of the Gauss quadrature rule (equation 12.1) to the integrals (12.30) - (12.31) leads to the following expressions for and :
(12.38) , and
(12.39)
where
and
are given by equations (12.32)-(12.33) and n is given by equation (12.37). The and the weights corresponding to n are to be taken from Table 12.1.
Subroutine INTEG-PNTS
This subroutine generates the data about the Gauss point coordinates and the weight corresponding to various values of n (the number of Gauss points). We restrict the values of n to We use the following notation for the variables:
Scalar n : number of Gauss points (integer) Array psi (n) : Gauss w (n) : corresponding weights (real) INPUT variables : n OUTPUT variables : psi (n), w (n)
point
coordinates
Now the subroutine can be written as follows. Subroutine INTEG-PNTS (n, psi, w) if , then
end if if , then
end if if , then
end if if , then
end if
if
then
end if
Subroutine SHAPALL
Subroutine INTEG-PNTS of the previous section gives the values of the Gauss point coordinates and the corresponding weights for given n (from 1 to 5). Subroutine SHAPE of
section 11.5 calculates the values of shape functions and their derivatives for given and given order of approximation p (from 1 to 3). Now we combine these two subroutines to generate the values of the shape functions and their derivatives at all the Gauss points for given n and given p . This is done through the subroutine SHAPALL. To simplify the calculation of n for given p , we make the choice that E is a constant, A is a linear functions of and f is a quadratic function of .
Then is given by equation (12.36) and n is found from inequality (12.29). We choose the minimum value of n . We use the following notation for the variables. Scalar variables: i,j : indices for do loop (integer) n : number of Gauss points (integer) ndofel : number of degrees of freedom per element (integer) p : order of approximation (integer) pbar : temporary variable (integer) psi : natural coordinate Array variables: dshap (ndofel) : values of the shape function derivates at given (real) dshaptot (n,ndofel) : values of the shape function derivatives at all the Gauss points (real) psi (n) : Gauss point coordinates (real) shap (ndofel) : shape function values at given (real) shaptot (n,ndofel) : shape function values at all the Gauss points (real) w (n) : weights corresponding to Gauss point coordinates (real) INPUT variable : p
OUTPUT variables : n, psi, w, ndofel, shaptot, dshaptot Now, the subroutine can be written as follows. Subroutine SHAPALL (p, n, psi, w, ndofel, shaptot, dshaptot) pbar = max (2p-1, p+2) if pbar is odd n = (pbar+1)/2 else n = (pbar+2)/2 end if call INTG-PNTS (n, psi, w) do i = 1, n psi = psi (i) call SHAPE ( p, psi, ndofel, shap, dshap) do j = 1, ndofel shaptot ( i, j ) = shap (ndofel) dshaptot ( i, j) = dshap (ndofel) end do end do
Introduction
Expressions for the element stiffness matrix and the element force vector for any order ( p ) of approximation were derived in Lecture 9. These expressions involve integration over the element. For computer implementation, these integrals need to be done numerically. Commonly used numerical integration scheme is the Gauss quadrature rule. In this scheme, the element is transformed to a master element (element of length two) whose coordinate (called as the natural coordinate) varies from minus one to plus one. In Lecture 11, we transformed the expressions for and to the integrals over the master element using a suitable mapping function between physical coordinate x and natural coordinate x . In Lecture 12, we applied the Gauss quadrature rule to these expressions to write these expressions as sums over the Gauss points involving multipliers called as weights. These expressions involve, besides the geometric, material and force parameters, the shape functions and their derivatives. At the end of Lecture 12, we created a subroutine SHAPALL to generate the values of the shape functions and their derivatives at all the Gauss points n for the given order ( p ) of approximation. In this lecture, we create a subroutine, called ELEMK to generate the element stiffness matrix and the element force vector order ( p ) of approximation. for the given element k for the given
Geometric, Material and Force Data To simplify the coding, we assume that the most general data is of the following form :
E = constant.
and
We use the linear mapping function of equation (11.7) between the physical coordinate x and the natural coordinate x :
(13.4) .
are the coordinates of the end nodes of the element k and p denotes the order of
13.3 Expressions for the Element Stiffness Matrix and Force Vector
and
(13.5) , (13.6)
where
(13.7) ,
(13.8) . Here, n is the number of Gauss points, corresponding weights. The functions are the Gauss point coordinates and and are . , and are the ,
i.e., the functions expressed in terms of the natural coordinate expressed in terms of and is the element length :
(13.9) The number of Gauss points ( n ) is given by inequality (12.29). We take the minimum value. Thus,
(13.10) if is odd, = if is even. is given by (13.11) Equations (13.10-13.11) are already built in the subroutine SHAPALL.
For the choice of the geometric, material and force data of section 13.1,
Subroutine ELEMK
This subroutine calculates the element stiffness matrix and the element force vector for the element kfor the given order ( p ) of approximation and for the given choice of the geometric, material and force data of section 13.1. The mapping function used is linear as given in section 13.2. First, we create the following two subroutines for reading the input geometric, material and force data :
The details of this subroutine are not given here as they are very simple. The output variables of the first subroutine are : a0,a1 : coefficients in equation (13.1) for the area of cross-section ( A ) of the bar (real), E : Young's modules ( E ) of the bar material which is taken as constant (real). The output variables of the second subroutine are : f0,f1,f2 : coefficients in equation (13.3) for the distributed force ( f ) acting on the bar (real). Notation for the variables of the subroutine ELEMK is as follows :
Scalar variables a0,a1 : same as in subroutine GEO_MAT_DATA (real) E : same as in subroutine GEO_MAT_DATA (real) EA : product of the Young's modulus and the area of cross-section of the bar (real) f : distributed force acting on the bar (real) f0,f1,f2 : same as in subroutine FORCE_DATA (real) h : element length (real) i,j,m : do loop indices (integer) k: element number (integer) n : number of Gauss points (integer) ndofel : number of degrees of freedom per element (integer) p : order of approximation (integer) psi : natural coordinate (real) x : physical coordinate (real) xL : x -coordinate of the left end of the element (real) xR : x -coordinate of the right end of the element (real) Array variables dshaptot(n,ndofel) : values of the shape function derivatives at all the Gauss points (real) felem(ndofel) : element force vector (real) kelem(ndofel,ndofel) : element stiffness matrix (real) psi(n) : Gauss point coordinates (real) shaptot(n,ndofel) : shape function values at all the Gauss points (real) w(n) : weights (real). Input variables : k, p, xL, xR Output variables : felem, kelem
Subroutine ELEMK (k, p, xL, xR, felem, kelem) initialize felem initialize kelem call GEO_MAT_DATA (a0,a1,E) call FORCE_DATA (f0,f1,f2) call SHAPALL (p, n, psi, w, ndofel, shaptot, dshaptot) h = xR - xL do m = 1, n psi = psi(m)
x = xL(1 - psi)/2 + xR(1 + psi)/2 EA = E*(a0 + a1*x) f = f0 + f1*x + f2*x*x do i = 1, ndofel felem(i) = felem(i) + f*shaptot(m,i)*(h/2)*w(m) do j = 1, ndofel kelem(i,j) = kelem(i,j)+EA*dshaptot(m,i)*dshaptot(m,j)*(2/h)*w(m) end do