import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import Polygon from matplotlib.collections import PatchCollection # ---------- PARAMETERS ---------- L = 2.0 # Plate length (horizontal, x-direction) a = 1.0 # Plate width (vertical, y-direction) r = 0.15 # Hole radius (a/r >= 5 --> 1/0.15 = 6.66 > 5) E = 2e11 # Young's modulus nu = 0.3 # Poisson's ratio h = 0.01 # Plate thickness # Mesh parameters Nr = 6 # Number of elements radially from hole to right edge Ntheta = 12 # Number of elements around hole (for half plate, only upper semi-circle) Nrad = Nr # Number of "rings" from hole to right edge Nvert = 16 # Number of vertical subdivisions (along y) # ---------- MESH GENERATION: RIGHT HALF ONLY ---------- # The mesh is generated from (x,y)=(0,0) to (L,a), but only x>=0, and with a hole at (0, a/2) def generate\_nodes\_elements(L, a, r, Nr, Ntheta): # Generate a polar mesh for the region near the hole, then a rect mesh for the outer region # 1. Generate points on concentric semi-circles (right half, upper half only) radii = np.linspace(r, a/2, Nr) thetas = np.linspace(-np.pi/2, np.pi/2, Ntheta) nodes = [] for rad in radii: for theta in thetas: x = rad * np.cos(theta) y = rad * np.sin(theta) + a/2 if x >= 0 and (0
Question:
import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import Polygon from matplotlib.collections import PatchCollection # ---------- PARAMETERS ---------- L = 2.0 # Plate length (horizontal, x-direction) a = 1.0 # Plate width (vertical, y-direction) r = 0.15 # Hole radius (a/r >= 5 --> 1/0.15 = 6.66 > 5) E = 2e11 # Young's modulus nu = 0.3 # Poisson's ratio h = 0.01 # Plate thickness # Mesh parameters Nr = 6 # Number of elements radially from hole to right edge Ntheta = 12 # Number of elements around hole (for half plate, only upper semi-circle) Nrad = Nr # Number of "rings" from hole to right edge Nvert = 16 # Number of vertical subdivisions (along y) # ---------- MESH GENERATION: RIGHT HALF ONLY ---------- # The mesh is generated from (x,y)=(0,0) to (L,a), but only x>=0, and with a hole at (0, a/2) def generate\_nodes\_elements(L, a, r, Nr, Ntheta): # Generate a polar mesh for the region near the hole, then a rect mesh for the outer region # 1. Generate points on concentric semi-circles (right half, upper half only) radii = np.linspace(r, a/2, Nr) thetas = np.linspace(-np.pi/2, np.pi/2, Ntheta) nodes = [] for rad in radii: for theta in thetas: x = rad * np.cos(theta) y = rad * np.sin(theta) + a/2 if x >= 0 and (0
Asked by: Test User 100064
Created at: 2025-04-26 22:09:16
Final Answer:
📢 Instructions:
- Ask anything relatd to above question only.
- For new Question goto :
VIPSolutions