### Define subdomains depending on parameters

262
views
0
6 months ago by
Hi, my goal is to solve a PDE on a subdomain $\Omega_0$ (instead of the complete domain $\Omega$) such that the solution equals 0 on the rest of the domain $\Omega-\Omega_0$.
For this purpose, I want to use the class  DiricheltBoundary and define the 'inside'-function such that it returns 'true' on $\Omega-\Omega_0$ and 'false' on $\Omega_0$.
Now my problem is, that $\Omega_0$ depends on a previously computed dolfin::Function 'f', i.e. $\omega\in\Omega_0 \Leftrightarrow f(\omega)<0$.
Anybody knows how to implement this in Fenics-C++? Can I somehow incooperate a dolfin::Function as an argument to the 'inside'-function of DiricheltBoundary or is there another workaround?
Community: FEniCS Project
I will add some code examples and hope somebody can help me out!!
As explained above my question is how to define the Dirichlet Boundary in dependence of a parameter, more precisely, a dolfin::Function.
Here is what I tried so far:

The definition of the class DirichletBoundary:

class DirichletBoundary : public SubDomain
{
Function defb;
bool inside(const Array<double>& x, bool on_boundary) const
{
return defb(x[0],x[1]) <= 0;
};
public : void set_value(Function x){
defb=x;
};
};​

and the corresponding initialization in the main.cpp, where 'defbound' is a given dolfin::Function:

  Constant u0(0.0);
DirichletBoundary boundary();
boundary().set_value(defbound);
DirichletBC bc(V, u0, boundary());

Unfortunately, this doesn't work and I get the following error message from the Linking-process:

CMakeFiles/demo_poisson.dir/main.cpp.o: In Funktion 'main':
/home/Dokumente/Test/main.cpp:137: Nicht definierter Verweis auf 'boundary()'
/home/Dokumente/Test/main.cpp:139: Nicht definierter Verweis auf 'boundary()'
collect2: error: ld returned 1 exit status
CMakeFiles/demo_poisson.dir/build.make:151: die Regel für Ziel „demo_poisson“ scheiterte
make[2]: *** [demo_poisson] Fehler 1
CMakeFiles/Makefile2:67: die Regel für Ziel „CMakeFiles/demo_poisson.dir/all“ scheiterte
make[1]: *** [CMakeFiles/demo_poisson.dir/all] Fehler 2
Makefile:83: die Regel für Ziel „all“ scheiterte
make: *** [all] Fehler 2

Any help/suggestion would be greatly appreciated since I am relatively new to C++/Fenics! Also, if the question is to unprecise please don't hesitate to ask for more details!
Best regards and thanks in advance!

written 6 months ago by Miller
Hi, it seems nobody can help me? Since I really need to resolve the issue and didn't manage to figure out the problem by myself so far, I would really appreciate any advice - also according to how to proceed from here to get an answer!?
Anyone knows another forum, community or support team, I could ask for help?
written 6 months ago by Miller