# Tag Info

31

In the solution of nonlinear hyperbolic PDEs, discontinuities ("shocks") appear even when the initial condition is smooth. In the presence of discontinuities, the notion of solution can only be defined in the weak sense. The numerical velocity of a shock depends on the correct Rankine-Hugoniot conditions being imposed, which in turn depends on numerically ...

21

You are looking at the mass conservation equation: $\dfrac{dm}{dt}=0$ When considering mass evolution per unit volume, this boils down to the density advection equation in flux form: $\dfrac{\partial \rho}{\partial t} = -\nabla \cdot (\rho u)$ Good thing about this is that it is just the advection equation of an arbitrary scalar field (in our case, this ...

20

It's a long-running joke that CFD stands for "colorful fluid dynamics". Nevertheless, it is used -- and useful -- in a wide range of applications. I believe your discontent stems from not sufficiently distinguishing between two interconnected but different steps: creating a mathematical model of a physical process and solving it numerically. Let me comment ...

19

I will try to answer your question considering that you are asking for Python specifically. I will describe my own method of tackling a simulation problem. Strategies for faster simulations are given in this description. First, I prototype new simulations in Python. Of course, I try to make use of NumPy and SciPy as much as I can. Whereas NumPy provides a ...

18

The proposed characteristics are reasonable in the sense that they roughly represent popular opinion. This question has massive scope, so I'll just make a few observations now. I can elaborate in response to comments. For more detailed related discussion, see What are criteria to choose between finite-differences and finite-elements? Low order conservative ...

18

This is most easily seen by considering the stationary Stokes equations $$-\mu \Delta u + \nabla p = f \\ \nabla \cdot u = 0$$ which is equivalent to the problem $$\min_u \frac\mu 2 \|\nabla u\|^2 - (f,u) \\ \text{so that} \; \nabla\cdot u = 0.$$ If you write down the Lagrangian and then the optimality conditions of this optimization problems, ...

16

One of the leaders in the field of using CFD for animation, Ron Fedkiw, had a web page with some fantastic examples, including references to the relevant publications.

15

For running of CFD simulations, I would suggest to start with the UserGuide and ProgrammersGuide. The ProgrammersGuide document features case examples as well, and it explains additional stuff such as boundary conditions. Using OpenFOAM on the top level is fairly easy, once you get a hang of the configuration files. Both documents are available in the /doc ...

15

Others have pointed out the Boussinesq approximation (note that it is different from Boussinesq for water waves), but you can also go a step further and allow for large density variation without going to a fully compressible formulation. This is called an "anelastic" model, and retains essentially the same computational structure as incompressible flow. For ...

14

The most common method is to reset negative values to some small, positive number. Of course, this is not a mathematically sound solution. A better general approach that may work and is easy, is to reduce the size of your time step. Negative values often arise in the solution of hyperbolic PDEs, because the appearance of shocks can lead to oscillations, ...

14

The compressible equations are hyperbolic in nature, i.e., they have a finite speed of sound. In practice, this implies that you have to take a time step that is proportional to something like the mesh size divided by the speed of sound. (This is, in its essence, the CFL condition you have to satisfy for stability when using explicit solvers, and for ...

14

Here's the deal with GPUs. On a GPU, every single core is slow. Really slow. However, you have thousands of cores. If you can effectively use the thousands of cores at a time, then your algorithm will run better on the GPU. If you cannot, then it will run much slower on the GPU. Linear algebra is one domain where parallelism is really well established. ...

13

In the 1D case, you don't want to use a forward or central difference scheme for the spatial derivative term $(\frac{d}{dx})$ because they are numerically unstable. Instead, it is better to discretize the equation with an explicit backwards (upwind) finite difference for the spatial derivative: $\frac{\rho_i^{k+1}-\rho_i^k}{\Delta t} + \frac{\rho_i^k U_i^k-... 13 If the semi-discrete model has a unique steady state and no limit cycles, then all convergent methods should converge to the same steady state. If the problem has multiple steady states (hysteresis) or stable limit cycles, then any change to the method (RK method, initial time step, and even non-associativity of floating point when summing stages) can change ... 13 Atmosphere and ocean have highly-stratified flows in which the Coriolis force is a major source of dynamics. Maintaining geostrophic balance is extremely important and many numerical schemes are intended to be exactly compatible (at least in the absence of topography) to avoid radiating energy in gravity waves. Due to the stratification, limiting vertical ... 12 Chances are, you don't want something truly random; you want something that has the same abstract 3D structure as a plant root system, but beyond a certain level of abstraction, you don't care what the root system looks like. I'm guessing you want some way to generate 3D fractal domains of the kind mentioned in this paper describing the calculation of ... 12 MAC finite difference schemes (Harlow and Welch 1965) are uniformly stable, but require smooth structured grids and are only second order accurate. Finite element methods are preferred for unstructured and high order methods. For continuous Galerkin finite element methods, there are no known spaces that have optimal approximation properties and are ... 12 It depends on your problem and your ODE solver/time discretization. If you have a hyperbolic PDE and want to solve it with an explicit method, then you need the time step restriction (called the Courant-Friedrichs-Lewy/CFL condition) or your numerical solution will typically oscillate and may grow to$\pm\infty$. On the other hand, if you have a parabolic ... 12 The tradeoffs below apply equally to DG and to spectral elements (or$p$-version finite elements). Changing the order of an element, as in$p$-adaptivity, is simpler for modal bases because the existing basis functions do not change. This is generally not relevant to performance, but some people like it anyway. Modal bases can also be filtered directly ... 11 I'm a heavy user of OpenFOAM, so naturally I'd recommend it. It has a large amount of features including combustion models (though not necessarily precisely what you need) and has been used together with Canterra by other people. If you need a solver for a specific equation that hasn't been implemented yet, you can pretty much literally write your equations. ... 11 In practice, most people stick to relatively low orders, usually first or second order. This view is often challenged by more theoretical researchers that believe in more accurate answers . The rate of convergence for simple smooth problems is well documented, for example see Bill Mitchell's comparison of hp adaptivity. While for theoretical works it is ... 11 I suggest you start by looking at the FEniCS Navier-Stokes demo which is documented here: http://fenicsproject.org/documentation/dolfin/1.2.0/python/demo/pde/navier-stokes/python/documentation.html For your specific test case, you might want to look at the NSBENCH set of test problem (which are described in Chapter 21 of the FEniCS Book). The code for that ... 11 The question assumes that there is a strict delineation between equations, but there isn't. On paper, of course, the Navier-Stokes equations have a parabolic character because there is a non-zero diffusion term. But, in reality, we say that equations are "hyperbolic" when we mean that they are advection dominated, and "parabolic" when they are diffusion ... 10 In two dimensions, the velocity-vorticity formulation is the simplest to implement because the variables are collocated, but boundary conditions can be complicated and it's a less direct statement of the problem. For primitive variable formulations, the staggered grid finite difference method of Harlow and Welch (1965) is a great place to start. 10 You can find a fully documented implementation of a very simple, yet quite efficient, solution method (Chorin's splitting method) here. For a selection of other popular methods, take a look at Chapter 21 in this book. Disclaimer: I'm the (co)author of both the demo program and the book. The book can be downloaded for free. 10 Incompressibility is ONLY defined as the velocity field being solenoidal. Incompressibility DOES NOT mean that density variation must be zero. From the continuity equation, the requirement that the velocity field have zero divergence only requires that the material derivative of density be zero. That is, the density of a material fluid particle must be ... 10 To add to John's answer, it is very, very common in low-speed flows with small density variations to use the Boussinesq Approximation to approximate the density variation due to temperature or dilute species concentration. This approximates the density variation as a linear function of the temperature and, therefore, removes the variable density from the ... 10 No. As the mesh size$h\rightarrow 0$, the solution on a given mesh converges to the solution of the differential equation (assuming a well-posed PDE and a suitable discretization). Consequently, if your discrete solution on M2 is closer to experimental results than that on M3 or M4, then there are only two possibilities: The differential equation does not ... 10 Create two random scalar fields$f$and$g$and set the velocity to: $$u=\nabla f \times \nabla g$$ which is guaranteed to be divergence free. 10 Suppose that the solution$u$of the PDE lives in some function space$X$. We'll write the PDE as a bilinear form$A(u, v) = f(v)$for all$v$in$X$, where$f$is some element of the dual space$X^*$. To approximate the solution$u$of this PDE, we can instead look for some field$u_N$that lives in a finite-dimensional subspace$V_N$of$X\$. Typically, ...

Only top voted, non community-wiki answers of a minimum length are eligible