예제 #1
0
def main():
    """Two simultaneous point loads."""
    # Default input parameters
    nelx, nely, volfrac, penalty, rmin, ft = cli.parse_args(
        nelx=120, volfrac=0.2, rmin=1.5)
    cli.main(nelx, nely, volfrac, penalty, rmin, ft,
             bc=SimultaneousLoadsBoundaryConditions(nelx, nely))
예제 #2
0
def main():
    """Distributed load."""
    # Default input parameters
    nelx, nely, volfrac, penalty, rmin, ft = cli.parse_args(
        nelx=120, volfrac=0.2, rmin=1.2)
    cli.main(nelx, nely, volfrac, penalty, rmin, ft,
             bc=DistributedLoadBoundaryConditions(nelx, nely))
예제 #3
0
def main():
    """Multiple loads."""
    # Default input parameters
    nelx, nely, volfrac, penalty, rmin, ft = cli.parse_args(nelx=120,
                                                            volfrac=0.2,
                                                            rmin=1.5)
    bc = MultipleLoadsBoundaryConditions(nelx, nely)
    problem = ComplianceProblem(bc, penalty)
    cli.main(nelx, nely, volfrac, penalty, rmin, ft, bc=bc, problem=problem)
예제 #4
0
def main():
    """I-shaped beam domain with stress computation."""
    # Default input parameters
    nelx, nely, volfrac, penalty, rmin, ft = cli.parse_args(
        nelx=120, nely=120, volfrac=0.3, penalty=12, rmin=1.2)
    bc = IBeamBoundaryConditions(nelx, nely)
    problem = VonMisesStressProblem(nelx, nely, penalty, bc)
    gui = StressGUI(problem, title="Stress on I Beam")
    filter = [topopt.filters.SensitivityBasedFilter,
              topopt.filters.DensityBasedFilter][ft](nelx, nely, rmin)
    solver = TopOptSolver(problem, volfrac, filter,
                          gui, maxeval=4000, ftol_rel=1e-5)
    cli.main(nelx, nely, volfrac, penalty, rmin, ft, solver=solver)
예제 #5
0
def main():
    """Run the example by constructing the TopOpt objects."""
    # Default input parameters
    nelx, nely, volfrac, penalty, rmin, ft = cli.parse_args(nelx=100,
                                                            nely=100,
                                                            volfrac=0.3,
                                                            penalty=10,
                                                            rmin=1.4)
    bc = DisplacementInverterBoundaryConditions(nelx, nely)
    # bc = GripperBoundaryConditions(nelx, nely)
    # bc = CrossSensitivityExampleBoundaryConditions(nelx, nely)
    problem = MechanismSynthesisProblem(bc, penalty)
    title = cli.title_str(nelx, nely, volfrac, rmin, penalty)
    gui = GUI(problem, title)
    filter = [SensitivityBasedFilter, DensityBasedFilter][ft](nelx, nely, rmin)
    solver = MechanismSynthesisSolver(problem, volfrac, filter, gui)
    cli.main(nelx, nely, volfrac, penalty, rmin, ft, solver=solver)
예제 #6
0
def main():
    """Multiple simultaneous point loads with stress computation."""
    # Default input parameters
    nelx, nely, volfrac, penalty, rmin, ft = cli.parse_args(nelx=120,
                                                            volfrac=0.2,
                                                            rmin=1.2)
    bc = DistributedLoadBoundaryConditions(nelx, nely)
    problem = VonMisesStressProblem(nelx, nely, penalty, bc)
    gui = StressGUI(problem, title="Stresses of Distributed Load Example")
    cli.main(nelx,
             nely,
             volfrac,
             penalty,
             rmin,
             ft,
             bc=bc,
             problem=problem,
             gui=gui)
예제 #7
0
def main():
    """Multiple loads with stresses."""
    # Default input parameters
    nelx, nely, volfrac, penalty, rmin, ft = cli.parse_args(nelx=120,
                                                            volfrac=0.2,
                                                            rmin=1.5)
    bc = MultipleLoadsBoundaryConditions(nelx, nely)
    problem = VonMisesStressProblem(nelx, nely, penalty, bc)
    title = cli.title_str(nelx, nely, volfrac, rmin, penalty)
    gui = StressGUI(problem, title)
    cli.main(nelx,
             nely,
             volfrac,
             penalty,
             rmin,
             ft,
             bc=bc,
             problem=problem,
             gui=gui)
예제 #8
0
def main():
    """Explore affects of parameters using complicance problem and MBB Beam."""
    # Default input parameters
    nelx, nely, volfrac, penalty, rmin, ft = cli.parse_args()
    cli.main(nelx, nely, volfrac, penalty, rmin, ft)
    # Vary the filter radius
    for scaled_factor in [0.25, 2]:
        cli.main(nelx, nely, volfrac, penalty, scaled_factor * rmin, ft)
    # Vary the penalization power
    for scaled_factor in [0.5, 4]:
        cli.main(nelx, nely, volfrac, scaled_factor * penalty, rmin, ft)
    # Vary the discreization
    for scale_factor in [0.5, 2]:
        cli.main(int(scale_factor * nelx), int(scale_factor * nely), volfrac,
                 penalty, rmin, ft)