From fe5b61b94144d9fe6fb131232f563857f386cb0a Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Thu, 28 Jun 2012 13:31:43 -0400 Subject: [PATCH] Enhanced description of CSG in docs. --- docs/img/halfspace.svg | 85 +++++-------------- docs/img/union.svg | 140 +++++++++---------------------- docs/source/methods/geometry.rst | 52 ++++++++++-- 3 files changed, 106 insertions(+), 171 deletions(-) diff --git a/docs/img/halfspace.svg b/docs/img/halfspace.svg index 9e8c2b90f4..8f5c5d54da 100644 --- a/docs/img/halfspace.svg +++ b/docs/img/halfspace.svg @@ -7,48 +7,12 @@ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="302" - height="198.50891" - id="svg2" version="1.1" - inkscape:version="0.48.3.1 r9886" - sodipodi:docname="New document 1"> + width="338.45703" + height="172" + id="svg2"> - - - @@ -62,40 +26,29 @@ + transform="translate(-152.54297,-201.36218)" + id="layer1"> + style="fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> +1 -1 diff --git a/docs/img/union.svg b/docs/img/union.svg index 0949ca5b51..066fa2ba14 100644 --- a/docs/img/union.svg +++ b/docs/img/union.svg @@ -7,48 +7,12 @@ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + version="1.1" width="452" height="272" - id="svg2" - version="1.1" - inkscape:version="0.48.3.1 r9886" - sodipodi:docname="halfspace.svg"> + id="svg2"> - - - @@ -62,102 +26,80 @@ + transform="translate(-109,-151.36218)" + id="layer1"> + style="fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + style="fill:#aab4ff;fill-opacity:1;stroke:none" /> +1 - +1 + -1 - -1 + -2 - -2 + +2 - +2 + -3 - -3 + +3 + y="297.36218" + id="tspan3825-1-8-2-2">+3 diff --git a/docs/source/methods/geometry.rst b/docs/source/methods/geometry.rst index cb83dcf636..806321f740 100644 --- a/docs/source/methods/geometry.rst +++ b/docs/source/methods/geometry.rst @@ -5,9 +5,51 @@ Geometry ======== OpenMC uses a technique known as `constructive solid geometry`_ (CSG) to build -arbitrarily complex 3D models. In a CSG model, every simply-connected region is -described as the union, intersection, or difference of half-spaces created by -bounding surfaces. In OpenMC, any second-order surface of the form +arbitrarily complex three-dimensional models in Euclidean space. In a CSG model, +every unique object is described as the union, intersection, or difference of +half-spaces created by bounding `surfaces`_. Every surface divides all of space +into exactly two half-spaces. We can mathematically define a surface as a +collection of points that satisfy an equation of the form :math:`f(x,y,z) = 0` +where :math:`f(x,y,z)` is a given function. The region for which :math:`f(x,y,z) +< 0` can be called the negative half-space (or simply the "negative side") and +the region for which :math:`f(x,y,z) > 0` can be called the positive half-space. + +Let us take the example of a sphere centered at the point :math:`(x_0,y_0,z_0)` +with radius :math:`R`. One would normally write the equation of the sphere as + +.. math:: + + (x - x_0)^2 + (y - y_0)^2 + (z - z_0)^2 = R^2 + +By subtracting the right-hand term from both sides of the equation, we can then +write the surface equation: + +.. math:: + + f(x,y,z) = (x - x_0)^2 + (y - y_0)^2 + (z - z_0)^2 - R^2 = 0 + +One can confirm that any point inside this sphere will correspond to +:math:`f(x,y,z) < 0` and any point outside the sphere will correspond to +:math:`f(x,y,z) > 0`. + +In OpenMC, every surface defined by the user is assigned an integer to uniquely +identify it. We can then refer to either of the two half-spaces created by a +surface by a combination of the unique ID of the surface and a positive/negative +sign. For example, to refer to the negative half-space of a sphere (the volume +inside the sphere) with unique ID 35, the reference would be -35. These +references to half-spaces are used in created regions in space of homogeneous +material, known as "cells". + + +.. figure:: ../../img/halfspace.svg + :align: center + :figclass: align-center + +.. figure:: ../../img/union.svg + :align: center + :figclass: align-center + +In OpenMC, any second-order surface of the form .. math:: @@ -16,9 +58,6 @@ bounding surfaces. In OpenMC, any second-order surface of the form can be modeled in OpenMC. For example, the equation for a sphere centered at :math:`(\bar{x},\bar{y},\bar{z})` and of radius :math:`R` can be written as -.. math:: - - f(x,y,z) = (x - \bar{x})^2 + (y - \bar{y})^2 + (z - \bar{z})^2 + R^2 = 0 ------------------- Reflective Surfaces @@ -40,3 +79,4 @@ gradient to the surface at the point of crossing, i.e. :math:`\mathbf{n} = \nabla f(x,y,z)`. .. _constructive solid geometry: http://en.wikipedia.org/wiki/Constructive_solid_geometry +.. _surfaces: http://en.wikipedia.org/wiki/Surface