Meaning of "side" argument in Boundary Conditions.


45
views
0
13 days ago by
Hello,

Sorry for the elementary question but It seems I cannot find any documentation on this subject, basically when one implements BC such as:

left = CompiledSubDomain("near(x[0], side) && on_boundary", side = 0.0)
right = CompiledSubDomain("near(x[0], side) && on_boundary", side = 1.0)

I do not know what does side=0.0 or side=1,0 mean.

Can anyone please point me into some documentation or shed some light on this?

Regards,

Carlos
Community: FEniCS Project

1 Answer


2
13 days ago by
What is going on here is that keyword arguments to CompiledSubDomain (i.e., arguments specified via "name=...") are used to set the values of variables in the C++ snippet given by the first string-valued argument.  The advantage of doing this (rather than just passing a string with "1.0" in place of "side") is that you can update the values and avoid re-compiling the C++ code.  See, e.g., the following code:
from dolfin import *
from numpy import array

abcd = CompiledSubDomain("near(x[0],a+b+c+d) && on_boundary",
                         a=1.0, b=2.0, c=3.0, d=4.0)
x = array([0.0,])
print(abcd.inside(x,True))
abcd.a = -9.0
print(abcd.inside(x,True))

(You can do the something similar with Expressions, which is often useful for updating time-dependent boundary data.)

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

Similar posts:
Search »