Question on how to install dolfinx_mc correctly for periodic boundary conditions?

Hello everyone, I hope this finds you well.

Following this tutorial https://jsdokken.com/dolfinx-tutorial/chapter3/robin_neumann_dirichlet.html I have learned how to set up Dirichlet, Neumann and Robin boundary conditions in FeniCSX.

Now I want to set up periodic boundary conditions, for example u(x, y=0, t) = u(x, y=1, t) and \frac{\partial u}{\partial y}(x, y=0, t) = \frac{\partial u}{\partial y}(x, y=1, t). I realized that I need to install dolfinx_mc for the implementation of periodic boundary conditions.

I installed dolfinx with :

 conda create -n fenicsx
 conda activate fenicsx
 conda install -c conda-forge fenics-dolfinx mpich pyvista matplotlib cycler 

and my dolfinx version is 0.7.2 .

Now I would like to ask how to install dolfinx_mc correctly in this case. I look forward to your help.

Best regards,
Mamadou

Dear @Mamadou_Diallo ,
First of all, DOLFINx-MPC will not be able to add the constraints on the derivatives.
To do such periodic conditions, I would recommend using my convenience function at:

(See around line 1100 for an example).
I would in addition strongly recommend moving to a newer version of DOLFINx than v0.7.2, as there are very few API changes to get to 0.9.0, but many improvements and bug-fixes.

Thank you very much @dokken for your quick reply.

Sure, I will look into it and update my dolfinx version.

Dear @dokken, is this line of code sufficient to upgrade from DolfINX v0.7.2 to 0.9.0?

conda update -c conda-forge dolfinx .

I would strongly advice making a new environment and install the packages from scratch rather than alter an existing environment.

Please help me. How can I do this?

Deactivate your current environment with conda deactivate.
Then create a new environment with
conda create -n dolfinx_v090 python=3.12
then activate this environment with
conda activate dolfinx_v090
and install dolfinx
conda install -c conda-forge fenics-dolfinx mpich pyvista
as shown at

Thank you @dokken for your help so far. I am able to download the new version of dolfinx usingconda create -n fenicsx-env. Using conda create -n dolfinx_v090 python=3.12 was not successful.
.

What is the output of these commands ?

The output of this command was conda install -c conda-forge fenics-dolfinx mpich pyvista was :

Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.

It took more than 3 hours without success. But using the one from the website took only a few minutes.

Is this within a clean environment, or inside your existing environment?

I did inside the clean environment. I ran the two following commands

conda deactivate
conda create -n dolfinx_v090 python=3.12
conda activate dolfinx_v090

and they work fine.

And what happens if you remove that environment, i.e.

conda deactivate
conda env remove -n dolfinx_v090

and then call

conda create -n dolfinx_v090
conda activate dolfinx_v090
conda install -c conda-forge fenics-dolfinx

Dear @dokken,

I got the same result as before:

(base) mamadou@it-latitude5431:~$ conda activate dolfinx_v090
(dolfinx_v090) mamadou@it-latitude5431:~$ conda install -c conda-forge fenics-dolfinx
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.