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

Go to the source code of this file.

Functions/Subroutines

subroutine checkconstraint (nobject, objectset, g0, nactive, nnlconst, ipoacti, ndesi, dgdxglob, nk, nodedesi)
 

Function/Subroutine Documentation

◆ checkconstraint()

subroutine checkconstraint ( integer  nobject,
character*81, dimension(4,*)  objectset,
real*8, dimension(nobject)  g0,
integer  nactive,
integer  nnlconst,
integer, dimension(*)  ipoacti,
integer  ndesi,
real*8, dimension(2,nk,nobject)  dgdxglob,
integer  nk,
integer, dimension(ndesi)  nodedesi 
)
21 !
22 ! check which constraints are active
23 !
24  implicit none
25 !
26  character*81 objectset(4,*)
27  character*20 empty
28 !
29  integer iobject,nobject,istat,nactive,nnlconst,
30  & ipoacti(*),ifree,i,ndesi,nk,node,nodedesi(ndesi)
31 !
32  real*8 g0(nobject),bounds(20),scale,bound,objnorm,
33  & dgdxglob(2,nk,nobject)
34 !
35 ! determine bounds of constraints
36 !
37  empty=' '
38 !
39  do iobject=1,nobject
40  if((objectset(1,iobject)(19:20).eq.'LE').or.
41  & (objectset(1,iobject)(19:20).eq.'GE')) then
42  if(objectset(1,iobject)(1:9).eq.'THICKNESS') then
43  do i=1,ndesi
44  node=nodedesi(i)
45  if(dgdxglob(2,node,iobject).gt.0) then
46  g0(iobject)=1.d0+g0(iobject)
47  endif
48  enddo
49  else
50  if(objectset(1,iobject)(61:80).eq.empty) then
51  read(objectset(1,iobject)(41:60),'(f20.0)',
52  & iostat=istat) scale
53  bounds(iobject)=g0(iobject)*scale
54  else
55  read(objectset(1,iobject)(41:60),'(f20.0)',
56  & iostat=istat) scale
57  read(objectset(1,iobject)(61:80),'(f20.0)',
58  & iostat=istat) bound
59  bounds(iobject)=bound*scale
60  endif
61  endif
62  endif
63  enddo
64 !
65 ! determine active constraints
66 !
67  nactive=0
68  nnlconst=0
69  ifree=1
70 !
71 ! determine all nonlinear constraints
72 !
73  do iobject=1,nobject
74  if(objectset(1,iobject)(19:20).eq.'LE') then
75  if(objectset(1,iobject)(1:9).eq.'THICKNESS') cycle
76  objnorm=g0(iobject)/bounds(iobject)-1
77  if(objnorm.gt.-0.02) then
78  nactive=nactive+1
79  nnlconst=nnlconst+1
80  ipoacti(ifree)=iobject
81  ifree=ifree+1
82  endif
83  elseif(objectset(1,iobject)(19:20).eq.'GE') then
84  if(objectset(1,iobject)(1:9).eq.'THICKNESS') cycle
85  objnorm=-1*(g0(iobject)/bounds(iobject))+1
86  if(objnorm.gt.-0.02) then
87  nactive=nactive+1
88  nnlconst=nnlconst+1
89  ipoacti(ifree)=iobject
90  ifree=ifree+1
91  endif
92  endif
93  enddo
94 !
95 ! determine all linear constraints
96 !
97  do iobject=1,nobject
98  if(objectset(1,iobject)(19:20).eq.'LE') then
99  if(objectset(1,iobject)(1:9).eq.'THICKNESS') then
100  if(g0(iobject)>0) then
101  do i=1,ndesi
102  node=nodedesi(i)
103  if(dgdxglob(2,node,iobject).eq.1) then
104  ipoacti(ifree)=i
105  ifree=ifree+1
106  nactive=nactive+1
107  endif
108  enddo
109  endif
110  endif
111  elseif(objectset(1,iobject)(19:20).eq.'GE') then
112  if(objectset(1,iobject)(1:9).eq.'THICKNESS') then
113  if(g0(iobject)>0) then
114  do i=1,ndesi
115  node=nodedesi(i)
116  if(dgdxglob(2,node,iobject).eq.1) then
117  ipoacti(ifree)=i
118  ifree=ifree+1
119  nactive=nactive+1
120  endif
121  enddo
122  endif
123  endif
124  endif
125  enddo
126 !
127  if(nactive.gt.0) then
128  write(*,*)
129  write(*,*) '*INFO at least 1 constraint active:'
130  write(*,*) ' projected gradient has been '
131  write(*,*) ' calculated based on the '
132  write(*,*) ' constraints:'
133  if(nnlconst.eq.nactive) then
134  do i=1,nactive
135  write(*,'(7x,a11)') objectset(1,ipoacti(i))
136  enddo
137  write(*,*)
138  elseif(nnlconst.lt.nactive) then
139  do i=1,nactive
140  write(*,'(7x,a11)') objectset(1,ipoacti(i))
141  enddo
142  write(*,*) ' THICKNESS'
143  write(*,*)
144  elseif(nnlconst.eq.0) then
145  write(*,*) ' THICKNESS'
146  write(*,*)
147  endif
148  endif
149 !
150  return
Hosted by OpenAircraft.com, (Michigan UAV, LLC)