Fenicsmechanics with anaconda (mac)

Hi,

I want to use FEniCS Mechanics on Anaconda because I put all my FEniCS package there. Yet, I am not able to figure out a way how to install it on Anaconda. I downloaded it from https://gitlab.com/ShaddenLab/fenicsmechanics and it is a .zip. And I found out that there is no “setup.exe” either. So I am totally lost here.

I also read the question FEniCS Mechanics to figure out if there’s any clue for me to install it into Anaconda. But I cannot find any help directly with anaconda, unfortunately. But I was also reminded to install cbc.solve which I also have no idea to install in anaconda.

Update:
I have tried to import the path. And there is an Error coming out:

runfile('/Users/pigdtt12345/Desktop/Bill/week_4_background/a_package_for_continuum_mechanics_simulations/fenics_package.py', wdir='/Users/pigdtt12345/Desktop/Bill/week_4_background/a_package_for_continuum_mechanics_simulations')

    **********************************************************
    *                        WARNING:                        *
    *  The CBC-Block FEniCS App, which MechanicsBlockSolver  *
    *      depends on, is not compatible with python 3.      *
    **********************************************************
    
Traceback (most recent call last):

  File "/Users/pigdtt12345/Desktop/Bill/week_4_background/a_package_for_continuum_mechanics_simulations/fenics_package.py", line 55, in <module>
    problem = fm.SolidMechanicsProblem(config)

  File "/Users/pigdtt12345/Desktop/fenics_mechanics/fenicsmechanics/solidmechanics.py", line 39, in __init__
    BaseMechanicsProblem.__init__(self, user_config)

  File "/Users/pigdtt12345/Desktop/fenics_mechanics/fenicsmechanics/basemechanics.py", line 55, in __init__
    self.config = self.check_config(user_config)

  File "/Users/pigdtt12345/Desktop/fenics_mechanics/fenicsmechanics/basemechanics.py", line 103, in check_config
    self.check_and_load_mesh(config)

  File "/Users/pigdtt12345/Desktop/fenics_mechanics/fenicsmechanics/basemechanics.py", line 196, in check_and_load_mesh
    self.mesh = load_mesh(mesh_file)

  File "/Users/pigdtt12345/Desktop/fenics_mechanics/fenicsmechanics/utils.py", line 37, in load_mesh
    mesh = dlf.Mesh(mesh_file)

RuntimeError: 

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***
***     fenics-support@googlegroups.com
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error:   Unable to read data from XML file.
*** Reason:  Unable to open file "mesh.xml.gz".
*** Where:   This error was encountered inside XMLFile.cpp.
*** Process: 0
*** 
*** DOLFIN version: 2019.1.0
*** Git changeset:  
*** -------------------------------------------------------------------------

I appreciate it if someone can guide me on how to do the process.

First , have you tried to read mesh outside fenicsmechanics ? just to troubleshoot if your installation of fenics is working fine. Second i suggest to try to seek guidance from this fenicsmechanics issue (FEniCS Mechanics) posted on the group earlier

If nothing works i can guide if you use docker to install fenics. I used it with docker and it worked fine. So you may also try to follow the same

Hi! Thank you so much for your help! Actually I have tried every possible way to build up fenicsmechanics to the fenics. The mesh works fine in my fenics in anaconda.

Actually yesterday it still did not work so I desperately turned off my laptop, but I turned it on today and I tried again the code to see if it could work as my last hope and it turned out like this:

runfile('/Users/pigdtt12345/Desktop/Bill/week_4_background/a_package_for_continuum_mechanics_simulations/fenics_package.py', wdir='/Users/pigdtt12345/Desktop/Bill/week_4_background/a_package_for_continuum_mechanics_simulations')

    **********************************************************
    *                        WARNING:                        *
    *  The CBC-Block FEniCS App, which MechanicsBlockSolver  *
    *      depends on, is not compatible with python 3.      *
    **********************************************************
    
No value was provided for 'theta'. A value of 1.0 (fully implicit) was used.
No value was provided for 'beta'. A value of 0.25 will be used for the Newmark integration scheme.
No value was provided for 'gamma'. A value of 0.5 will be used for the Newmark integration scheme.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Solving nonlinear variational problem.
  Newton iteration 0: r (abs) = 0.000e+00 (tol = 1.000e-10) r (rel) = nan (tol = 1.000e-09)
  Newton solver finished in 0 iterations and 0 linear solver iterations.
* 'u' saved *
******************************
t = 0.010000
Solving nonlinear variational problem.
  Newton iteration 0: r (abs) = 1.801e+00 (tol = 1.000e-10) r (rel) = 1.000e+00 (tol = 1.000e-09)
  Newton iteration 1: r (abs) = 4.673e-02 (tol = 1.000e-10) r (rel) = 2.594e-02 (tol = 1.000e-09)
  Newton iteration 2: r (abs) = 1.056e-05 (tol = 1.000e-10) r (rel) = 5.863e-06 (tol = 1.000e-09)
  Newton iteration 3: r (abs) = 1.361e-12 (tol = 1.000e-10) r (rel) = 7.556e-13 (tol = 1.000e-09)
  Newton solver finished in 3 iterations and 3 linear solver iterations.
* 'u' saved *
******************************
t = 0.020000
* 'u' saved *Solving nonlinear variational problem.
  Newton iteration 0: r (abs) = 1.831e+00 (tol = 1.000e-10) r (rel) = 1.000e+00 (tol = 1.000e-09)
  Newton iteration 1: r (abs) = 4.588e-02 (tol = 1.000e-10) r (rel) = 2.506e-02 (tol = 1.000e-09)
  Newton iteration 2: r (abs) = 1.147e-05 (tol = 1.000e-10) r (rel) = 6.266e-06 (tol = 1.000e-09)
  Newton iteration 3: r (abs) = 1.854e-12 (tol = 1.000e-10) r (rel) = 1.012e-12 (tol = 1.000e-09)
  Newton solver finished in 3 iterations and 3 linear solver iterations.

******************************
t = 0.030000
Solving nonlinear variational problem.
  Newton iteration 0: r (abs) = 1.862e+00 (tol = 1.000e-10) r (rel) = 1.000e+00 (tol = 1.000e-09)
  Newton iteration 1: r (abs) = 4.771e-02 (tol = 1.000e-10) r (rel) = 2.562e-02 (tol = 1.000e-09)
  Newton iteration 2: r (abs) = 1.292e-05 (tol = 1.000e-10) r (rel) = 6.935e-06 (tol = 1.000e-09)
  Newton iteration 3: r (abs) = 2.489e-12 (tol = 1.000e-10) r (rel) = 1.337e-12 (tol = 1.000e-09)
  Newton solver finished in 3 iterations and 3 linear solver iterations.
* 'u' saved *
******************************
t = 0.040000
Solving nonlinear variational problem.
  Newton iteration 0: r (abs) = 1.897e+00 (tol = 1.000e-10) r (rel) = 1.000e+00 (tol = 1.000e-09)
  Newton iteration 1: r (abs) = 5.432e-02 (tol = 1.000e-10) r (rel) = 2.864e-02 (tol = 1.000e-09)
  Newton iteration 2: r (abs) = 1.519e-05 (tol = 1.000e-10) r (rel) = 8.008e-06 (tol = 1.000e-09)
  Newton iteration 3: r (abs) = 3.286e-12 (tol = 1.000e-10) r (rel) = 1.733e-12 (tol = 1.000e-09)
  Newton solver finished in 3 iterations and 3 linear solver iterations.
* 'u' saved *
******************************
t = 0.050000
Solving nonlinear variational problem.
  Newton iteration 0: r (abs) = 1.934e+00 (tol = 1.000e-10) r (rel) = 1.000e+00 (tol = 1.000e-09)
  Newton iteration 1: r (abs) = 6.779e-02 (tol = 1.000e-10) r (rel) = 3.505e-02 (tol = 1.000e-09)
  Newton iteration 2: r (abs) = 1.834e-05 (tol = 1.000e-10) r (rel) = 9.483e-06 (tol = 1.000e-09)
  Newton iteration 3: r (abs) = 4.321e-12 (tol = 1.000e-10) r (rel) = 2.234e-12 (tol = 1.000e-09)
  Newton solver finished in 3 iterations and 3 linear solver iterations.
* 'u' saved *
******************************
t = 0.060000
Solving nonlinear variational problem.
  Newton iteration 0: r (abs) = 1.975e+00 (tol = 1.000e-10) r (rel) = 1.000e+00 (tol = 1.000e-09)
  Newton iteration 1: r (abs) = 8.986e-02 (tol = 1.000e-10) r (rel) = 4.551e-02 (tol = 1.000e-09)
  Newton iteration 2: r (abs) = 2.219e-05 (tol = 1.000e-10) r (rel) = 1.124e-05 (tol = 1.000e-09)
  Newton iteration 3: r (abs) = 6.070e-12 (tol = 1.000e-10) r (rel) = 3.074e-12 (tol = 1.000e-09)
  Newton solver finished in 3 iterations and 3 linear solver iterations.
* 'u' saved *
******************************
t = 0.070000
Solving nonlinear variational problem.
  Newton iteration 0: r (abs) = 2.019e+00 (tol = 1.000e-10) r (rel) = 1.000e+00 (tol = 1.000e-09)
  Newton iteration 1: r (abs) = 1.223e-01 (tol = 1.000e-10) r (rel) = 6.060e-02 (tol = 1.000e-09)
  Newton iteration 2: r (abs) = 2.777e-05 (tol = 1.000e-10) r (rel) = 1.376e-05 (tol = 1.000e-09)
  Newton iteration 3: r (abs) = 1.168e-11 (tol = 1.000e-10) r (rel) = 5.786e-12 (tol = 1.000e-09)
  Newton solver finished in 3 iterations and 3 linear solver iterations.
* 'u' saved *
******************************
t = 0.080000
* 'u' saved *Solving nonlinear variational problem.
  Newton iteration 0: r (abs) = 2.067e+00 (tol = 1.000e-10) r (rel) = 1.000e+00 (tol = 1.000e-09)
  Newton iteration 1: r (abs) = 1.674e-01 (tol = 1.000e-10) r (rel) = 8.101e-02 (tol = 1.000e-09)
  Newton iteration 2: r (abs) = 4.641e-05 (tol = 1.000e-10) r (rel) = 2.246e-05 (tol = 1.000e-09)
  Newton iteration 3: r (abs) = 3.619e-11 (tol = 1.000e-10) r (rel) = 1.751e-11 (tol = 1.000e-09)
  Newton solver finished in 3 iterations and 3 linear solver iterations.

******************************
t = 0.090000
Solving nonlinear variational problem.
  Newton iteration 0: r (abs) = 2.118e+00 (tol = 1.000e-10) r (rel) = 1.000e+00 (tol = 1.000e-09)
  Newton iteration 1: r (abs) = 2.276e-01 (tol = 1.000e-10) r (rel) = 1.074e-01 (tol = 1.000e-09)
  Newton iteration 2: r (abs) = 1.114e-04 (tol = 1.000e-10) r (rel) = 5.259e-05 (tol = 1.000e-09)
  Newton iteration 3: r (abs) = 1.458e-10 (tol = 1.000e-10) r (rel) = 6.883e-11 (tol = 1.000e-09)
  Newton solver finished in 3 iterations and 3 linear solver iterations.
* 'u' saved *
******************************
t = 0.100000
Solving nonlinear variational problem.
  Newton iteration 0: r (abs) = 2.174e+00 (tol = 1.000e-10) r (rel) = 1.000e+00 (tol = 1.000e-09)
  Newton iteration 1: r (abs) = 3.049e-01 (tol = 1.000e-10) r (rel) = 1.402e-01 (tol = 1.000e-09)
  Newton iteration 2: r (abs) = 2.724e-04 (tol = 1.000e-10) r (rel) = 1.253e-04 (tol = 1.000e-09)
  Newton iteration 3: r (abs) = 6.469e-10 (tol = 1.000e-10) r (rel) = 2.975e-10 (tol = 1.000e-09)
  Newton solver finished in 3 iterations and 3 linear solver iterations.
* 'u' saved *
******************************
t = 0.110000
Solving nonlinear variational problem.
  Newton iteration 0: r (abs) = 2.234e+00 (tol = 1.000e-10) r (rel) = 1.000e+00 (tol = 1.000e-09)
  Newton iteration 1: r (abs) = 3.999e-01 (tol = 1.000e-10) r (rel) = 1.790e-01 (tol = 1.000e-09)
  Newton iteration 2: r (abs) = 5.966e-04 (tol = 1.000e-10) r (rel) = 2.670e-04 (tol = 1.000e-09)
  Newton iteration 3: r (abs) = 2.712e-09 (tol = 1.000e-10) r (rel) = 1.214e-09 (tol = 1.000e-09)
  Newton iteration 4: r (abs) = 3.913e-13 (tol = 1.000e-10) r (rel) = 1.751e-13 (tol = 1.000e-09)
  Newton solver finished in 4 iterations and 4 linear solver iterations.
* 'u' saved *
******************************
t = 0.120000

To be honest, I am totally confused what’s going on here. It seems that the code worked this time? I hope you could help me verify this. I read some other fenicsmechanics q&a and also your reply to others about the installation. If this is not the right outcome. I think I may really need help from docker. (Actually I have not yet used docker either…)

This seems to be at least working now … Try going through FEniCS tutorial …you’ll get a hang of the situation