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 varsmooth(aub,adl,sol,aux,irow,jq,
20     &  neqa,neqb,alpha)
21!
22!     variable smoothing for the finite element solution
23!
24!     Ref: The Finite Element Method for Fluid Dynamics,
25!          O.C. Zienkiewicz, R.L. Taylor & P. Nithiarasu
26!          6th edition (2006) ISBN 0 7506 6322 7
27!          p. 206
28!
29      implicit none
30!
31      integer irow(*),jq(*),neqa,neqb,i,j
32!
33      real*8 aub(*),adl(*),sol(*),aux(*),alpha,c1,c2
34!
35c      write(*,*) 'varssmooth alpha= ',alpha
36      c1=1.d0/(1.d0+0.5d0*alpha)
37      c2=alpha/(1.d0+0.5d0*alpha)
38!
39      do i=neqa,neqb
40        do j=jq(i),jq(i+1)-1
41          aux(i)=aux(i)+aub(j)*sol(irow(j))
42        enddo
43         sol(i)=c1*sol(i)+c2*aux(i)*adl(i)
44      enddo
45!
46      return
47      end
48