Page 1 of 1

Adding new surface types

Posted: Wed Apr 04, 2012 10:33 am
by Jaakko Leppänen
Adding new surface types can now (since update 2.1.4) be done with changes in a single subroutine "usersurf.c". The file consists of three parts that are explained by the comments in the source code. The idea is that the user can add new source routines in the code, and use them in the calculation with surface type of the form:

Code: Select all

surf <name> usr <param1> <param2> ...
Once the routines have been developed and tested, I can copy the source code in the actual surface routines and assign a new name for the surface. This should significantly simplify the development of new surface types.

Re: Adding new surface types

Posted: Sun Apr 08, 2012 9:31 pm
by jesse.johns
With this new capability, will it be possible to adjust the sizing ratio of the shells in pins when account for self-shielding affects? In other words, to make a different pin cell, say... pin_c that when the shells are applied for burnup they adhere to a different thickness ratio?

Re: Adding new surface types

Posted: Tue Apr 10, 2012 5:04 pm
by Jaakko Leppänen
Not really, the new subroutine simply allows you to create new surface types that can be used for defining cells.

What kind of sub-division do you have in mind?

Re: Adding new surface types

Posted: Tue Apr 10, 2012 9:02 pm
by jesse.johns

I didn't have anything in mind particularly, just curious if that capability would exist if the need arose for optically "thick" elements.


Re: Adding new surface types

Posted: Sun Dec 23, 2012 3:27 pm
by orca.blu

first question

in userSurf.c, coordinates x, y, and z are passed as "long", as well as u,v and w

Code: Select all

void UserSurf(long part, long np, const double *params, double *xmin, 
	      double *xmax, double *ymin, double *ymax, double *zmin, 
	      double *zmax, long *in, double *dmin, long x, long y, long z, 
	      long u, long v, long w)
it seems a bit strange, is it correct?

After changing them to double (also in the header),
and some plotting, everything seems ok.
sph_long.png (2.04 KiB) Viewed 2747 times
second question

I would like to use torus surfaces.

The algorithm for test if a point is inside a torus is quite simple.
On the other hand, the computation of the distance to the surface along a given direction needs the solution a fourth order polynomial equation (i.e., it is long and boring).

I tried to use the new surface without implementing the third part of usersurf.c.

If delta-tracking is forced ("set dt 1")
and the torus surface is not used to define "outside" (so that StopAtBoundary is never called)
everything seems fine.

I tried few runs with a simple big torus of 10% enriched U.
Here collision mesh plots for XY plane and several X-normal planes.
tr1.png (39.68 KiB) Viewed 2747 times
tr2.png (57.57 KiB) Viewed 2747 times
Do you think that it might work correctly?
More in general, is it possible to use complex surfaces providing only part 1 and part 2 algorithms in usersurf.c?


Merry Christmas

Re: Adding new surface types

Posted: Mon Dec 24, 2012 11:50 am
by Jaakko Leppänen
Ooops... The variable type should definitely be double. Thanks for pointing this out.

I think providing just the point test (part 2) should work with 100% delta-tracking mode, but it cat really limit the performance of the code. Also, you cannot use the surface current detector with the surface, or use it to define the outermost boundary of the geometry.

Part 1 of the routine is needed to define the maximum x-, y- and z- coordinates of the geometry, which are used by the source sampling routine, and also to define wheter the geometry is 2- or 3-dimensional. If the surface is completely enclosed by another surface for which these are available, there should be no problem either.

Have you considered solving the distance by first making a coordinate transformation to a toroidal system? I haven't looked at the problem closer, but to me it seems that you could get rid of one of the three coordinates. Or you could feed the problem to Mathematica...

Re: Adding new surface types

Posted: Thu Dec 27, 2012 4:17 pm
by orca.blu
thank you Jaakko,

actually I did not even know that there was a toroidal coordinate system.
I will try to understand if there is an easy way to solve the problem.
Otherwise, I found an old MCNP manual in which is more or less explained how to deal with the problem of the torus and the solution of the quartic equation.

For the immediate, I'm ok with 100% dt.