1!
2!     CalculiX - A 3-dimensional finite element program
3!              Copyright (C) 1998-2021 Guido Dhondt
4!
5!     This program is free software; you can redistribute it and/or
6!     modify it under the terms of the GNU General Public License as
7!     published by the Free Software Foundation(version 2);
8!
9!
10!     This program is distributed in the hope that it will be useful,
11!     but WITHOUT ANY WARRANTY; without even the implied warranty of
12!     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13!     GNU General Public License for more details.
14!
15!     You should have received a copy of the GNU General Public License
16!     along with this program; if not, write to the Free Software
17!     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18!
19      subroutine linvec(vec,konl,nope,jj,vecl,istart,iend)
20!
21!     calculates a trilinear approximation to the quadratic interpolation
22!     of the temperatures in a C3D20 element (full integration). A
23!     quadratic interpolation of the temperatures leads to quadratic
24!     thermal stresses, which cannot be handled by the elements
25!     displacement functions (which lead to linear stresses). Thus,
26!     the temperatures are approximated by a trilinear function.
27!
28      implicit none
29!
30      integer konl(20),nope,jj,i1,j,istart,iend
31!
32      real*8 vec(istart:iend,*),vecl(3),a20l(20,27)
33!
34      a20l=reshape((
35     &/-0.088729832,-0.240369600,-0.059630393,-0.240369600,-0.240369600,
36     & -0.059630393,-0.011270159,-0.059630393, 0.524865555, 0.066666663,
37     &  0.066666663, 0.524865555, 0.066666663, 0.008467776, 0.008467776,
38     &  0.066666663, 0.524865555, 0.066666663, 0.008467776, 0.066666663,
39     & -0.164549715,-0.164549715,-0.149999995,-0.149999995,-0.149999995,
40     & -0.149999995,-0.035450279,-0.035450279, 0.524865544, 0.295766106,
41     &  0.066666668, 0.295766106, 0.066666668, 0.037567223, 0.008467777,
42     &  0.037567223, 0.295766106, 0.295766106, 0.037567223, 0.037567223,
43     & -0.240369600,-0.088729832,-0.240369600,-0.059630393,-0.059630393,
44     & -0.240369600,-0.059630393,-0.011270159, 0.524865555, 0.524865555,
45     &  0.066666663, 0.066666663, 0.066666663, 0.066666663, 0.008467776,
46     &  0.008467776, 0.066666663, 0.524865555, 0.066666663, 0.008467776,
47     & -0.164549715,-0.149999995,-0.149999995,-0.164549715,-0.149999995,
48     & -0.035450279,-0.035450279,-0.149999995, 0.295766106, 0.066666668,
49     &  0.295766106, 0.524865544, 0.037567223, 0.008467777, 0.037567223,
50     &  0.066666668, 0.295766106, 0.037567223, 0.037567223, 0.295766106,
51     & -0.157274855,-0.157274855,-0.157274855,-0.157274855,-0.092725137,
52     & -0.092725137,-0.092725137,-0.092725137, 0.295766105, 0.295766105,
53     &  0.295766105, 0.295766105, 0.037567224, 0.037567224, 0.037567224,
54     &  0.037567224, 0.166666664, 0.166666664, 0.166666664, 0.166666664,
55     & -0.149999995,-0.164549715,-0.164549715,-0.149999995,-0.035450279,
56     & -0.149999995,-0.149999995,-0.035450279, 0.295766106, 0.524865544,
57     &  0.295766106, 0.066666668, 0.037567223, 0.066666668, 0.037567223,
58     &  0.008467777, 0.037567223, 0.295766106, 0.295766106, 0.037567223,
59     & -0.240369600,-0.059630393,-0.240369600,-0.088729832,-0.059630393,
60     & -0.011270159,-0.059630393,-0.240369600, 0.066666663, 0.066666663,
61     &  0.524865555, 0.524865555, 0.008467776, 0.008467776, 0.066666663,
62     &  0.066666663, 0.066666663, 0.008467776, 0.066666663, 0.524865555,
63     & -0.149999995,-0.149999995,-0.164549715,-0.164549715,-0.035450279,
64     & -0.035450279,-0.149999995,-0.149999995, 0.066666668, 0.295766106,
65     &  0.524865544, 0.295766106, 0.008467777, 0.037567223, 0.066666668,
66     &  0.037567223, 0.037567223, 0.037567223, 0.295766106, 0.295766106,
67     & -0.059630393,-0.240369600,-0.088729832,-0.240369600,-0.011270159,
68     & -0.059630393,-0.240369600,-0.059630393, 0.066666663, 0.524865555,
69     &  0.524865555, 0.066666663, 0.008467776, 0.066666663, 0.066666663,
70     &  0.008467776, 0.008467776, 0.066666663, 0.524865555, 0.066666663,
71     & -0.164549715,-0.149999995,-0.035450279,-0.149999995,-0.164549715,
72     & -0.149999995,-0.035450279,-0.149999995, 0.295766106, 0.037567223,
73     &  0.037567223, 0.295766106, 0.295766106, 0.037567223, 0.037567223,
74     &  0.295766106, 0.524865544, 0.066666668, 0.008467777, 0.066666668,
75     & -0.157274855,-0.157274855,-0.092725137,-0.092725137,-0.157274855,
76     & -0.157274855,-0.092725137,-0.092725137, 0.295766105, 0.166666664,
77     &  0.037567224, 0.166666664, 0.295766105, 0.166666664, 0.037567224,
78     &  0.166666664, 0.295766105, 0.295766105, 0.037567224, 0.037567224,
79     & -0.149999995,-0.164549715,-0.149999995,-0.035450279,-0.149999995,
80     & -0.164549715,-0.149999995,-0.035450279, 0.295766106, 0.295766106,
81     &  0.037567223, 0.037567223, 0.295766106, 0.295766106, 0.037567223,
82     &  0.037567223, 0.066666668, 0.524865544, 0.066666668, 0.008467777,
83     & -0.157274855,-0.092725137,-0.092725137,-0.157274855,-0.157274855,
84     & -0.092725137,-0.092725137,-0.157274855, 0.166666664, 0.037567224,
85     &  0.166666664, 0.295766105, 0.166666664, 0.037567224, 0.166666664,
86     &  0.295766105, 0.295766105, 0.037567224, 0.037567224, 0.295766105,
87     & -0.124999996,-0.124999996,-0.124999996,-0.124999996,-0.124999996,
88     & -0.124999996,-0.124999996,-0.124999996, 0.166666664, 0.166666664,
89     &  0.166666664, 0.166666664, 0.166666664, 0.166666664, 0.166666664,
90     &  0.166666664, 0.166666664, 0.166666664, 0.166666664, 0.166666664,
91     & -0.092725137,-0.157274855,-0.157274855,-0.092725137,-0.092725137,
92     & -0.157274855,-0.157274855,-0.092725137, 0.166666664, 0.295766105,
93     &  0.166666664, 0.037567224, 0.166666664, 0.295766105, 0.166666664,
94     &  0.037567224, 0.037567224, 0.295766105, 0.295766105, 0.037567224,
95     & -0.149999995,-0.035450279,-0.149999995,-0.164549715,-0.149999995,
96     & -0.035450279,-0.149999995,-0.164549715, 0.037567223, 0.037567223,
97     &  0.295766106, 0.295766106, 0.037567223, 0.037567223, 0.295766106,
98     &  0.295766106, 0.066666668, 0.008467777, 0.066666668, 0.524865544,
99     & -0.092725137,-0.092725137,-0.157274855,-0.157274855,-0.092725137,
100     & -0.092725137,-0.157274855,-0.157274855, 0.037567224, 0.166666664,
101     &  0.295766105, 0.166666664, 0.037567224, 0.166666664, 0.295766105,
102     &  0.166666664, 0.037567224, 0.037567224, 0.295766105, 0.295766105,
103     & -0.035450279,-0.149999995,-0.164549715,-0.149999995,-0.035450279,
104     & -0.149999995,-0.164549715,-0.149999995, 0.037567223, 0.295766106,
105     &  0.295766106, 0.037567223, 0.037567223, 0.295766106, 0.295766106,
106     &  0.037567223, 0.008467777, 0.066666668, 0.524865544, 0.066666668,
107     & -0.240369600,-0.059630393,-0.011270159,-0.059630393,-0.088729832,
108     & -0.240369600,-0.059630393,-0.240369600, 0.066666663, 0.008467776,
109     &  0.008467776, 0.066666663, 0.524865555, 0.066666663, 0.066666663,
110     &  0.524865555, 0.524865555, 0.066666663, 0.008467776, 0.066666663,
111     & -0.149999995,-0.149999995,-0.035450279,-0.035450279,-0.164549715,
112     & -0.164549715,-0.149999995,-0.149999995, 0.066666668, 0.037567223,
113     &  0.008467777, 0.037567223, 0.524865544, 0.295766106, 0.066666668,
114     &  0.295766106, 0.295766106, 0.295766106, 0.037567223, 0.037567223,
115     & -0.059630393,-0.240369600,-0.059630393,-0.011270159,-0.240369600,
116     & -0.088729832,-0.240369600,-0.059630393, 0.066666663, 0.066666663,
117     &  0.008467776, 0.008467776, 0.524865555, 0.524865555, 0.066666663,
118     &  0.066666663, 0.066666663, 0.524865555, 0.066666663, 0.008467776,
119     & -0.149999995,-0.035450279,-0.035450279,-0.149999995,-0.164549715,
120     & -0.149999995,-0.149999995,-0.164549715, 0.037567223, 0.008467777,
121     &  0.037567223, 0.066666668, 0.295766106, 0.066666668, 0.295766106,
122     &  0.524865544, 0.295766106, 0.037567223, 0.037567223, 0.295766106,
123     & -0.092725137,-0.092725137,-0.092725137,-0.092725137,-0.157274855,
124     & -0.157274855,-0.157274855,-0.157274855, 0.037567224, 0.037567224,
125     &  0.037567224, 0.037567224, 0.295766105, 0.295766105, 0.295766105,
126     &  0.295766105, 0.166666664, 0.166666664, 0.166666664, 0.166666664,
127     & -0.035450279,-0.149999995,-0.149999995,-0.035450279,-0.149999995,
128     & -0.164549715,-0.164549715,-0.149999995, 0.037567223, 0.066666668,
129     &  0.037567223, 0.008467777, 0.295766106, 0.524865544, 0.295766106,
130     &  0.066666668, 0.037567223, 0.295766106, 0.295766106, 0.037567223,
131     & -0.059630393,-0.011270159,-0.059630393,-0.240369600,-0.240369600,
132     & -0.059630393,-0.240369600,-0.088729832, 0.008467776, 0.008467776,
133     &  0.066666663, 0.066666663, 0.066666663, 0.066666663, 0.524865555,
134     &  0.524865555, 0.066666663, 0.008467776, 0.066666663, 0.524865555,
135     & -0.035450279,-0.035450279,-0.149999995,-0.149999995,-0.149999995,
136     & -0.149999995,-0.164549715,-0.164549715, 0.008467777, 0.037567223,
137     &  0.066666668, 0.037567223, 0.066666668, 0.295766106, 0.524865544,
138     &  0.295766106, 0.037567223, 0.037567223, 0.295766106, 0.295766106,
139     & -0.011270159,-0.059630393,-0.240369600,-0.059630393,-0.059630393,
140     & -0.240369600,-0.088729832,-0.240369600, 0.008467776, 0.066666663,
141     &  0.066666663, 0.008467776, 0.066666663, 0.524865555, 0.524865555,
142     &  0.066666663, 0.008467776, 0.066666663, 0.524865555, 0.066666663/
143     &  ),(/20,27/))
144!
145      do i1=1,nope
146         do j=1,3
147            vecl(j)=vecl(j)+a20l(i1,jj)*vec(j,konl(i1))
148         enddo
149      enddo
150!
151      return
152      end
153