Universe rotation in transformation card

New ideas for code development

Universe rotation in transformation card

Postby Andrei Fokau » Mon Jul 19, 2010 12:24 pm

Sometimes, one can save quite a number of lines if it would be possible to rotate universes. My guess is that TRANS card can be extended to the form of MCNP card TRn:
Code: Select all
TRn O1 O2 O3   B1 B2 B3   B4 B5 B6   B7 B8 B9   M
where
O1 O2 O3 = displacement vector of the transformation
B1 ... B9 = rotation matrix of the transformation
M = 1/–1 vector is origin of aux/main coordinate system in main/aux system

If it is too complicated to implement, then I would be happy with a simple rotation angle in one of the three coordinate planes.
Code: Select all
trans <u> <x> <y> <z> <type> <angle>
where
<type> is YZ, XZ, XY (or 1, 2, 3 in analogy with the PLOT card, but the symbolic way is more user-friendly)
<angle> is angle between the old position of the first axis (Y, X, X corresp.) and its new position counted in the same direction as for parameters of the PAD surface type.

Actually, one can do both ways - starting from the easiest, and if one day the time allows, then implementing the first complicated way, which can be defined as
Code: Select all
trans <u> <x> <y> <z> matrix   B1 B2 B3   B4 B5 B6   B7 B8 B9
KTH Reactor Physics (Stockholm, Sweden) neutron.kth.se
Andrei Fokau
 
Posts: 77
Joined: Thu Mar 25, 2010 12:25 am
Location: KTH, Stockholm, Sweden

Re: Universe rotation in transformation card

Postby Jaakko Leppänen » Mon Jul 19, 2010 7:12 pm

The easiest way to implement the rotation would probably be to use the matrix notation, similar to MCNP. So in matrix notation the operation would be

X1 = B*X0 + O,

Where X0 and X1 are the initial and transformed coordinates, B is the rotation matrix and O is the displacement vector.

Right?
- Jaakko
User avatar
Jaakko Leppänen
Site Admin
 
Posts: 1982
Joined: Thu Mar 18, 2010 10:43 pm
Location: Espoo, Finland

Re: Universe rotation in transformation card

Postby Andrei Fokau » Tue Jul 20, 2010 5:32 pm

Yes, that is right. Jaakko, do you think it can be implemented with one of the comming updates?

The simple method still attracts by its simplicity - I think one would typically want to simply rotate a universe in one of the coordinate planes and displace it. I hope the simple form can be easily translated by Serpent to the matrix form during reading the input.
KTH Reactor Physics (Stockholm, Sweden) neutron.kth.se
Andrei Fokau
 
Posts: 77
Joined: Thu Mar 25, 2010 12:25 am
Location: KTH, Stockholm, Sweden

Re: Universe rotation in transformation card

Postby Jaakko Leppänen » Wed Aug 25, 2010 2:27 pm

This method was included in update 1.1.13, but it looses neutrons at surface crossings so I didn't add it in the documentation just yet. It should be safe to use rotations in full delta-tracking mode (set dt 1.0).

The option is added in the trans card. If three additional values are given, they are interpreted as the rotation angles with respect to x-, y- and z- axes. If 9 values are given, the data is read in the matrix notation.

I'll try to find the problem with surface crossings and fix it for the next update.
- Jaakko
User avatar
Jaakko Leppänen
Site Admin
 
Posts: 1982
Joined: Thu Mar 18, 2010 10:43 pm
Location: Espoo, Finland

Re: Universe rotation in transformation card

Postby Jaakko Leppänen » Sun Oct 03, 2010 2:35 pm

The problem in universe rotation turned out to be very simple - I only rotated the coordinates, not the direction cosines.

To make the fix, go to rotatecoords.c and add variables "double *u, double *v, double *w" in the function declaration (and the prototype in header.h). Then add lines:

Code: Select all
      u0 = *u;
      v0 = *v;
      w0 = *w;

      *u = u0*DATA[rot]     + v0*DATA[rot + 1] + w0*DATA[rot + 2];
      *v = u0*DATA[rot + 3] + v0*DATA[rot + 4] + w0*DATA[rot + 5];
      *w = u0*DATA[rot + 6] + v0*DATA[rot + 7] + w0*DATA[rot + 8];

in the loop. The compiler will complain about the subroutines where the function is called with the wrong list of arguments. Simply add u, v and w in the calls.

The fix will also be implemented in the next update.
- Jaakko
User avatar
Jaakko Leppänen
Site Admin
 
Posts: 1982
Joined: Thu Mar 18, 2010 10:43 pm
Location: Espoo, Finland


Return to Development

Who is online

Users browsing this forum: No registered users and 1 guest