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 mafillv2rhs(kon,ipkon,lakon,b2,v,nea,neb,mi,dtimef,
20     &     ipvar,var,nk)
21!
22!     filling the rhs b2 of the velocity equations (step 3)
23!
24      implicit none
25!
26      character*8 lakon(*)
27!
28      integer kon(*),ipkon(*),nea,neb,mi(*),ipvar(*),i,j,k,
29     &     node,indexe,nope,nk
30!
31      real*8 b2(nk,3),v(nk,0:mi(2)),bb(3,8),dtimef,var(*)
32!
33      do i=nea,neb
34!
35        if(lakon(i)(1:1).ne.'F') cycle
36        indexe=ipkon(i)
37        if(lakon(i)(4:4).eq.'8') then
38          nope=8
39        elseif(lakon(i)(4:4).eq.'4') then
40          nope=4
41        elseif(lakon(i)(4:4).eq.'6') then
42          nope=6
43        else
44          cycle
45        endif
46!
47        call e_c3d_v2rhs(kon(indexe+1),lakon(i),bb,i,v,dtimef,mi,
48     &       ipvar,var,nk)
49!
50        do j=1,nope
51          node=kon(indexe+j)
52          do k=1,3
53            b2(node,k)=b2(node,k)+bb(k,j)
54          enddo
55        enddo
56      enddo
57c      write(*,*) 'mafillv2rhs '
58c      do i=1,nk
59c        write(*,*) i,(b2(i,j),j=1,3)
60c      enddo
61!
62      return
63      end
64