← Back to team overview

dolfin team mailing list archive

Re: [Question #120032]: passing BC to NonlinearProblem

 

Question #120032 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/120032

    Status: Answered => Solved

Siva Shankar Rudraraju confirmed that the question is solved:
thanks. Didn't realise earlier that NonlinearProblem is an abstract
class.  Following is an the implementation with the BC's which does the
job for me.

class MechTransportEquation((NonlinearProblem):
    def __init__(self, a, L, bcs, ffc_parameters):

        NonlinearProblem.__init__(self)

        self.L = L

        self.a = a
	self.bcs=bcs

        self.reset_sparsity = True

        self.ffc_parameters = ffc_parameters

    def F(self, b, x):

        assemble(self.L, tensor=b, form_compiler_parameters=self.ffc_parameters)
	# Apply boundary conditions on b
	for bc in self.bcs:
            bc.apply(b, x);
    def J(self, A, x):

        assemble(self.a, tensor=A, reset_sparsity=self.reset_sparsity,

                 form_compiler_parameters=self.ffc_parameters)

	# Apply boundary conditions on A
	for bc in self.bcs:
            bc.apply(A);
        self.reset_sparsity = False

-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.



References