MoDeNa  1.0
Software framework facilitating sequential multi-scale modelling
solidprop.f90
Go to the documentation of this file.
1 
7 module solidprop
8  use constants
9  implicit none
10  private
11  public optconst
12 contains
13 !********************************BEGINNING*************************************
15 subroutine optconst(lambda,n,k)
16  use quadpack
17  use interpolation
18  real(dp), intent(in) :: lambda
19  real(dp), intent(out) :: n
20  real(dp), intent(out) :: k
21  !qags variables
22  real(dp) :: a !start point of integration
23  real(dp) :: abserr
24  real(dp) :: b !end point of integration
25  real(dp), parameter :: epsabs = 0.0e0_dp
26  real(dp), parameter :: epsrel = 0.001e0_dp
27  integer :: ier
28  integer :: neval
29  real(dp) :: res
30  !end of qags variables
31  integer :: ni=1 !number of points, where we want to interpolate
32  real(dp) :: xi(1) !x-values of points, where we want to interpolate
33  real(dp) :: yi(1) !interpolated y-values
34  a=lambdan(1)
35  b=lambdan(size(lambdan))
36  if (lambda<a) then
37  write(*,*) 'No data for such low wavelength.'
38  write(*,*) 'Minimum wavelength is',a
39  stop
40  elseif (lambda>b) then
41  call qag ( nwew, a, b, epsabs, epsrel, 1, res, abserr, neval, ier )
42  if (ier /= 0) then
43  write(*,*) 'qag returned',ier
44  write(*,*) 'wavelength',lambda
45  write(*,*) 'new real part of refractive index not calculated'
46  stop
47  endif
48  n=res
49  call qag ( kwew, a, b, epsabs, epsrel, 1, res, abserr, neval, ier )
50  if (ier /= 0) then
51  write(*,*) 'qag returned',ier
52  write(*,*) 'wavelength',lambda
53  write(*,*) 'new imaginery part of refractive index not calculated'
54  stop
55  endif
56  k=res
57  call qag ( planck2, a, b, epsabs, epsrel, 1, res, abserr, neval, ier )
58  if (ier /= 0) then
59  write(*,*) 'qag returned',ier
60  write(*,*) 'wavelength',lambda
61  write(*,*) 'new refractive index not calculated'
62  stop
63  endif
64  n=n/res
65  k=k/res
66  else
67  xi(1)=lambda
68  call pwl_interp_1d ( size(lambdan), lambdan, nwl, ni, xi, yi )
69  n=yi(1)
70  call pwl_interp_1d ( size(lambdak), lambdak, kwl, ni, xi, yi )
71  k=yi(1)
72  endif
73 end subroutine optconst
74 !***********************************END****************************************
75 
76 
77 !********************************BEGINNING*************************************
79 real(dp) function nwew ( lambda )
80 !***************************DECLARATION******************************
81  use interpolation
82  real(dp) :: lambda
83  integer :: ni=1 !number of points, where we want to interpolate
84  real(dp) :: xi(1) !x-values of points, where we want to interpolate
85  real(dp) :: yi(1) !interpolated y-values
86 !******************************BODY**********************************
87  xi(1)=lambda
88  call pwl_interp_1d ( size(lambdan), lambdan, nwl, ni, xi, yi )
89  nwew=yi(1)*planck(tmean,lambda)
90 end function nwew
91 !***********************************END****************************************
92 
93 
94 !********************************BEGINNING*************************************
96 real(dp) function kwew ( lambda )
97 !***************************DECLARATION******************************
98  use interpolation
99  real(dp) :: lambda
100  integer :: ni=1 !number of points, where we want to interpolate
101  real(dp) :: xi(1) !x-values of points, where we want to interpolate
102  real(dp) :: yi(1) !interpolated y-values
103 !******************************BODY**********************************
104  xi(1)=lambda
105  call pwl_interp_1d ( size(lambdak), lambdak, kwl, ni, xi, yi )
106  kwew=yi(1)*planck(tmean,lambda)
107 end function kwew
108 !***********************************END****************************************
109 
110 
111 !********************************BEGINNING*************************************
113 real(dp) function planck(temp,lambda)
114 !***************************DECLARATION******************************
115  real(dp), intent(in) :: temp
116  real(dp), intent(in) :: lambda
117  real(dp) :: n
118 !******************************BODY**********************************
119  n=1.57_dp !just guess, equation for emissive power is correct only
120  ! for constant n
121  planck=2*pi*hpc*c0**2/(n**2*lambda**5*(exp(hpc*c0/(n*lambda*kb*temp))-1))
122 end function planck
123 !***********************************END****************************************
124 
125 
126 !********************************BEGINNING*************************************
128 real(dp) function planck2(lambda)
129 !***************************DECLARATION******************************
130  real(dp), intent(in) :: lambda
131 !******************************BODY**********************************
132  planck2=planck(tmean,lambda)
133 end function planck2
134 !***********************************END****************************************
135 end module solidprop