SciML / FEniCS.jl

A scientific machine learning (SciML) wrapper for the FEniCS Finite Element library in the Julia programming language
https://docs.sciml.ai/FEniCS/stable/
Other
96 stars 25 forks source link

Add wrapper for Cell class and assemble_local function #81

Closed CFBaptista closed 4 years ago

CFBaptista commented 4 years ago

This pull request adds a wrapper for the Cell class. I have already wrapped some of its attributes. The Cell class is needed when trying to assemble a Form in a single cell instead of in the entire mesh using the function assemble_local. This pull request also adds a wrapper for the assemble_local function. Here is an example:

using FEniCS

mesh = UnitSquareMesh(8, 8)
c = Cell(mesh, 0)

Q = FunctionSpace(mesh, "P", 1)
p = FeFunction(Q)
assign(p, Expression("x[0]+x[1]",  degree=1))

# Assemble Form in a single cell
assemble_local(p*dx, c)

# Coordinates of cell vertices
get_vertex_coordinates(c)

# Largest distance between vertices of cell
h(c)

# Coordinate of the cell mid-point
midpoint(c)

# Volume of cell
volume(c)