solver with subdomains in pyDolfin

Asked by dbeacham

What methods are there currently available in the pyDolfin interface to solve a (non)linear problem where I have several boundary domains ie:

a = (...)*ds(1) + (...)*ds(2)
L = ...

I've had a look through some of the documentation in python for VariationalProblem/NonlinearSolver/etc but there is no mention of MeshFunctions in any of their constructors such as there would be in the corresponding c++ interface.

Thanks for any help, David.

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
dbeacham
Solved:
Last query:
Last reply:
Revision history for this message
dbeacham (blackcabbage) said :
#1

After reading through the tutorial on fenics.org I managed to sort this out using the following for any others who have a problem (effectively augmenting the cahn-hilliard demo with an extra argument):

class MyProblem(NonlinearProblem):
    def __init__(self, a, L, ext_facet_domains=None):
        NonlinearProblem.__init(self)__
        self.a = a
        self.L = L
        self.ext_facet_domains = ext_facet_domains

    def F(self, b, x):

    def J(self, A, x):

Revision history for this message
dbeacham (blackcabbage) said :
#2

That should be:

class MyProblem(NonlinearProblem):
    def __init__(self, a, L, ext_facet_domains=None):
        NonlinearProblem.__init__(self)
        self.a = a
        self.L = L
        self.ext_facet_domains = ext_facet_domains

    def F(self, b, x):
         assemble(self.L, tensor=b, exterior_facet_domains=self.ext_facet_domains)

    def J(self, A, x):
        assemble(self.a, tensor=A, exterior_facet_domains=self.ext_facet_domains)