Program in FORTRAN which calculate the detection efficiency

Click For Summary

Discussion Overview

The discussion revolves around writing a FORTRAN program to calculate the detection efficiency for both a punctual source and a disc source at a distance from a detector. The focus includes efficiency as a function of various parameters such as detector radius, source-detector distance, and source radius, while working within a 3D spherical coordinate system.

Discussion Character

  • Technical explanation
  • Homework-related
  • Debate/contested

Main Points Raised

  • The original poster (OP) shares a FORTRAN code snippet aimed at calculating detection efficiency but seeks assistance with the program.
  • Some participants request clarification on the specific help the OP needs, questioning whether the issue lies in understanding the code or in getting it to run.
  • Another participant notes that the variable Dds has not been initialized, which could lead to issues in the program.

Areas of Agreement / Disagreement

Participants generally agree on the need for proper syntax in the code and the importance of initializing variables. However, there is no consensus on the specific nature of the OP's problem or the exact assistance required.

Contextual Notes

Limitations include the lack of initialization for certain variables and unresolved syntax errors in the provided code, which may affect the program's functionality.

inesnoussa
Messages
3
Reaction score
0
Hi everyone,
I want to write a program in FORTRAN which calculate the detection efficiency for a punctual source and a disc source at a distance from the detector .The disc detector is assumed to be perfect: ie photon absorbing everything that falls on it. So here I am working in 3D and I use ux, uy and uz to lead the photon randomly using the spherical coordinate system

a) efficiency vs the detector radius
b) efficiency as a function of source detector distance
c) efficiency according to the radius of the source
Here's the code that I am trying to write for a point source;

program sourceponc

integer i,N
real x,y,z,eff,count,Dds,rd,ux,uy,uz,tcount=0
do i=1,N

theta = acos(1-2*rand())
phi = 2*pi*rand()
ux=cos(theta)sin(phi)
uy=sin(theta)sin(phi)
uz=cos(theta)
t=Dds/uz
x=ux*t
y=uy*t

if(sqrt(x**2+y**2+z**2).le.1)then
count=count+1
endif
end do
eff=count/N
print*,eff
end
There's someone there who could help me ? Thank you in advance
 
Technology news on Phys.org
When posting code you have written, please use the code tags to enclose the actual source statements.

It's not clear from the OP what help you are seeking. Is there some problem getting this code to run? Are you having trouble writing the program.

PF will help you if you are having a problem understanding the statements in a programming language or you are experiencing difficulty in getting a program to run. We will not write the program for you.
 
What SteamKing said.

Also, you have not initialized Dds.
 
Hi,
the problem here is that i keep getting these error while compiling:

sourceponc.f90:11:

ux=cos(theta)sin(phi) 1 Error: Unclassifiable statement at (1) sourceponc.f90:12:

uy=sin(theta)sin(phi) 1 Error: Unclassifiable statement at (1)
 
inesnoussa said:
Hi,
the problem here is that i keep getting these error while compiling:

sourceponc.f90:11:

ux=cos(theta)sin(phi) 1 Error: Unclassifiable statement at (1) sourceponc.f90:12:

uy=sin(theta)sin(phi) 1 Error: Unclassifiable statement at (1)

The compiler is having trouble deciphering this statement. You are missing an arithmetic operator (+ - * /) between sin(theta) and sin(phi). You can't just cram two terms together like this without an arithmetic operator in between.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 23 ·
Replies
23
Views
3K
  • · Replies 26 ·
Replies
26
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K
Replies
26
Views
5K
  • · Replies 89 ·
3
Replies
89
Views
6K
Replies
6
Views
4K
Replies
11
Views
16K