def test_example_09(): from hermes2d.examples.c09 import set_bc, temp_ext, set_forms # The following parameters can be changed: INIT_REF_NUM = 4 # number of initial uniform mesh refinements INIT_REF_NUM_BDY = 1 # number of initial uniform mesh refinements towards the boundary P_INIT = 4 # polynomial degree of all mesh elements TAU = 300.0 # time step in seconds # Problem constants T_INIT = 10 # temperature of the ground (also initial temperature) FINAL_TIME = 86400 # length of time interval (24 hours) in seconds # Global variable TIME = 0; # Boundary markers. bdy_ground = 1 bdy_air = 2 # Load the mesh mesh = Mesh() mesh.load(get_cathedral_mesh()) # Perform initial mesh refinements for i in range(INIT_REF_NUM): mesh.refine_all_elements() mesh.refine_towards_boundary(bdy_air, INIT_REF_NUM_BDY) # Create an H1 space with default shapeset space = H1Space(mesh, P_INIT) set_bc(space) # Set initial condition tsln = Solution() tsln.set_const(mesh, T_INIT) # Initialize the weak formulation wf = WeakForm() set_forms(wf) # Initialize the linear system. ls = LinSystem(wf) ls.set_spaces(space) # Time stepping nsteps = int(FINAL_TIME/TAU + 0.5) rhsonly = False; # Assemble and solve ls.assemble() rhsonly = True ls.solve_system(tsln, lib="scipy")
def test_example_09(): from hermes2d.examples.c09 import set_bc, temp_ext, set_forms # The following parameters can be changed: INIT_REF_NUM = 4 # number of initial uniform mesh refinements INIT_REF_NUM_BDY = 1 # number of initial uniform mesh refinements towards the boundary P_INIT = 4 # polynomial degree of all mesh elements TAU = 300.0 # time step in seconds # Problem constants T_INIT = 10 # temperature of the ground (also initial temperature) FINAL_TIME = 86400 # length of time interval (24 hours) in seconds # Global variable TIME = 0 # Boundary markers. bdy_ground = 1 bdy_air = 2 # Load the mesh mesh = Mesh() mesh.load(get_cathedral_mesh()) # Perform initial mesh refinements for i in range(INIT_REF_NUM): mesh.refine_all_elements() mesh.refine_towards_boundary(bdy_air, INIT_REF_NUM_BDY) # Create an H1 space with default shapeset space = H1Space(mesh, P_INIT) set_bc(space) # Set initial condition tsln = Solution() tsln.set_const(mesh, T_INIT) # Initialize the weak formulation wf = WeakForm() set_forms(wf) # Initialize the linear system. ls = LinSystem(wf) ls.set_spaces(space) # Time stepping nsteps = int(FINAL_TIME / TAU + 0.5) rhsonly = False # Assemble and solve ls.assemble() rhsonly = True ls.solve_system(tsln, lib="scipy")
def test_example_09(): from hermes2d.examples.c09 import set_bc, temp_ext, set_forms # The following parameters can be played with: P_INIT = 1 # polynomial degree of elements INIT_REF_NUM = 4 # number of initial uniform refinements TAU = 300.0 # time step in seconds # Problem constants T_INIT = 10 # temperature of the ground (also initial temperature) FINAL_TIME = 86400 # length of time interval (24 hours) in seconds # Global variable TIME = 0 # Load the mesh mesh = Mesh() mesh.load(get_cathedral_mesh()) # for i in range(INIT_REF_NUM): # mesh.refine_all_elements() # mesh.refine_towards_boundary(2, 5) # Set up shapeset shapeset = H1Shapeset() pss = PrecalcShapeset(shapeset) # Set up spaces space = H1Space(mesh, shapeset) set_bc(space) space.set_uniform_order(P_INIT) # Enumerate basis functions space.assign_dofs() # Set initial condition tsln = Solution() tsln.set_const(mesh, T_INIT) # Weak formulation wf = WeakForm(1) set_forms(wf, tsln) # Matrix solver solver = DummySolver() # Linear system ls = LinSystem(wf, solver) ls.set_spaces(space) ls.set_pss(pss) # Visualisation sview = ScalarView("Temperature", 0, 0, 450, 600) # title = "Time %s, exterior temperature %s" % (TIME, temp_ext(TIME)) # Tview.set_min_max_range(0,20); # Tview.set_title(title); # Tview.fix_scale_width(3); # Time stepping nsteps = int(FINAL_TIME / TAU + 0.5) rhsonly = False # Assemble and solve ls.assemble() rhsonly = True ls.solve_system(tsln)
TAU = 300.0 # time step in seconds # Problem constants T_INIT = 10 # temperature of the ground (also initial temperature) FINAL_TIME = 86400 # length of time interval (24 hours) in seconds # Global variable TIME = 0 # Boundary markers. bdy_ground = 1 bdy_air = 2 # Load the mesh mesh = Mesh() mesh.load(get_cathedral_mesh()) # Perform initial mesh refinements for i in range(INIT_REF_NUM): mesh.refine_all_elements() mesh.refine_towards_boundary(bdy_air, INIT_REF_NUM_BDY) # Create an H1 space with default shapeset space = H1Space(mesh, P_INIT) set_bc(space) # Set initial condition tsln = Solution() tsln.set_const(mesh, T_INIT) # Initialize the weak formulation
# The following parameters can be played with: P_INIT = 1 # polynomial degree of elements INIT_REF_NUM = 4 # number of initial uniform refinements TAU = 300.0 # time step in seconds # Problem constants T_INIT = 10 # temperature of the ground (also initial temperature) FINAL_TIME = 86400 # length of time interval (24 hours) in seconds # Global variable TIME = 0; # Load the mesh mesh = Mesh() mesh.load(get_cathedral_mesh()) for i in range(INIT_REF_NUM): mesh.refine_all_elements() mesh.refine_towards_boundary(2, 5) # Set up shapeset shapeset = H1Shapeset() pss = PrecalcShapeset(shapeset) # Set up spaces space = H1Space(mesh, shapeset) set_bc(space) space.set_uniform_order(P_INIT) # Enumerate basis functions