Code Monkey home page Code Monkey logo

fenics-examples's Introduction

FEniCS-examples

Example Python codes for FEniCS


bvp1.py is the simplest example and solves the linear 2-point boundary value problem

-u"(x)=-1 

with the boundary conditions

u(0) = 0, u'(1) = 1

bvp2.py solves a system of two coupled boundary value problems

-u1" +  u2  = f1
 u1  -  u2" = f2

with the boundary conditions

u1(0)=0, u1(1)=1
u2(0)=1, u2(1)=0

nl_system3.py solves a system of 3 nonlinear boundary value problems

-u1" + u2' + u3  +                        u1*u3 = f1
-u1' - u2" + u3  +                   - 16*u2*u3 = f2
 u1  + u2  - u3" +  u1*u3 - 16*u2*u3 +    u3^2  = 0 

with the boundary conditions

u1(0) = 0,  u1(1) = 1
u2(0) = 1,  u2(1) = 0
u3(0) = 0,  u3(1) = 0

adv_diff.py solves the advection diffusion equation

u_t + a*u_x = d*u_xx

with a given initial condition and homogeneous Neumann conditons

u_x(-1) = u_x(+1) = 0

`newton.py' solves the nonlinear boundary value problem

(exp(a*u)*u')' = 0
u(0) = 0, u(1) = 1

Using a manual Newton's method with continuation/homotopy


`newton_sys2.py' solves the two coupled nonlinear boundary value problems

-u1" + a*exp(u2)*u1 = 0
-u2" + a*exp(u1)*u2 = 0

u1(0) = 0,  u1(1) = 1
u2(1) = 1,  u2(0) = 0    

finite_well.py computes eigenvalues and eigenfunctions for a finite potential quantum well.


'nonuniform.py' constructs a nonuniform 1D grid with clustering at desired locations and then solves a boundary value problem which has a rapidly varying solution at those locations.

-[p(x)u']' = 1 

 u(0) = u(1) = 0

 p(x) = 1.001 + cos(4*pi*x)

'quantum_dot.py' computes the ground state in a hemispherical quantum dot using the inverse iteration with repeated Cholesky solves via PETScLUSolver

fenics-examples's People

Contributors

gregvw avatar srg831 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.