1
1
/* ********************************************************************
2
2
CombLayer : MCNP(X) Input builder
3
3
4
- * File: commonBeam /M1Mirror.cxx
4
+ * File: softimax /M1Mirror.cxx
5
5
*
6
- * Copyright (c) 2004-2021 by Stuart Ansell
6
+ * Copyright (c) 2004-2023 by Stuart Ansell
7
7
*
8
8
* This program is free software: you can redistribute it and/or modify
9
9
* it under the terms of the GNU General Public License as published by
@@ -95,14 +95,31 @@ M1Mirror::populate(const FuncDataBase& Control)
95
95
FixedRotate::populate (Control);
96
96
97
97
theta=Control.EvalVar <double >(keyName+" Theta" );
98
- phi=Control.EvalDefVar <double >(keyName+" Phi" , 0.0 );
99
-
98
+ phi=Control.EvalVar <double >(keyName+" Phi" );
99
+
100
100
width=Control.EvalVar <double >(keyName+" Width" );
101
- thick =Control.EvalVar <double >(keyName+" Thick " );
101
+ height =Control.EvalVar <double >(keyName+" Height " );
102
102
length=Control.EvalVar <double >(keyName+" Length" );
103
103
104
- mirrMat=ModelSupport::EvalMat<int >(Control,keyName+" M1MirrorMat" );
105
- baseMat=ModelSupport::EvalMat<int >(Control,keyName+" BaseMat" );
104
+ slotXStep=Control.EvalVar <double >(keyName+" SlotXStep" );
105
+ slotWidth=Control.EvalVar <double >(keyName+" SlotWidth" );
106
+ slotDepth=Control.EvalVar <double >(keyName+" SlotDepth" );
107
+
108
+ pipeXStep=Control.EvalVar <double >(keyName+" PipeXStep" );
109
+ pipeYStep=Control.EvalVar <double >(keyName+" PipeYStep" );
110
+ pipeZStep=Control.EvalVar <double >(keyName+" PipeZStep" );
111
+ pipeSideRadius=Control.EvalVar <double >(keyName+" PipeSideRadius" );
112
+ pipeBaseLen=Control.EvalVar <double >(keyName+" PipeBaseLen" );
113
+ pipeBaseRadius=Control.EvalVar <double >(keyName+" PipeBaseRadius" );
114
+ pipeOuterLen=Control.EvalVar <double >(keyName+" PipeOuterLen" );
115
+ pipeOuterRadius=Control.EvalVar <double >(keyName+" PipeOuterRadius" );
116
+
117
+ mirrorMat=ModelSupport::EvalMat<int >(Control,keyName+" MirrorMat" );
118
+ waterMat=ModelSupport::EvalMat<int >(Control,keyName+" WaterMat" );
119
+ pipeMat=ModelSupport::EvalMat<int >(Control,keyName+" PipeMat" );
120
+ outerMat=ModelSupport::EvalMat<int >(Control,keyName+" OuterMat" );
121
+ voidMat=ModelSupport::EvalMat<int >(Control,keyName+" VoidMat" );
122
+
106
123
107
124
return ;
108
125
}
@@ -118,66 +135,31 @@ M1Mirror::createSurfaces()
118
135
119
136
// main xstal CENTRE AT ORIGIN
120
137
const Geometry::Quaternion QXA
121
- (Geometry::Quaternion::calcQRotDeg (-theta,X ));
138
+ (Geometry::Quaternion::calcQRotDeg (-theta,Z ));
122
139
123
140
Geometry::Vec3D PX (X);
124
141
Geometry::Vec3D PY (Y);
125
142
Geometry::Vec3D PZ (Z);
126
143
144
+ QXA.rotate (PX);
127
145
QXA.rotate (PY);
128
- QXA.rotate (PZ);
129
-
130
- const Geometry::Quaternion QYA
131
- (Geometry::Quaternion::calcQRotDeg (phi,PY));
132
-
133
- QYA.rotate (PX);
134
- QYA.rotate (PZ);
135
-
136
- ModelSupport::buildPlane (SMap,buildIndex+101 ,Origin-PY*(length/2.0 ),PY);
137
- ModelSupport::buildPlane (SMap,buildIndex+102 ,Origin+PY*(length/2.0 ),PY);
138
- ModelSupport::buildPlane (SMap,buildIndex+103 ,Origin-PX*(width/2.0 ),PX);
139
- ModelSupport::buildPlane (SMap,buildIndex+104 ,Origin+PX*(width/2.0 ),PX);
140
-
141
- if (std::abs (radius)>Geometry::zeroTol)
142
- {
143
- // calc edge cut
144
- const double tAngle = length/(2.0 *radius); // cos(-a) == cos(a)
145
- const double lift = radius*(1.0 -cos (tAngle));
146
- if (radius<0 )
147
- ModelSupport::buildPlane (SMap,buildIndex+105 ,Origin-PZ*lift,-PZ);
148
- else
149
- ModelSupport::buildPlane (SMap,buildIndex+105 ,Origin-PZ*lift,PZ);
150
- ModelSupport::buildCylinder (SMap,buildIndex+107 ,
151
- Origin-PZ*radius,PX,std::abs (radius));
152
- ModelSupport::buildCylinder (SMap,buildIndex+117 ,
153
- Origin-PZ*radius,PX,std::abs (radius)+thick);
154
- }
155
- else
156
- {
157
- ModelSupport::buildPlane (SMap,buildIndex+105 ,Origin-PZ*thick,PZ);
158
- ModelSupport::buildPlane (SMap,buildIndex+106 ,Origin,PZ);
159
- }
160
-
161
-
162
- // support
163
- ModelSupport::buildPlane (SMap,buildIndex+203 ,
164
- Origin-PX*(baseOutWidth+width/2.0 ),PX);
165
- ModelSupport::buildPlane (SMap,buildIndex+204 ,
166
- Origin+PX*(baseOutWidth+width/2.0 ),PX);
167
- ModelSupport::buildPlane (SMap,buildIndex+205 ,Origin+PZ*baseTop,PZ);
168
- ModelSupport::buildPlane (SMap,buildIndex+206 ,Origin-PZ*baseDepth,PZ);
169
-
170
-
171
- ModelSupport::buildPlane (SMap,buildIndex+216 ,Origin-PZ*(thick+baseGap),PZ);
172
-
173
- // / create the link point towards the reflected beam
174
- // (do it here to avoid re-definition of variables in createLinks()
175
-
176
- Geometry::Vec3D Yrefl (PY);
177
- Geometry::Quaternion::calcQRotDeg (-theta,X).rotate (Yrefl);
178
-
179
- FixedComp::setConnect (1 ,Origin+PZ*baseTop,Yrefl);
180
- FixedComp::setLinkSurf (1 ,-SMap.realSurf (buildIndex+205 ));
146
+
147
+ ModelSupport::buildPlane (SMap,buildIndex+1 ,Origin-PY*(length/2.0 ),PY);
148
+ ModelSupport::buildPlane (SMap,buildIndex+2 ,Origin+PY*(length/2.0 ),PY);
149
+ ModelSupport::buildPlane (SMap,buildIndex+3 ,Origin-PX*width,PX);
150
+ ModelSupport::buildPlane (SMap,buildIndex+4 ,Origin,PX);
151
+ ModelSupport::buildPlane (SMap,buildIndex+5 ,Origin-PZ*(height/2.0 ),PZ);
152
+ ModelSupport::buildPlane (SMap,buildIndex+6 ,Origin+PZ*(height/2.0 ),PZ);
153
+
154
+
155
+ // support cuts:
156
+ Geometry::Vec3D slotOrg=Origin-X*slotXStep;
157
+ ModelSupport::buildPlane (SMap,buildIndex+13 ,slotOrg-PX*(slotWidth/2.0 ),PX);
158
+ ModelSupport::buildPlane (SMap,buildIndex+14 ,slotOrg+PX*(slotWidth/2.0 ),PX);
159
+ ModelSupport::buildPlane
160
+ (SMap,buildIndex+15 ,slotOrg-PZ*(height/2.0 -slotDepth),PZ);
161
+ ModelSupport::buildPlane
162
+ (SMap,buildIndex+16 ,slotOrg+PZ*(height/2.0 -slotDepth),PZ);
181
163
182
164
return ;
183
165
}
@@ -193,35 +175,12 @@ M1Mirror::createObjects(Simulation& System)
193
175
194
176
HeadRule HR;
195
177
// xstal
196
- if (std::abs (radius)<Geometry::zeroTol)
197
- HR=ModelSupport::getHeadRule (SMap,buildIndex,
198
- " 101 -102 103 -104 105 -106 " );
199
- else
200
- HR=ModelSupport::getHeadRule
201
- (SMap,buildIndex," 103 -104 107 -117 105 " );
202
-
203
- makeCell (" M1Mirror" ,System,cellIndex++,mirrMat,0.0 ,HR);
204
-
205
- // Make sides
206
- HR=ModelSupport::getHeadRule (SMap,buildIndex," 101 -102 -103 203 -205 206 " );
207
- makeCell (" LeftSide" ,System,cellIndex++,baseMat,0.0 ,HR);
208
- HR=ModelSupport::getHeadRule (SMap,buildIndex," 101 -102 104 -204 -205 206 " );
209
- makeCell (" RightSide" ,System,cellIndex++,baseMat,0.0 ,HR);
210
- HR=ModelSupport::getHeadRule (SMap,buildIndex,
211
- " 101 -102 103 -104 -216 206 " );
212
- makeCell (" Base" ,System,cellIndex++,baseMat,0.0 ,HR);
213
-
214
- // vacuum units:
215
178
HR=ModelSupport::getHeadRule
216
- (SMap,buildIndex," 101 -102 103 -104 -105 216 " );
217
- makeCell (" BaseVac " ,System,cellIndex++,0 ,0.0 ,HR);
179
+ (SMap,buildIndex," 1 -2 3 -4 5 -6 " );
180
+ makeCell (" M1Mirror " ,System,cellIndex++,mirrorMat ,0.0 ,HR);
218
181
219
- HR=ModelSupport::getHeadRule
220
- (SMap,buildIndex," 101 -102 103 -104 -205 106 " );
221
- makeCell (" TopVac" ,System,cellIndex++,0 ,0.0 ,HR);
222
182
223
- HR=ModelSupport::getHeadRule
224
- (SMap,buildIndex," 101 -102 203 -204 -205 206" );
183
+ HR=ModelSupport::getHeadRule (SMap,buildIndex," 1 -2 3 -4 5 -6" );
225
184
addOuterSurf (HR);
226
185
227
186
return ;
0 commit comments