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 scalesen(dgdxglob,nobject,nk,nodedesi,ndesi, 20 & objectset,iscaleflag,iobject) 21! 22! Scaling the sensitivities 23! 24! iscaleflag=1: length of the vector is scaled to 1 25! iscaleflag=2: greatest vector value is scaled to 1 26! 27 implicit none 28! 29 character*81 objectset(5,*) 30! 31 integer nobject,nk,nodedesi(*),i,ndesi,iobject,iscaleflag,node 32! 33 real*8 dgdxglob(2,nk,*),dd 34! 35 if(iscaleflag.eq.1) then 36 if(objectset(5,iobject)(81:81).ne.'G') then 37 dd=0.d0 38 do i=1,ndesi 39 node=nodedesi(i) 40 dd=dd+dgdxglob(2,node,iobject)**2 41 enddo 42 dd=dsqrt(dd) 43 do i=1,ndesi 44 node=nodedesi(i) 45 dgdxglob(2,node,iobject)=dgdxglob(2,node,iobject)/dd 46 enddo 47 endif 48 elseif(iscaleflag.eq.2) then 49 if(objectset(5,iobject)(81:81).ne.'G') then 50 dd=0.d0 51 do i=1,ndesi 52 node=nodedesi(i) 53 dd=max(dd,abs(dgdxglob(2,node,iobject))) 54 enddo 55 do i=1,ndesi 56 node=nodedesi(i) 57 dgdxglob(2,node,iobject)=dgdxglob(2,node,iobject)/dd 58 enddo 59 endif 60 endif 61! 62 return 63 end 64