← Back to team overview

dolfin team mailing list archive

Re: [Question #92245]: Gradients and SubFunctions

 

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

    Status: Answered => Open

Phil Marinier is still having a problem:
I am doing a corrosion of rebar in concrete problem and I am mapping the potentials across the concrete domain. This problem is governed by the dirichlet BCs on the interface betweent he steel and the concrete. But those BCs depend on the current at the location which is dependant on the normal gradient at the location which is dependant on the total potential distribution, which is dependant on the BCs and around again. So originally, all i had to do was pull out the gradient values on the interface to calculate my currnets and my new BCs for the next iteration.
Now I'm trying to do solve the problem by domain decomposition. I want to eventually be able to run a series of comparisions with multiple anodes and cathodes, and eventually do the inverse problem too, possible both by domain decomposiiton and just one domain. So I have 2 domains above my anode and cathode, and they have to communicate with each other along the boundary between them. So I have to calcualte the gradients on each domain, and then average them, and reset the average gradient as my neumann condition for the next iteration.

I am calculating my gradients like so:

element = FiniteElement("Lagrange", triangle, 1)
VE = VectorElement("Lagrange", triangle, 1)

v = TestFunction(VE)
u = TrialFunction(VE)
f = Function(element)

a = dot(v, u)*dx
L = dot(v, grad(f))*dx

Function is working fine for me right now for setting boundary
conditions. Maybe I have a weird version of dolfin. I seem to have
0.9.2, but I got it by doing a mercurial clone on Aug 11th. I have been
declaring some of my Functions like so:

dolfin::Function PhiA;
dolfin::Function PhiC;
dolfin::Function GradA;
dolfin::Function GradAX;

It's been compiling, so I assume it isn't a problem. The ones that I
know the FunctionSpace I have been using the FunctionSpace in the
declaration. Should I be using Expression instead? And if I should be
using expression, I'm going to need a way to convert from Functions to
Expressions and vice versa. Most of these problems might be solved as
soon as I generate the programmers reference. If so sorry.

I ran a whole bunch of test programs when I started this whole project,
and since I'm using rectangle class for my domain, the numbering scheme
has been very constant. It starts in the bottom left corner and goes
across left to right, going up one row each time. If you are using
rectangle with the option "crossed" as I am, the node in the middle of
each square will be numbered after all the nodes at the corners of the
squares. This has been consistant in all my tests, so I stopped worrying
about it. I do use vertex iterators and the inside() function of
subdomains to make things more generic and safer.

I think what Patrick said about using multiple arguments in the .get()
and .set() functions is what I need to make this work. I can't work on
it right away though, I have to do a lot of marking for my TA job today
and probably tomorrow. I will also try and generate the programmers
reference. Thank you for your help.

Phil

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