Fem-fenics: Difference between revisions

Jump to navigation Jump to search
29 bytes added ,  8 September 2013
no edit summary
No edit summary
No edit summary
Line 612: Line 612:
import_ufl_Problem ("PressureUpdate");
import_ufl_Problem ("PressureUpdate");


# We can either load the mesh from the file as in Dolfin but we can also use the msh pkg to generate the L-shape domain
# We can either load the mesh from the file as in Dolfin but  
# we can also use the msh pkg to generate the L-shape domain
name = [tmpnam ".geo"];
name = [tmpnam ".geo"];
fid = fopen (name, "w");
fid = fopen (name, "w");
Line 630: Line 631:
fputs (fid,"Plane Surface(8) = {7};\n");
fputs (fid,"Plane Surface(8) = {7};\n");
fclose (fid);
fclose (fid);
msho = msh2m_gmsh (canonicalize_file_name (name)(1:end-4),"scale", 1,"clscale", .2);
msho = msh2m_gmsh (canonicalize_file_name (name)(1:end-4),...
                  "scale", 1,"clscale", .2);
unlink (canonicalize_file_name (name));
unlink (canonicalize_file_name (name));


Line 675: Line 677:


# Tentative velocity step. From ufl file
# Tentative velocity step. From ufl file
#  eq = (1/k)*inner(u - u0, v)*dx + inner(grad(u0)*u0, v)*dx + \
#  eq = (1/k)*inner(u - u0, v)*dx + inner(grad(u0)*u0, v)*dx \
#     nu*inner(grad(u), grad(v))*dx - inner(f, v)*dx
#       + nu*inner(grad(u), grad(v))*dx - inner(f, v)*dx
a1 = BilinearForm ('TentativeVelocity', V, k);
a1 = BilinearForm ('TentativeVelocity', V, k);


Line 754: Line 756:


# Load mesh from file
# Load mesh from file




Line 817: Line 821:


# Tentative velocity step
# Tentative velocity step
F1 = (1/k)*inner(u - u0, v)*dx + inner(grad(u0)*u0, v)*dx + \
F1 = (1/k)*inner(u - u0, v)*dx + inner(grad(u0)*u0, v)*dx \
     nu*inner(grad(u), grad(v))*dx - inner(f, v)*dx
     + nu*inner(grad(u), grad(v))*dx - inner(f, v)*dx
a1 = lhs(F1)
a1 = lhs(F1)
L1 = rhs(F1)
L1 = rhs(F1)
60

edits

Navigation menu