This shows you the differences between two versions of the page.
docs:classes:flowfield [2009/02/16 11:44] gibson |
docs:classes:flowfield [2010/02/02 07:55] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== FlowField ====== | ||
- | |||
- | The FlowField class represents vector-valued fields of the form | ||
- | |||
- | <latex> | ||
- | {\bf u}({\bf x}) &= \sum_{k_x,k_y,k_z,j} \hat{u}_{k_x k_y k_z j}\bar{T}_{k_y}(y) \; e^{2 \pi i (k_x x/L_x + k_z z/L_z)} {\bf e}_j | ||
- | </latex> | ||
- | |||
- | and also scalar and tensor fields with appropriate changes in the dimensionality of the coefficients. | ||
- | The barred %%T%% function is a Chebyshev polynomial scaled to fit the domain y ∈ [a,b]. ((<latex> | ||
- | \bar{T}_{k_y}(y) = T_{k_y}\left(\frac{2}{b-a}(y - \frac{b+a}{2})\right)</latex>)) The spatial domain | ||
- | of a FlowField is Ω = [0,Lx] x [a,b] x [0,Lz], with periodicity in x and z. | ||
- | |||
- | In channelflow programming, fields such as velocity, pressure, stress tensors, vorticity, etc. | ||
- | are stored as variables of type FlowField. The main functionality of the FlowField class is | ||
- | |||
- | * algebraic and differential operations, +/-, +=, ∇, ∇<sup>2</sup>, norms, inner products, etc. | ||
- | * transforming back and forth between spectral coefficients <latex> \hat{u}_{k_x k_y k_z j}</latex> and gridpoint values <latex>u_j (x_{n_x}, y_{n_y}, z_{n_z})</latex> | ||
- | * serving as input to DNS algorithms, which map velocity fields forward in time: u(x,t) → u(x, t+Δt) | ||
- | * setting and accessing scpetral coefficients and gridpoint values | ||
- | * reading and writing to disk | ||
- | |||
- | |||
- | ===== Constructors / Initialization ===== | ||
- | |||
- | FlowFields are initialized with gridsize and cellsize parameters, read from disk, | ||
- | or assigned from computations. Examples: | ||
- | |||
- | <code c++> | ||
- | FlowField f; // null value, 0-d field on 0x0x0 grid | ||
- | FlowField u(Nx, Ny, Nz, Nd, Lx, Lz, a, b); // Nd-dim field on Nx x Ny x Nz grid, [0,Lx]x[a,b]x[0,Lz] | ||
- | FlowField g(Nx, Ny, Nz, Nd, 2, Lx, Lz, a, b); // Nd-dim 2-tensor | ||
- | FlowField h("h"); // read from file "h.ff" | ||
- | FlowField omega = curl(u); | ||
- | </code> | ||
- | |||
- | ===== Algebraic and differential operators ===== | ||
- | |||
- | Assume f,g,h etc. are FlowField variables with compatible cell and grid sizes. Examples of | ||
- | possible operations | ||
- | |||
- | <code> | ||
- | f += g; // f = f + g | ||
- | f = curl(g); | ||
- | f = lapl(g); | ||
- | f = div(g); | ||
- | f = diff(g, j, n); // f_i = d^n g_i /dx_j | ||
- | f = grad(g); // f_ij = dg_i / dx_j | ||
- | f = cross(g,h); | ||
- | f *= 2.7; // f = 2.7*f | ||
- | | ||
- | |||
- | Real c = L2IP(f,g); // L2 inner product of f,g | ||
- | Real n = L2Norm(u); | ||
- | Real D = dissipation(u); | ||
- | Real E = energy(u); | ||
- | Real I = wallshear(u); | ||
- | </code> | ||
- | |||
- | The latter functions are defined as | ||
- | |||
- | <latex> $ \begin{align*} | ||
- | L2IP(f,g) &= \frac{1}{L_x L_y L_z} \int_{\Omega} {\bf f} \cdot {\bf g} \,\, d{\bf x} \\ | ||
- | L2Norm(u) &= \left(\frac{1}{L_x L_y L_z} \int_{\Omega} \|{\bf u}\|^2\,\, d{\bf x} \right)^{1/2}\\ | ||
- | E(u) &= \frac{1}{2 L_x L_y L_z} \int_{\Omega} \|{\bf u}\|^2\,\, d{\bf x} \\ | ||
- | D(u) &= \frac{1}{L_x L_y L_z} \int_{\Omega} \|\nabla \times {\bf u}\|^2 \,\, d{\bf x} \\ | ||
- | I(u) &= \frac{1}{L_x L_z} \int_{y=a,b} \frac{\partial u}{\partial y} \, dx dz | ||
- | \end{align*} $ </latex> | ||
- | |||
- | ===== Transforms and data access ===== | ||
- | |||
- | FlowField transforms are a complicated subject --there are transforms in x,y, and z and | ||
- | implicit symmetries in complex spectral coefficients due to the real-valuedness of the | ||
- | field, for instance. This section outlines the bare essentials of transforms and data | ||
- | access methods. For further details see the {docs:chflowguide.pdf|Channelflow User Guide}}. | ||
- | |||