FW: RE: [fluka-discuss]: source.f-read file

From: Vasilis Vlachoudis <Vasilis.Vlachoudis_at_cern.ch>
Date: Thu, 12 Jun 2014 07:05:09 +0000

Dear Yanyanlin,

please do not send the emails personally but to the FLUKA discuss list.

The problem is that you are reading a new line for every primary particle. The START card asks for 2500 particles, so after the first 25 particles there is nothing more to read.
The best way is to read the file once inside the block
IF (LFIRST) THEN
,,,
END IF
and store it in arrays XSPOT, YSPOT, ISPOT

and later in the source, for every primary particle sample a random position from
the array

N = INT(FLRNDM()*NSPOT) + 1
X = XSPOT(N)
Y = YSPOT(N)
...

One last point was that the IUNIT variable I mention before was to be used for all I/O e.g.
READ(IUNIT,...)
instead of
READ(21,...)

Best Regards
Vasilis Vlachoudis
Dep EN, CERN
CH-1211 GENEVA 23
SWITZERLAND

Phone: +41-22 767 9851
GSM: +41-76 487 4378
Fax: +41-22 766 9644

________________________________
From: 闫渊林 [yanyuanlin_at_impcas.ac.cn]
Sent: 12 June 2014 06:44
To: Vasilis Vlachoudis
Subject: Re: RE: [fluka-discuss]: source.f-read file


Dear Vasilis,

Thank your for your advice.It has helt me.But now my routine can't running successfully.I'm not sure if the data file format is wrong though i have test the data file and fortran statement :
        k=0
 20 READ(21,10,IOSTAT=IV)X(K),Y(K),INUM(K)
        K=K+1
 10 FORMAT(F7.3,1X,F7.3,1X,I4)
        IF(IV.EQ.0) GOTO 20
in a indepented routine,and the test result is right.Can you tell where the wrong is?Thank you!

Yanyuanlin

-----原始邮件-----
发件人: "Vasilis Vlachoudis" <Vasilis.Vlachoudis_at_cern.ch>
发送时间: 2014年6月10日 星期二
收件人: "闫渊林" <yanyuanlin_at_impcas.ac.cn>, "fluka-discuss_at_fluka.org" <fluka-discuss_at_fluka.org>
抄送:
主题: RE: [fluka-discuss]: source.f-read file

Hi again,

You can use the OAUXFI routine
CALL OAUXFI(FILENAME, IONUMBER, STATUS(NEW,OLD,UNKNOWN...), IERR)
e.g.
CALL OAUXFI('filename.dat', 21, 'OLD', IERR)

For me the most preferable way is to add an OPEN card in the input file

OPEN 21 OLD
filename.dat

then pass the unit as what(1) in SOURCE card in your input

SOURCE 21

and from the source.f you can get the unit
as iunit = NINT(WHASOU(1))

It allows you to modify the file/unit from the input without the need to recompile your source code.

Vasilis.

________________________________
From: owner-fluka-discuss_at_mi.infn.it<mailto:owner-fluka-discuss_at_mi.infn.it> [owner-fluka-discuss_at_mi.infn.it<mailto:owner-fluka-discuss_at_mi.infn.it>] on behalf of 闫渊林 [yanyuanlin_at_impcas.ac.cn<mailto:yanyuanlin_at_impcas.ac.cn>]
Sent: 10 June 2014 05:27
To: fluka-discuss_at_fluka.org<mailto:fluka-discuss_at_fluka.org>
Subject: [fluka-discuss]: source.f-read file



Dear FLUKA experts,

I'm using the source.f which will read a data file.But if the open(21,file=file's absolute path way),fluka can't run.If file=relative path way,where should I put the data file?

 Best Wish!
Yanyuanlin






Received on Thu Jun 12 2014 - 10:37:41 CEST

This archive was generated by hypermail 2.3.0 : Thu Jun 12 2014 - 10:37:44 CEST