Re: [fluka-discuss]: magfld subroutine - did I do it right?

From: Giuseppe Battistoni <giuseppe.battistoni_at_mi.infn.it>
Date: Thu, 4 Aug 2016 16:57:13 +0200

-------- Forwarded Message --------
Subject: Re: [fluka-discuss]: magfld subroutine - did I do it right?
Date: Thu, 4 Aug 2016 16:56:43 +0200
From: Giuseppe Battistoni <giuseppe.battistoni_at_mi.infn.it>
To: mjm_at_jlab.org

No, the use of a source.f routine (invoked by adding
the SOURCE card), is a completely independent thing.
That routine generates the initial (primary) kinematics in those
cases in which the standard BEAM, BEAMPOS, etc. cards are not
enough

        GB

On 04/08/16 16:52, mjm_at_jlab.org wrote:
> Thanks for the input. Once the subroutine is made, are there any other
> steps needed for it to be added to the input file? In flair, I added the
> MGNFIELD card, then went to the Compile tab and added the magfld.f
> subroutine, but one of the tutorials I found about subroutines mentioned
> adding a SOURCE card? Is that necessary?
>
>> Hello
>> a couple of advices:
>> 1) the OPEN file is correct apart from the fact that you need to assign
>> numerical value (between 21 and 99) to U variable (so to assign the
>> fortran logic unit).
>> For istance, U = 98.
>>
>> However, using OPEN in this way, the B map file will be searched in the
>> same directory where fluka is running, i.e. in the temporary directory
>> created by rfluka script.
>> You have either to give an absolute path to search for the file
>> to be readout, or, alternatively, you can use a special
>> FLUKA routine: OAUXFI (Open AUxiliary File) which automatically searches
>> for the file in the working directory (the one from which you launch the
>> run), or in the $FLUPRO directory or in your home directory.
>> The sintax would be:
>> U = 98
>> ALL OAUXFI('magfld.txt',U,'OLD',IERR)
>> where IERR is an integer output variable returning 0 is the file
>> is found and correctly opened.
>>
>> 2) you search for the nearest integer on the basis of X,Y,Z coordinate.
>> In any case you should make some checks to protect yourself from the
>> possibility of getting an index greater to the maximum dimension
>> of the BX,BY,BZ errors. That would produce a run-time error.
>> A part from this, with such a method you will get a non-continuos
>> dependence of B on the coordinates. It can be acceptable in some case,
>> but you could instead make a better job and spend some time trying
>> to find the closest points in X, Y and Z and perform ab interpolation. A
>> linear (or I should say trilinear) interpolation would be enough to have
>> a smooth dependence of B on the
>> three space coordinates.
>> Surely you can find in the web examples of algorithms to perform
>> interpolation.
>>
>> Cheers
>> Giuseppe Battistoni
>>
>> On 03/08/16 22:15, mjm_at_jlab.org wrote:
>>> I've been brushing up on my Fortran in order to make a magfld subroutine
>>> for a non-uniform magnetic field, using data from a file given to me by
>>> my
>>> supervisor. I just wanted to get some input from more experienced FLUKA
>>> users before I tried adding it to Flair, to make sure it looks okay.
>>> Please let me know if it looks okay, or if you see any problems with it.
>>> Thanks in advance.
>>>
>>
>> --
>> INFN Milano
>> via Celoria 16, 20133 Milano
>> tel: +39 02 50317307
>> fax: +39 02 50317617
>>
>> __________________________________________________________________________
>> You can manage unsubscription from this mailing list at
>> https://www.fluka.org/fluka.php?id=acc_info
>>
>

-- 
INFN Milano
via Celoria 16, 20133 Milano
tel: +39 02 50317307
fax: +39 02 50317617
__________________________________________________________________________
You can manage unsubscription from this mailing list at https://www.fluka.org/fluka.php?id=acc_info
Received on Thu Aug 04 2016 - 18:22:30 CEST

This archive was generated by hypermail 2.3.0 : Thu Aug 04 2016 - 18:22:33 CEST