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 modaldampings(inpc,textpart,nmethod,xmodal,istep,
20     &  istat,n,iline,ipol,inl,ipoinp,inp,ipoinpc,ier)
21!
22!     reading the input deck: *MODAL DAMPING
23!
24      implicit none
25!
26      logical rayleigh
27!
28      character*1 inpc(*)
29      character*132 textpart(16)
30!
31      integer nmethod,istep,istat,n,key,iline,ipol,inl,ipoinp(2,*),
32     &  inp(3,*),ipoinpc(0:*),i,lowfrequ,highfrequ,k,ier
33!
34      real*8 xmodal(*),zeta
35!
36      if(istep.lt.1) then
37         write(*,*)
38     &      '*ERROR reading *MODAL DAMPING: *MODAL DAMPING can only'
39         write(*,*) '  be used within a STEP'
40         ier=1
41         return
42      endif
43!
44      rayleigh=.false.
45      do i=2,n
46         if(textpart(i)(1:8).eq.'RAYLEIGH') then
47            rayleigh=.true.
48         else
49            write(*,*)
50     &      '*WARNING reading *MODAL DAMPING: parameter not recognized:'
51            write(*,*) '         ',
52     &                 textpart(i)(1:index(textpart(i),' ')-1)
53            call inputwarning(inpc,ipoinpc,iline,
54     &"*MODAL DAMPING%")
55         endif
56      enddo
57      if(rayleigh) then
58         xmodal(11)=-0.5d0
59         call getnewline(inpc,textpart,istat,n,key,iline,ipol,inl,
60     &        ipoinp,inp,ipoinpc)
61         if((istat.lt.0).or.(key.eq.1)) then
62            write(*,*) '*ERROR reading *MODAL DAMPING: definition
63     &                  not complete'
64            write(*,*) '       '
65            call inputerror(inpc,ipoinpc,iline,
66     &           "*MODAL DAMPING%",ier)
67            return
68         endif
69         read(textpart(3)(1:20),'(f20.0)',iostat=istat) xmodal(1)
70         if(istat.gt.0) then
71            call inputerror(inpc,ipoinpc,iline,
72     &           "*MODAL DAMPING%",ier)
73            return
74         endif
75         read(textpart(4)(1:20),'(f20.0)',iostat=istat) xmodal(2)
76         if(istat.gt.0) then
77            call inputerror(inpc,ipoinpc,iline,
78     &           "*MODAL DAMPING%",ier)
79            return
80         endif
81!
82         call getnewline(inpc,textpart,istat,n,key,iline,ipol,inl,
83     &        ipoinp,inp,ipoinpc)
84!
85      else
86         do
87            call getnewline(inpc,textpart,istat,n,key,iline,ipol,inl,
88     &           ipoinp,inp,ipoinpc)
89            if((istat.lt.0).or.(key.eq.1)) exit
90!
91            read(textpart(1)(1:10),'(i10)',iostat=istat) lowfrequ
92            if(istat.gt.0) then
93               call inputerror(inpc,ipoinpc,iline,
94     &              "*MODAL DAMPING%",ier)
95               return
96            endif
97            read(textpart(2)(1:10),'(i10)',iostat=istat) highfrequ
98            if(istat.gt.0) then
99               call inputerror(inpc,ipoinpc,iline,
100     &              "*MODAL DAMPING%",ier)
101               return
102            endif
103            read(textpart(3)(1:20),'(f20.0)',iostat=istat) zeta
104            if(istat.gt.0) then
105               call inputerror(inpc,ipoinpc,iline,
106     &              "*MODAL DAMPING%",ier)
107               return
108            endif
109!
110            if(highfrequ<lowfrequ) highfrequ=lowfrequ
111            do k=lowfrequ,highfrequ
112               xmodal(11+k)=zeta
113            enddo
114         enddo
115      endif
116      return
117      end
118
119