Last active
August 14, 2017 08:41
-
-
Save ysimillides/d73c501f7f151c35d5002e8a11908a6e to your computer and use it in GitHub Desktop.
workflow-example-fenics.jl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
push!(LOAD_PATH,"/home/ysimillides/Downloads/FEniCS.jl-master/src") | |
using FEniCS | |
using PyCall | |
@pyimport fenics | |
mesh = UnitSquareMesh(8,8) | |
V = FunctionSpace(mesh,"P",1) | |
u_D = Expression("1+x[0]*x[0]+2*x[1]*x[1]",degree=2) | |
bc1 = DirichletBC(V,u_D, "on_boundary") | |
u=TrialFunction(V) | |
v=TestFunction(V) | |
f=Constant(-6.0) | |
a = dot(grad(u),grad(v))*dx | |
L = f*v*dx | |
U = FEniCS.Function(V) | |
lvsolve(a,L,U,bc1) | |
errornorm(u_D,U,norm="L2") | |
saved_sol = File("FEniCS.jl/sol_poisson.pvd") | |
saved_sol << U.pyobject | |
#https://github.com/hplgit/fenics-tutorial/blob/master/pub/python/vol1/ft01_poisson.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment