1!     CalculiX - A 3-dimensional finite element program
2!              Copyright (C) 1998-2021 Guido Dhondt
3!
4!     This program is free software; you can redistribute it and/or
5!     modify it under the terms of the GNU General Public License as
6!     published by the Free Software Foundation(version 2);
7!
8!
9!     This program is distributed in the hope that it will be useful,
10!     but WITHOUT ANY WARRANTY; without even the implied warranty of
11!     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12!     GNU General Public License for more details.
13!
14!     You should have received a copy of the GNU General Public License
15!     along with this program; if not, write to the Free Software
16!     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17!
18      subroutine materialdata_em(elcon,nelcon,alcon,nalcon,
19     &  imat,ntmat_,t1l,elconloc,ncmat_,alpha)
20!
21      implicit none
22!
23!     determines the electric conductance and the magnetic
24!     permeability for temperature t1l
25!
26      integer nelcon(2,*),nalcon(2,*),imat,k,ntmat_,nelconst,
27     &  ncmat_,id,seven
28!
29      real*8 elcon(0:ncmat_,ntmat_,*),alcon(0:6,ntmat_,*),alpha(6),t1l,
30     &  elconloc(21)
31!
32      seven=7
33!
34      nelconst=nelcon(1,imat)
35!
36!     calculating the electric conductance
37!
38      call ident2(alcon(0,1,imat),t1l,nalcon(2,imat),seven,id)
39      if(nalcon(2,imat).eq.0) then
40         do k=1,6
41            alpha(k)=0.d0
42         enddo
43         continue
44      elseif(nalcon(2,imat).eq.1) then
45         do k=1,nalcon(1,imat)
46            alpha(k)=alcon(k,1,imat)
47         enddo
48      elseif(id.eq.0) then
49         do k=1,nalcon(1,imat)
50            alpha(k)=alcon(k,1,imat)
51         enddo
52      elseif(id.eq.nalcon(2,imat)) then
53         do k=1,nalcon(1,imat)
54            alpha(k)=alcon(k,id,imat)
55         enddo
56      else
57         do k=1,nalcon(1,imat)
58            alpha(k)=(alcon(k,id,imat)+
59     &           (alcon(k,id+1,imat)-alcon(k,id,imat))*
60     &           (t1l-alcon(0,id,imat))/
61     &           (alcon(0,id+1,imat)-alcon(0,id,imat)))
62         enddo
63      endif
64!
65!     calculating the permeability
66!
67      call ident2(elcon(0,1,imat),t1l,nelcon(2,imat),ncmat_+1,id)
68      if(nelcon(2,imat).eq.0) then
69         continue
70      elseif(nelcon(2,imat).eq.1) then
71         do k=1,nelconst
72            elconloc(k)=elcon(k,1,imat)
73         enddo
74      elseif(id.eq.0) then
75         do k=1,nelconst
76            elconloc(k)=elcon(k,1,imat)
77         enddo
78      elseif(id.eq.nelcon(2,imat)) then
79         do k=1,nelconst
80            elconloc(k)=elcon(k,id,imat)
81         enddo
82      else
83         do k=1,nelconst
84            elconloc(k)=elcon(k,id,imat)+
85     &           (elcon(k,id+1,imat)-elcon(k,id,imat))*
86     &           (t1l-elcon(0,id,imat))/
87     &           (elcon(0,id+1,imat)-elcon(0,id,imat))
88         enddo
89      endif
90!
91      return
92      end
93