Hello,
I'm trying to change the volume of a cell on a 1D mesh. Is there any easy/straightforward way to do it?
By creating a IntervalMesh I'll get all the cells with the same volume according to the number of cell and the size of the domain and that's not what I want....
By creating a mesh manually, I can assign the vertex and the cell as:
mesh = Mesh()
editor.open(mesh, 'interval', 1, 1)
editor.init_vertices(37039)
editor.init_cells(12)
vert_id = 0
cell_id = 0
dist = 5.40118317e-8/10
total = 0.0
for i in range(37039):
editor.add_vertex(vert_id, total)
total += dist
vert_id += 1
#RESERVOIR
editor.add_cell(0, 0, 18514)
#MEMBRANE
editor.add_cell(1, 18514,18515)
editor.add_cell(2, 18515,18516)
editor.add_cell(3, 18516,18517)
editor.add_cell(4, 18517,18518)
editor.add_cell(5, 18518,18519)
editor.add_cell(6, 18519,18520)
editor.add_cell(7, 18520,18521)
editor.add_cell(8, 18521,18522)
editor.add_cell(9, 18522,18523)
editor.add_cell(10, 18523,18524)
# RESERVOIR
editor.add_cell(11,18524,37038)
editor.close()
mesh.init()
but then, while generating my FunctionSpace:
element = FiniteElement("Lagrange", mesh.ufl_cell(), 1)
finiteElementProductSpace = element
for i in range(numberOfSolutes-1):
finiteElementProductSpace *= element
# Generating the finite element function space
ME = FunctionSpace(mesh, finiteElementProductSpace)
I get an error:
*** Error: Unable to compute index of mesh entity.
*** Reason: Mesh entity was not found.
*** Where: This error was encountered inside MeshEntity.cpp.
By the documentation on the mesh class it says that by calling mesh.init() all entities would be created. Is it a problem related to the definition of topology and geometry of the generated mesh? Since my idea is to build a similar IntervalMesh, I copied the topology and geometry dimensions from it when opening the editor...
Can someone point out what i'm missing here?
Thanks in advance for the help!