Giter Site home page Giter Site logo

topologyoptimizer's Introduction

GNU GPLv3 License Test TopologyOptimizer

TopologyOptimizer

This program is based on TopOpt by Johannes Haubner, Franziska Neumann and Michael Ulbrich.

Usage/Examples

Running

The program is run using run.py. This program takes in two command line arguments; a design file and a domain size. The folder designs contains some design files, and you can easily make a custom design using those files as a template. If the design is path/to/design.json, the output of the program is saved to output/design/data. The produced data can be visualized with plot.py, which automatically reads all the data files, and produces corresponding figures in output/design/figures. plot.py can also take a list of designs as an argument to limit which designs it will plot. For instance,

python3 plot.py design1 design2

will only create figures from output/design1/data and output/design2/data.

Docker

TopologyOptimizer uses fenics-dolfin, which is not available on Windows. The TopOpt project includes a docker image which makes running the program on Windows easy. As it is not my docker image, I can't guarantee that it will work forever. To use the Docker, simply run

docker pull ghcr.io/johanneshaubner/topopt:latest

cd topopt
docker run -it -v $(pwd):/topopt ghcr.io/johanneshaubner/topopt

Then, in the Docker container, you can run the program as normal:

python3 run.py designs/twin_pipe.json 40

Conda

If you are using Linux (or wsl), you can run the program using conda. I have not tested that this works, so the following text is simply copied from the TopOpt repository:

conda env create -f environment.yml --experimental-solver=libmamba
conda activate topopt

cd topopt
python3 topopt.py

conda deactivate topopt

It has to be ensured that the conda-libmamba-solver is installed.

For practical problems it is furthermore necessary to link IPOPT against HSL when compiling (see comment in http://www.dolfin-adjoint.org/en/release/documentation/stokes-topology/stokes-topology.html).

For running the MMA examples, it is required to clone the GitHub repository https://github.com/arjendeetman/GCMMA-MMA-Python into the folder mma/MMA_Python.

Design file format

The design files are written in json, and the settings are:

  1. objective
    Allowed values: "minimize_power" or "maximize_flow"
    Description: Decides the objective function to be minimized.

  2. width
    Allowed values: float
    Description: The width of the domain

  3. height
    Allowed values: float
    Description: The height of the domain

  4. fraction
    Allowed values: float
    Description: The fraction of the domain that is allowed to be empty, the volume fraction.

  5. flows
    Allowed values: list of flows, where a flow has the following values:

    • side: "left", "right", "top", or "bottom"
    • center: float
    • length: float
    • rate: float

    Description: Defines the boundary conditions on the velocity field. Each flow describes a parabolic flow pattern. A positive rate indicates flow into the domain, and a negative flow pattern indicates flow out of the domain.

  6. max_region
    Allowed values:

    • center: (float, float)
    • size: (float, float)

    Description: The region where you want to maximize flow. Mandatory for the "maximize_flow" objective, does nothing for the "minimize_power" objective. The desired flow direction is currently hard coded to (-1, 0).

  7. no_slip (optional)
    Allowed values: List containing values of "left", "right", "top", or "bottom"
    Description: The sides where there is no flow (velocity is 0). Defaults to all sides with no defined flow.

  8. zero_pressure (optional)
    Allowed values: List containing values of "left", "right", "top", or "bottom"
    Description: The sides where there is no pressure. If not set, pressure is 0 at (0, 0).

Running Tests

To run tests, run the following command:

pytest

License

GNU GPLv3

topologyoptimizer's People

Contributors

johanneshaubner avatar emilinya avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.