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 robustdesigns(inpc,textpart,nmethod,
20     &  istep,istat,n,iline,ipol,inl,ipoinp,
21     &  inp,tieset,ipoinpc,ntie,tinc,tper,tmin,tmax,tincf,isens,
22     &  ier,physcon,irobustdesign)
23!
24!     reading the input deck: *ROBUST DESIGN
25!
26      implicit none
27!
28      logical iread,iwrite
29!
30      character*1 inpc(*)
31      character*81 tieset(3,*)
32      character*132 textpart(16)
33!
34      integer nmethod,istep,istat,n,key,i,isens,
35     &  iline,ipol,inl,ipoinp(2,*),inp(3,*),irobustdesign(*),
36     &  ipoinpc(0:*),ntie,ier
37!
38      real*8 tinc,tper,tmin,tmax,tincf,reliability,physcon(*)
39!
40!     Read in *ROBUST DESIGN
41!
42      if(isens.eq.1) then
43         write(*,*) '*ERROR reading *ROBUST DESIGN:'
44         write(*,*) '      no more than one *ROBUST DESIGN'
45         write(*,*) '      is allowed per input deck'
46         ier=1
47         return
48      endif
49!
50      if(istep.lt.1) then
51         write(*,*) '*ERROR reading *ROBUST DESIGN: *ROBUST DESIGN can
52     &         only be used within a STEP'
53         ier=1
54         return
55      endif
56!
57c      if(istep.lt.2) then
58c         write(*,*) '*ERROR reading *ROBUST DESIGN: *ROBUST DESIGN'
59c         write(*,*) '      requires a previous *STATIC step'
60c         ier=1
61c         return
62c      endif
63!
64      tinc=0.d0
65      tper=0.d0
66      tmin=0.d0
67      tmax=0.d0
68      tincf=0.d0
69!
70      iwrite=.false.
71      iread=.false.
72!
73      nmethod=14
74!
75!     check whether design variables were defined
76!
77c      do i=1,ntie
78c         if(tieset(1,i)(81:81).eq.'D') exit
79c      enddo
80c      if(i.gt.ntie) then
81c         write(*,*) '*ERROR reading *ROBUST DESIGN'
82c         write(*,*) '      no design variables were defined'
83c         call inputerror(inpc,ipoinpc,iline,
84c     &        "*ROBUST DESIGN%",ier)
85c         return
86c      endif
87!
88!     check what information is requested by the user
89!     irobustdesign(1)=1 --> the full stochastic perturbation method
90!                         is performed (default)
91!     irobustdesign(1)=2 --> only the eigenvectors of the randomfield is
92!                         calculated
93!
94c      if(n.eq.2) then
95c         if(textpart(2)(1:15).eq.'RANDOMFIELDONLY') then
96            irobustdesign(1)=2
97c         else
98c            irobustdesign(1)=1
99c            write(*,*) '*WARNING Keyword in *ROBUST DESIGN'
100c            write(*,*) '   not known, keyword ignored'
101c         endif
102c      endif
103!
104!     Read in the reliability of the random field
105!
106      call getnewline(inpc,textpart,istat,n,key,iline,ipol,inl,
107     &        ipoinp,inp,ipoinpc)
108!
109      read(textpart(1)(1:20),'(f20.0)',iostat=istat) reliability
110      if(istat.gt.0) then
111         write(*,*) '*ERROR in *ROBUST DESIGN reliability of'
112         write(*,*) '       the random field not specified'
113         call inputerror(inpc,ipoinpc,iline,
114     &        "*ROBUST DESIGN%",ier)
115         return
116      endif
117      if((reliability.le.0.d0).or.(reliability.ge.1.d0)) then
118         write(*,*) '*ERROR reading *ROBUST DESIGN'
119         write(*,*) '       Reliability of the random field'
120         write(*,*) '       has to be in the range'
121         write(*,*) '       between 0 and 1'
122         write(*,*)
123         call inputerror(inpc,ipoinpc,iline,
124     &          "*ROBUST DESIGN%",ier)
125         return
126      endif
127      physcon(11)=reliability
128!
129      call getnewline(inpc,textpart,istat,n,key,iline,ipol,inl,
130     &        ipoinp,inp,ipoinpc)
131!
132      return
133      end
134