[mcstas-users] Problem of Virtual-output/input

wokaoyan1981 wokaoyan1981 at 126.com
Fri Aug 8 08:00:15 CEST 2008


Hello Emmanuel,


Thank you for your reply.I do not use network disk. I just output to local computer. Taking notice of the neutron file "DataAfterMono_list.p.x.y.z.vx.vy.vz.t.sx.sy.sz", it approximates 1.2GB including  17417317 events (all)! Is it the reason why it takes a long time to "Virtual_input" neutron file? 

The codes to generate data is as the following:
/*******************************************************************************
*
* %Parameters
* dist:       [m]    focusing distance from source to SlitIn
* GapM2_G:    [m]    distance between M2Exit and guide entrance
* xw:         [m]    width of neutron guide entrance
* yh:         [m]    height of neutron guide entrance
* l:          [m]    length of straight neutron guide
* m:          [1]    multiplication factor
* CH1:        [']    horizontal divergence of the first collimator
* len_C1      [m]    length of the first collimator
* L1:         [m]    distance between first collimator exit and mono,0.01~0.3AA
* lambda:     [Angs] Wavelength at monochromator,value:1.2~3
* DM:         [Angs] d-spacing of monochromator
* NH:         [columns]   number of horizontal slabs
* NV:         [columns}   number of vertical slabs
* mosaich:    [']    horizontal mosaics
* mosaicv:    [']    vertical mosaics
* RV:         [m]    Monochromator vertical curvature, 0 for flat, -1 for automatic
*                    setting(then RV=2*L2*sin(DEG2RAD*A1) )
* RH:         [m]    Monochromator horizontal curvature, 0 for flat, -1 for automatic
*                    setting(then  RH = 2*L2/sin(DEG2RAD*A1))
* L2:         [m]    distance between mono and sample
* %Link
* A reference/HTML link for more information
*
* %End
*******************************************************************************/
/* Change name of instrument and input parameters with default values */
DEFINE INSTRUMENT residual_stress(
   dist=4.049, GapM2_G=0, xw=0.06, yh=0.11, l=6, m=2, CH1=10, 
   L1=0.3, A1=30, DM=3.355, len_C1=0.6, NH=1, NV=15, mosaich=25,mosaicv=25,
   RV=-1, RH=0, L2=1.9) 
/* The DECLARE section allows us to declare variables or  small      */
/* functions in C syntax. These may be used in the whole instrument. */

DECLARE
%{
double M2Exit_mono; /* distance between M2Exit and monochromator */
double lambda; /*wavelength after diffraction*/
double monow; /*width of mono*/ 
%}

/* The INITIALIZE section is executed when the simulation starts     */
/* (C code). You may use them as component parameter values.         */
INITIALIZE
%{
M2Exit_mono=GapM2_G+l+len_C1+L1;
lambda=2*DM*sin(DEG2RAD*A1);
if (RV<0) RV=2*L2*sin(DEG2RAD*A1);
if (RH<0) RH = 2*L2/sin(DEG2RAD*A1);
monow=xw/sin(DEG2RAD*A1);
printf("\nlambda=%f\tRV=%f\tRH=%f\tmonow=%f\n",lambda,RV,RH,monow); 
%}

/* Here comes the TRACE section, where the actual      */
/* instrument is defined as a sequence of components.  */
TRACE
/* Progress_bar is an Arm displaying simulation progress.*/
COMPONENT Origin = Progress_bar()
  AT (0,0,0) ABSOLUTE
/********************* reactor source********************************/
COMPONENT Source = Source_Maxwell_3(
    height = 0.11, width =0.06 , 
    l_low =0.2,l_high =7,               
    dist = dist,                         
    xw = 0.08, yh = 0.13,
    T1 = 320,I1 =9.87E12) 
   AT (0, 0, 0)  RELATIVE Origin
/***********thermal channel,4.049m*110mm*60mm********/
COMPONENT SlitIn = Slit(
    width = 0.06, height = 0.11)
  AT (0, 0, 0 ) RELATIVE  Source
COMPONENT M2Exit = Slit(
    width = 0.06, height = 0.11)
  AT (0, 0, 4.049 ) RELATIVE SlitIn 
 /************************straightguide*******************/
COMPONENT straight_guide = Guide(
    w1 = xw, h1 = yh, w2 = xw, h2 = yh, l =l, m = m)
  AT (0, 0, GapM2_G) RELATIVE M2Exit
/**********************first collimator**********************/
COMPONENT collimator1 = Collimator_linear(
    xmin = -xw/2, xmax = xw/2, ymin = -yh/2, ymax = yh/2,
    len = len_C1, divergence = CH1)
  AT (0, 0, l) RELATIVE straight_guide
/************************mono_craddle*************************/
COMPONENT mono_craddle = Arm(
    )
  AT (0, 0, M2Exit_mono) RELATIVE M2Exit
  ROTATED (0, A1, 0) RELATIVE Origin
/***************************monochromator****************************/
COMPONENT monochromator = Monochromator_curved(
    width=monow, height=0.13, NH=NH, NV=NV,reflect = "HOPG.rfl", transmit = "HOPG.trm",
    gap = 0.0005,  mosaich = mosaich, mosaicv = mosaicv, r0 = 1, 
    t0 = 1.0, RV = RV, RH = RH, DM = DM)
  AT (0, 0, 0) RELATIVE mono_craddle
/*********************mono_out*******************/
COMPONENT mono_out = Arm(
    )
  AT (0, 0, 0) RELATIVE mono_craddle
  ROTATED (0, +2*A1, 0) RELATIVE Origin
/******************psd_after_mono********************/
COMPONENT psd_after_mono = PSD_monitor(
    nx = 90, ny =90, filename = "psd_after_mono ",
    xwidth =0.2, yheight =0.2)
  AT (0, 0, 0.4) RELATIVE mono_out
/********************Virtual_output*********************/
COMPONENT DataAfterMono = Virtual_output(
    file = "DataAfterMono")
  AT (0, 0, 0.4) RELATIVE mono_out
/* This section is executed when the simulation ends (C code). Other    */
/* optional sections are : SAVE                                         */
FINALLY
%{
%}
/* The END token marks the instrument definition end */
END

I run it with ncount=1E8, Scilab on another computer(XP platform).It needs 14.2667 minutes.

Under the same directory, I run the split simulation with repeat=1,lenC2=0.45 and ncout=1E8, Scilab. It takes 
/*******************************************************************************
* %Parameters
* repeat: [1] repeat count
* lenC2:      [m] length of collimator 2
* %Link
* A reference/HTML link for more information
*
* %End
*******************************************************************************/
/* Change name of instrument and input parameters with default values */
DEFINE INSTRUMENT test(repeat=1,lenC2)

/* The DECLARE section allows us to declare variables or  small      */
/* functions in C syntax. These may be used in the whole instrument. */
DECLARE
%{
%}

/* The INITIALIZE section is executed when the simulation starts     */
/* (C code). You may use them as component parameter values.         */
INITIALIZE
%{
%}

/* Here comes the TRACE section, where the actual      */
/* instrument is defined as a sequence of components.  */
TRACE

COMPONENT SourceAfterMono = Virtual_input(
    file = "DataAfterMono_list.p.x.y.z.vx.vy.vz.t.sx.sy.sz", repeat_count = repeat)
  AT (0,0,0) ABSOLUTE

COMPONENT PsdAtEntrance = PSD_monitor(
    filename = "PsdAtEntrance", xwidth = 0.2, yheight = 0.2)
  AT (0, 0, 1.35-lenC2) RELATIVE SourceAfterMono

/* This section is executed when the simulation ends (C code). Other    */
/* optional sections are : SAVE                                         */
FINALLY
%{
%}
/* The END token marks the instrument definition end */
END

Looking forward to your reply!

Regards,
Tom











 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman2.mcstas.org/pipermail/mcstas-users/attachments/20080808/414f699d/attachment.html>
-------------- next part --------------
_______________________________________________
mcstas-users mailing list
mcstas-users at mcstas.org
http://mailman.mcstas.org/cgi-bin/mailman/listinfo/mcstas-users


More information about the mcstas-users mailing list