Support for quadrilateral and hexahedral meshes

Declined
#73 · Created  · Last updated

Declined pull request

Changes are moved to the other PR

Closed by: ·2017-07-12

Description

FFC now accepts "Q" and "TensorProductElement" element families. Changes made in representation.py to handle TensorProductElements Added quad and hex test cases to test/unit/misc/test_elements.py

With this PR + the corresponding PR in FIAT (https://bitbucket.org/fenics-project/fiat/pull-requests/39/) following commands work correctly:

assemble(1.0 * dx(mesh_quad)) assemble(1.0 * dx(mesh_hex)) assemble(Expression('x[...]', degree = 1) * dx(mesh_quad))

Simple Poisson equation can be solved on a quad mesh, but boundary conditions need to be applied manually (bc.apply does not work). Example:

from dolfin import * import numpy as np mesh = UnitQuadMesh(mpi_comm_world(), 2, 2) # Build the set of vertices where bcs should be prescribed node_set = VertexFunction('size_t', mesh, 0) bc_boundary = CompiledSubDomain('near(x[0], 0)') bc_boundary.mark(node_set, 1) # Only keep vertices marked as 1 node_set = [v.index() for v in SubsetIterator(node_set, 1)] V = FunctionSpace(mesh, "Lagrange", 1) dof_set = np.array(vertex_to_dof_map(V)[node_set], dtype='intc') bc_u = Constant(0.0) # Define variational problem u = TrialFunction(V) v = TestFunction(V) a = inner(grad(u), grad(v))*dx L = 1.0*v*dx A = assemble(a) # Modify A: zero bc row & set diagonal to 1 A.ident_local(dof_set) A.apply('insert') b = assemble(L) # Modify b: entry in the bc row is taken from bc_u bc_values = interpolate(bc_u, V).vector().array() b_values = b.array() b_values[dof_set] = bc_values[dof_set] b.set_local(b_values) b.apply('insert') u = Function(V) solve(A, u.vector(), b)

This PR takes care of getting the data from FIAT and computing intermediate representation for the code generation for quadhex case

UPD: together with https://bitbucket.org/fenics-project/ffc/pull-requests/82 and https://bitbucket.org/fenics-project/dolfin/pull-requests/371 topological DirichletBC will work correctly for quads and hexes

0 attachments

0 comments

Loading commits...