msh_parser¶
-
dg_maxwell.msh_parser.plot_element_boundary(x_nodes, y_nodes, axes_handler, grid_width=2.0, grid_color='blue')[source]¶ Plots the boundary of a given \(2^{nd}\) order element.
Parameters: x_nodes : np.ndarray [8]
\(x\) nodes of the element.
y_nodes : np.ndarray [8]
\(y\) nodes of the element.
axes_handler : matplotlib.axes.Axes
The plot handler being used to plot the element grid. You may generate it by calling the function pyplot.axes()
grid_width : float
Grid line width.
grid_color : str
Grid line color.
Returns: None
-
dg_maxwell.msh_parser.plot_element_grid(x_nodes, y_nodes, xi_LGL, eta_LGL, axes_handler, grid_width=1.0, grid_color='red')[source]¶ Uses the \(\xi_{LGL}\) and \(\eta_{LGL}\) points to plot a grid in the \(x-y\) plane using the points corresponding to the \((\xi_{LGL}, \eta_{LGL})\) points.
Usage
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
# Plots a grid for an element using 8 LGL points N_LGL = 8 xi_LGL = lagrange.LGL_points(N) eta_LGL = lagrange.LGL_points(N) # 8 x_nodes and y_nodes of an element x_nodes = [0., 0., 0., 0.5, 1., 1., 1., 0.5] y_nodes = [1., 0.5, 0., 0., 0., 0.5, 1., 1.] axes_handler = pyplot.axes() msh_parser.plot_element_grid(x_nodes, y_nodes, xi_LGL, eta_LGL, axes_handler) pyplot.title(r'Gird plot of an element.') pyplot.xlabel(r'$x$') pyplot.ylabel(r'$y$') pyplot.xlim(-.1, 1.1) pyplot.ylim(-.1, 1.1) pyplot.show()
Parameters: x_nodes : np.array [8]
x_nodes of the element.
y_nodes : np.array [8]
y_nodes of the element.
xi_LGL : np.array [N_LGL]
LGL points on the \(\xi\) axis
eta_LGL : np.array [N_LGL]
LGL points on the \(\eta\) axis
axes_handler : matplotlib.axes.Axes
The plot handler being used to plot the element grid. You may generate it by calling the function pyplot.axes()
grid_width : float
Grid line width.
grid_color : str
Grid line color.
Returns: None
-
dg_maxwell.msh_parser.plot_mesh_grid(nodes, elements, xi_LGL, eta_LGL, axes_handler)[source]¶ Plots the mesh grid.
Parameters: nodes : np.ndarray [N, 2]
Array of nodes in the mesh. First column and the second column are the \(x\) and \(y\) coordinates respectivily.
elements : np.ndarray [N_e, 8]
Array of elements.
xi_LGL : np.array [N_LGL]
LGL points on the \(\xi\) axis
eta_LGL : np.array [N_LGL]
LGL points on the \(\eta\) axis
axes_handler : matplotlib.axes.Axes
The plot handler being used to plot the element grid. You may generate it by calling the function pyplot.axes()
Returns: None
-
dg_maxwell.msh_parser.read_order_2_msh(msh_file)[source]¶ Parses the \(2^{nd}\) order .msh files.
Parameters: msh_file : str
.msh file to be parsed
Returns: tuple(np.ndarray, np.ndarray)
Tuple of Nodes and Elements respectively. Nodes is a \(N \times 2\) array, where, \(N\) is the total number of Nodes in the mesh. Each node contains it’s \((x, y)\) coordinates. Elements is a \(N_e \times 8\) array which contains the tags of all the nodes which defines each element. A tag of a node is the array index of a node.