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 uncouptempdisps(inpc,textpart,
20     &  nmethod,iperturb,isolver,
21     &  istep,istat,n,tinc,tper,tmin,tmax,idrct,ithermal,iline,ipol,
22     &  inl,ipoinp,inp,ipoinpc,alpha,ctrl,ttime,nener,ier)
23!
24!     reading the input deck: *UNCOUPLED TEMPERATURE-DISPLACEMENT
25!
26!     isolver=0: SPOOLES
27!             2: iterative solver with diagonal scaling
28!             3: iterative solver with Cholesky preconditioning
29!             4: sgi solver
30!             5: TAUCS
31!             7: pardiso
32!             8: pastix
33!
34      implicit none
35!
36      logical timereset
37!
38      character*1 inpc(*)
39      character*20 solver
40      character*132 textpart(16)
41!
42      integer nmethod,iperturb(*),isolver,istep,istat,n,key,i,idrct,
43     &  ithermal(*),iline,ipol,inl,ipoinp(2,*),inp(3,*),ipoinpc(0:*),
44     &  nener,ier
45!
46      real*8 tinc,tper,tmin,tmax,alpha(*),ctrl(*),ttime
47!
48      idrct=0
49      alpha(1)=-0.05d0
50      tmin=0.d0
51      tmax=0.d0
52      nmethod=4
53      timereset=.false.
54!
55      if(iperturb(1).eq.0) then
56         iperturb(1)=2
57      elseif((iperturb(1).eq.1).and.(istep.gt.1)) then
58         write(*,*)
59     &       '*ERROR reading *UNCOUPLED TEMPERATURE-DISPLACEMENT:'
60         write(*,*) '       perturbation analysis is not provided in a '
61         write(*,*) '       *UNCOUPLED TEMPERATURE-DISPLACEMENT step.'
62         ier=1
63         return
64      endif
65!
66      if(istep.lt.1) then
67         write(*,*)
68     &       '*ERROR reading *UNCOUPLED TEMPERATURE-DISPLACEMENT:'
69         write(*,*) '       *UNCOUPLED TEMPERATURE-DISPLACMENT '
70         write(*,*) '       can only be used within a STEP'
71         ier=1
72         return
73      endif
74!
75!     default solver
76!
77      solver='                    '
78      if(isolver.eq.0) then
79         solver(1:7)='SPOOLES'
80      elseif(isolver.eq.2) then
81         solver(1:16)='ITERATIVESCALING'
82      elseif(isolver.eq.3) then
83         solver(1:17)='ITERATIVECHOLESKY'
84      elseif(isolver.eq.4) then
85         solver(1:3)='SGI'
86      elseif(isolver.eq.5) then
87         solver(1:5)='TAUCS'
88      elseif(isolver.eq.7) then
89         solver(1:7)='PARDISO'
90      elseif(isolver.eq.8) then
91         solver(1:6)='PASTIX'
92      endif
93!
94      do i=2,n
95         if(textpart(i)(1:6).eq.'ALPHA=') then
96            read(textpart(i)(7:26),'(f20.0)',iostat=istat) alpha(1)
97            if(istat.gt.0) then
98               call inputerror(inpc,ipoinpc,iline,
99     &            "*UNCOUPLED TEMPERATURE-DISPLACEMENT%",ier)
100               return
101            endif
102            if(alpha(1).lt.-1.d0/3.d0) then
103               write(*,*) '*WARNING in dynamics: alpha is smaller'
104               write(*,*) '  than -1/3 and is reset to -1/3'
105               alpha(1)=-1.d0/3.d0
106            elseif(alpha(1).gt.0.d0) then
107               write(*,*) '*WARNING in dynamics: alpha is greater'
108               write(*,*) '  than 0 and is reset to 0'
109               alpha(1)=0.d0
110            endif
111         elseif(textpart(i)(1:7).eq.'SOLVER=') then
112            read(textpart(i)(8:27),'(a20)') solver
113         elseif((textpart(i)(1:6).eq.'DIRECT').and.
114     &          (textpart(i)(1:9).ne.'DIRECT=NO')) then
115            idrct=1
116         elseif(textpart(i)(1:11).eq.'STEADYSTATE') then
117            nmethod=1
118         elseif(textpart(i)(1:7).eq.'DELTMX=') then
119            read(textpart(i)(8:27),'(f20.0)',iostat=istat) ctrl(27)
120         elseif(textpart(i)(1:9).eq.'TIMERESET') then
121            timereset=.true.
122         elseif(textpart(i)(1:17).eq.'TOTALTIMEATSTART=') then
123            read(textpart(i)(18:37),'(f20.0)',iostat=istat) ttime
124         else
125            write(*,*)
126     &        '*WARNING in uncouptempdisps: parameter not recognized:'
127            write(*,*) '         ',
128     &                 textpart(i)(1:index(textpart(i),' ')-1)
129            call inputwarning(inpc,ipoinpc,iline,
130     &"*UNCOUPLED TEMPERATURE-DISPLACEMENT%")
131         endif
132      enddo
133      if(nmethod.eq.1) ctrl(27)=1.d30
134!
135      if((ithermal(1).eq.0).and.(nmethod.ne.1).and.
136     &   (nmethod.ne.2).and.(iperturb(1).ne.0)) then
137         write(*,*)
138     &        '*ERROR reading *UNCOUPLED TEMPERATURE-DISPLACEMENT:'
139         write(*,*) '       please define initial '
140         write(*,*) '       conditions for the temperature'
141         ier=1
142         return
143      else
144         ithermal(1)=4
145      endif
146!
147      if(solver(1:7).eq.'SPOOLES') then
148         isolver=0
149      elseif(solver(1:16).eq.'ITERATIVESCALING') then
150         isolver=2
151      elseif(solver(1:17).eq.'ITERATIVECHOLESKY') then
152         isolver=3
153      elseif(solver(1:3).eq.'SGI') then
154         isolver=4
155      elseif(solver(1:5).eq.'TAUCS') then
156         isolver=5
157      elseif(solver(1:7).eq.'PARDISO') then
158         isolver=7
159      elseif(solver(1:6).eq.'PASTIX') then
160         isolver=8
161      else
162         write(*,*)
163     &       '*WARNING reading *UNCOUPLED TEMPERATURE-DISPLACEMENT:'
164         write(*,*) '         unknown solver;'
165         write(*,*) '         the default solver is used'
166      endif
167!
168      call getnewline(inpc,textpart,istat,n,key,iline,ipol,inl,
169     &     ipoinp,inp,ipoinpc)
170      if((istat.lt.0).or.(key.eq.1)) then
171         if(iperturb(1).ge.2) then
172            write(*,*)
173     &       '*WARNING reading *UNCOUPLED TEMPERATURE-DISPLACEMENT:'
174            write(*,*) '         a nonlinear analysis is requested'
175            write(*,*) '         but no time increment nor step is speci
176     &fied'
177            write(*,*) '         the defaults (1,1) are used'
178            tinc=1.d0
179            tper=1.d0
180            tmin=1.d-5
181            tmax=1.d+30
182         endif
183         if(timereset)ttime=ttime-tper
184         if(nmethod.eq.4) nener=1
185         return
186      endif
187!
188      read(textpart(1)(1:20),'(f20.0)',iostat=istat) tinc
189      if(istat.gt.0) then
190         call inputerror(inpc,ipoinpc,iline,
191     &        "*UNCOUPLED TEMPERATURE-DISPLACEMENT%",ier)
192         return
193      endif
194      read(textpart(2)(1:20),'(f20.0)',iostat=istat) tper
195      if(istat.gt.0) then
196         call inputerror(inpc,ipoinpc,iline,
197     &        "*UNCOUPLED TEMPERATURE-DISPLACEMENT%",ier)
198         return
199      endif
200      read(textpart(3)(1:20),'(f20.0)',iostat=istat) tmin
201      if(istat.gt.0) then
202         call inputerror(inpc,ipoinpc,iline,
203     &        "*UNCOUPLED TEMPERATURE-DISPLACEMENT%",ier)
204         return
205      endif
206      read(textpart(4)(1:20),'(f20.0)',iostat=istat) tmax
207      if(istat.gt.0) then
208         call inputerror(inpc,ipoinpc,iline,
209     &        "*UNCOUPLED TEMPERATURE-DISPLACEMENT%",ier)
210         return
211      endif
212!
213      if(tinc.le.0.d0) then
214         write(*,*)
215     &       '*ERROR reading *UNCOUPLED TEMPERATURE-DISPLACEMENT:'
216         write(*,*) '       initial increment size is
217     &negative'
218      endif
219      if(tper.le.0.d0) then
220         write(*,*)
221     &      '*ERROR reading *UNCOUPLED TEMPERATURE-DISPLACEMENT:'
222         write(*,*) '       step size is negative'
223      endif
224      if(tinc.gt.tper) then
225         write(*,*)
226     &     '*ERROR reading *UNCOUPLED TEMPERATURE-DISPLACEMENT:'
227         write(*,*) '       initial increment size exc
228     &eeds step size'
229      endif
230!
231      if(idrct.ne.1) then
232         if(dabs(tmin).lt.1.d-6*tper) then
233            tmin=min(tinc,1.d-6*tper)
234         endif
235         if(dabs(tmax).lt.1.d-10) then
236            tmax=1.d+30
237         endif
238         if(tinc.gt.dabs(tmax)) then
239            write(*,*)
240     &       '*WARNING reading *UNCOUPLED TEMPERATURE-DISPLACEMENT'
241            write(*,*) '         the initial increment ',tinc
242            write(*,*) '         exceeds the maximum increment ',
243     &          tmax
244            write(*,*) '         the initial increment is reduced'
245            write(*,*) '         to the maximum value'
246            tinc=dabs(tmax)
247         endif
248      endif
249!
250      if(timereset)ttime=ttime-tper
251!
252      if(nmethod.eq.4) nener=1
253!
254      call getnewline(inpc,textpart,istat,n,key,iline,ipol,inl,
255     &     ipoinp,inp,ipoinpc)
256!
257      return
258      end
259
260
261
262
263
264
265
266
267