How to get the position information of a Node variable

Dear Juan,

I want to define the recombination rate R as a function of position in the device volume.
How to write the expression? For example, if considering the R=x^{2} where R is a Node variable.

Hi @Tao,

You should be able to use x or y or z for each component of the coordinate.

Dear Juan,

Thanks for your help! It is worked.
I have another question. If R=x^{2} where R is an Edge Variable, using x,y,z directly is not worked.
How to get the position information?( like (x@n0 + x@n1)/2 ? )

Best,
Tao

To create the position on the middle edge, the following two forms would work:

edge_average_model(device=device, region=region, node_model="x", edge_model="xmid")

which creates the xmid model.

Alternatively

edge_from_node_model(device=device, region=region, node_model="x")
edge_model(device=device, region=region, name="xmid", equation="(x@n0 + x@n1)/2")

which creates x@n0 and x@n1 edge models needed for xmid.

1 Like