User Tools

Site Tools


gtspring2009:schedule:chflow1

This is an old revision of the document!


A PCRE internal error occured. This might be caused by a faulty plugin

====== Channelflow tutorial: using utility programs ====== ===== Background ===== ==== What is channelflow? ==== * set of C++ libraries for high-level programming * set of command-line utility programs * set of matlab scripts for visualization * database of invariant solutions * website with documentation, discussion forums ==== Why is CFD a hassle? ==== * Navier-Stokes is a stiff, 3D, nonlinear, constrained PDE * Integration algorithms are complex, tailored to geometry * Turbulence has multiple scales, requires fine resolution * > 10^5-d state space, > 1 MB for each data point * Integration is computationally expensive \\ \\ //this changes your workflow...// * integrate a flow and save velocity field to disk at regular intervals * read saved data from disk for visualization, statistics, etc. * run jobs on number crunchers (PACE), transfer files via scp, ... \\ \\ //...and changes your analytic framework// * can't represent du/dt = F(u) simply * can't compute a 10^5 x 10^5 Jacobian matrix (even with sparse structure) * hard to choose projections for state-space portraits \\ \\ All this makes numerical analysis of fluid dynamics a hassle, compared to low-dimensional ODE systems. Channelflow tries to lower the hassle factor by giving packaging important data structures and algorithms and giving them simple, flexible, high-level interfaces: * in C++ classes, for writing your own fluids codes * in predefined utility programs, for common calculations \\ \\ We will discuss programming in channelflow another day. Today is about using predefined channelflow utility programs to do calculations. ===== Important concepts ===== ==== FlowField ==== FlowField : C++ class representing spectral expansion of scalar, vector, tensor fields <latex> {\bf u}({\bf x},t) = \sum_{k_x k_y k_z} a_{k_x k_y k_z} T_{k_y}(y) \; e^{2 \pi i (k_x x / L_x + k_z z / L_z)} </latex> FlowField class has a platform-independent binary file format that retains coefficients, geometrical parameters, and other state information. We will discuss FlowField as a C++ class later, when we cover programming with channelflow. For, now, just think of a FlowField as a velocity field stored as a binary file (file extension .ff). Why not ASCII? Binary floating-point IO is exact and much more efficient than ASCII. Gives efficient, exactly invertible IO. Plus the ordering of multidimensional spectral coefficients with complex symmetries is tricky enough that ASCII is incomprehensible, too. However, if you want ASCII values of velocity at each gridpoint, there's a utility for conversion (field2ascii). In channelflow utilities, velocity fields u(x,t) are **differences from the laminar flow** <latex> {\bf u}_{total}({\bx x}, t) = {\bf u}({\bx x}, t) + y {\bf e}_x </latex> so that they have Dirichlet boundary conditions and form a vector space. ==== Channelflow utilities ==== FlowFields are binary file representations of velocity fields. Channelflow utilities are programs that operate on FlowField files or directories of FlowField files saved at regular intervals. Examples: ^ utility ^ action ^ | fieldprops | print out properties of field: norms, symmetries, etc. | | fieldplots | extract 2D slices of a velocity field for plotting | | addfields | compute u' = sum a_n u_n and save to disk | | couette | integrate an initial condition, save results to disk | | seriesprops | compute statistics of saved fields | | makebasis | Gram-Schmidt orthogonalize a set of fields | | projectseries | project saved data onto basis set | | findorbit | compute equilibria, traveling waves, periodic orbits | | arnoldi | compute eigenvalues of solutions via Arnoldi iteration | The utilities are stand-alone command-line programs that are run from the Unix shell. You can get brief built-in help information on each utility by running it with a -h or --help option. For example, running "couette --help" produces gibson@akbar$ couette --help couette : integrate an initial condition and save velocity fields to disk. options : -T0 --T0 <real> default == 0 start time -T1 --T1 <real> default == 100 end time -vdt --variabledt adjust dt for CFL -dt --dt <real> default == 0.03125 timestep -dtmin --dtmin <real> default == 0.001 minimum time step -dtmax --dtmax <real> default == 0.05 maximum time step -dT --dT <real> default == 1 save interval -CFLmin --CFLmin <real> default == 0.4 minimum CFL number -CFLmax --CFLmax <real> default == 0.6 maximum CFL number -ts --timestepping <string> default == sbdf3 timestepping algorithm ... -p --pressure print pressure grad <flowfield> (trailing arg 1) initial condition The built-in help gives a brief description of each utility's purpose and a list of its command-line options and arguments. Channelflow utilities are invoked at the command line with syntax like utility -opt1 value -opt2 value -flag1 arg3 arg2 arg1 or concretely couette -T0 0 -T1 400 -vdt -dt 0.02 -ts sbdf4 u0.ff Utilities often store data at regular intervals dT into a output directory, specified with -T0, -T1, and -dT, and -o options. E.g. couette -T0 0 -T1 400 -dt 0.02 -dT 2.0 -o data/ u0.ff integrates the flow from t=T0 to t=T1 with timestep dt=0.02 and stores a time series of velocity fields at intervals dT=2.0 in the ''data/'' directory. The velocity fields have filenames data/u0.ff data/u1.ff etc. where the label is the time t = T0 + n dT. If T0 or dT is not an integer, the label is rounded to three decimal places. For utilities that //read// time series of velocity fields, you need to specify the same (or compatible) time intervals. For the most part, the default dT=1 is a good, simple interval. Reynolds number defaults to 400. ===== Example calculations ===== ==== Computing a 1d unstable manifold ==== The Nagata (1990) "lower-branch" equilibrium has a one-dimensional unstable manifold. Here we compute the unstable manifold by integrating two 1d trajectories <latex> u_{\pm}(x,t) = f^t(u_{LB} \pm v_{LB}), t \in [0, \infty] </latex> using several channelflow utilities: * ''fieldprops'' * ''arnoldi'' * ''addfields'' * ''couette'' * ''seriesprops'' * ''makebasis'' * ''projectseries'' \\ \\ 1. Download the solution from the [[http://www.channelflow.org/database|channelflow database]] wget http://channelflow.org/database/a1.14_g2.5_Re400/LB.ff \\ \\ 2. Examine the properties of the lower-branch solution with ''fieldprops'' fieldprops -g uLB \\ \\ 3. Plot the LB with "fieldplots" and matlab script "plotbox" (bad fieldplots -o plot uLB then within Matlab, ''plotbox('LB')''. \\ \\ 4. Compute the eigenfunctions with ''arnoldi'' (skip this?) arnoldi --flow LB.ff === addfields === Add a small pertubation along the unstable manifold addfields 1 uLB 0.01 uLBef1 uLBp01ef1 addfields 1 uLB -0.01 uLBef1 uLBm01ef1 === couette === Integrate the perturbations couette -T0 0 -T1 400 -o data-uLBp01ef1 uLBp01ef1 couette -T0 0 -T1 400 -o data-uLBm01ef1 uLBm01ef1 === seriesprops === Produce input vs dissipation curves for perturbations seriesprops -T0 0 -T1 400 -d data-uLBp01ef1 -o ivd-uLBp01ef1 seriesprops -T0 0 -T1 400 -d data-uLBp01ef1 -o ivd-uLBm01ef1

gtspring2009/schedule/chflow1.1232464350.txt.gz · Last modified: 2009/01/20 07:12 by gibson