I have the following L-shaped block with equally spaced grid points that I want to solve Laplace’s Equation w/ a Dirichlet Boundary Condition over:
Initially, I wrote up a Jacobi iteration solver to solve the Euler Backward discretized partial difference equation to see what the solution should converge to as a reference, and now I’m ready to dive into using fenics for the first time to discretize and solve the problem. I looked over one example for the heat equation, and from the standpoint of a beginner, it looks like I need to start by connecting the gridpoints into geometric shapes called a “mesh”, then apply an initial condition, then boundary conditions, then forcing term (0 in this case), and use a solver. What I need the most help with, is how to create a mesh from my set of gridpoints.
num_of_points_x, num_of_points_y = 11, 11
N, M = num_of_points_x-1, num_of_points_y-1
dx, dy = 0.1, 0.1
j, l = np.arange(0,num_of_points_x), np.arange(0,num_of_points_y)
x, y = j*dx, l*dy
[DNE_block_x,DNE_block_y] = np.meshgrid(np.arange(N+1-4,N+1),np.arange(N+1-6,N+1));
[X,Y] = np.meshgrid(x,y)
X[DNE_block_x,DNE_block_y] = np.nan
Y[DNE_block_x,DNE_block_y] = np.nan
I have my 2 2-D numpy arrays, X
and Y
, with NaN values outside of the L-shaped block’s boundaries, and I know that dolfinx has some built-in mesh generating functions, but I know that they don’t simply accept N-Dimensional numpy arrays and spit out a mesh, so that’s where I need help i.e. figuring out how to create a mesh for my L-shaped grid. More specifically, it states in the documentation of dolfinx.mesh.create_mesh()
that it “Create a mesh from topology and geometry arrays”, I don’t know what topology or geometry arrays are, what they look like, or how to create them, but I’m guessing they can be made from my X
and Y
arrays, and I would like to know how (if possible), as well as what goes where for the parameters i.e. what goes in place of parameters “cells”, “x”, and “e”.