def test_example_08(): from hermes2d.examples.c08 import set_bc, set_forms set_verbose(False) # The following parameter can be changed: P_INIT = 4 # 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")
def test_example_08(): from hermes2d.examples.c08 import set_bc, set_forms set_verbose(False) mesh = Mesh() mesh.load(get_sample_mesh()) shapeset = H1Shapeset() pss = PrecalcShapeset(shapeset) # create an H1 space xdisp = H1Space(mesh, shapeset) ydisp = H1Space(mesh, shapeset) xdisp.set_uniform_order(8) ydisp.set_uniform_order(8) set_bc(xdisp, ydisp) ndofs = xdisp.assign_dofs(0) ndofs += ydisp.assign_dofs(ndofs) # initialize the discrete problem wf = WeakForm(2) set_forms(wf) solver = DummySolver() sys = LinSystem(wf, solver) sys.set_spaces(xdisp, ydisp) sys.set_pss(pss) xsln = Solution() ysln = Solution() sys.assemble() sys.solve_system(xsln, ysln) E = float(200e9) nu = 0.3 stress = VonMisesFilter(xsln, ysln, E / (2 * (1 + nu)), (E * nu) / ((1 + nu) * (1 - 2 * nu)))
FN_DY, H1OrthoHP, RefSystem, ) from hermes2d.forms import set_forms from hermes2d.examples import ( get_example_mesh, get_sample_mesh, get_cylinder_mesh, get_07_mesh, get_cathedral_mesh, get_bracket_mesh, ) domain_mesh = get_example_mesh() sample_mesh = get_sample_mesh() cylinder_mesh = get_cylinder_mesh() def test_example_01(): mesh = Mesh() mesh.load(domain_mesh) mesh.refine_all_elements() mesh.refine_all_elements() mesh.refine_all_elements() def test_example_02(): set_verbose(False) mesh = Mesh()
#! /usr/bin/env python from hermes2d import Mesh, H1Shapeset, PrecalcShapeset, H1Space, \ LinSystem, WeakForm, DummySolver, Solution, ScalarView, VonMisesFilter from hermes2d.examples.c07 import set_bc, set_forms from hermes2d.examples import get_sample_mesh mesh = Mesh() mesh.load(get_sample_mesh()) #mesh.refine_element(0) #mesh.refine_all_elements() #mesh.refine_towards_boundary(5, 3) shapeset = H1Shapeset() pss = PrecalcShapeset(shapeset) # create an H1 space xdisp = H1Space(mesh, shapeset) ydisp = H1Space(mesh, shapeset) xdisp.set_uniform_order(8) ydisp.set_uniform_order(8) set_bc(xdisp, ydisp) ndofs = xdisp.assign_dofs(0) ndofs += ydisp.assign_dofs(ndofs) # initialize the discrete problem wf = WeakForm(2) set_forms(wf)
# du_2/dn = f_1 on Gamma_3 and du_2/dn = 0 on Gamma_2, Gamma_4, Gamma_5 # u_1 = 0 and u_2 = 0 on Gamma_1 # Import modules from hermes2d import Mesh, MeshView, H1Shapeset, PrecalcShapeset, H1Space, \ LinSystem, WeakForm, DummySolver, Solution, ScalarView, VonMisesFilter from hermes2d.examples.c08 import set_bc, set_forms from hermes2d.examples import get_sample_mesh # The following parameter can be changed: P_INIT = 4 # 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)
from hermes2d import Mesh, H1Shapeset, PrecalcShapeset, H1Space, \ LinSystem, WeakForm, Solution, ScalarView, VonMisesFilter, \ set_verbose, set_warn_integration, DummySolver, H2D_EPS_HIGH, H2D_FN_DX, \ H2D_FN_DY, \ H1Adapt, H1ProjBasedSelector, CandList, \ RefSystem from hermes2d.forms import set_forms from hermes2d.examples import get_example_mesh, get_sample_mesh, \ get_cylinder_mesh, get_07_mesh, get_cathedral_mesh, get_bracket_mesh domain_mesh = get_example_mesh() sample_mesh = get_sample_mesh() cylinder_mesh = get_cylinder_mesh() def test_example_01(): mesh = Mesh() mesh.load(domain_mesh) mesh.refine_all_elements() mesh.refine_all_elements() mesh.refine_all_elements() def test_example_02(): set_verbose(False) P_INIT = 3 # Load the mesh file domain_mesh = get_example_mesh() # Original L-shape domain mesh = Mesh() mesh.load(domain_mesh)