Hi All,
I am trying to maintain my workflow with Fenics with Conda after having changed system from Linux based to MaxOS with Apple silicon, but I am having issues. In retrospect Fenics is quite a big hammer for my task, but it is what I have been using and don’t want to completely start from scratch with a different package.
When I was on Linux I couldn’t get FenicsX working and so proceeded with legacy Fenics. Using the legacy package I was able to get it working well for my problem. However, when I attempt to install the legacy version on my new system, following Fenics :: Anaconda.org, with conda install -c conda-forge fenics
, so that I can use my existing code, it fails with
PackagesNotFoundError: The following packages are not available from current channels:
- fenics
From what I can tell this is because it is not supported for apple silicon. Is this correct?
Ok. So following https://fenicsproject.org/download/, I have installed FenicsX with
conda install -c conda-forge fenics-dolfinx mpich pyvista
But of course now I am facing the updated API. My case is simple - no complicated geometry or mesh - just lines, rectangles, cubes etc., but a multiple fields and non-linear dynamics in the PDE, and, crucially, it needs periodic boundary conditions.
I have made some progress updating the API calls in my code by following the demos, e.g. for the Cahn-Hilliard equation. However, I can’t find any resources, anywhere, about how to implement periodic boundary conditions in Fenicsx. Everything I see is for the legacy version which implements it by first defining a subclass of SubDomain with something like:
class PeriodicBoundary(SubDomain):
m_L = 0.0
def __init__(self,a_L):
super(PeriodicBoundary,self).__init__()
self.m_L = a_L
def inside(self, x, on_boundary):
return bool(x[0] < DOLFIN_EPS and x[0] > -DOLFIN_EPS and on_boundary)
# Map right boundary to left boundary
def map(self, x, y):
y[0] = x[0] - self.m_L
Which is what I had working in legacy fenics, but doesn’t seem applicable in FenicsX. Is this correct?
Searching for an alternative, I found and installed the dolfinx_mpc package, as per Dolfinx Mpc :: Anaconda.org, and found examples employing periodic boundaries. However, beyond my not understanding the workflow for constraints with this package (requiring API calls to meshtags, locate_entities_boundary etc. that weren’t required in legacy fenics), if I understand correctly, the only API entry in dolfinx_mpc I can find is for “LinearProblem”, so I can’t apply it to my system.
I’m trying to do something seemingly simple, that I was able to do quite easily in legacy fenics, amounting to something like the Cahn-Hilliard example, but with periodic boundaries. How can I do this in FenicsX?
Thanks,
R.