def run_reference_simulation(d, solver): tube = receiver.Tube(ro, ro - ri, h, nr, nt, nz) tube.set_times(times) if d == 1: tube.make_1D(0, 0) elif d == 2: tube.make_2D(0) R, T, Z = tube.mesh X = R * np.cos(T) Y = R * np.sin(T) Ts = temperature(times, X, Y, Z).reshape((len(times), ) + tube.dim[:tube.ndim]) tube.add_results("temperature", Ts) tube.set_pressure_bc(receiver.PressureBC(times, pressure(times))) solver.setup_tube(tube) state_n = solver.init_state(tube, mat) for i in range(1, len(tube.times)): state_np1 = solver.solve(tube, i, state_n, 0.0) solver.dump_state(tube, i, state_np1) state_n = state_np1 return tube
def setUp(self): self.ro = 5 self.ri = 4.5 self.h = 2.5 self.nr = 10 self.nt = 20 self.nz = 5 self.E = 150000.0 self.nu = 0.35 self.tube = receiver.Tube(self.ro, self.ro - self.ri, self.h, self.nr, self.nt, self.nz) self.times = np.array([0, 1]) self.tube.set_times(self.times) self.tube.set_pressure_bc( receiver.PressureBC(self.times, self.times / 50.0)) self.mat = parse.parse_xml( os.path.join(os.path.dirname(__file__), "moose-verification", "model.xml"), "creeping", ) self.d = 0.25 self.solver = structural.PythonTubeSolver(verbose=False)
def setUp(self): self.ro = 5 self.ri = 4.5 self.h = 2.5 self.nr = 10 self.nt = 20 self.nz = 5 self.E = 150000.0 self.nu = 0.35 self.tube = receiver.Tube(self.ro, self.ro - self.ri, self.h, self.nr, self.nt, self.nz) self.times = np.array([0, 1]) self.tube.set_times(self.times) self.tube.set_pressure_bc( receiver.PressureBC(self.times, self.times * 0)) self.emodel = elasticity.IsotropicLinearElasticModel( self.E, "youngs", self.nu, "poissons") self.mat = models.SmallStrainElasticity(self.emodel) self.d = 0.25 self.force_exact = (np.pi * (self.ro**2.0 - self.ri**2.0) * self.E * self.d / self.h) self.stiffness_exact = (np.pi * (self.ro**2.0 - self.ri**2.0) * self.E / self.h) self.solver = structural.PythonTubeSolver(verbose=False)
def make_tube(self, dim, nr=15, nt=30, nz=5): tube = receiver.Tube(self.ro, self.ro - self.ri, self.h, nr, nt, nz) if dim == 1: tube.make_1D(self.h / 2, 0) elif dim == 2: tube.make_2D(self.h / 2) times = np.array([0, 1]) tube.set_times(times) R, _, _ = tube.mesh Ts = np.zeros((2, ) + R.shape[:dim]) Ts[1] = self.T(R) tube.add_results("temperature", Ts) if self.p != 0: tube.set_pressure_bc(receiver.PressureBC(times, times * self.p)) return tube
def gen_tube(k, tforce, tube_length, tube_ri, E, alpha, nr=5): emodel = elasticity.IsotropicLinearElasticModel(E, "youngs", 0.25, "poissons") mmodel = models.SmallStrainElasticity(emodel, alpha=alpha) solver = structural.PythonTubeSolver(atol=1.0e-4) ro = np.sqrt(tube_length * k / (np.pi * E) + tube_ri**2.0) A = np.pi * (ro**2.0 - tube_ri**2.0) tube = receiver.Tube(ro, ro - tube_ri, tube_length, nr, 1, 1) tube.set_times(np.array([0, 1.0])) tube.make_1D(tube_length / 2.0, 0) dT = tforce / (E * alpha * A) temp = np.zeros((2, nr)) temp[1] = dT tube.add_results("temperature", temp) tube.set_pressure_bc( receiver.PressureBC(np.array([0, 1]), np.array([0, 0]))) return spring.TubeSpring(tube, solver, mmodel)
def valid_pressure_bc(): return receiver.PressureBC(times, np.zeros((len(times), )))
# Various meshes needed to define the boundary conditions # 1) A mesh over the times and height (for the fluid temperatures) time_h, z_h = np.meshgrid(times, np.linspace(0,height,nz), indexing='ij') # 2) A surface mesh over the outer surface (for the flux) time_s, theta_s, z_s = np.meshgrid(times, np.linspace(0,2*np.pi,nt+1)[:nt], np.linspace(0,height,nz), indexing = 'ij') # Setup each tube in turn and assign it to the correct panel # Tube 0 tube_0 = receiver.Tube(r_outer, thickness, height, nr, nt, nz, T0 = T_base) tube_0.set_times(times) tube_0.set_bc(receiver.ConvectiveBC(r_outer-thickness, height, nz, times, fluid_temp(time_h,z_h)), "inner") tube_0.set_bc(receiver.HeatFluxBC(r_outer, height, nt, nz, times, h_flux(time_s, theta_s, z_s) * h_tube_0), "outer") tube_0.set_pressure_bc(receiver.PressureBC(times, pressure(times))) # Tube 1 tube_1 = receiver.Tube(r_outer, thickness, height, nr, nt, nz, T0 = T_base) tube_1.set_times(times) tube_1.set_bc(receiver.ConvectiveBC(r_outer-thickness, height, nz, times, fluid_temp(time_h,z_h)), "inner") tube_1.set_bc(receiver.HeatFluxBC(r_outer, height, nt, nz, times, h_flux(time_s, theta_s, z_s) * h_tube_1), "outer") tube_1.set_pressure_bc(receiver.PressureBC(times, pressure(times))) # Tube 2 tube_2 = receiver.Tube(r_outer, thickness, height, nr, nt, nz, T0 = T_base) tube_2.set_times(times) tube_2.set_bc(receiver.ConvectiveBC(r_outer-thickness, height, nz, times, fluid_temp(time_h,z_h)), "inner")