FEniCS Mechanics

Hi there ,

I want to use FEniCS mechanics but i am not able to figure out a way how to make it work.
In the past i have been installing packages in the past using sudo python setup.py install.

I cant figure out a way to make it work. I have downloaded FEniCS mechanics from https://gitlab.com/ShaddenLab/fenicsmechanics. I am using FEniCS 1.6.0

I would be thankful if someone can very kindly guide me how to proceed.

Best,
Ovais

I’ve never heard of that project but the instructions for installation on the bottom of this page are pretty clear.

Also note that

FEniCS Mechanics requires that version 2016.1.0 or newer of FEniCS be installed.

Thanks for your response. Actually I am using FEniCS in docker container , all other dependencies are also installed and running in docker container. I wanted to use this package in docker container so that I can operate in the same environment. Do you see a way to install and use it in docker container ? I would be grateful for your response

Hi Ovais,

I am using Fenics Mechanics. First, you need to install cbc.solve. I downloaded cbc.solve from the following link: https://github.com/Juanlu001/CBC.Solve

Installation of cbc.solve is easy. You just need to follow the instruction in the “Install” doc. Next, download fenicsmechanics and place both cbc.solve and fenicsmechanics in the same directory.

Now you can run fenicsmechanics by including the path to the fenicsmechanics directory at the top of your code. For example,

import sys
sys.path.append("…/fenicsmechanics-master")

Best wishes…

1 Like

Thanks for your reply. I am using FEniCS in Docker Container with OS Windows 10. How did you install your FEniCS ? Also which version of FEniCS are you using

This is the screen shot of my code

i am still getting this error

fenics@ea0fd10839f3:~/shared/fenicsmechanics/demos/ellipsoid$ python land_ellipsoid_edit.py
Traceback (most recent call last):
File “land_ellipsoid_edit.py”, line 3, in
import fenicsmechanics as fm
ImportError: No module named fenicsmechanics
fenics@ea0fd10839f3:~/shared/fenicsmechanics/demos/ellipsoid$

Very sorry for asking a basic question but i am a newbie with regards to fenics and using fenics mechanics for the first time.
Will be thankful for your input.
Best Regards

HI,

I am running Fenics in Ubuntu. For installation, I followed the steps as given in : https://fenicsproject.org/download/ .

I am not very much familiar with windows OS, but I am quite sure that this error is because of fenics can not find the fenicsmechancis package. I had the same problem initially. After several trials I was not able to run fenicsmechanics. Then I uninstalled everything and then created a virtual environment in Ubuntu and installed fenics, then cbc.solve and then moved the fenicsmechanics directory to the same directory as that of cbc.solve.

Well, I am also new in fenics. So, can not give any expert advise. Just try few more times.

Best of luck.

1 Like

You were right the issue was with path. I was mentioning path in windows format , once i changed the format to linux, it started working. For consumption of others the path should be
‘/home/fenics/shared/fenicsmechanics-master’

Working now ! :slight_smile: Thanks

1 Like