view example/NavierStokes/VelocityUpdate.ufl @ 76:6cb2a3e3be68

New examples which solve vector field problems * NS: solve the incompressible NS equations using the chorin-temam algorithm * MixedPoisson: solve the Poisson equation using amixed formulation using DG and Brezzi-Douglas-marini finite elements
author gedeone-octave <marcovass89@hotmail.it>
date Fri, 02 Aug 2013 23:01:39 +0200
parents
children
line wrap: on
line source

# Copyright (C) 2010 Anders Logg
#
# This file is part of DOLFIN.
#
# DOLFIN is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# DOLFIN is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
#
# First added:  2010-08-30
# Last changed: 2010-09-01
#
# The bilinear form a(u, v) and linear form L(v) for the velocity
# update step in Chorin's method for the incompressible Navier-Stokes
# equations.
#
# Compile this form with FFC: ffc -l dolfin TentativeVelocity.ufl.

# Define function spaces (P2-P1)
V = VectorElement("CG", triangle, 2)
Q = FiniteElement("CG", triangle, 1)

# Define trial and test functions
u = TrialFunction(V)
v = TestFunction(V)

# Define coefficients
k  = Constant(triangle)
u1 = Coefficient(V)
p1 = Coefficient(Q)

# Define bilinear and linear forms
a = inner(u, v)*dx
L = inner(u1, v)*dx - k*inner(grad(p1), v)*dx