Giter Site home page Giter Site logo

akosmrlj / fenics_tutorial Goto Github PK

View Code? Open in Web Editor NEW
12.0 1.0 7.0 8.37 MB

FEniCS tutorial prepared for the KITP Active Matter workshop (https://www.kitp.ucsb.edu/activities/active20)

License: MIT License

Python 0.19% Jupyter Notebook 37.86% HTML 61.95%

fenics_tutorial's Introduction

Tutorial on using FEniCS for solving PDEs

This is the GitHub repository for a tutorial on using the FEniCS package to solve PDEs. This tutorial was prepared for the KITP workshop Symmetry, Thermodynamics and Topology in Active Matter and the recorded video is available here.

Layout

This tutorial is organized as follows:

  • poisson - several examples of solving the Poisson's equation in 2d
  • elasticity - two examples of solving 2d linear elasticity problems
  • thermoelasticity - one examples of solving 2d thermoelasticity problem
  • CahnHilliard - solving the Cahn-Hilliard equation in 2d

Getting started

Cloning the repository

Open a terminal and clone the repository with

git clone https://github.com/akosmrlj/FEniCS_tutorial.git

This command will create a local copy of the repository on your computer. It will be stored in a directory called FEniCS_tutorial.

Creating conda environment

We recommend using Anaconda and creating a fenicsproject environment. This can be done by typing in the terminal:

conda create -n fenicsproject -c conda-forge fenics mshr matplotlib jupyterlab

This should install all packages needed to run this tutorial.

Running examples

Each example comes with three files:

  • the standalone python code
  • Jupyter notebook with explanations
  • HTML copy of the Jupyter notebook

To run examples you first need to activate the fenicsproject environment:

conda activate fenicsproject

Afterward, you can either run the python code directly from the terminal, e.g.

python poisson_basic.py

or you can start the Jupyter lab as

jupyter lab

where you can open the Jupyer notebooks containing the code and explanations.

Additional software

We recommend installing Paraview for visualization.

Note: It is also possible to install Paraview via the conda-forge channel. However, this has not been tested and one may encounter a number of package dependency issues if trying to install Paraview in the fenicsproject conda environment provided above.

Additional resources

There is a very detailed FEniCS tutorial eBook. Please note that this eBook was written in 2017 and some of the functions have slightly changed. Here are a few demos with explanations that are up to date: https://fenicsproject.org/docs/dolfin/latest/python/demos.html

Lecturer

Andrej Košmrlj, Princeton University website

fenics_tutorial's People

Contributors

akosmrlj avatar sknepnek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.