This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
docs:classes:fieldsymmetry [2009/02/16 06:55] gibson |
docs:classes:fieldsymmetry [2010/02/02 07:55] (current) |
||
|---|---|---|---|
| Line 19: | Line 19: | ||
| <latex> $ \begin{align*} | <latex> $ \begin{align*} | ||
| \sigma &= (s_x, s_y, s_x, a_x, a_z, s)\\ | \sigma &= (s_x, s_y, s_x, a_x, a_z, s)\\ | ||
| - | sx, sy, sz, s &= \pm 1\\ | + | s_x, s_y, s_z, s &= \pm 1\\ |
| - | ax, az &\in [-0.5, 0.5) | + | a_x, a_z &\in [-0.5, 0.5) |
| \end{align*} $ </latex> | \end{align*} $ </latex> | ||
| Line 29: | Line 29: | ||
| </latex> | </latex> | ||
| - | In C++ code, elements of the symmetry group can be defined as follows | + | The following is a brief overview of FieldSymmetry functionality. For a complete description, |
| + | see the header file {{:librarycode:symmetry.h}}. | ||
| + | ===== Constructors / Initialization ===== | ||
| + | |||
| + | In C++ code, elements of the symmetry group can initialized as follows, | ||
| + | where %%sx,sy,sz%% are of type %%int%% and %%ax, az%% are of type %%Real%%. | ||
| <code c++> | <code c++> | ||
| FieldSymmetry sigma0(sx, sy, sz, ax, az, s); | FieldSymmetry sigma0(sx, sy, sz, ax, az, s); | ||
| - | FieldSymmetry sigma1(sx, sy, sz, ax, az); // The s argument s defaults to 1 | + | FieldSymmetry sigma1(sx, sy, sz, ax, az); // the s argument s defaults to 1 |
| FieldSymmetry sigma2(sx, sy, sz); // s defaults to 1; ax,az to 0 | FieldSymmetry sigma2(sx, sy, sz); // s defaults to 1; ax,az to 0 | ||
| - | FieldSymmetry tau(ax, az); // Pure translation: s,sx,sy,sz default to 1 | + | FieldSymmetry tau(ax, az); // pure translation: s,sx,sy,sz default to 1 |
| - | FieldSymmetry sigma3; // The identity: s defaults to 1; ax,az to 0; sx,sy,sz to 1 | + | FieldSymmetry identity; // the identity: s defaults to 1; ax,az to 0; sx,sy,sz to 1 |
| </code> | </code> | ||
| - | where sx,sy,sz are of type int and ax, az are of type Real. FieldSymmetries act on each | + | ===== Operations ===== |
| - | other and velocity fields as follows | + | |
| + | FieldSymmetries act on each other and velocity fields as follows | ||
| <code c++> | <code c++> | ||
| Line 58: | Line 64: | ||
| </code> | </code> | ||
| - | FieldSymmetries can be saved to / read from disk as follows | + | FieldSymmetries can be saved to / read from disk... |
| <code c++> | <code c++> | ||
| Line 66: | Line 72: | ||
| </code> | </code> | ||
| - | Any element of G is of the form | + | ...compared to each other... |
| + | <code c++> | ||
| + | if (sigma1 != identity) | ||
| + | ... | ||
| + | else if (sigma1 == sigma7) | ||
| + | ... | ||
| + | </code> | ||
| + | ===== ASCII IO ===== | ||
| + | ==== FieldSymmetry ==== | ||
| + | The FieldSymmetry uses ASCII input-output. The storage format is | ||
| + | s sx sy sz ax az | ||
| + | Thus, the following C++ channelflow code | ||
| + | |||
| + | <code c++> | ||
| + | FieldSymmetry sigma(-1, -1, -1, 0.3, 0.1); | ||
| + | sigma.save("sigma"); | ||
| + | </code> | ||
| + | |||
| + | produces the ASCII file ''sigma.asc'' with contents | ||
| + | |||
| + | 1 -1 -1 -1 0.3 0.1 | ||
| + | |||
| + | which can then be read back into a channeflow program with | ||
| + | |||
| + | <code c++> | ||
| + | FieldSymmetry sigma("sigma"); | ||
| + | </code> | ||
| + | |||
| + | Note that the order of parameters in the ASCII file is different than the order in the ''FieldSymmetry'' constructor: the overall multiplicative sign ''s'' goes first in the file and last in the C++ constructor. I apologize for this. The reasons for the difference are are historical. The next release of channelflow will have order (s, sx, sy, sz, ax, az) for both. | ||
| + | |||
| + | ==== SymmetryList ==== | ||
| + | |||
| + | The ''SymmetryList'' class is a essentially an array of ''FieldSymmetry'' objects with simple ASCII IO methods. The ASCII format is | ||
| + | |||
| + | % N | ||
| + | s0 sx0 sy0 sz0 ax0 az0 | ||
| + | s1 sx1 sy1 sz1 ax1 az1 | ||
| + | ... | ||
| + | |||
| + | where N is the number of symmetries listed in the file. Thus the file ''S.asc'' with contents | ||
| + | |||
| + | % 2 | ||
| + | 1 1 1 -1 0.5 0.0 | ||
| + | 1 -1 -1 1 0.5 0.5 | ||
| + | |||
| + | represents the symmetries σ0 = (1, 1, 1, -1, 0.5, 0.0) and σ1 = (1, -1, -1, 1, 0.5, 0.5). These are the generators of the S | ||
| + | [[docs:math:symmetry#isotropy_groups_of_known_solutions|S symmetry group]]. The generators can be loaded into channelflow, used, and saved as follows | ||
| + | |||
| + | <code c++> | ||
| + | SymmetryList S("S"); // load generators from ASCII file | ||
| + | FlowField foo = S[0](u); // apply (1, 1, 1, -1, 0.5, 0.0) to u | ||
| + | FlowField bar = S[1](u); // apply (1, -1, -1, 1, 0.5, 0.5) to u | ||
| + | S.save("Q"); // save generators into another file | ||
| + | |||
| + | SymmetryList P(4); // Create another symmetry group | ||
| + | P[0] = FieldSymmetry(1,1,1, 0.2, 0.0); | ||
| + | P[1] = etc.; | ||
| + | </code> | ||
| + | | ||