This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

How to apply pre-determined boundary condition to each boundary node

0 votes

I am working in a framework that has a mesh defined by an entirely separate data structure. I want to use fenics simply to solve an equation over my geometry, and then pass the solution back to the other data structure to continue computation.

In the previously defined data structure, I have a value assigned at every boundary node that I would like to use as a boundary condition in my pde. I'd appreciate any advice on the best way to do this. My ideas so far are

  1. Use the mesh editor class to build a mesh in fenics from the pre-existing mesh. Then I can assign the vertex indices explicitly and use this to determine the boundary condition.

  2. Import the mesh from a .mesh file (converted to dolfin-xml). To do this there would need to be some correspondence between the .mesh file and the index of the vertices. Does such a correspondence exist?

I am also confused as to how to define the function that applies the boundary condition. i.e. If I want to define the value of the boundary condition to be something other than an expression that depends on the coordinates, or a constant value. I've been trying to read through the API reference and it appears that I need to use the GenericFunction class. Is the eval member of the GenericFunction class a virtual function?

If you could help on any of these points I'd appreciate it.

asked Nov 17, 2016 by rviertel FEniCS Novice (700 points)
...