### Incompatible Dirichlet boundary condition

238

views

0

Hello,

I'm trying to implement a Dirichlet boundary condition in a scalar function space (3d mesh), but then I run into an error saying that "*** Reason: Expecting a vector-valued boundary value but given function is scalar." I wonder how to solve this issue.

To be more precise, I'm working in a 3d mesh, where some functions are vector (such as velocity vector), but others are scalars (like a electric potential). This electric potential is defined as:

$\text{potential= FunctionSpace(mesh,element, constrained_domain=PeriodicBoundary())}$potential= FunctionSpace(mesh,element, constrained_domain=PeriodicBoundary())

Where, I'm applying Periodic boundary conditions defined as class elsewhere. Then, on the walls of my geometry I should apply Dirichlet Boundary condition, but the condition varies along the geometry, so I created a class to define such subdomains.

Finally, I try to implement it via:

$\text{bc_walls = DirichletBC(potential,external_p,walls) }$bc_walls = DirichletBC(potential,external_p,walls)

Where external_p is an object from the class described above and walls represents the boundary region. The code fails at this line. Notice that if I try to replace external_p for a scalar constant (such as Constant(0)) I still face the same error, however it would run if I replaced it by a vector constant, such as Constant((0,0,0)).

I appreciate your attention and help.

I'm trying to implement a Dirichlet boundary condition in a scalar function space (3d mesh), but then I run into an error saying that "*** Reason: Expecting a vector-valued boundary value but given function is scalar." I wonder how to solve this issue.

To be more precise, I'm working in a 3d mesh, where some functions are vector (such as velocity vector), but others are scalars (like a electric potential). This electric potential is defined as:

$\text{potential= FunctionSpace(mesh,element, constrained_domain=PeriodicBoundary())}$potential= FunctionSpace(mesh,element, constrained_domain=PeriodicBoundary())

Where, I'm applying Periodic boundary conditions defined as class elsewhere. Then, on the walls of my geometry I should apply Dirichlet Boundary condition, but the condition varies along the geometry, so I created a class to define such subdomains.

Finally, I try to implement it via:

$\text{bc_walls = DirichletBC(potential,external_p,walls) }$bc_walls = DirichletBC(potential,external_p,walls)

Where external_p is an object from the class described above and walls represents the boundary region. The code fails at this line. Notice that if I try to replace external_p for a scalar constant (such as Constant(0)) I still face the same error, however it would run if I replaced it by a vector constant, such as Constant((0,0,0)).

I appreciate your attention and help.

Community: FEniCS Project

Please login to add an answer/comment or follow this question.

Hope this helps you..... :)