How to specify exterior_facet_domains to NonlinearVariationalsolver in C++

Asked by Pietro Maximoff


In Python, you can write:
A = assemble( a, exterior_facet_domains=boundary_parts).

How can I do this in C++ for a NonlinearVariationalSolver in C++. Currently, I tried:
mysolver.solve( exterior_facet_domains=sub_domains );

where mysolver is a NonlinearVariationalsolver.

The error is: ‘exterior_facet_domains’ was not declared in this scope.

So, how do I define it?


Question information

English Edit question
DOLFIN Edit question
No assignee Edit question
Solved by:
Jan Blechta
Last query:
Last reply:
Revision history for this message
Best Jan Blechta (blechta) said :

There are few ways of specifying subdomains. Check So you can attach subdomains to your forms or a mesh (method 2,3). You can also overload piece of code that calls assembler and specify subdomains there (method 1).

In Cahn-Hilliard demo there's shown how you overload NonlinearProblem::F,J methods - you could just supply subdomains to assembler there.

I'm not sure if it is possible for NonlineavariationalProblem but you would probably need to overload NonlinearVariationalSolver::
NonlinearDiscreteProblem::F,J methods. But you would need to check the source-code how to do this. So I would avoid this approach.


Revision history for this message
Pietro Maximoff (segment-x) said :

Thanks Jan Blechta, that solved my question.