コード例 #1
0
ファイル: test_structural_tube.py プロジェクト: BBarua/srlife
    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)
コード例 #2
0
ファイル: test_structural_tube.py プロジェクト: BBarua/srlife
    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)
コード例 #3
0
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)
コード例 #4
0
ファイル: run_problem.py プロジェクト: BBarua/srlife
    params = solverparams.ParameterSet()
    params[
        'progress_bars'] = True  # Print a progress bar to the screen as we solve
    params[
        'nthreads'] = 4  # Solve will run in multithreaded mode, set to number of available cores
    params['system'][
        'atol'] = 1.0e-4  # During the standby very little happens, lower the atol to accept this result

    # Choose the solvers, i.e. how we are going to solve the thermal,
    # single tube, structural system, and damage calculation problems.
    # Right now there is only one option for each
    # Define the thermal solver to use in solving the heat transfer problem
    thermal_solver = thermal.FiniteDifferenceImplicitThermalSolver(
        params["thermal"])
    # Define the structural solver to use in solving the individual tube problems
    structural_solver = structural.PythonTubeSolver(params["structural"])
    # Define the system solver to use in solving the coupled structural system
    system_solver = system.SpringSystemSolver(params["system"])
    # Damage model to use in calculating life
    damage_model = damage.TimeFractionInteractionDamage(params['damage'])

    # The solution manager
    solver = managers.SolutionManager(model,
                                      thermal_solver,
                                      thermal_mat,
                                      fluid_mat,
                                      structural_solver,
                                      deformation_mat,
                                      damage_mat,
                                      system_solver,
                                      damage_model,
コード例 #5
0
    R, T, Z = tube.mesh
    X = R * np.cos(T)
    Y = R * np.sin(T)
    cs = [X, Y, Z]
    coords = np.array([c.flatten() for c in cs[:d]])
    dres = ["disp_x", "disp_y", "disp_z"]
    disps = np.array(
        [tube.results[d].reshape((len(tube.times), -1)) for d in dres[:d]])

    mc, md = load_displacements_exodus(moose_ver[d - 1], d)

    return compare_nodal_field(mc, md, coords, disps, d)


if __name__ == "__main__":
    solver = structural.PythonTubeSolver(verbose=False)

    print("Analytical comparison")
    print("=====================")
    print("")
    for d in range(1, 4):
        for case in cases:
            tube = case.run_comparison(d, solver)

            a, r = case.evaluate_comparison(tube)
            print(case.name + ": " "%iD" % d)
            print("Max absolute error: %e" % a)
            print("Max relative error: %e" % r)
            print("")

            case.plot_comparison(tube)
コード例 #6
0
ファイル: time.py プロジェクト: BBarua/srlife
    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


if __name__ == "__main__":
    if len(sys.argv) != 2:
        raise ValueError("Need to supply one argument, problem dimension!")

    d = int(sys.argv[1])

    if d not in [1, 2, 3]:
        raise ValueError("Invalid problem dimension %i!" % d)

    solver = structural.PythonTubeSolver()

    print("Running %iD problem..." % d)

    t1 = time.time()
    tube = run_reference_simulation(d, solver)
    t2 = time.time()

    print("Walltime: %f s" % (t2 - t1))
コード例 #7
0
ファイル: test_structural_tube.py プロジェクト: BBarua/srlife
 def setUp(self):
     self.solver = structural.PythonTubeSolver()
     self.atol = 1.0e-3
コード例 #8
0
ファイル: test_structural_tube.py プロジェクト: BBarua/srlife
    def setUp(self):
        self.atol = 1.0e-3
        self.rtol = 1.0e-3

        self.problems = cases
        self.solver = structural.PythonTubeSolver()