19.06.2015 Views

A FEniCS Tutorial - FEniCS Project

A FEniCS Tutorial - FEniCS Project

A FEniCS Tutorial - FEniCS Project

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Contents<br />

1 Fundamentals 4<br />

1.1 The Poisson equation . . . . . . . . . . . . . . . . . . . . . . . . . 5<br />

1.2 Variational Formulation . . . . . . . . . . . . . . . . . . . . . . . 6<br />

1.3 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8<br />

1.4 Controlling the Solution Process . . . . . . . . . . . . . . . . . . 15<br />

1.5 Linear Variational Problem and Solver Objects . . . . . . . . . . 17<br />

1.6 Examining the Discrete Solution . . . . . . . . . . . . . . . . . . 17<br />

1.7 Solving a Real Physical Problem . . . . . . . . . . . . . . . . . . 20<br />

1.8 Quick Visualization with VTK . . . . . . . . . . . . . . . . . . . 24<br />

1.9 Computing Derivatives . . . . . . . . . . . . . . . . . . . . . . . . 26<br />

1.10 A Variable-Coefficient Poisson Problem . . . . . . . . . . . . . . 28<br />

1.11 Computing Functionals . . . . . . . . . . . . . . . . . . . . . . . 31<br />

1.12 Visualization of Structured Mesh Data . . . . . . . . . . . . . . . 35<br />

1.13 Combining Dirichlet and Neumann Conditions . . . . . . . . . . 38<br />

1.14 Multiple Dirichlet Conditions . . . . . . . . . . . . . . . . . . . . 42<br />

1.15 A Linear Algebra Formulation . . . . . . . . . . . . . . . . . . . . 43<br />

1.16 Parameterizing the Number of Space Dimensions . . . . . . . . . 46<br />

2 Nonlinear Problems 48<br />

2.1 Picard Iteration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49<br />

2.2 A Newton Method at the Algebraic Level . . . . . . . . . . . . . 51<br />

2.3 A Newton Method at the PDE Level . . . . . . . . . . . . . . . . 54<br />

2.4 Solving the Nonlinear Variational Problem Directly . . . . . . . . 55<br />

3 Time-Dependent Problems 58<br />

3.1 A Diffusion Problem and Its Discretization . . . . . . . . . . . . 59<br />

3.2 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60<br />

3.3 Avoiding Assembly . . . . . . . . . . . . . . . . . . . . . . . . . . 63<br />

3.4 A Physical Example . . . . . . . . . . . . . . . . . . . . . . . . . 66<br />

4 Creating More Complex Domains 71<br />

4.1 Built-In Mesh Generation Tools . . . . . . . . . . . . . . . . . . . 71<br />

4.2 Transforming Mesh Coordinates . . . . . . . . . . . . . . . . . . . 72<br />

5 Handling Domains with Different Materials 73<br />

5.1 Working with Two Subdomains . . . . . . . . . . . . . . . . . . . 74<br />

5.2 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75<br />

5.3 Multiple Neumann, Robin, and Dirichlet Condition . . . . . . . . 77<br />

6 More Examples 81<br />

2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!