예제 #1
0
파일: 08.py 프로젝트: Richardma/hermes2d
set_bc(xvel, yvel, press)

ndofs = 0
ndofs += xvel.assign_dofs(ndofs)
ndofs += yvel.assign_dofs(ndofs)
ndofs += press.assign_dofs(ndofs)

xprev = Solution()
yprev = Solution()

xprev.set_zero(mesh)
yprev.set_zero(mesh)

# initialize the discrete problem
wf = WeakForm(3)
set_forms(wf, xprev, yprev)

# visualize the solution
vview = VectorView("velocity [m/s]", 0, 0, 1200, 350)
pview = ScalarView("pressure [Pa]", 0, 500, 1200, 350)
vview.set_min_max_range(0, 1.9)
vview.show_scale(False)
pview.show_scale(False)
pview.show_mesh(False)

solver = DummySolver()
sys = LinSystem(wf, solver)
sys.set_spaces(xvel, yvel, press)
sys.set_pss(pss)
#dp.set_external_fns(xprev, yprev)
예제 #2
0
# Load the mesh file
mesh = Mesh()
mesh.load(get_sample_mesh())

# Perform uniform mesh refinement
mesh.refine_all_elements()

# Create the x- and y- displacement space using the default H1 shapeset
xdisp = H1Space(mesh, P_INIT)
ydisp = H1Space(mesh, P_INIT)
set_bc(xdisp, ydisp)

# Initialize the weak formulation
wf = WeakForm(2)
set_forms(wf)

# Initialize the linear system.
ls = LinSystem(wf)
ls.set_spaces(xdisp, ydisp)

# Assemble and solve the matrix problem
xsln = Solution()
ysln = Solution()
ls.assemble()
ls.solve_system(xsln, ysln, lib="scipy")

# Visualize the solution
view = ScalarView("Von Mises stress [Pa]", 50, 50, 1200, 600)
E = float(200e9)
nu = 0.3
예제 #3
0
파일: 08.py 프로젝트: B-Rich/hermes-legacy
# Load the mesh file
mesh = Mesh()
mesh.load(get_sample_mesh())

# Perform uniform mesh refinement
mesh.refine_all_elements()

# Create the x- and y- displacement space using the default H1 shapeset
xdisp = H1Space(mesh, P_INIT)
ydisp = H1Space(mesh, P_INIT)
set_bc(xdisp, ydisp)

# Initialize the weak formulation
wf = WeakForm(2)
set_forms(wf)

# Initialize the linear system.
ls = LinSystem(wf)
ls.set_spaces(xdisp, ydisp)

# Assemble and solve the matrix problem
xsln = Solution()
ysln = Solution()
ls.assemble()
ls.solve_system(xsln, ysln, lib="scipy")

# Visualize the solution
view = ScalarView("Von Mises stress [Pa]", 50, 50, 1200, 600)
E = float(200e9)
nu = 0.3