Fem-fenics: Difference between revisions

Jump to navigation Jump to search
180 bytes added ,  8 September 2013
no edit summary
No edit summary
Line 97: Line 97:




f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)")
f = Expression("10*exp(-(pow(x[0] - 0.5, 2) +  
 
                pow(x[1] - 0.5, 2)) / 0.02)")
g = Expression("sin(5*x[0])")
g = Expression("sin(5*x[0])")


Line 604: Line 604:


=== Incompressible Navier-Stokes equations ===
=== Incompressible Navier-Stokes equations ===
A complete description of the problem is avilable on the [http://fenicsproject.org/documentation/dolfin/1.2.0/python/demo/pde/navier-stokes/python/documentation.html Fenics website.]


<div style="width: 100%;">
<div style="width: 100%;">
Line 697: Line 699:


A3 = assemble (a3, noslip);
A3 = assemble (a3, noslip);




Line 803: Line 806:
# Define boundary conditions
# Define boundary conditions
noslip  = DirichletBC(V, (0, 0),
noslip  = DirichletBC(V, (0, 0),
                      "on_boundary && \
          "on_boundary && \
                      (x[0] < DOLFIN_EPS | x[1] < DOLFIN_EPS | \
          (x[0] < DOLFIN_EPS | x[1] < DOLFIN_EPS | \
                      (x[0] > 0.5 - DOLFIN_EPS && x[1] > 0.5 - DOLFIN_EPS))")
          (x[0] > 0.5 - DOLFIN_EPS && x[1] > 0.5 - DOLFIN_EPS))")
inflow  = DirichletBC(Q, p_in, "x[1] > 1.0 - DOLFIN_EPS")
inflow  = DirichletBC(Q, p_in, "x[1] > 1.0 - DOLFIN_EPS")
outflow = DirichletBC(Q, 0, "x[0] > 1.0 - DOLFIN_EPS")
outflow = DirichletBC(Q, 0, "x[0] > 1.0 - DOLFIN_EPS")
Line 842: Line 845:


# Use amg preconditioner if available
# Use amg preconditioner if available
prec = "amg" if has_krylov_solver_preconditioner("amg") else "default"
prec = "amg" if has_krylov_solver_preconditioner("amg")  
            else "default"


# Create files for storing solution
# Create files for storing solution
60

edits

Navigation menu