Hi guys,
I am solving the Navier-Stokes equation with some customized coefficients for each cell, the area of each cell.
I was checking the past post, and figure out the area but I don’t know how to put it back in the weak form.
Area: define mesh
nx = 2
ny = 2
msh = mesh.create_rectangle(MPI.COMM_WORLD, [np.array([-1, -1]), np.array([1, 1])], [nx, ny], dolfinx.cpp.mesh.CellType.triangle)
cell=msh.ufl_cell()
tdim = msh.topology.dim
num_cells = msh.topology.index_map(tdim).size_local
h = dolfinx.cpp.mesh.h(msh, tdim, range(num_cells)) #h is the largest edge
print(num_cells)
print("edge length", h)
DG0 = dolfinx.fem.FunctionSpace(msh, ("DG", 0))
v_DG0 = ufl.TestFunction(DG0)
cell_area_form = dolfinx.fem.form(v_DG0*ufl.dx)
cell_area = dolfinx.fem.assemble_vector(cell_area_form)
print(cell_area.array)
What I need:
( grad u ,grad v)_over the domain dx + sum over the area of the cell (div(u) ,div(v))_for each cell dx = (f,v)_over the domaindx
then solve for the u, where v is the test function, u is the trail function
Thank you so much!
Rui