File: Source_simple_js.html

package info (click to toggle)
mccode 3.5.19%2Bds5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,113,256 kB
  • sloc: ansic: 40,697; python: 25,137; yacc: 8,438; sh: 5,405; javascript: 4,596; lex: 1,632; cpp: 742; perl: 296; lisp: 273; makefile: 226; fortran: 132
file content (259 lines) | stat: -rw-r--r-- 7,444 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML><HEAD>
<TITLE>McStas: Source_simple Component</TITLE>
<LINK REV="made" HREF="mailto:peter.willendrup@risoe.dk">
</HEAD>

<BODY>

<P ALIGN=CENTER>
 [ <A href="#id">Identification</A>
 | <A href="#desc">Description</A>
 | <A href="#ipar">Input parameters</A>
 | <A href="#opar">Output parameters</A>
 | <A href="#links">Links</A> ]
</P>

<H1>The <CODE>Source_simple</CODE> Component</H1>

A circular neutron source with flat energy spectrum and arbitrary flux


<H2><A NAME=id></A>Identification</H2>

<UL>
  <LI> <B>Author:</B> Kim Lefmann</B>
  <LI> <B>Origin:</B> Risoe</B>
  <LI> <B>Date:</B> October 30, 1997</B>
  <LI> <B>Version:</B>(Unknown)</B>
  <LI> <B>Modification history:</B> <UL>
    <LI>  KL, October 4, 2001
    <LI>  Emmanuel Farhi, October 30, 2001. Serious bug corrected.
  </UL>
</UL>
<H2><A NAME=desc></A>Description</H2>

<PRE>
The routine is a circular neutron source, which aims at a square target
centered at the beam (in order to improve MC-acceptance rate).  The angular
divergence is then given by the dimensions of the target.
The neutron energy is uniformly distributed between lambda0-dlambda and
lambda0+dlambda or between E0-dE and E0+dE.
The flux unit is specified in n/cm2/s/st/energy unit (meV or Angs).

This component replaces Source_flat, Source_flat_lambda,
Source_flux and Source_flux_lambda.

Example: Source_simple(radius=0.1, dist=2, focus_xw=.1, focus_yh=.1, E0=14, dE=2)

</PRE>

<H2><A NAME=ipar></A>Input parameters</H2>
Parameters in <B>boldface</B> are required;
the others are optional.
<TABLE BORDER=1>
<TR><TH>Name</TH>  <TH>Unit</TH>  <TH>Description</TH>
<TH>Default</TH> <TH><input type="text" value="Source_simple" id="instance"></TH></TR>
<TR> <TD>radius</TD>
     <TD>m</TD>
     <TD>Radius of circle in (x,y,0) plane where neutrons are generated.
</TD>
<TD ALIGN=RIGHT>0.1</TD><td><input type="text" value="" id="radius"></td></TR>
<TR> <TD>yheight</TD>
     <TD>m</TD>
     <TD>Height of rectangle in (x,y,0) plane where neutrons are generated.
</TD>
<TD ALIGN=RIGHT>0</TD><td><input type="text" value="" id="yheight"></td> </TR>
<TR> <TD>xwidth</TD>
     <TD>m</TD>
     <TD>Width of rectangle in (x,y,0) plane where neutrons are generated.
</TD>
<TD ALIGN=RIGHT>0</TD><td><input type="text" value="" id="xwidth"></td> </TR>
<TR> <TD>dist</TD>
     <TD>m</TD>
     <TD>Distance to target along z axis.
</TD>
<TD ALIGN=RIGHT>0</TD><td><input type="text" value="" id="dist"></td>  </TR>
<TR> <TD>focus_xw</TD>
     <TD>m</TD>
     <TD>Width of target
</TD>
<TD ALIGN=RIGHT>.045</TD><td><input type="text" value="" id="focus_xw"></td>  </TR>
<TR> <TD>focus_yh</TD>
     <TD>m</TD>
     <TD>Height of target
</TD>
<TD ALIGN=RIGHT>.12</TD><td><input type="text" value="" id="focus_yh"></td>  </TR>
<TR> <TD>E0</TD>
     <TD>meV</TD>
     <TD>Mean energy of neutrons.
</TD>
<TD ALIGN=RIGHT>0</TD><td><input type="text" value="" id="E0"></td>  </TR>
<TR> <TD>dE</TD>
     <TD>meV</TD>
     <TD>Energy half spread of neutrons (flat or gaussian sigma).
</TD>
<TD ALIGN=RIGHT>0</TD><td><input type="text" value="" id="dE"></td>  </TR>
<TR> <TD>lambda0</TD>
     <TD>AA</TD>
     <TD>Mean wavelength of neutrons.
</TD>
<TD ALIGN=RIGHT>0</TD><td><input type="text" value="" id="lambda0"></td> </TR>
<TR> <TD>dlambda</TD>
     <TD>AA</TD>
     <TD>Wavelength half spread of neutrons.
</TD>
<TD ALIGN=RIGHT>0</TD><td><input type="text" value="" id="dlambda"></td> </TR>
<TR> <TD>flux</TD>
     <TD>1/(s*cm**2*st*energy unit)</TD>
     <TD>flux per energy unit, Angs or meV if flux=0, the source emits 1 in 4*PI whole space.
</TD>
<TD ALIGN=RIGHT>1</TD><td><input type="text" value="" id="flux"></td> </TR>
<TR> <TD>gauss</TD>
     <TD>1</TD>
     <TD>Gaussian (1) or Flat (0) energy/wavelength distribution
</TD>
<TD ALIGN=RIGHT>0</TD><td><input type="text" value="" id="gauss"></td> </TR>
<TR> <TD>target_index</TD>
     <TD>1</TD>
     <TD>relative index of component to focus at, e.g. next is +1 this is used to compute 'dist' automatically.
</TD>
<TD ALIGN=RIGHT>+1</TD><td><input type="text" value="" id="target_index"></td> </TR>
</TABLE>

<TABLE BORDER=0 ALIGN=CENTER>
  <TR>
  <TH align="right">AT (</TH>
  <td><input type="text" value="0" id="xpos" maxlength="4" size="4">, </td>
  <td><input type="text" value="0" id="ypos" maxlength="4" size="4">, </td>
  <td><input type="text" value="0" id="zpos" maxlength="4" size="4"></td>
  <TH>) RELATIVE</TH>
  <td><input type="text" value="PREVIOUS" id="REF"></td>
  <td rowspan="2">
    <button style="height:50px" onclick="comp()"><strong>Generate</strong></button>
  </td>
  </TR>
  <TR>
  <TH align="right">ROTATED (</TH>
  <td><input type="text" value="" id="xrot" maxlength="4" size="4">, </td>
  <td><input type="text" value="" id="yrot" maxlength="4" size="4">, </td>
  <td><input type="text" value="" id="zrot" maxlength="4" size="4"></td>
  <TH>) RELATIVE</TH>
  <td><input type="text" value="PREVIOUS" id="REF2"></td></TR>
</TABLE>



<script>

function getval(tag) {
  var ret = document.getElementById(tag);
  ret.select();
  ret.setSelectionRange(0, 99999); // For mobile devices
  return ret.value;
}

function parstr(tag,init) {
   var val = getval(tag);
   var str = "";
   if (val) {
     if (init==0) {
        str = str + ",\n";
     }
     str = str + "  " + tag + " = " + val;
   }
   return str;
}

function addpos() {
   var xpos = getval("xpos");
   var ypos = getval("ypos");
   var zpos = getval("zpos");
   var REF = getval("REF");

   var ATpos = "\) \n AT \(";
   ATpos = ATpos + xpos + ", ";
   ATpos = ATpos + ypos + ", ";
   ATpos = ATpos + zpos;
   ATpos = ATpos + "\) RELATIVE " ; 
   ATpos = ATpos + " " + REF ;
   return ATpos;
}

function addrot() {
   var xrot = getval("xrot");
   var yrot = getval("yrot");
   var zrot = getval("zrot");
   var REF2 = getval("REF2");

   var ATrot = "";

   if (xrot && yrot && zrot) { 
     ATrot = "\n ROTATED \(";
     ATrot = ATrot + xrot + ", ";
     ATrot = ATrot + yrot + ", ";
     ATrot = ATrot + zrot;
     ATrot = ATrot + "\) RELATIVE " ; 
     ATrot = ATrot + " " + REF2 ;
   }
   return ATrot;
}

function compdef(type) {
  var instance = getval("instance");
  var compstr = "COMPONENT " + instance + " = " + type +"\(\n";
  return compstr;
}

function comp() {
  // Get the text fields

  var Text = compdef("Source_simple");

  var Add;

  var init = 1;

  const pars = ["radius", "yheight", "xwidth", "dist", "focus_xw",
  "focus_yh", "E0", "dE", "lambda0", "dlambda", "flux", "gauss", "target_index"];

  let len = pars.length;

  for (var i=0; i<len; i++) {
    Add = parstr(pars[i],init);
    if (Add) {
      init=0;
      Text = Text + Add;",\n ";
    }
  }
 
  Text = Text + addpos(); 
  Text = Text + addrot(); 

  // Copy the text inside the text field
  navigator.clipboard.writeText(Text);
  
  // Alert the copied text
  alert(Text);
}
</script>

<H2><A NAME=links></A>Links</H2>

<UL>
  <LI> <A HREF="Source_simple.comp">Source code</A> for <CODE>Source_simple.comp</CODE>.
</UL>
<HR>
<P ALIGN=CENTER>
 [ <A href="#id">Identification</A>
 | <A href="#desc">Description</A>
 | <A href="#ipar">Input parameters</A>
 | <A href="#opar">Output parameters</A>
 | <A href="#links">Links</A> ]
</P>

<ADDRESS>
Generated automatically by McDoc, Peter Willendrup
&lt;<A HREF="mailto:peter.willendrup@risoe.dk">peter.willendrup@risoe.dk</A>&gt; /
Thu Nov  3 12:09:33 2022</ADDRESS>
</BODY></HTML>