CalculiX  2.13
A Free Software Three-Dimensional Structural Finite Element Program
modelchanges.f File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine modelchanges (inpc, textpart, tieset, istat, n, iline, ipol, inl, ipoinp, inp, ntie, ipoinpc, istep, ipkon, nset, istartset, iendset, set, ialset, ne)
 

Function/Subroutine Documentation

◆ modelchanges()

subroutine modelchanges ( character*1, dimension(*)  inpc,
character*132, dimension(16)  textpart,
character*81, dimension(3,*)  tieset,
integer  istat,
integer  n,
integer  iline,
integer  ipol,
integer  inl,
integer, dimension(2,*)  ipoinp,
integer, dimension(3,*)  inp,
integer  ntie,
integer, dimension(0:*)  ipoinpc,
integer  istep,
integer, dimension(*)  ipkon,
integer  nset,
integer, dimension(*)  istartset,
integer, dimension(*)  iendset,
character*81, dimension(*)  set,
integer, dimension(*)  ialset,
integer  ne 
)
22 !
23 ! reading the input deck: *MODEL CHANGE
24 !
25  implicit none
26 !
27  logical contactpair,add,remove,element
28 !
29  character*1 inpc(*)
30  character*81 tieset(3,*),noelset,set(*)
31  character*132 textpart(16)
32 !
33  integer istat,n,i,key,ipos,iline,ipol,inl,ipoinp(2,*),ipkon(*),
34  & inp(3,*),ntie,ipoinpc(0:*),iposslave,iposmaster,itie,istep,
35  & iset,j,k,m,nset,ne,istartset(*),iendset(*),ialset(*),nelem
36 !
37  if(istep.eq.0) then
38  write(*,*) '*ERROR reading *MODEL CHANGE: *MODEL CHANGE'
39  write(*,*) ' cannot be used before the first step'
40  call exit(201)
41  endif
42 !
43  contactpair=.false.
44  add=.false.
45  remove=.false.
46  element=.false.
47 !
48  do i=2,n
49  if(textpart(i)(1:16).eq.'TYPE=CONTACTPAIR') then
50  contactpair=.true.
51  elseif(textpart(i)(1:12).eq.'TYPE=ELEMENT') then
52  element=.true.
53  elseif(textpart(i)(1:3).eq.'ADD') then
54  add=.true.
55  elseif(textpart(i)(1:6).eq.'REMOVE') then
56  remove=.true.
57  else
58  write(*,*)
59  & '*WARNING reading *MODEL CHANGE: parameter not recognized:'
60  write(*,*) ' ',
61  & textpart(i)(1:index(textpart(i),' ')-1)
62  call inputwarning(inpc,ipoinpc,iline,
63  &"*MODEL CHANGE%")
64  endif
65  enddo
66 !
67 ! checking the validity of the input
68 !
69  if((.not.contactpair).and.(.not.element)) then
70  write(*,*) '*ERROR reading *MODEL CHANGE: model change can'
71  write(*,*) ' only be used for contact pairs or elements'
72  call exit(201)
73  endif
74 !
75  if((contactpair).and.(element)) then
76  write(*,*) '*ERROR reading *MODEL CHANGE: model change cannot'
77  write(*,*) ' be used for contact pairs and elements at'
78  write(*,*) ' the same time'
79  call exit(201)
80  endif
81 !
82  if((.not.add).and.(.not.remove)) then
83  write(*,*) '*ERROR reading *MODEL CHANGE: at least ADD or'
84  write(*,*) ' REMOVE has to be selected'
85  call exit(201)
86  endif
87 !
88  if(add.and.remove) then
89  write(*,*) '*ERROR reading *MODEL CHANGE: ADD and REMOVE'
90  write(*,*) ' cannot both be selected'
91  call exit(201)
92  endif
93 !
94 ! reading the slave and the master surface
95 !
96  if(contactpair) then
97  call getnewline(inpc,textpart,istat,n,key,iline,ipol,inl,
98  & ipoinp,inp,ipoinpc)
99  if((istat.lt.0).or.(key.eq.1)) then
100  write(*,*)'*ERROR reading *MODEL CHANGE: definition of the '
101  write(*,*) ' contact pair is not complete.'
102  call exit(201)
103  endif
104 !
105 ! selecting the appropriate action
106 !
107  iposslave=index(textpart(1)(1:80),' ')
108  iposmaster=index(textpart(2)(1:80),' ')
109  do i=1,ntie
110  if((tieset(1,i)(81:81).ne.'C').and.
111  & (tieset(1,i)(81:81).ne.'-')) cycle
112  ipos=index(tieset(2,i),' ')-1
113  if(ipos.ne.iposslave) cycle
114  if(tieset(2,i)(1:ipos-1).ne.textpart(1)(1:ipos-1)) cycle
115  ipos=index(tieset(3,i),' ')-1
116  if(ipos.ne.iposmaster) cycle
117  if(tieset(3,i)(1:ipos-1).ne.textpart(2)(1:ipos-1)) cycle
118  itie=i
119  exit
120  enddo
121 !
122  if(add) then
123  tieset(1,itie)(81:81)='C'
124  else
125  tieset(1,itie)(81:81)='-'
126  endif
127 !
128  call getnewline(inpc,textpart,istat,n,key,iline,ipol,inl,
129  & ipoinp,inp,ipoinpc)
130  else
131 !
132 ! element change
133 !
134  do
135  call getnewline(inpc,textpart,istat,n,key,iline,ipol,inl,
136  & ipoinp,inp,ipoinpc)
137  if((istat.lt.0).or.(key.eq.1)) return
138  do i=1,n
139  read(textpart(i)(1:10),'(i10)',iostat=istat)
140  & nelem
141  if(istat.gt.0) then
142 !
143 ! set name
144 !
145  noelset=textpart(i)(1:80)
146  noelset(81:81)=' '
147  ipos=index(noelset,' ')
148  noelset(ipos:ipos)='E'
149  do j=1,nset
150  if(j.eq.iset)cycle
151  if(noelset.eq.set(j)) then
152  m=iendset(j)-istartset(j)+1
153  do k=1,m
154  nelem=ialset(istartset(j)+k-1)
155  ipkon(nelem)=-2-ipkon(nelem)
156  enddo
157  exit
158  endif
159  enddo
160  if(noelset.ne.set(j)) then
161  noelset(ipos:ipos)=' '
162  write(*,*) '*ERROR in noelsets: element set ',
163  & noelset
164  write(*,*) ' has not been defined yet'
165  call exit(201)
166  endif
167  else
168 !
169 ! node or element number
170 !
171  if(nelem.gt.ne) then
172  write(*,*) '*WARNING in noelsets: element ',
173  & nelem
174  write(*,*) ' > ne;'
175  else
176  ipkon(nelem)=-2-ipkon(nelem)
177  endif
178  endif
179  enddo
180  enddo
181  endif
182 !
183  return
subroutine inputwarning(inpc, ipoinpc, iline, text)
Definition: inputwarning.f:20
subroutine getnewline(inpc, textpart, istat, n, key, iline, ipol, inl, ipoinp, inp, ipoinpc)
Definition: getnewline.f:21
Hosted by OpenAircraft.com, (Michigan UAV, LLC)