Giter VIP home page Giter VIP logo

mem4py's Introduction

mem4py - A membrane finite element solver based on kinetic dynamic relaxation

This tool provides a solution method to solve the deformations of pressurized membrane structures. The steady-state is found with the method of kinetic dynamic relaxation which proved its effectiveness for a variety of membrane structures.

Installation:

mem4py is written in cython which is a C-compliable python script. In benefits from C like speedup and can be called using a simple python script.

  1. Get eigen3 either with
sudo apt-get install libeigen3-dev

or download under http://eigen.tuxfamily.org.

  1. Clone mem4py to folder of choice
git clone https://github.com/pthedens/mem4py.git
  1. If eigen3 is not located at /usr/include/eigen3 or C:\Program Files\eigen3 change EIGEN_PATH to eigen3 in setup.py

  2. Compile in mem4py/ with

"python setup.py build install"

or using pip

"pip install -e ."

Windows

Compiler

Install a cython compatible compiler (Visual Studio/Windows SDK C/C++) if you don't already have a C/C++ compiler.

Setup environment and dependencies with Anaconda/Miniconda

# Assuming you are running a recent python 3.x version
conda create --name mem4py cython numpy matplotlib scipy
# Run the build script
python setup.py build install
cd tutorials && python main.py

Test

In ./tutorials run main.py to test example cases.

Setting up your own problem

You can set up your own problem using gmsh and a python script. In gmsh you define the geometry and boundary conditions, and the python script is used for material and solver properties.

Mesh:

A surface mesh in gmsh format has to be provided in the /msh folder.

  • Only 3 node triangular shells are implemented as membrane elements.

  • Boundary conditions are defined on physical surfaces, lines or points

Material and solver properties:

In a python script the properties are defined in a dict which is fed to the solver. Closely follow the example case in the tutorials folder.

License:

The software is licensed under MIT.

Acknowledgments

mem4py extensively uses a cython version of eigen3 which is originally based on https://github.com/strohel/Ceygen. Many thanks to the developers to make eigen3 cython compatible.

This project has received funding from the European Union’s Horizon 2020 research and innovation programme under the Marie Sklodowska-Curie grant agreement No 642682 (AWESCO).

mem4py's People

Contributors

pthedens avatar ashcan avatar rschmehl avatar

Stargazers

Tilen Ceglar avatar  avatar  avatar  avatar Jonas Schlagenhauf avatar

Watchers

 avatar  avatar

mem4py's Issues

`ModuleNotFoundError: No module named 'mem4py.mem4py'`

I am not really familiar with python packaging, but phew there must be simpler ways!
It would seem as conda doesn't seem to install the package into the environment, but in some global scope.
So I am not sure if this is what worked ashcan@ecd2a78 or if it was something else.

Please test which works!
Option 1:

diff --git a/setup.py b/setup.py
index 9720cb3..e170301 100644
--- a/setup.py
+++ b/setup.py
@@ -32,7 +32,7 @@ files = glob('src/**/*{}'.format(ext), recursive=True)
 def makeExtension(file, includeDirs):
     # There probably is a better way of doing this..
     # Extension namespace.package.name
-    nameSpace = os.path.relpath(file, Path('src/'))
+    nameSpace = os.path.relpath(file, Path(f'src/{APPNAME}'))^M
     extName = os.path.splitext(nameSpace)[0].replace(os.path.sep, '.')
     extName = APPNAME if (extName == f"{APPNAME}.{APPNAME}") else extName  # Handle mem4py.mem4py
     return Extension(extName, [file], include_dirs=includeDirs, language='c++')```

Option 2:

diff --git a/setup.py b/setup.py
index 9720cb3..0f2cddd 100644
--- a/setup.py
+++ b/setup.py
@@ -34,7 +34,7 @@ def makeExtension(file, includeDirs):
     # Extension namespace.package.name
     nameSpace = os.path.relpath(file, Path('src/'))
     extName = os.path.splitext(nameSpace)[0].replace(os.path.sep, '.')
-    extName = APPNAME if (extName == f"{APPNAME}.{APPNAME}") else extName  # Handle mem4py.mem4py
+    #extName = APPNAME if (extName == f"{APPNAME}.{APPNAME}") else extName  # Handle mem4py.mem4py^M
     return Extension(extName, [file], include_dirs=includeDirs, language='c++')

I can't test on Linux as I seem to have other issues while compiling on Ubuntu.

ceygen errors
#16 269.8 src/mem4py/ceygen/ceygenMath.cpp:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
#16 269.8  #error Do not use this file, it is the result of a failed Cython compilation.
#16 269.8   ^~~~~
#16 269.8
#16 269.8 Error compiling Cython file:
#16 269.8 ------------------------------------------------------------
#16 269.8 ...
#16 269.8     o.init(o_data, o_shape, o_strides)
#16 269.8     o.assign(x + y[0])
#16 269.8
#16 269.8 @cython.boundscheck(False)
#16 269.8 @cython.wraparound(False)
#16 269.8 cdef dtype[:] add_vs(dtype[:] x, dtype y, dtype[:] out) nogil:
#16 269.8     ^
#16 269.8 ------------------------------------------------------------
#16 269.8
#16 269.8 src/mem4py/ceygen/ceygenMath.pyx:25:5: Function signature does not match previous declaration#16 269.8
#16 269.8 Error compiling Cython file:
#16 269.8 ------------------------------------------------------------
#16 269.8 ...
#16 269.8     o.init(o_data, o_shape, o_strides)
#16 269.8     o.assign(x * y[0])
#16 269.8
#16 269.8 @cython.boundscheck(False)
#16 269.8 @cython.wraparound(False)
#16 269.8 cdef dtype[:] multiply_vs(dtype[:] x, dtype y, dtype[:] out) nogil:
#16 269.8     ^
#16 269.8 ------------------------------------------------------------

Need Help

Hi
I am interested in the problem calculated by your code, but I am an undergraduate student and I am just starting to learn about it, is there any material I can refer to for study?

Best regards

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.