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 cload(xload,kstep,kinc,time,node,idof,coords,vold,
20     &  mi,ntrans,trab,inotr,veold)
21!
22!     user subroutine cload
23!
24!
25!     INPUT:
26!
27!     kstep              step number
28!     kinc               increment number
29!     time(1)            current step time
30!     time(2)            current total time
31!     node               node number
32!     idof               degree of freedom
33!     coords(1..3)       global coordinates of the node
34!     vold(0..mi(2)
35!              ,1..nk)   solution field in all nodes (for modal
36!                        dynamics: in all nodes for which output
37!                        was requested or a force was applied)
38!                        (not available for CFD-calculations)
39!                        0: temperature
40!                        1: displacement in global x-direction
41!                        2: displacement in global y-direction
42!                        3: displacement in global z-direction
43!                        4: not used
44!     mi(1)              max # of integration points per element (max
45!                        over all elements)
46!     mi(2)              max degree of freedomm per node (max over all
47!                        nodes) in fields like v(0:mi(2))...
48!     veold(0..mi(2)
49!               ,1..nk)  For non-CFD-calculations:
50!                        derivative of the solution field w.r.t.
51!                        time in all nodes(for modal
52!                        dynamics: in all nodes for which output
53!                        was requested or a force was applied)
54!                        0: temperature rate
55!                        1: velocity in global x-direction
56!                        2: velocity in global y-direction
57!                        3: velocity in global z-direction
58!
59!                        For CFD-calculations:
60!                        0: temperature
61!                        1: velocity in global x-direction
62!                        2: velocity in global y-direction
63!                        3: velocity in global z-direction
64!                        4: static pressure
65!
66!     ntrans             number of transform definitions
67!     trab(1..6,i)       coordinates of two points defining transform i
68!     trab(7,i)          -1: cylindrical transformation
69!                         1: rectangular transformation
70!     inotr(1,j)         transformation number applied to node j
71!     inotr(2,j)         a SPC in a node j in which a transformation
72!                        applied corresponds to a MPC. inotr(2,j)
73!                        contains the number of a new node generated
74!                        for the inhomogeneous part of the MPC
75!
76!     OUTPUT:
77!
78!     xload              concentrated load in direction idof of node
79!                        "node" (global coordinates)
80!
81      implicit none
82!
83      integer kstep,kinc,node,idof,mi(*),ntrans,inotr(2,*),itr
84!
85      real*8 xload,time(2),coords(3),vold(0:mi(2),*),trab(7,*),
86     &  veold(0:mi(2),*),a(3,3),ve1,ve2,ve3,f1,f2,f3
87!
88!     displacements vold and velocities veold are given in
89!     the global system
90!
91!     example how to transform the velocity into the local system
92!     defined in node "node"
93!
94      if(ntrans.eq.0) then
95         itr=0
96      else
97         itr=inotr(1,node)
98      endif
99!
100      if(itr.ne.0) then
101         call transformatrix(trab(1,itr),coords,a)
102         ve1=veold(1,node)*a(1,1)+veold(2,node)*a(2,1)
103     &     +veold(3,node)*a(3,1)
104         ve2=veold(1,node)*a(1,2)+veold(2,node)*a(2,2)
105     &     +veold(3,node)*a(3,2)
106         ve3=veold(1,node)*a(1,3)+veold(2,node)*a(2,3)
107     &     +veold(3,node)*a(3,3)
108!
109!     suppose you know the size of the force in local coordinates:
110!     f1, f2 and f3. Calculating the size of the force in
111!     direction idof in global coordinates is done in the following
112!     way:
113!
114         xload=f1*a(idof,1)+f2*a(idof,2)+f3*a(idof,3)
115      else
116!
117!        no local system defined in node "node"; suppose the force in
118!        global coordinates has components f1, f2 and f3
119!
120         if(idof.eq.1) then
121            xload=f1
122         elseif(idof.eq.2) then
123            xload=f2
124         elseif(idof.eq.3) then
125            xload=f3
126         endif
127      endif
128!
129      return
130      end
131
132