Marking sub-regions

Asked by Pietro Maximoff

Hello

In the brain, there's a trapped copper wire. I'd like to mark the immediate region/tetrahedral cells surrounding the copper wire as non-conducting, i.e., with a diffusion coefficient of zero except for the top and bottom surface. I'd like to do this within the C++ code. How can I do this?

I've tried mesh.intersecting_cell() and mesh.intersecting_cells() but they didn't work.

Thanks

P.

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Johan Hake
Solved:
Last query:
Last reply:

This question was reopened

Revision history for this message
Johan Hake (johan-hake) said :
#1

What do you mean with did not work. Maybe you can try something like
this pseudo code:

   Vd = FunctionSpace(mesh, "DG", 0)
   sigma = Function(V)
   sigma.vector() = some_default_value
   for point in copperwire_points:
      for cellid in mesh.intersecting_cells(point):
         sigma.vector()[cellid] = 0

Johan

On 03/26/2012 09:05 PM, Pietro Maximoff wrote:
> New question #191778 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/191778
>
> Hello
>
> In the brain, there's a trapped copper wire. I'd like to mark the
> immediate region/tetrahedral cells surrounding the copper wire as
> non-conducting, i.e., with a diffusion coefficient of zero except for
> the top and bottom surface. I'd like to do this within the C++ code.
> How can I do this?
>
> I've tried mesh.intersecting_cell() and mesh.intersecting_cells() but
> they didn't work.
>
> Thanks
>
> P.
>
>
>

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

Thanks Johan.

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

Actually, while the above partly worked on the vertices, there was still some conduction through some parts of the cells because I used Expression to set the conduction values like so:

class Conduction : public Expression {
public:
 void eval(Array<double>& values, const Array<double>& x) const {
                        // the pseudo code above
                        ....
                        if (non_conducting)
                            values[0] = 0.0;
                        else
       values[0] = conduction_value;
 }
};

How can I (in C++) set a whole tetrahedral cell to be non-conducting and not just at the vertices?

Many thanks

P.

Revision history for this message
Best Johan Hake (johan-hake) said :
#4

You should be able to change the element of the Expression to DG0
instead of CG1. Then the conductance is set on the whole element. For
this I would also suggest using a DG0 Function instead of an Expression.
You can then in a preprocess stage set the values of the Function.

Johan

On 03/28/2012 06:01 PM, Pietro Maximoff wrote:
> Question #191778 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/191778
>
> Status: Solved => Open
>
> Pietro Maximoff is still having a problem:
> Actually, while the above partly worked on the vertices, there was still
> some conduction through some parts of the cells because I used
> Expression to set the conduction values like so:
>
> class Conduction : public Expression {
> public:
> void eval(Array<double>& values, const Array<double>& x) const {
> // the pseudo code above
> ....
> if (non_conducting)
> values[0] = 0.0;
> else
> values[0] = conduction_value;
> }
> };
>
> How can I (in C++) set a whole tetrahedral cell to be non-conducting and
> not just at the vertices?
>
> Many thanks
>
> P.
>

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

Thanks Johan Hake, that solved my question.