Code Monkey home page Code Monkey logo

openlsto's Introduction

OpenLSTO

Open Source Code for Level Set Topology Optimization

OpenLSTO is an open-source software for level set based structural topology optimization, written in C++, developed and Maintained by researchers at UC San Diego and Cardiff University.

The topology optimization method deals with the problem of determining the optimal distribution inside a design domain in order to obtain the best structural performance. Level Set Method was originally developed as a mathematical tool for tracking the motion of interfaces. Its natural handling of topological changes coupled with a clear and smooth interface representation led to its use for structural topology optimization.

This first full release implements the M2DO lab’s level set topology optimization method to solve the problems of minimizing compliance (maximizing stiffness) under a volume constraint and minimizing stress under a volume constraint in 2D and 3D design domains. A hole nucleation algorithm for the compliance problem is also included. While OpenLSTO has been designed with ease of installation and use in mind, some third-party packages have been used in order for the code to be able to handle more complex problems. A light version of the code without third-party packages, and with less capabilities, is available here

The level-set module of this software, M2DO_LSM, was adapted from code written by Lester Hedges, which can be found here.

Installation

  • Download

To clone the repository to the local machine,(git client) git clone https://github.com/M2DOLab/OpenLSTO.git

The Zip file is also available with the following static link: Download link

  • CLI environment

In general, all OpenLSTO execution occurs via command line arguments within a terminal. For Unix/Linux or Mac OS X users, the native terminal applications are needed.

  • Execution

Go to the relevant folder under projects to run a specific module, e.g to compliance minimization:

cd projects/compliance

Compile & Build:

make main

Execution

./bin/a.out

Clean existing compilation files:

make clean

clean existing object files:

make clean_obj

clean existing output files:

make clean_results

  • External dependency

Users of OpenLSTO need a data visualization tool to post-process solution files. The software currently supports .vtk output format natively read by ParaView.

Licensing

OpenLSTO is available for download under the Apache V. 2.0 license. Please refer to the License page for terms and conditions.

Contributors

Prof. Hyunsun Alicia Kim (UCSD, Cardiff U.)

Dr. Sandilya Kambampati (UCSD)

Dr. Lester Hedges

Dr. Zongliang Du (UCSD)

Dr. Renato Picelli (Cardiff U.)

Dr. Scott Townsend (Cardiff U.)

Dr. Xiao-Yi Zhou (Cardiff U.)

Dr. Hayoung Chung (UCSD)

Dr. Eliana Bortot (UCSD)

Ms. Carolina Jauregui (UCSD)

Mr. Andreas Neofytou (Cardiff U.)

Mr. Douglas de Aquino Castro (UCSD)

openlsto's People

Contributors

carolinaj avatar giacomo-b avatar hayoungchung avatar leili-topopt avatar m2dolab avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openlsto's Issues

Question about Solve Least Squares

Hallo,
Thanks for the execellent open source code.

I have some question about the part of Solve Least Squares.

Normally, we can solve a least squares problem directly, when we the two matrix AtA and AtB obtain. Then the parameters of the second degree polynomial can be compute by L = inv(AtA)*AtB. But in you code, the CG method is employed to solve this problem. Are there any advantages when the CG method is used?

Beside, in FE analysis Ku=F, you also use CG method to solve the equilibrium equation,any advantages? (I usually solve is equation directly u=inv(K)*F. Are there any disadvantages?)

Illegal instruction: 4 - When running 3d project

I get the following message when running comp_min and the optimisation doesn't run. Have I missed something?

Screenshot 2019-04-25 at 16 47 23

$ make comp_min
g++ -std=c++14 -Wall -g  -I./../../M2DO_FEA//include -I./../../M2DO_3D_LSM/ -c -o ./../../M2DO_FEA/bin//quadrature.o ./../../M2DO_FEA//src/quadrature.cpp
In file included from ./../../M2DO_FEA//src/quadrature.cpp:1:
./../../M2DO_FEA//include/quadrature.h:4:17: warning: using directive refers to implicitly-defined namespace 'std'
using namespace std ;
                ^
1 warning generated.
g++ -std=c++14 -Wall -g  -I./../../M2DO_FEA//include -I./../../M2DO_3D_LSM/ -c -o ./../../M2DO_FEA/bin//linear_shape.o ./../../M2DO_FEA//src/linear_shape_function.cpp
g++ -std=c++14 -Wall -g  -I./../../M2DO_FEA//include -I./../../M2DO_3D_LSM/ -c -o ./../../M2DO_FEA/bin//node.o ./../../M2DO_FEA//src/node.cpp
g++ -std=c++14 -Wall -g  -I./../../M2DO_FEA//include -I./../../M2DO_3D_LSM/ -c -o ./../../M2DO_FEA/bin//solid_element.o ./../../M2DO_FEA//src/solid_element.cpp
In file included from ./../../M2DO_FEA//src/solid_element.cpp:1:
./../../M2DO_FEA//include/quadrature.h:4:17: warning: using directive refers to implicitly-defined namespace 'std'
using namespace std ;
                ^
./../../M2DO_FEA//src/solid_element.cpp:445:20: warning: unused variable 'dim_j' [-Wunused-variable]
                int shape_j = 0, dim_j = 0 ;
                                 ^
./../../M2DO_FEA//src/solid_element.cpp:445:7: warning: unused variable 'shape_j' [-Wunused-variable]
                int shape_j = 0, dim_j = 0 ;
                    ^
3 warnings generated.
g++ -std=c++14 -Wall -g  -I./../../M2DO_FEA//include -I./../../M2DO_3D_LSM/ -c -o ./../../M2DO_FEA/bin//solid_material.o ./../../M2DO_FEA//src/solid_material.cpp
g++ -std=c++14 -Wall -g  -I./../../M2DO_FEA//include -I./../../M2DO_3D_LSM/ -c -o ./../../M2DO_FEA/bin//mesh.o ./../../M2DO_FEA//src/mesh.cpp
In file included from ./../../M2DO_FEA//src/mesh.cpp:1:
./../../M2DO_FEA//include/quadrature.h:4:17: warning: using directive refers to implicitly-defined namespace 'std'
using namespace std ;
                ^
./../../M2DO_FEA//src/mesh.cpp:602:31: warning: format specifies type 'long' but the argument has type 'std::__1::__vector_base<int, std::__1::allocator<int> >::value_type'
      (aka 'int') [-Wformat]
        fprintf(pFile, "%li \t", element_type[i]);
                        ~~~      ^~~~~~~~~~~~~~~
                        %i
./../../M2DO_FEA//src/mesh.cpp:605:29: warning: format specifies type 'long' but the argument has type 'std::__1::__vector_base<int, std::__1::allocator<int> >::value_type'
      (aka 'int') [-Wformat]
                        fprintf(pFile, "%li \t", solid_elements[i].node_ids[j]);
                                        ~~~      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                        %i
./../../M2DO_FEA//src/mesh.cpp:667:9: warning: unused variable 'nel' [-Wunused-variable]
    int nel = nelx*nely;
        ^
./../../M2DO_FEA//src/mesh.cpp:708:39: warning: format specifies type 'int' but the argument has type 'std::__1::vector<M2DO_FEA::Node, std::__1::allocator<M2DO_FEA::Node>
      >::size_type' (aka 'unsigned long') [-Wformat]
    fprintf(pFile, "POINT_DATA %d\n", nodes.size());
                               ~~     ^~~~~~~~~~~~
                               %lu
./../../M2DO_FEA//src/mesh.cpp:720:1: warning: unused label 'error' [-Wunused-label]
error:
^~~~~~
./../../M2DO_FEA//src/mesh.cpp:751:39: warning: format specifies type 'int' but the argument has type 'std::__1::vector<M2DO_FEA::Node, std::__1::allocator<M2DO_FEA::Node>
      >::size_type' (aka 'unsigned long') [-Wformat]
    fprintf(pFile, "POINT_DATA %d\n", nodes.size());
                               ~~     ^~~~~~~~~~~~
                               %lu
./../../M2DO_FEA//src/mesh.cpp:763:1: warning: unused label 'error' [-Wunused-label]
error:
^~~~~~
8 warnings generated.
g++ -std=c++14 -Wall -g  -I./../../M2DO_FEA//include -I./../../M2DO_3D_LSM/ -c -o ./../../M2DO_FEA/bin//boundary_conditions.o ./../../M2DO_FEA//src/boundary_conditions.cpp
g++ -std=c++14 -Wall -g  -I./../../M2DO_FEA//include -I./../../M2DO_3D_LSM/ -c -o ./../../M2DO_FEA/bin//stationary_study.o ./../../M2DO_FEA//src/stationary_study.cpp
g++ -std=c++14 -Wall -g  -I./../../M2DO_FEA//include -I./../../M2DO_3D_LSM/ -c -o ./../../M2DO_FEA/bin//sensitivity.o ./../../M2DO_FEA//src/sensitivity.cpp
mkdir -p bin
g++ -std=c++14 -Wall -g  -I./../../M2DO_FEA//include -I./../../M2DO_3D_LSM/ -o ./bin/a.out comp_min.cpp ./../../M2DO_FEA/bin//quadrature.o ./../../M2DO_FEA/bin//linear_shape.o ./../../M2DO_FEA/bin//node.o ./../../M2DO_FEA/bin//solid_element.o ./../../M2DO_FEA/bin//solid_material.o ./../../M2DO_FEA/bin//mesh.o ./../../M2DO_FEA/bin//boundary_conditions.o ./../../M2DO_FEA/bin//stationary_study.o ./../../M2DO_FEA/bin//sensitivity.o
In file included from comp_min.cpp:2:
In file included from ./../../M2DO_3D_LSM/lsm_3d.h:12:
./../../M2DO_3D_LSM/mp_vector.cpp:84:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
./../../M2DO_3D_LSM/mp_vector.cpp:87:1: warning: all paths through this function will call itself [-Winfinite-recursion]
{
^
./../../M2DO_3D_LSM/mp_vector.cpp:99:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
In file included from comp_min.cpp:2:
In file included from ./../../M2DO_3D_LSM/lsm_3d.h:134:
./../../M2DO_3D_LSM/lsm_3d.cpp:76:26: warning: unused variable 'xGlobal' [-Wunused-variable]
                  double xGlobal = i + xLocal;
                         ^
./../../M2DO_3D_LSM/lsm_3d.cpp:77:26: warning: unused variable 'yGlobal' [-Wunused-variable]
                  double yGlobal = j + yLocal;
                         ^
./../../M2DO_3D_LSM/lsm_3d.cpp:78:26: warning: unused variable 'zGlobal' [-Wunused-variable]
                  double zGlobal = k + zLocal;
                         ^
In file included from comp_min.cpp:3:
In file included from ./../../M2DO_3D_LSM/lsm_opti_3d.h:70:
./../../M2DO_3D_LSM/lsm_opti_3d.cpp:148:12: warning: unused variable 'new_vol' [-Wunused-variable]
    double new_vol;
           ^
./../../M2DO_3D_LSM/lsm_opti_3d.cpp:41:10: warning: unused variable 'bpoint_tempx' [-Wunused-variable]
  double bpoint_tempx = 0.0, bpoint_tempy = 0.0, bpoint_tempz = 0.0;
         ^
./../../M2DO_3D_LSM/lsm_opti_3d.cpp:41:30: warning: unused variable 'bpoint_tempy' [-Wunused-variable]
  double bpoint_tempx = 0.0, bpoint_tempy = 0.0, bpoint_tempz = 0.0;
                             ^
./../../M2DO_3D_LSM/lsm_opti_3d.cpp:41:50: warning: unused variable 'bpoint_tempz' [-Wunused-variable]
  double bpoint_tempx = 0.0, bpoint_tempy = 0.0, bpoint_tempz = 0.0;
                                                 ^
./../../M2DO_3D_LSM/lsm_opti_3d.cpp:393:12: warning: unused variable 'new_vol' [-Wunused-variable]
    double new_vol;
           ^
./../../M2DO_3D_LSM/lsm_opti_3d.cpp:272:10: warning: unused variable 'bpoint_tempx' [-Wunused-variable]
  double bpoint_tempx = 0.0, bpoint_tempy = 0.0, bpoint_tempz = 0.0;
         ^
./../../M2DO_3D_LSM/lsm_opti_3d.cpp:272:30: warning: unused variable 'bpoint_tempy' [-Wunused-variable]
  double bpoint_tempx = 0.0, bpoint_tempy = 0.0, bpoint_tempz = 0.0;
                             ^
./../../M2DO_3D_LSM/lsm_opti_3d.cpp:272:50: warning: unused variable 'bpoint_tempz' [-Wunused-variable]
  double bpoint_tempx = 0.0, bpoint_tempy = 0.0, bpoint_tempz = 0.0;
                                                 ^
14 warnings generated.
$ ./bin/a.out

Number of phi values: 18081
Illegal instruction: 4
$ 

Mass matrix does not scale with thickness

While extending the code for supporting an eigenfrequencies problem (for which I need the mass matrix), I noticed that SolidElement::M() returns a matrix M_mat which does not depend on the thickness of the element (specified as h in SolidMaterial :: SolidMaterial (int spacedim, double E, double nu, double rho, double alphaT, double h)).
No matter the imposed thickness, the mass matrix always assumes it to be unitary, I believe there is a missing h in the SolidElement::M() method, correct me if I'm wrong.

Zero normals for 3D cantilever example in stl export

I've compiled the code and run the 2D examples successfully. The 3D example project for the cantilever compliance minimization problem runs successfully, and exports an stl file to 'mystlfile.stl', but all of the normals in the file are "0 0 0." This prevents it from being successfully opened with tools such as meshlab. As a work-around, I was able to import the result stl file in to OpenSCAD and then export it to generate a file that has the appropriate normals in it.

multi constraints

Can you handle multi constraints by the current Ope LSTO version? I noticed that the optimise.cpp is designed for volume constraint.

Uninitialized variable in lsm_hole_insertion.hpp

When compiling the hole_creation example, my compiler (Visual C++) produces an error due to the uninitialized variable h occurring here: https://github.com/M2DOLab/OpenLSTO/blob/master/projects/hole_creation/lsm_hole_insertion.hpp#L324
h is not set to any value, it is only declared on line 245:
https://github.com/M2DOLab/OpenLSTO/blob/master/projects/hole_creation/lsm_hole_insertion.hpp#L245
Since h is described as "unit length of element in level set mesh", it seems logical that it should have some non-zero value. Thanks in advance!

Other geometry than cuboid for 3D optimization

Hi,

I was trying to work out how to generate initial geometries for the optimizations in 3d with for example a hollow square beam. I saw that there were some functions like LevelSet3D::MakeLBeam() and LevelSet3D::Advect_LBeam(). I tried to use them but it keeps given the "Segmentation fault (code dumped)" error.

Is there a way to make different shapes, like in the stress minimization example, doing the L shape by using the kill_region function?

Thanks!

Error thrown trying to run 3D project

image

Getting the following error when running the 3D project. This is in windows with msys shell and minGw is installed.

Further details,, Shrinking the dimension to 1x1x1 gets rid of the error, but no results are generated:
image

Wrapping this package in Julia

I just wanted to inform you that there is an effort to wrap OpenLSTO in Julia as a pre-built binary package JuliaPackaging/Yggdrasil#3428. In the near future, installing OpenLSTO in Julia will be as simple as using Pkg; Pkg.add("OpenLSTO_jll") on all of Linux, Windows and Mac. Then you can call functions from this package using ccall. If anyone here wants to take a stab at wrapping OpenLSTO_jll in some thin wrapper Julia functions and types for a more pleasant experience, let me know and we can arrange a meeting.

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.