How to implement periodic boundary conditions in FEniCS 2019, such that, if there is a displacement/force along the y-axis, then the periodic boundary condition will apply only to the x-axis, and vice versa?
What modification can be done the default pbc formulation, which is
class PeriodicBoundary(SubDomain):
# Left boundary is "target domain" G
def inside(self, x, on_boundary):
return bool(x[0] < DOLFIN_EPS and x[0] > -DOLFIN_EPS and on_boundary)
# Map right boundary (H) to left boundary (G)
def map(self, x, y):
y[0] = x[0] - 1
y[1] = x[1]
I am actually a bit hesitant to use dolfinx_mpc since it is only available in a docker container, and Iām not familiar with docker. Iām using Ubuntu WSL with Jupyter to run FEniCS. I did see something regarding āSourceā on the github page, but Iām not sure how to use that.
EDIT : I cloned the dolfinx_mpc github in the jupyter notebook, and import dolfinx_mpc works, so I think I can use it
I tried to use only x or y coordinates in the map function, but then I get the error
Error: Unable to periodic boundary mapping.
*** Reason: Need to set coordinate 0 in sub_domain.map.
This doesnāt make sense. There is a docker image available, but this is not the exclusive method by which dolfinx_mpc may be used.
I did see something regarding āSourceā on the github page
This implies using the source code. If youāre running the components of FEniCSx with whatever method youāve chosen, thereās nothing stopping you from compiling dolfinx_mpc.
This doesnāt make sense. There is a docker image available, but this is not the exclusive method by which dolfinx_mpc may be used
Well, I couldnāt find any other way other than Source and Docker (Those are mentioned on the github page, Obviously I later realized that Jupyter can clone github repositories, and decided to run git clone).
I went through the GitHub and I noticed 2 functions, create_periodic_constraint_geometrical and create_general_constraint
From the doctrings that the first function constraints all dofs, but the 2nd function seems to gives more freedom in terms of the dofs
The example section reads
If the dof D located at [d0,d1] should be constrained to the dofs
E and F at [e0,e1] and [f0,f1] as
D = alpha E + beta F
the dictionary should be:
{numpy.array([d0, d1], dtype=numpy.float64).tobytes():
{numpy.array([e0, e1], dtype=numpy.float64).tobytes(): alpha,
numpy.array([f0, f1], dtype=numpy.float64).tobytes(): beta}}
What I want to do is apply the periodic boundary condition in only 1 direction, x or y, on an edge of a square plate. Should I use the 2nd function to do that or is there any way to use the 1st one.
Could not find a configuration file for package āDOLFINXā that is
compatible with requested version ā0.5.1ā.
The following configuration files were considered but not accepted:
/home/sarvesh/anaconda3/envs/fenicsx-env/lib/cmake/dolfinx/DOLFINXConfig.cmake, version: 0.5.0
This seems to be a version mismatch, so how do I edit those lines to install a compatible version?
Iām sorry but I donāt understand how to install thatā¦I see two compressed files, if Iām supposed to download those how do I do that (in the correct directory).
EDIT
I used wget and patool to download and extract, but now I get the error
CMake Error at CMakeLists.txt:137 (add_library):
Target ādolfinx_mpcā links to target āhdf5::hdf5ā but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?