← Back to team overview

dolfin team mailing list archive

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

 

On Thu, 2010-08-05 at 03:35 +0000, Siva Shankar Rudraraju wrote:
> New question #120032 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/120032
> 
> We have a multifield problem setup using assemble(...)  and solve(....), which we are planning to rephrase as a NonlinearProblem class object as follows: 
> 
> class MechTransportEquation(NonlinearProblem):
>     def __init__(self, a, L, bcs, boundary_subdomains):
>         NonlinearProblem.__init__(self)
>         self.L = L
>         self.a = a
>         self.reset_sparsity = False
> 	self.bcs = bcs
>         self.boundary_subdomains = boundary_subdomains
>         self.ffc_opt = {"quadrature_degree": 2, "optimize": True, "eliminate_zeros": True,  "precompute_ip_const": True}
>     def F(self, b, x):
>         assemble(self.L, tensor=b)
>     def J(self, A, x):
>         assemble(self.a, tensor=A, reset_sparsity=self.reset_sparsity)
> 
> Usually I setup the essential BC as a DirichletBC object. (say bc1 = DirichletBC(U.sub(4), dirl, bott) ). So the best way would be passing bc1 as an argument during MechTransportEquation initialization. Now, my questions are:
> 
> 1) Does NonlinearProblem class accept objects of DirichletBC directly, or should we pass the BC values and respective BC domains seperately. 
> 

I'm not sure what you mean, but NonlinearProblem is an abstract class,
i.e. it knows nothing about PDEs, bc, etc.

> 2) What do the bcs, boundary_subdomains members of the NonlinearProblem class mean. Are they the BC values and respective BC domains?. If so how can I specify the subspace on which this BC is being applied (i.e, like the first argument to DirichletBC).   
> 

They are members of MechTransportEquation, not NonlinearProblem.

An object of type MechTransportEquation should be create by:

    problem = MechTransportEquation(a, L, bcs, . . . )

where '. . .' whatever else is needed to form J and F (e.g., boundary
sub-domains).

Garth

> 
> --Shiva
> 

-- 
Garth N. Wells <gnw20@xxxxxxxxx>




Follow ups

References