Changeset 3064 for branches

Show
Ignore:
Timestamp:
05/04/11 00:19:39 (13 months ago)
Author:
farhi
Message:

optics/FC: fixed error when computing automatic phase
monitors/Mon_nD: fixed bugs reported by Lambert with disk hape
example/TAS: Source stuff is not removable, for e.g. IN22 (%include)

Location:
branches/mcstas-1.x/lib
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • branches/mcstas-1.x/lib/examples/templateTAS.instr

    r2876 r3064  
    22* 
    33* McStas, neutron ray-tracing package 
    4 *         Copyright (C) 1997-2008, All rights reserved 
     4*         Copyright (C) 1997-2010, All rights reserved 
    55*         Risoe National Laboratory, Roskilde, Denmark 
    66*         Institut Laue Langevin, Grenoble, France 
     
    1212* Date: 2006 
    1313* Origin: <a href="http://www.ill.fr">ILL (France)</a> 
    14 * Release: McStas 1.12 
     14* Release: McStas 1.12b 
    1515* Version: $Revision: 1.6 $ 
    1616* %INSTRUMENT_SITE: Templates 
     
    441441 
    442442/* geometry tests w/r to collimator lengths */ 
    443 if (machine_hkl.l1 <= 5.34) 
    444   exit(fprintf(stderr, "%s: ERROR: L1 too short. Min=5.34\n", NAME_CURRENT_COMP)); 
     443if (machine_hkl.l1 <= 1) 
     444  exit(fprintf(stderr, "%s: ERROR: L1 too short. Min=1\n", NAME_CURRENT_COMP)); 
    445445 
    446446if (machine_hkl.l2 <= 0.35) 
     
    463463double L; 
    464464L = 1/(1/L1+1/L2); 
    465 if (RMV < 0) machine_real.rmv = 2*L*sin(DEG2RAD*machine_real.a1); 
    466 if (RMH < 0) machine_real.rmh = 2*L/sin(DEG2RAD*machine_real.a1); 
     465if (RMV < 0) machine_real.rmv = fabs(2*L*sin(DEG2RAD*machine_real.a1)); 
     466if (RMH < 0) machine_real.rmh = fabs(2*L/sin(DEG2RAD*machine_real.a1)); 
    467467L = 1/(1/L3+1/L4); 
    468 if (RAV < 0) machine_real.rav = 2*L*sin(DEG2RAD*machine_real.a5); 
    469 if (RAH < 0) machine_real.rah = 2*L/sin(DEG2RAD*machine_real.a5); 
     468if (RAV < 0) machine_real.rav = fabs(2*L*sin(DEG2RAD*machine_real.a5)); 
     469if (RAH < 0) machine_real.rah = fabs(2*L/sin(DEG2RAD*machine_real.a5)); 
    470470 
    471471if (verbose) { 
     
    481481    machine_hkl.da, machine_real.rah, machine_real.rav, 
    482482    (!machine_real.rah && !machine_real.rav ? "flat" : "curved")); 
     483 
    483484} 
    484485%} 
     
    488489/* Source description */ 
    489490 
     491INSTRUMENT COMPONENT Origin=Progress_bar() 
     492AT (0,0,0) ABSOLUTE 
     493 
    490494/* a flat constant source */ 
    491 COMPONENT Source = Source_gen( 
     495INSTRUMENT COMPONENT Source = Source_gen( 
    492496  radius  = 0.10, 
    493497  dist = machine_hkl.l1, 
     
    497501AT (0,0,0) ABSOLUTE 
    498502 
    499 COMPONENT SC1 = Collimator_linear( 
     503INSTRUMENT COMPONENT SC1 = Collimator_linear( 
    500504  xmin =-0.08/2, ymin =-0.11/2, 
    501505  xmax = 0.08/2, ymax = 0.11/2, 
    502   len = 5.34, 
     506  len = machine_hkl.l1 > 6.34 ? 5.34 : machine_hkl.l1/2, 
    503507  divergence=ALF1, 
    504508  divergenceV=BET1) 
    505 AT (0, 0, (machine_hkl.l1-5.34)/2) RELATIVE Source 
     509WHEN (ALF1 && BET1) 
     510AT (0, 0, (machine_hkl.l1-5.34)/2) ABSOLUTE 
     511 
     512INSTRUMENT COMPONENT Guide_out=Arm() 
     513AT (0, 0, machine_hkl.l1) ABSOLUTE 
    506514 
    507515COMPONENT Mono_Cradle = Arm() 
    508   AT (0, 0, machine_hkl.l1) RELATIVE Source 
    509   ROTATED (0, machine_real.a1, 0) RELATIVE Source 
    510  
     516  AT (0, 0, 0) RELATIVE PREVIOUS 
     517   
    511518SPLIT COMPONENT PG1Xtal = Monochromator_curved( 
    512519  width  = 0.10, 
     
    514521  NH=1, NV=9, 
    515522  RV=machine_real.rmv, RH=machine_real.rmh, 
    516   mosaich = machine_hkl.etam, mosaicv = machine_hkl.etam, 
    517   r0 = 0.7, DM=machine_hkl.dm) 
     523  DM=machine_hkl.dm, mosaich = machine_hkl.etam, mosaicv = machine_hkl.etam, 
     524  r0 = (fabs(machine_hkl.dm-3.355) < 0.2 ? 1: 0.7),  
     525  reflect=(fabs(machine_hkl.dm-3.355) < 0.2 ? "HOPG.rfl" : "")) 
    518526AT (0, 0, 0) RELATIVE Mono_Cradle 
     527ROTATED (0, machine_real.a1, 0) RELATIVE Mono_Cradle 
    519528 
    520529/*                                on mono, pointing towards sample */ 
  • branches/mcstas-1.x/lib/monitors/Monitor_nD.comp

    r2879 r3064  
    121121*                                variable with limits to define arc. 
    122122*                                (diameter is xwidth, height is yheight). 
    123 *     disk                      Disk flat xy monitor. radius is xwidth. 
     123*     disk                      Disk flat xy monitor. diameter is xwidth. 
    124124*     sphere                    To get a spherical monitor (e.g. a 4PI) 
    125125*                                (diameter is xwidth). 
  • branches/mcstas-1.x/lib/optics/FermiChopper.comp

    r2828 r3064  
    394394      mean_t     = FCVars.sum_t/FCVars.sum_N; 
    395395      mean_phase = fmod(mean_t*nu*2*PI, 2*PI); 
     396      /* now we shift the phase so that the neutron pulse is centered on the slit pack */ 
     397      mean_phase+=radius/vxp1*2*PI*nu; 
    396398      FCVars.ph0 = -mean_phase; 
    397399    } 
     
    644646    /* base opening time */ 
    645647    double div, mean_phase; 
    646     div        = atan(w/length); 
     648    div        = atan2(w,length)/PI*180; 
    647649    mean_phase = fmod(mean_t*nu*360, 360); 
     650    mean_phase+=radius/mean_v*360*nu; 
    648651    if (mean_phase > 180) mean_phase -= 360; 
    649652 
     
    656659           "              Mean energy       omega = %g [meV]\n" 
    657660           "              Mean arrival time t     = %g [s]\n" 
    658            "              Mean phase              = %g [deg] (negate to optimize transmission)\n" 
     661           "              Mean phase              = %g [deg] (%s)\n" 
     662           "              Slit pack divergence    = %g [deg] (full width)\n" 
    659663           "              Opening time      dt    = %g [s]\n" 
    660664           "              Intensity reaching FC   = %g [n/s]\n" 
     
    662666           , NAME_CURRENT_COMP, 
    663667           mean_v, mean_L, mean_w, mean_t, mean_phase, 
     668           (zero_time > 1 ? "set automatically" : "use phase=-(this value) to optimize"), 
     669           2*div, 
    664670           (nu ? div/PI/nu : 1), 
    665671           FCVars.sum_N, 
  • branches/mcstas-1.x/lib/share/monitor_nd-lib.c

    r2699 r3064  
    790790    if ((abs(mc_mn_Vars->Flag_Shape) == mc_mn_DEFS->SHAPE_DISK) || (abs(mc_mn_Vars->Flag_Shape) == mc_mn_DEFS->SHAPE_SPHERE)) 
    791791    { 
    792       mc_mn_Vars->area = PI*mc_mn_Vars->Sphere_Radius*mc_mn_Vars->Sphere_Radius; /* disk shapes */ 
     792      mc_mn_Vars->area = PI*mc_mn_Vars->Sphere_Radius*mc_mn_Vars->Sphere_Radius*1E4 /* disk shapes */ 
    793793    } 
    794794    if (mc_mn_Vars->area == 0) mc_mn_Vars->Coord_Number = 0;