Home > Archive > Fortran > April 2007 > Fortran novice
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| ben_nielsen20@yahoo.com 2007-04-19, 7:05 pm |
| Hello,
I need some help, please!!! I'm a little clueless about Fortran.
I'm trying to get the following program to run using a compiler for
Windows I downloaded off here:
http://gcc.gnu.org/wiki/GFortranBinaries
Which also references another program located here:
http://gams.nist.gov/serve.cgi/Module/CMLIB/DQAGI/592/
There is also this small data input file:
'file input.par'
'fundamental frequency, Hz'
333.0d0
'power, W'
7.52d-3
'line full width, cm'
1.83d-3
'line length, cm'
0.4d0
'thickness Si, cm'
0.072d0
'measurement temp. T2, deg c'
23.5d0
It doesn't seem to want to run either a "&" or a "*" for a line
continuation. There are also a number of other errors.
Thanks,
B
PROGRAM 3omega
c version 1, 01-Nov-2001
c Calculate real temperature variation at a given frequency
c for a silicon plate heated by a thin metal strip.
c The calculation can be applied to plates composed of
c material other than silicon if the thermal conductivity
c and thermal diffusivity of that material are substituted
c in the indicated lines below.
c This is used for analyzing data obtained by the 3 omega
c method
c
c library routine 'dqagi' used for integration
c --------------------------------------------------------
c A data file named 'input.par' written in ASCII is needed
c
c A sample file is given in section A2. Just substitute data
c in the appropriate lines. Double precision is used.
c
c Function Fcomplex is written for a two layer system. The
c main program defines one of these layers as having zero
c thickness and having the same material parameters as
c the other layer.
c --------------------------------------------------------
c Nomenclature (not necessarily the same as in the standard)
c D =diffusivity
c k =conductivity
c L =substrate thickness
c lnth=heater length
c b =heater half-width
c b2 =heater full width
c w =angular frequency at 2 omega
c f =fundamental frequency
c f2 =frequency at 2 omega
c q =power input to specimen
c T =measurement temperature
c tr =substrate temperature signal at 2 omega
c
c --------------------------------------------------------
c define integration parameters for dqagi
double precision, external :: fr
c
double precision, parameter :: bound=0.d0
double precision, parameter :: epsabs=1.d-6
double precision, parameter :: epsrel=1.d-12
integer, parameter :: inf=1
integer, parameter :: limit=1000
integer, parameter :: lenw=limit*4
integer, parameter :: idim=2
c
double precision result, abserr, work(lenw), T
double precision f, f2, b2
integer neval, ier, last, iwork(limit)
character*30, label
c --------------------------------------------------------
c common variables
double precision w, b
double precision d(idim), k(idim), L(idim)
common w, d, k, L, b
c
double precision q, pi
double precision tr, lnth
c
1 format(A12)
2 format(A30)
3 format(6(1x,d13.6))
4 format(1x,A33,D12.4)
c --------------------------------------------------------
pi=4.d0*atan(1.d0)
c --------------------------------------------------------
open(1,'input.par')
c
read (1,2)
read(1,2) label ; read(1,*) f
read(1,2) label ; read(1,*) q
read(1,2) label ; read(1,*) b2
read(1,2) label ; read(1,*) lnth
read(1,2) label ; read(1,*) L(1)
read(1,2) label ; read(1,*) T
c
f2=2*f
w=2.d0*pi*f2
b=b2/2.d0
c ++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++
c The thermal conductivity of Si as a function of
c temperature is computed in the line 90 below. If another
c material is wanted, replace line 90
90 k(1)=1.685d0-8.73d-3*T+3.62d-5*T*T-9.0d-8*T*T*T
c The thermal diffusivity of Si as a function of the
c thermal conductivity of Si is computed in line 96 below.
c If another material is wanted, replace line 96.
96 D(1)=0.093d0+0.268d0*k(1)+0.180d0*k(1)*k(1)
c ++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++
write(*,4)'thermal conductivity of Si, W/cm/K ', k(1)
write(*,4)'thermal diffusivity of Si, cm2/s ', D(1)
k(2)=k(1)
D(2)=D(1)
L(2)=0.d0
c
c --------------------------------------------------------
c Calculate the temperature variation
c
c calculate average temperature (real and imaginary) using
c dqagi
c
call dqagi(fr,bound,inf,epsabs,epsrel,result,
*abserr,neval,ier,limit,lenw,last,iwork,
work)
if (ier.gt.0) then
call list(bound,inf,epsabs,epsrel,result,
*abserr,neval,ier,limit,lenw,last,'fr')
end if
c
tr=result*q/pi/lnth
c
write(*,4) 'substrate thermal signal ', tr
c --------------------------------------------------------
close(2)
end
c
c ****************************************
***************
function fr(x)
c real part of integrand for dqagi
double precision x, fr
complex*8 fcomplex
c
fr=real(fcomplex(x))
return
end function fr
c
c ****************************************
***************
function fcomplex(x)
c
c complex integrand for 2 layers in vacuum
c
c common variables
double precision w, b
double precision d(2), k(2), L(2)
common w, d, k, L, b
c
double precision x
complex*8 u(2), ea1, ea2
complex*8 ci, gp, gm, ex1, ex2, bp, bm, ftr, fcomplex
c
ci=(0,1.d0)
u(1)=sqrt(x*x-ci*w/d(1))
u(2)=sqrt(x*x-ci*w/d(2))
gp=u(1)*k(1)+u(2)*k(2)
gm=u(1)*k(1)-u(2)*k(2)
ea1= 2.d0*u(1)*L(1)
if (real(ea1).gt.160) then
ex1=0.d0
else
ex1= exp(-ea1)
end if
ea2= 2.d0*u(2)*L(2)
if (real(ea2).gt.160) then
ex2=0.d0
else
ex2= exp(-ea2)
end if
bp=(gp*ex2 + gm)*ex1
bm=(gm*ex2 + gp)
ftr=(bm+bp)/(bm-bp)/u(1)/k(1)
if(x.eq.0.d0) then
fcomplex=ftr
else
fcomplex=ftr*sin(x*b)*sin(x*b)/x/x/b/b
end if
c print*,'end of fcomplex'
return
end function fcomplex
c
c ****************************************
***************
subroutine list(bound,inf,epsabs,epsrel,result,
*abserr,neval,ier,limit,lenw,last,ri)
c
double precision bound,epsabs,epsrel,result,
*abserr,integer inf,limit,lenw,neval,ier,last
character*2 ri
c
print*,'list parameters from dqagi call to ', ri
print*, 'epsabs=', epsabs
print*, 'epsrel=', epsrel
print*, ' limit=', limit
print*, 'result=', result
print*, ' neval=', neval
print*, ' ier=', ier
print*, ' last=', last
print*, ' '
return
end subroutine list
c ****************************************
***************
END PROGRAM 3omega
| |
| Michael Metcalf 2007-04-19, 7:05 pm |
| Please note that this is a fixed source form program: labels must be in
columns 1-5, a continuation mark in column 6, and the statements in columns
7-72. That's the first thing to check. The file suffix will normally have to
be .f and not .f90 (which normally implies free form source).
HTH
Mike Metcalf
| |
| ben_nielsen20@yahoo.com 2007-04-19, 10:03 pm |
| On Apr 19, 4:59 pm, "Michael Metcalf" <michaelmetc...@compuserve.com>
wrote:
> Please note that this is a fixed source form program: labels must be in
> columns 1-5, a continuation mark in column 6, and the statements in columns
> 7-72. That's the first thing to check. The file suffix will normally have to
> be .f and not .f90 (which normally implies free form source).
>
> HTH
>
> Mike Metcalf
Hi Mike,
I have it down to one error for this line:
open(1, 'input.par')
It says "Error: Syntax error in open statement at (1)
line 71, column 13
Any ideas???
Thanks,
Ben
| |
| Dan Nagle 2007-04-19, 10:03 pm |
| Hello,
A quick glance suggests that the end following the close(2)
should be a contains instead.
Decide whether you want internal procedures (use contains)
or separate procedures in the same file (use end and lose
the end program on the last source line).
ben_nielsen20@yahoo.com wrote:
> Hello,
>
> I need some help, please!!! I'm a little clueless about Fortran.
> I'm trying to get the following program to run using a compiler for
> Windows I downloaded off here:
> http://gcc.gnu.org/wiki/GFortranBinaries
> Which also references another program located here:
> http://gams.nist.gov/serve.cgi/Module/CMLIB/DQAGI/592/
>
> There is also this small data input file:
> 'file input.par'
> 'fundamental frequency, Hz'
> 333.0d0
> 'power, W'
> 7.52d-3
> 'line full width, cm'
> 1.83d-3
> 'line length, cm'
> 0.4d0
> 'thickness Si, cm'
> 0.072d0
> 'measurement temp. T2, deg c'
> 23.5d0
>
> It doesn't seem to want to run either a "&" or a "*" for a line
> continuation. There are also a number of other errors.
>
> Thanks,
> B
>
>
> PROGRAM 3omega
> c version 1, 01-Nov-2001
> c Calculate real temperature variation at a given frequency
> c for a silicon plate heated by a thin metal strip.
> c The calculation can be applied to plates composed of
> c material other than silicon if the thermal conductivity
> c and thermal diffusivity of that material are substituted
> c in the indicated lines below.
> c This is used for analyzing data obtained by the 3 omega
> c method
> c
> c library routine 'dqagi' used for integration
> c --------------------------------------------------------
> c A data file named 'input.par' written in ASCII is needed
> c
> c A sample file is given in section A2. Just substitute data
> c in the appropriate lines. Double precision is used.
> c
> c Function Fcomplex is written for a two layer system. The
> c main program defines one of these layers as having zero
> c thickness and having the same material parameters as
> c the other layer.
> c --------------------------------------------------------
> c Nomenclature (not necessarily the same as in the standard)
> c D =diffusivity
> c k =conductivity
> c L =substrate thickness
> c lnth=heater length
> c b =heater half-width
> c b2 =heater full width
> c w =angular frequency at 2 omega
> c f =fundamental frequency
> c f2 =frequency at 2 omega
> c q =power input to specimen
> c T =measurement temperature
> c tr =substrate temperature signal at 2 omega
> c
> c --------------------------------------------------------
> c define integration parameters for dqagi
> double precision, external :: fr
> c
> double precision, parameter :: bound=0.d0
> double precision, parameter :: epsabs=1.d-6
> double precision, parameter :: epsrel=1.d-12
> integer, parameter :: inf=1
> integer, parameter :: limit=1000
> integer, parameter :: lenw=limit*4
> integer, parameter :: idim=2
>
> c
> double precision result, abserr, work(lenw), T
> double precision f, f2, b2
> integer neval, ier, last, iwork(limit)
> character*30, label
> c --------------------------------------------------------
> c common variables
> double precision w, b
> double precision d(idim), k(idim), L(idim)
> common w, d, k, L, b
> c
> double precision q, pi
> double precision tr, lnth
> c
> 1 format(A12)
> 2 format(A30)
> 3 format(6(1x,d13.6))
> 4 format(1x,A33,D12.4)
> c --------------------------------------------------------
> pi=4.d0*atan(1.d0)
> c --------------------------------------------------------
> open(1,'input.par')
> c
> read (1,2)
> read(1,2) label ; read(1,*) f
> read(1,2) label ; read(1,*) q
> read(1,2) label ; read(1,*) b2
> read(1,2) label ; read(1,*) lnth
> read(1,2) label ; read(1,*) L(1)
> read(1,2) label ; read(1,*) T
> c
> f2=2*f
> w=2.d0*pi*f2
> b=b2/2.d0
> c ++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++
> c The thermal conductivity of Si as a function of
> c temperature is computed in the line 90 below. If another
> c material is wanted, replace line 90
>
> 90 k(1)=1.685d0-8.73d-3*T+3.62d-5*T*T-9.0d-8*T*T*T
>
> c The thermal diffusivity of Si as a function of the
> c thermal conductivity of Si is computed in line 96 below.
> c If another material is wanted, replace line 96.
>
> 96 D(1)=0.093d0+0.268d0*k(1)+0.180d0*k(1)*k(1)
>
> c ++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++
> write(*,4)'thermal conductivity of Si, W/cm/K ', k(1)
> write(*,4)'thermal diffusivity of Si, cm2/s ', D(1)
> k(2)=k(1)
> D(2)=D(1)
> L(2)=0.d0
> c
> c --------------------------------------------------------
> c Calculate the temperature variation
> c
> c calculate average temperature (real and imaginary) using
> c dqagi
> c
> call dqagi(fr,bound,inf,epsabs,epsrel,result,
> *abserr,neval,ier,limit,lenw,last,iwork,
work)
> if (ier.gt.0) then
> call list(bound,inf,epsabs,epsrel,result,
> *abserr,neval,ier,limit,lenw,last,'fr')
> end if
> c
> tr=result*q/pi/lnth
> c
> write(*,4) 'substrate thermal signal ', tr
> c --------------------------------------------------------
> close(2)
> end
> c
> c ****************************************
***************
> function fr(x)
> c real part of integrand for dqagi
> double precision x, fr
> complex*8 fcomplex
> c
> fr=real(fcomplex(x))
> return
> end function fr
> c
> c ****************************************
***************
> function fcomplex(x)
> c
> c complex integrand for 2 layers in vacuum
> c
> c common variables
> double precision w, b
> double precision d(2), k(2), L(2)
> common w, d, k, L, b
> c
> double precision x
> complex*8 u(2), ea1, ea2
> complex*8 ci, gp, gm, ex1, ex2, bp, bm, ftr, fcomplex
> c
> ci=(0,1.d0)
> u(1)=sqrt(x*x-ci*w/d(1))
> u(2)=sqrt(x*x-ci*w/d(2))
> gp=u(1)*k(1)+u(2)*k(2)
> gm=u(1)*k(1)-u(2)*k(2)
> ea1= 2.d0*u(1)*L(1)
> if (real(ea1).gt.160) then
> ex1=0.d0
> else
> ex1= exp(-ea1)
> end if
> ea2= 2.d0*u(2)*L(2)
> if (real(ea2).gt.160) then
> ex2=0.d0
> else
> ex2= exp(-ea2)
> end if
> bp=(gp*ex2 + gm)*ex1
> bm=(gm*ex2 + gp)
> ftr=(bm+bp)/(bm-bp)/u(1)/k(1)
> if(x.eq.0.d0) then
> fcomplex=ftr
> else
> fcomplex=ftr*sin(x*b)*sin(x*b)/x/x/b/b
> end if
> c print*,'end of fcomplex'
> return
> end function fcomplex
> c
> c ****************************************
***************
> subroutine list(bound,inf,epsabs,epsrel,result,
> *abserr,neval,ier,limit,lenw,last,ri)
> c
> double precision bound,epsabs,epsrel,result,
> *abserr,integer inf,limit,lenw,neval,ier,last
> character*2 ri
> c
> print*,'list parameters from dqagi call to ', ri
> print*, 'epsabs=', epsabs
> print*, 'epsrel=', epsrel
> print*, ' limit=', limit
> print*, 'result=', result
> print*, ' neval=', neval
> print*, ' ier=', ier
> print*, ' last=', last
> print*, ' '
> return
> end subroutine list
> c ****************************************
***************
> END PROGRAM 3omega
>
--
Dan Nagle
Purple Sage Computing Solutions, Inc.
| |
| glen herrmannsfeldt 2007-04-19, 10:03 pm |
| ben_nielsen20@yahoo.com wrote:
> I need some help, please!!! I'm a little clueless about Fortran.
> I'm trying to get the following program to run using a compiler for
First, the * for continuation MUST be in column 6. Yours seem to
be somewhere between 5 and 7.
(snip)
> PROGRAM 3omega
Program names, like variable names, start with a letter.
(snip)
> open(1,'input.par')
open(1,file='input.par')
(snip)
> END PROGRAM 3omega
Remove this statement. The main program ended many
lines ago. If the compiler actually does believe this, it
gives you a second main program that doesn't do anything.
Also, you don't need the apostrophe's on the input data
if you are reading it in A format. If you do list directed
read, you probably do need them, but you aren't doing that.
-- glen
| |
| ben_nielsen20@yahoo.com 2007-04-19, 10:03 pm |
| Now there are no errors, but is says,
"GFORTRAN: CreateProcess: No such file or directory"
PROGRAM omega3
c version 1, 01-Nov-2001
c Calculate real temperature variation at a given frequency
c for a silicon plate heated by a thin metal strip.
c The calculation can be applied to plates composed of
c material other than silicon if the thermal conductivity
c and thermal diffusivity of that material are substituted
c in the indicated lines below.
c This is used for analyzing data obtained by the 3 omega
c method
c
c library routine 'dqagi' used for integration
c --------------------------------------------------------
c A data file named 'input.par' written in ASCII is needed
c
c A sample file is given in section A2. Just substitute data
c in the appropriate lines. Double precision is used.
c
c Function Fcomplex is written for a two layer system. The
c main program defines one of these layers as having zero
c thickness and having the same material parameters as
c the other layer.
c --------------------------------------------------------
c Nomenclature (not necessarily the same as in the standard)
c D =diffusivity
c k =conductivity
c L =substrate thickness
c lnth=heater length
c b =heater half-width
c b2 =heater full width
c w =angular frequency at 2 omega
c f =fundamental frequency
c f2 =frequency at 2 omega
c q =power input to specimen
c T =measurement temperature
c tr =substrate temperature signal at 2 omega
c
c --------------------------------------------------------
c define integration parameters for dqagi
double precision, external :: fr
c
double precision, parameter :: bound=0.d0
double precision, parameter :: epsabs=1.d-6
double precision, parameter :: epsrel=1.d-12
integer, parameter :: inf=1
integer, parameter :: limit=1000
integer, parameter :: lenw=limit*4
integer, parameter :: idim=2
c
double precision result, abserr, work(lenw), T
double precision f, f2, b2
integer neval, ier, last, iwork(limit)
character*30, label
c --------------------------------------------------------
c common variables
double precision w, b
double precision d(idim), k(idim), L(idim)
common w, d, k, L, b
c
double precision q, pi
double precision tr, lnth
c
1 format(A12)
2 format(A30)
3 format(6(1x,d13.6))
4 format(1x,A33,D12.4)
c --------------------------------------------------------
pi=4.d0*atan(1.d0)
c --------------------------------------------------------
open(1,file='input.par')
c
read (1,2)
read(1,2) label ; read(1,*) f
read(1,2) label ; read(1,*) q
read(1,2) label ; read(1,*) b2
read(1,2) label ; read(1,*) lnth
read(1,2) label ; read(1,*) L(1)
read(1,2) label ; read(1,*) T
c
f2=2*f
w=2.d0*pi*f2
b=b2/2.d0
c ++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++
c The thermal conductivity of Si as a function of
c temperature is computed in the line 90 below. If another
c material is wanted, replace line 90
90 k(1)=1.685d0-8.73d-3*T+3.62d-5*T*T-9.0d-8*T*T*T
c The thermal diffusivity of Si as a function of the
c thermal conductivity of Si is computed in line 96 below.
c If another material is wanted, replace line 96.
96 D(1)=0.093d0+0.268d0*k(1)+0.180d0*k(1)*k(1)
c ++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++
write(*,4)'thermal conductivity of Si, W/cm/K ', k(1)
write(*,4)'thermal diffusivity of Si, cm2/s ', D(1)
k(2)=k(1)
D(2)=D(1)
L(2)=0.d0
c
c --------------------------------------------------------
c Calculate the temperature variation
c
c calculate average temperature (real and imaginary) using
c dqagi
c
call dqagi(fr,bound,inf,epsabs,epsrel,result,
* abserr,neval,ier,limit,lenw,last,iwork,w
ork)
if (ier.gt.0) then
call list(bound,inf,epsabs,epsrel,result,
* abserr,neval,ier,limit,lenw,last,'fr')
end if
c
tr=result*q/pi/lnth
c
write(*,4) 'substrate thermal signal ', tr
c --------------------------------------------------------
close(2)
end
c
c ****************************************
***************
function fr(x)
c real part of integrand for dqagi
double precision x, fr
complex*8 fcomplex
c
fr=real(fcomplex(x))
return
end function fr
c
c ****************************************
***************
function fcomplex(x)
c
c complex integrand for 2 layers in vacuum
c
c common variables
double precision w, b
double precision d(2), k(2), L(2)
common w, d, k, L, b
c
double precision x
complex*8 u(2), ea1, ea2
complex*8 ci, gp, gm, ex1, ex2, bp, bm, ftr, fcomplex
c
ci=(0,1.d0)
u(1)=sqrt(x*x-ci*w/d(1))
u(2)=sqrt(x*x-ci*w/d(2))
gp=u(1)*k(1)+u(2)*k(2)
gm=u(1)*k(1)-u(2)*k(2)
ea1= 2.d0*u(1)*L(1)
if (real(ea1).gt.160) then
ex1=0.d0
else
ex1= exp(-ea1)
end if
ea2= 2.d0*u(2)*L(2)
if (real(ea2).gt.160) then
ex2=0.d0
else
ex2= exp(-ea2)
end if
bp=(gp*ex2 + gm)*ex1
bm=(gm*ex2 + gp)
ftr=(bm+bp)/(bm-bp)/u(1)/k(1)
if(x.eq.0.d0) then
fcomplex=ftr
else
fcomplex=ftr*sin(x*b)*sin(x*b)/x/x/b/b
end if
c print*,'end of fcomplex'
return
end function fcomplex
c
c ****************************************
***************
subroutine list(bound,inf,epsabs,epsrel,result,
* abserr,neval,ier,limit,lenw,last,ri)
c
double precision bound,epsabs,epsrel,result,abserr
integer inf,limit,lenw,neval,ier,last
character*2 ri
c
print*,'list parameters from dqagi call to ', ri
print*, 'epsabs=', epsabs
print*, 'epsrel=', epsrel
print*, ' limit=', limit
print*, 'result=', result
print*, ' neval=', neval
print*, ' ier=', ier
print*, ' last=', last
print*, ' '
return
end subroutine list
c ****************************************
***************
| |
| mintoo 2007-04-20, 4:07 am |
| i am not an expert but, i noticed one thing:
open(1,'input.par')
close(2)
I did'nt run that program but i am not sure if that's right thing to do
| |
| Tom Micevski 2007-04-20, 4:07 am |
| ben_nielsen20@yahoo.com wrote:
> On Apr 19, 4:59 pm, "Michael Metcalf" <michaelmetc...@compuserve.com>
> wrote:
>
> Hi Mike,
>
> I have it down to one error for this line:
> open(1, 'input.par')
>
> It says "Error: Syntax error in open statement at (1)
> line 71, column 13
you need to add an extra space (so OPEN starts in column 7, not column 6
like it is now).
| |
| Michael Metcalf 2007-04-20, 8:06 am |
| Is that because you call a library procedue, DQAGI, that is not supplied
(see the comment lines!).
Regards,
Mike Metcalf
| |
| ben_nielsen20@yahoo.com 2007-04-20, 7:04 pm |
| I downloaded DQAGI.f and saved it in the same folder as my 3omega.f
program. Where will my program look for the DQAGI program?
I also noticed my program has this statement:
call dqagi(fr,bound,inf,epsabs,epsrel,result,
* abserr,neval,ier,limit,lenw,last,iwork,w
ork)
Whereas, in the DQAGI program it reads:
SUBROUTINE DQAGI(F,BOUND,INF,EPSABS,EPSREL,RESULT,A
BSERR,NEVAL,
1 IER,LIMIT,LENW,LAST,IWORK,WORK)
It has an "f" instead of an "fr". Could this be the problem?
Thanks,
Ben
| |
|
| NNTP-Posting-Host: quatramaran.ens.fr
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: nef.ens.fr 1177087143 18855 129.199.129.64 (20 Apr 2007 16:39:03 GMT)
X-Complaints-To: abuse@ens.fr
NNTP-Posting-Date: Fri, 20 Apr 2007 16:39:03 +0000 (UTC)
X-Newsreader: Flrn (0.9.1 - 05/04)
Xref: number1.nntp.dca.giganews.com comp.lang.fortran:161449
> I downloaded DQAGI.f and saved it in the same folder as my 3omega.f
> program. Where will my program look for the DQAGI program?
You have to tell the compiler yourself. Example to compile in one step:
gfortran DQAGI.f my_own_code.f -o my_program.exe
You can also compile in two steps (makes for easier recompiling,
especially with a large number of source files):
gfortran DQAGI.f -c (this will create an object file called DQAGI.o)
gfortran my_own_code.f DQAGI.o -o my_program.exe
> I also noticed my program has this statement:
> call dqagi(fr,bound,inf,epsabs,epsrel,result,
> * abserr,neval,ier,limit,lenw,last,iwork,w
ork)
>
> Whereas, in the DQAGI program it reads:
> SUBROUTINE DQAGI(F,BOUND,INF,EPSABS,EPSREL,RESULT,A
BSERR,NEVAL,
> 1 IER,LIMIT,LENW,LAST,IWORK,WORK)
>
> It has an "f" instead of an "fr". Could this be the problem?
No, argument names for subroutines are local to the declaration. You can
call the subroutine with different variables used as argument, using
different names, it doesn't matter. The only thing you need to check is
that they have the same type (integer, real, complex, etc.) and kind
(real*4, real*8, complex*8, ...).
--
FX
| |
| Steven G. Kargl 2007-04-20, 7:04 pm |
| In article <1177086196.362928.139790@o5g2000hsb.googlegroups.com>,
ben_nielsen20@yahoo.com writes:
> I downloaded DQAGI.f and saved it in the same folder as my 3omega.f
> program. Where will my program look for the DQAGI program?
>
> I also noticed my program has this statement:
> call dqagi(fr,bound,inf,epsabs,epsrel,result,
> * abserr,neval,ier,limit,lenw,last,iwork,w
ork)
>
> Whereas, in the DQAGI program it reads:
> SUBROUTINE DQAGI(F,BOUND,INF,EPSABS,EPSREL,RESULT,A
BSERR,NEVAL,
> 1 IER,LIMIT,LENW,LAST,IWORK,WORK)
>
> It has an "f" instead of an "fr". Could this be the problem?
>
No.
I suggest that you take the time to read one or more
Fortran tutorials available on the web. It will save
you a lot of time. In particular, it looks like you're
dealing with old Fortran 77 code. I'd suggest a stop
at Clive Page's webpage and download his slim volume.
http://www.star.le.ac.uk/~cgp/fortran.html
--
Steve
http://troutmask.apl.washington.edu/~kargl/
| |
| ben_nielsen20@yahoo.com 2007-04-20, 7:04 pm |
| On Apr 20, 9:39 am, "FX" <coud...@alussinan.org> wrote:
>
> You have to tell the compiler yourself. Example to compile in one step:
> gfortran DQAGI.f my_own_code.f -o my_program.exe
>
> You can also compile in two steps (makes for easier recompiling,
> especially with a large number of source files):
> gfortran DQAGI.f -c (this will create an object file called DQAGI.o)
> gfortran my_own_code.f DQAGI.o -o my_program.exe
>
Does the name I put in for "my_program" not matter? I saved the above
code as "3omega.f".
So would it look something like this?
gfortran DQAGI.f 3omega.f -o 3omega.exe
Do I also have to specify the "input.par" file in the command line?
| |
| Brooks Moses 2007-04-20, 7:04 pm |
| ben_nielsen20@yahoo.com wrote:
> Does the name I put in for "my_program" not matter? I saved the above
> code as "3omega.f".
> So would it look something like this?
> gfortran DQAGI.f 3omega.f -o 3omega.exe
Yes, that should work.
Note that the name you give the .exe file is arbitrary. It's usually
most convenient to also call it 3omega, as you've done, but you can put
any name you want after the "-o".
> Do I also have to specify the "input.par" file in the command line?
No. It is specified in the following line of 3omega.f:
open(1,'input.par')
- Brooks
--
The "bmoses-nospam" address is valid; no unmunging needed.
| |
| ben_nielsen20@yahoo.com 2007-04-20, 7:04 pm |
| When I try to run DQAGI.f by itself the compiler comes up with: "No
such file or directory"
| |
| glen herrmannsfeldt 2007-04-20, 7:04 pm |
| ben_nielsen20@yahoo.com wrote:
> I downloaded DQAGI.f and saved it in the same folder as my 3omega.f
> program. Where will my program look for the DQAGI program?
> I also noticed my program has this statement:
> call dqagi(fr,bound,inf,epsabs,epsrel,result,
> * abserr,neval,ier,limit,lenw,last,iwork,w
ork)
For fixed form the C of CALL should be in column 7 or greater,
and the * of the continuation in column 6.
> Whereas, in the DQAGI program it reads:
> SUBROUTINE DQAGI(F,BOUND,INF,EPSABS,EPSREL,RESULT,A
BSERR,NEVAL,
> 1 IER,LIMIT,LENW,LAST,IWORK,WORK)
> It has an "f" instead of an "fr". Could this be the problem?
It would be very unusual for 13 out of 14 to have the same name.
No, the names don't matter. The types must agree, though.
-- glen
| |
| ben_nielsen20@yahoo.com 2007-04-20, 7:04 pm |
| Can subroutines be run by themselves?
This comes up with the same "No such file or directory" response in
the compiler.
gfortran DQAGI.f 3omega.f -o 3omega.exe
| |
| e p chandler 2007-04-20, 7:04 pm |
| On Apr 20, 12:23 pm, ben_nielse...@yahoo.com wrote:
> I downloaded DQAGI.f and saved it in the same folder as my 3omega.f
> program. Where will my program look for the DQAGI program?
>
> I also noticed my program has this statement:
> call dqagi(fr,bound,inf,epsabs,epsrel,result,
> * abserr,neval,ier,limit,lenw,last,iwork,w
ork)
>
> Whereas, in the DQAGI program it reads:
> SUBROUTINE DQAGI(F,BOUND,INF,EPSABS,EPSREL,RESULT,A
BSERR,NEVAL,
> 1 IER,LIMIT,LENW,LAST,IWORK,WORK)
>
> It has an "f" instead of an "fr". Could this be the problem?
>
> Thanks,
>
> Ben
As long as the types, kinds (and sizes) of the arguments match, what
they are named does not matter. I briefly look at the source for this
subroutine and it looks like fixed format Fortran with implicit
typing. So unless otherwise specified, the types of F and FR would be
default real. I'm also guessing that F or FR is the name of a
function, but that does not matter here.
The arguments named in the body of a subroutine are DUMMY arguments.
They get replaced with the ACTUAL arguments as used in the calling
program. So if you have a real variable foo and a
SUBROUTINE FUBAR(BAR)
.......
END
and you
CALL FUBAR(FOO)
then FUBAR acts upon FOO, as it would with BAR.
------ Aside -----
I'm not sure how to gather all the subroutines needed for your program
as DQAG requires a number of OTHER routines.
But once you do, you can add their names to the command line. If you
put them all in the same directory then you might be able to compile
with
gfortran *.f -o my_program.exe
-- elliot
| |
| e p chandler 2007-04-20, 7:04 pm |
| On Apr 20, 2:21 pm, ben_nielse...@yahoo.com wrote:
> Can subroutines be run by themselves?
>
> This comes up with the same "No such file or directory" response in
> the compiler.
> gfortran DQAGI.f 3omega.f -o 3omega.exe
It might help if you show us what appears when you issue the command
dir *.f
(If you are in a fullscreen session, switch to a command prompt
(console) window with alt-enter. Then click the icon at upper left and
select edit then mark. Click and drag the mouse to hilight part of the
screen. Press ENTER to copy. Now open up some other application like
NOTEPAD and EDIT then PASTE. You now have an instant text screen shot
suitable for including in a newsgroup posting.
This is a real easy way to show your files, commands typed and a
limited amount of output from a program without having to type it into
your newsreader or web application.
--- elliot
| |
| Beliavsky 2007-04-20, 7:04 pm |
| On Apr 20, 2:52 pm, e p chandler <e...@juno.com> wrote:
> On Apr 20, 2:21 pm, ben_nielse...@yahoo.com wrote:
>
>
>
> It might help if you show us what appears when you issue the command
>
> dir *.f
>
> (If you are in a fullscreen session, switch to a command prompt
> (console) window with alt-enter. Then click the icon at upper left and
> select edit then mark. Click and drag the mouse to hilight part of the
> screen. Press ENTER to copy. Now open up some other application like
> NOTEPAD and EDIT then PASTE. You now have an instant text screen shot
> suitable for including in a newsgroup posting.
The OP should just type
dir *.f > temp.txt
He can open temp.txt and paste its contents wherever. It works on
Unix, too, and also for command line programs that he creates. Hope
this does not sound abrupt. Happy Friday.
>
> This is a real easy way to show your files, commands typed and a
> limited amount of output from a program without having to type it into
> your newsreader or web application.
>
> --- elliot
| |
| glen herrmannsfeldt 2007-04-20, 7:04 pm |
| ben_nielsen20@yahoo.com wrote:
> Can subroutines be run by themselves?
no.
> This comes up with the same "No such file or directory" response in
> the compiler.
> gfortran DQAGI.f 3omega.f -o 3omega.exe
It should say which file wasn't found.
Note that unix file name are case sensitive, and are
assumed to be in the same directory unless you say otherwise.
-- glen
| |
| ben_nielsen20@yahoo.com 2007-04-20, 7:04 pm |
| Here's what it says:
C:\GFORTRAN\BIN>dir *.f
Volume in drive C is System
Volume Serial Number is 5852-4E18
Directory of C:\GFORTRAN\BIN
04/20/2007 12:21 PM 12,748 3omega.f
04/20/2007 12:06 PM 226,064 DQAGI.f
2 File(s) 238,812 bytes
0 Dir(s) 87,331,287,040 bytes free
I've been saving both programs in Notepad. Is it necessary to save
them as Unicode or ANSI file type? When I save them as ANSI I get "No
such file or directory". When I save them as Unicode I get some
errors:
C:\GFORTRAN\BIN>gfortran dqagi.f 3omega.f -o 3omega.exe
dqagi.f:1.1:
\xFF\xFE SUBROUTINE
DQAGI(F,BOUND,INF,EPSABS,EPSREL,RESULT,A
BSERR,NEVAL,
1
Error: Non-numeric character in statement label at (1)
dqagi.f:1.2:
\xFF\xFE SUBROUTINE
DQAGI(F,BOUND,INF,EPSABS,EPSREL,RESULT,A
BSERR,NEVAL,
1
Error: Invalid character in name at (1)
dqagi.f:163.22:
DIMENSION IWORK(LIMIT),WORK(LENW)
1
Error: Variable 'limit' cannot appear in the expression at (1)
dqagi.f:161.27:
INTEGER IER,INF,IWORK,LAST,LENW,LIMIT,LVL,L1,L2,
L3,NEVAL
1
Error: The module or main program array 'iwork' at (1) must have
constant shap
dqagi.f:163.34:
DIMENSION IWORK(LIMIT),WORK(LENW)
1
Error: Variable 'lenw' cannot appear in the expression at (1)
dqagi.f:160.63:
DOUBLE PRECISION ABSERR,BOUND,EPSABS,EPSREL,F,RESULT,WORK
1
Error: The module or main program array 'work' at (1) must have
constant shape
3omega.f:1.1:
\xFF\xFEc version 1, 01-Nov-2001
1
Error: Non-numeric character in statement label at (1)
3omega.f:1.2:
\xFF\xFEc version 1, 01-Nov-2001
1
Error: Invalid character in name at (1)
| |
| e p chandler 2007-04-20, 7:04 pm |
| On Apr 20, 3:34 pm, Beliavsky <beliav...@aol.com> wrote:
> On Apr 20, 2:52 pm, e p chandler <e...@juno.com> wrote:
>
>
>
>
>
>
>
>
>
>
>
> The OP should just type
>
> dir *.f > temp.txt
>
> He can open temp.txt and paste its contents wherever. It works on
> Unix, too, and also for command line programs that he creates. Hope
> this does not sound abrupt. Happy Friday.
>
Thanks for the reminder. Simple and portable (mutatis mutandis). Happy
Friday.
-- elliot
| |
| e p chandler 2007-04-20, 7:04 pm |
| On Apr 20, 4:15 pm, ben_nielse...@yahoo.com wrote:
> Here's what it says:
>
> C:\GFORTRAN\BIN>dir *.f
> Volume in drive C is System
> Volume Serial Number is 5852-4E18
>
> Directory of C:\GFORTRAN\BIN
>
> 04/20/2007 12:21 PM 12,748 3omega.f
> 04/20/2007 12:06 PM 226,064 DQAGI.f
> 2 File(s) 238,812 bytes
> 0 Dir(s) 87,331,287,040 bytes free
>
> I've been saving both programs in Notepad. Is it necessary to save
> them as Unicode or ANSI file type? When I save them as ANSI I get "No
> such file or directory". When I save them as Unicode I get some
> errors:
>
> C:\GFORTRAN\BIN>gfortran dqagi.f 3omega.f -o 3omega.exe
> dqagi.f:1.1:
>
> \xFF\xFE SUBROUTINE
> DQAGI(F,BOUND,INF,EPSABS,EPSREL,RESULT,A
BSERR,NEVAL,
> 1
> Error: Non-numeric character in statement label at (1)
> dqagi.f:1.2:
>
> \xFF\xFE SUBROUTINE
> DQAGI(F,BOUND,INF,EPSABS,EPSREL,RESULT,A
BSERR,NEVAL,
> 1
> Error: Invalid character in name at (1)
> dqagi.f:163.22:
>
> DIMENSION IWORK(LIMIT),WORK(LENW)
> 1
> Error: Variable 'limit' cannot appear in the expression at (1)
> dqagi.f:161.27:
>
> INTEGER IER,INF,IWORK,LAST,LENW,LIMIT,LVL,L1,L2,
L3,NEVAL
> 1
> Error: The module or main program array 'iwork' at (1) must have
> constant shap
> dqagi.f:163.34:
>
> DIMENSION IWORK(LIMIT),WORK(LENW)
> 1
> Error: Variable 'lenw' cannot appear in the expression at (1)
> dqagi.f:160.63:
>
> DOUBLE PRECISION ABSERR,BOUND,EPSABS,EPSREL,F,RESULT,WORK
> 1
> Error: The module or main program array 'work' at (1) must have
> constant shape
> 3omega.f:1.1:
>
> \xFF\xFEc version 1, 01-Nov-2001
> 1
> Error: Non-numeric character in statement label at (1)
> 3omega.f:1.2:
>
> \xFF\xFEc version 1, 01-Nov-2001
> 1
> Error: Invalid character in name at (1)
Notepad is known to sometimes insert garbage characters at the start
of files that it does not recognize as text. If you can not see these
characters in Notepad, open a command window and use "EDIT filename"
from the command line. EDIT has two side effects. It converts LF to CR/
LF and it strips trailing Control-Z. EDIT leaves embedded tab
characters intact.
Try right clicking on the link to the source file or the fullsource
file, then select "save target as" (.f document type is fine) and
click OK. You will get a LF delimited text file. If the compiler
complains, use EDIT or any of a number of other utilities.
| |
| ben_nielsen20@yahoo.com 2007-04-20, 7:04 pm |
| Now I'm getting this error:
C:\GFORTRAN\BIN>gfortran 3omega.f
3omega.f:1.1:
\xFF\xFEc version 1, 01-Nov-2001
1
Error: Non-numeric character in statement label at (1)
3omega.f:1.2:
\xFF\xFEc version 1, 01-Nov-2001
1
Error: Invalid character in name at (1)
Is this some of the garbage characters that Notepad puts in?
| |
| John Harper 2007-04-22, 7:04 pm |
| In article <1177045735.343912.80750@n76g2000hsh.googlegroups.com>,
mintoo <varun.tangri@gmail.com> wrote:
>i am not an expert but, i noticed one thing:
>
>open(1,'input.par')
>
I notice three things there.
(1) open(1,file='input.par') is the standard Fortran ever since 1977.
(3) Some systems use unit number 1 for special purposes; it may be
safer to make sure you use a number that is not already in use for
something else. 5 and 6 often are. Years ago our graphics package
was Disspla, which used several unit numbers for its own purposes,
and one got weird errors by using them for one's own.
(2) If you're using free source form (often a program file name
ending .f90) a Fortran statement may start in position 1 on the line,
but if you're using fixed source form (often a program name ending .f)
then every statement must start in or after position 7 and end in or
before position 72. RTFM for what may go in positions 1-6.
-- John Harper, School of Mathematics, Statistics and Computer Science,
Victoria University, PO Box 600, Wellington 6140, New Zealand
e-mail john.harper@vuw.ac.nz phone (+64)(4)463 5341 fax (+64)(4)463 5045
| |
| ben_nielsen20@yahoo.com 2007-04-23, 7:05 pm |
| Does anyone know why this program won't run?:
c version 1, 01-Nov-2001
c Calculate real temperature variation at a given frequency
c for a silicon plate heated by a thin metal strip.
c The calculation can be applied to plates composed of
c material other than silicon if the thermal conductivity
c and thermal diffusivity of that material are substituted
c in the indicated lines below.
c This is used for analyzing data obtained by the 3 omega
c method
c
c library routine 'dqagi' used for integration
c --------------------------------------------------------
c A data file named 'input.par' written in ASCII is needed
c
c A sample file is given in section A2. Just substitute data
c in the appropriate lines. Double precision is used.
c
c Function Fcomplex is written for a two layer system. The
c main program defines one of these layers as having zero
c thickness and having the same material parameters as
c the other layer.
c --------------------------------------------------------
c Nomenclature (not necessarily the same as in the standard)
c D =diffusivity
c k =conductivity
c L =substrate thickness
c lnth=heater length
c b =heater half-width
c b2 =heater full width
c w =angular frequency at 2 omega
c f =fundamental frequency
c f2 =frequency at 2 omega
c q =power input to specimen
c T =measurement temperature
c tr =substrate temperature signal at 2 omega
c
c --------------------------------------------------------
c define integration parameters for dqagi
double precision, external :: fr
c
double precision, parameter :: bound=0.d0
double precision, parameter :: epsabs=1.d-6
double precision, parameter :: epsrel=1.d-12
integer, parameter :: inf=1
integer, parameter :: limit=1000
integer, parameter :: lenw=limit*4
integer, parameter :: idim=2
c
double precision result, abserr, work(lenw), T
double precision f, f2, b2
integer neval, ier, last, iwork(limit)
character*30, label
c --------------------------------------------------------
c common variables
double precision w, b
double precision d(idim), k(idim), L(idim)
common w, d, k, L, b
c
double precision q, pi
double precision tr, lnth
c
1 format(A12)
2 format(A30)
3 format(6(1x,d13.6))
4 format(1x,A33,D12.4)
c --------------------------------------------------------
pi=4.d0*atan(1.d0)
c --------------------------------------------------------
open(1,file='input.par')
c
read (1,2)
read(1,2) label ; read(1,*) f
read(1,2) label ; read(1,*) q
read(1,2) label ; read(1,*) b2
read(1,2) label ; read(1,*) lnth
read(1,2) label ; read(1,*) L(1)
read(1,2) label ; read(1,*) T
c
f2=2*f
w=2.d0*pi*f2
b=b2/2.d0
c ++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++
c The thermal conductivity of Si as a function of
c temperature is computed in the line 90 below. If another
c material is wanted, replace line 90
90 k(1)=1.685d0-8.73d-3*T+3.62d-5*T*T-9.0d-8*T*T*T
c The thermal diffusivity of Si as a function of the
c thermal conductivity of Si is computed in line 96 below.
c If another material is wanted, replace line 96.
96 D(1)=0.093d0+0.268d0*k(1)+0.180d0*k(1)*k(1)
c ++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++
write(*,4)'thermal conductivity of Si, W/cm/K ', k(1)
write(*,4)'thermal diffusivity of Si, cm2/s ', D(1)
k(2)=k(1)
D(2)=D(1)
L(2)=0.d0
c
c --------------------------------------------------------
c Calculate the temperature variation
c
c calculate average temperature (real and imaginary) using
c dqagi
c
call dqagi(fr, bound, inf, epsabs, epsrel,
*result, abserr, neval, ier, limit, lenw, last, iwork, work)
if (ier.gt.0) then
call list(bound, inf, epsabs, epsrel,
* result, abserr, neval, ier, limit, lenw, last, 'fr')
end if
c
tr=result*q/pi/lnth
c
write(*,4) 'substrate thermal signal ', tr
c --------------------------------------------------------
close(2)
end
c
c ****************************************
***************
function fr(x)
c real part of integrand for dqagi
double precision x, fr
complex*8 fcomplex
c
fr=real(fcomplex(x))
return
end function fr
c
c ****************************************
***************
function fcomplex(x)
c
c complex integrand for 2 layers in vacuum
c
c common variables
double precision w, b
double precision d(2), k(2), L(2)
common w, d, k, L, b
c
double precision x
complex*8 u(2), ea1, ea2
complex*8 ci, gp, gm, ex1, ex2, bp, bm, ftr, fcomplex
c
ci=(0,1.d0)
u(1)=sqrt(x*x-ci*w/d(1))
u(2)=sqrt(x*x-ci*w/d(2))
gp=u(1)*k(1)+u(2)*k(2)
gm=u(1)*k(1)-u(2)*k(2)
ea1= 2.d0*u(1)*L(1)
if (real(ea1).gt.160) then
ex1=0.d0
else
ex1= exp(-ea1)
end if
ea2= 2.d0*u(2)*L(2)
if (real(ea2).gt.160) then
ex2=0.d0
else
ex2= exp(-ea2)
end if
bp=(gp*ex2 + gm)*ex1
bm=(gm*ex2 + gp)
ftr=(bm+bp)/(bm-bp)/u(1)/k(1)
if(x.eq.0.d0) then
fcomplex=ftr
else
fcomplex=ftr*sin(x*b)*sin(x*b)/x/x/b/b
end if
c print*,'end of fcomplex'
return
end function fcomplex
c
c ****************************************
***************
subroutine list(bound, inf, epsabs, epsrel,
* result, abserr, neval, ier, limit, lenw, last, ri)
c
double precision bound, epsabs, epsrel, result, abserr
integer inf, limit, lenw, neval, ier, last
character*2 ri
c
print*,'list parameters from dqagi call to ', ri
print*, 'epsabs=', epsabs
print*, 'epsrel=', epsrel
print*, ' limit=', limit
print*, 'result=', result
print*, ' neval=', neval
print*, ' ier=', ier
print*, ' last=', last
print*, ' '
return
end subroutine list
c ****************************************
***************
Is it a problem with the way I'm saving it in Notepad? If I save it
as an ANSI file I get this error:
C:\gfortran\bin>gfortran 3omega.f
gfortran: CreateProcess: No such file or directory
If I save it as Unicode I get this error:
C:\GFORTRAN\BIN>gfortran 3omega.f
3omega.f:1.1:
\xFF\xFEc version 1, 01-Nov-2001
1
Error: Non-numeric character in statement label at (1)
3omega.f:1.2:
\xFF\xFEc version 1, 01-Nov-2001
1
Error: Invalid character in name at (1)
Thanks,
Ben
| |
| ben_nielsen20@yahoo.com 2007-04-23, 7:05 pm |
| Thanks everyone for your help, but unfortunately I still haven't been
able to get my program to run. Can anyone tell me why it won't run as
it appears below? Is it a problem with the way I'm saving it in
Notepad?
If I save it as an ANSI file I get this error:
C:\gfortran\bin>gfortran 3omega.f
gfortran: CreateProcess: No such file or directory
If I save it as a Unicode file I get this error:
C:\gfortran\bin>gfortran 3omega.f
3omega.f:1.1:
\xFF\xFEc version 1, 01-Nov-2001
1
Error: Non-numeric character in statement label at (1)
3omega.f:1.2:
\xFF\xFEc version 1, 01-Nov-2001
1
Error: Invalid character in name at (1)
c version 1, 01-Nov-2001
c Calculate real temperature variation at a given frequency
c for a silicon plate heated by a thin metal strip.
c The calculation can be applied to plates composed of
c material other than silicon if the thermal conductivity
c and thermal diffusivity of that material are substituted
c in the indicated lines below.
c This is used for analyzing data obtained by the 3 omega
c method
c
c library routine 'dqagi' used for integration
c --------------------------------------------------------
c A data file named 'input.par' written in ASCII is needed
c
c A sample file is given in section A2. Just substitute data
c in the appropriate lines. Double precision is used.
c
c Function Fcomplex is written for a two layer system. The
c main program defines one of these layers as having zero
c thickness and having the same material parameters as
c the other layer.
c --------------------------------------------------------
c Nomenclature (not necessarily the same as in the standard)
c D =diffusivity
c k =conductivity
c L =substrate thickness
c lnth=heater length
c b =heater half-width
c b2 =heater full width
c w =angular frequency at 2 omega
c f =fundamental frequency
c f2 =frequency at 2 omega
c q =power input to specimen
c T =measurement temperature
c tr =substrate temperature signal at 2 omega
c
c --------------------------------------------------------
c define integration parameters for dqagi
double precision, external :: fr
c
double precision, parameter :: bound=0.d0
double precision, parameter :: epsabs=1.d-6
double precision, parameter :: epsrel=1.d-12
integer, parameter :: inf=1
integer, parameter :: limit=1000
integer, parameter :: lenw=limit*4
integer, parameter :: idim=2
c
double precision result, abserr, work(lenw), T
double precision f, f2, b2
integer neval, ier, last, iwork(limit)
character*30, label
c --------------------------------------------------------
c common variables
double precision w, b
double precision d(idim), k(idim), L(idim)
common w, d, k, L, b
c
double precision q, pi
double precision tr, lnth
c
1 format(A12)
2 format(A30)
3 format(6(1x,d13.6))
4 format(1x,A33,D12.4)
c --------------------------------------------------------
pi=4.d0*atan(1.d0)
c --------------------------------------------------------
open(1,file='input.par')
c
read (1,2)
read(1,2) label ; read(1,*) f
read(1,2) label ; read(1,*) q
read(1,2) label ; read(1,*) b2
read(1,2) label ; read(1,*) lnth
read(1,2) label ; read(1,*) L(1)
read(1,2) label ; read(1,*) T
c
f2=2*f
w=2.d0*pi*f2
b=b2/2.d0
c ++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++
c The thermal conductivity of Si as a function of
c temperature is computed in the line 90 below. If another
c material is wanted, replace line 90
90 k(1)=1.685d0-8.73d-3*T+3.62d-5*T*T-9.0d-8*T*T*T
c The thermal diffusivity of Si as a function of the
c thermal conductivity of Si is computed in line 96 below.
c If another material is wanted, replace line 96.
96 D(1)=0.093d0+0.268d0*k(1)+0.180d0*k(1)*k(1)
c ++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++
write(*,4)'thermal conductivity of Si, W/cm/K ', k(1)
write(*,4)'thermal diffusivity of Si, cm2/s ', D(1)
k(2)=k(1)
D(2)=D(1)
L(2)=0.d0
c
c --------------------------------------------------------
c Calculate the temperature variation
c
c calculate average temperature (real and imaginary) using
c dqagi
c
call dqagi(fr, bound, inf, epsabs, epsrel,
*result, abserr, neval, ier, limit, lenw, last, iwork, work)
if (ier.gt.0) then
call list(bound, inf, epsabs, epsrel,
* result, abserr, neval, ier, limit, lenw, last, 'fr')
end if
c
tr=result*q/pi/lnth
c
write(*,4) 'substrate thermal signal ', tr
c --------------------------------------------------------
close(2)
end
c
c ****************************************
***************
function fr(x)
c real part of integrand for dqagi
double precision x, fr
complex*8 fcomplex
c
fr=real(fcomplex(x))
return
end function fr
c
c ****************************************
***************
function fcomplex(x)
c
c complex integrand for 2 layers in vacuum
c
c common variables
double precision w, b
double precision d(2), k(2), L(2)
common w, d, k, L, b
c
double precision x
complex*8 u(2), ea1, ea2
complex*8 ci, gp, gm, ex1, ex2, bp, bm, ftr, fcomplex
c
ci=(0,1.d0)
u(1)=sqrt(x*x-ci*w/d(1))
u(2)=sqrt(x*x-ci*w/d(2))
gp=u(1)*k(1)+u(2)*k(2)
gm=u(1)*k(1)-u(2)*k(2)
ea1= 2.d0*u(1)*L(1)
if (real(ea1).gt.160) then
ex1=0.d0
else
ex1= exp(-ea1)
end if
ea2= 2.d0*u(2)*L(2)
if (real(ea2).gt.160) then
ex2=0.d0
else
ex2= exp(-ea2)
end if
bp=(gp*ex2 + gm)*ex1
bm=(gm*ex2 + gp)
ftr=(bm+bp)/(bm-bp)/u(1)/k(1)
if(x.eq.0.d0) then
fcomplex=ftr
else
fcomplex=ftr*sin(x*b)*sin(x*b)/x/x/b/b
end if
c print*,'end of fcomplex'
return
end function fcomplex
c
c ****************************************
***************
subroutine list(bound, inf, epsabs, epsrel,
* result, abserr, neval, ier, limit, lenw, last, ri)
c
double precision bound, epsabs, epsrel, result, abserr
integer inf, limit, lenw, neval, ier, last
character*2 ri
c
print*,'list parameters from dqagi call to ', ri
print*, 'epsabs=', epsabs
print*, 'epsrel=', epsrel
print*, ' limit=', limit
print*, 'result=', result
print*, ' neval=', neval
print*, ' ier=', ier
print*, ' last=', last
print*, ' '
return
end subroutine list
c ****************************************
***************
| |
| Brooks Moses 2007-04-23, 7:05 pm |
| ben_nielsen20@yahoo.com wrote:
> Thanks everyone for your help, but unfortunately I still haven't been
> able to get my program to run. Can anyone tell me why it won't run as
> it appears below? Is it a problem with the way I'm saving it in
> Notepad?
>
> If I save it as an ANSI file I get this error:
>
> C:\gfortran\bin>gfortran 3omega.f
> gfortran: CreateProcess: No such file or directory
This looks like an installation problem of some sort. The "gfortran"
program calls a number of other programs to do the actual compilation,
assembly, and linking. The error for the Unicode file indicates that
the compilation part is running correctly, but perhaps the assembler or
linker hasn't been installed.
At a rough guess, perhaps there's a MinGW "binutils" package that
GFortran depends on, which you haven't installed?
If you try compiling a basic "Hello, World" program, do you get the same
error?
> If I save it as a Unicode file I get this error:
>
> C:\gfortran\bin>gfortran 3omega.f
> 3omega.f:1.1:
>
> \xFF\xFEc version 1, 01-Nov-2001
> 1
> Error: Non-numeric character in statement label at (1)
> 3omega.f:1.2:
>
> \xFF\xFEc version 1, 01-Nov-2001
> 1
> Error: Invalid character in name at (1)
This is the expected error; GFortran doesn't currently understand
Unicode files.
- Brooks
--
The "bmoses-nospam" address is valid; no unmunging needed.
| |
|
| > If I save it as an ANSI file
This is the right thing to do.
> I get this error:
>
> C:\gfortran\bin>gfortran 3omega.f
> gfortran: CreateProcess: No such file or directory
This is an unexpected error. Can you indicate which gfortran version you
have (output of "gfortran -v") and what is the setting of your PATH
environment variable (quoting from memory, this should be given by "set
PATH")?
That bug has been reported and I thought I had it fixed in recent
binaries ("recent" meaning "less than two w s old").
--
FX
| |
| ben_nielsen20@yahoo.com 2007-04-23, 7:05 pm |
|
>
>
> This looks like an installation problem of some sort. The "gfortran"
> program calls a number of other programs to do the actual compilation,
> assembly, and linking. The error for the Unicode file indicates that
> the compilation part is running correctly, but perhaps the assembler or
> linker hasn't been installed.
>
> At a rough guess, perhaps there's a MinGW "binutils" package that
> GFortran depends on, which you haven't installed?
>
> If you try compiling a basic "Hello, World" program, do you get the same
> error?
The problem is with my compiler- it won't even run a simple
program...guess I should have checked this before. I'll try to
download another one and see what happens.
| |
| Beliavsky 2007-04-23, 7:05 pm |
| On Apr 23, 4:51 pm, ben_nielse...@yahoo.com wrote:
>
> The problem is with my compiler- it won't even run a simple
> program...guess I should have checked this before. I'll try to
> download another one and see what happens.
I suggest trying Mingw g95 . If you install it and cannot compile
Hello World even after perusing the readme.txt file found in the
installation, please post to g95 newsgroup http://groups.google.com/group/gg95
.. Based on earlier comments, you need a text editor that is good for
Fortran code (indents blocks and colors keywords, for example). XEmacs
and Emacs have Fortran 90 (free source form) modes. You can Google
this newsgroup or the web for other recommendations of text editors.
Once you're in business you have lots of fun with the OTPL :).
| |
| ben_nielsen20@yahoo.com 2007-04-23, 7:05 pm |
|
> This is an unexpected error. Can you indicate which gfortran version you
> have (output of "gfortran -v") and what is the setting of your PATH
> environment variable (quoting from memory, this should be given by "set
> PATH")?
>
> That bug has been reported and I thought I had it fixed in recent
> binaries ("recent" meaning "less than two w s old").
>
> --
> FX
C:\gfortran\bin>gfortran -v
Using built-in specs.
Target: i386-pc-mingw32
Configured with: ../trunk/configure --prefix=/mingw --enable-
languages=c,fortran
--with-gmp=/home/coudert/local --disable-nls --with-ld=/mingw/bin/ld
--with-as=
/mingw/bin/as --disable-werror --enable-bootstrap --enable-threads --
build=i386-
pc-mingw32 --disable-shared --enable-libgomp
Thread model: win32
gcc version 4.3.0 20070416 (experimental)
| |
| ben_nielsen20@yahoo.com 2007-04-23, 7:05 pm |
|
> I suggest trying Mingw g95 .
I was able to compile with G95.
| |
|
| >> and what is the setting of your PATH environment variable (quoting
>
> C:\gfortran\bin>gfortran -v
OK, I understand. Is C:\gfortran\bin in your PATH? Does it work better if
you run it from another directory?
--
FX
| |
|
|
|
|
|