beam_width = 2. pressure = 2. domainCorners = np.array([[0., 0.], [0, beam_width], [beam_length, 0.], [beam_length, beam_width]]) geomDomain = Quadrilateral(domainCorners) model_data = dict() model_data["E"] = 1e3 model_data["nu"] = 0.25 model_data["state"] = "plane stress" numElemU = 20 numElemV = 10 numGauss = 4 #xPhys, yPhys = myQuad.getRandomIntPts(numPtsU*numPtsV) xPhys, yPhys, Wint = geomDomain.getQuadIntPts(numElemU, numElemV, numGauss) data_type = "float32" Xint = np.concatenate((xPhys, yPhys), axis=1).astype(data_type) Wint = np.array(Wint).astype(data_type) # prepare boundary points in the fromat Xbnd = [Xcoord, Ycoord, norm_x, norm_y] and # Wbnd for boundary integration weights and # Ybnd = [trac_x, trac_y], where Xcoord, Ycoord are the x and y coordinates of the point, # norm_x, norm_y are the x and y components of the unit normals # trac_x, trac_y are the x and y components of the traction vector at each point #boundary for x=beam_length, include both the x and y directions xPhysBnd, yPhysBnd, xNorm, yNorm, Wbnd = geomDomain.getQuadEdgePts( numElemV, numGauss, 2) Xbnd = np.concatenate((xPhysBnd, yPhysBnd, xNorm, yNorm),
xmin = 0 xmax = 1 ymin = 0 ymax = 1 domainCorners = np.array([[xmin, ymin], [xmin, ymax], [xmax, ymin], [xmax, ymax]]) myQuad = Quadrilateral(domainCorners) numPtsU = 80 numPtsV = 80 numElemU = 20 numElemV = 20 numGauss = 4 boundary_weight = 1e4 xPhys, yPhys, Wint = myQuad.getQuadIntPts(numElemU, numElemV, numGauss) data_type = "float32" Xint = np.concatenate((xPhys, yPhys), axis=1).astype(data_type) Wint = Wint.astype(data_type) Yint = rhs_fun(Xint[:, [0]], Xint[:, [1]]) xPhysBnd, yPhysBnd, _, _ = myQuad.getUnifEdgePts(numPtsU, numPtsV, [1, 1, 1, 1]) Xbnd = np.concatenate((xPhysBnd, yPhysBnd), axis=1).astype(data_type) Ybnd = exact_sol(Xbnd[:, [0]], Xbnd[:, [1]]) Wbnd = boundary_weight * np.ones_like(Ybnd).astype(data_type) #plot the boundary and interior points plt.scatter(Xint[:, 0], Xint[:, 1], s=0.5) plt.scatter(Xbnd[:, 0], Xbnd[:, 1], s=1, c='red')