# Is the way borders are listed in the buildmesh argument critical?

Hello,
I observed, with the attached code, a dependence of the results on the line starting with “mesh th=buildmesh(…”.
Case 1: mesh th=buildmesh(rig(m)+lef(m)+bot(20*m)+top(20*m));
does not give the same results as
Case 2: mesh th=buildmesh(rig(m)+top(20*m)+bot(20*m)+lef(m));

The first case does not calculate the solution (output is nan), while the second case, where “top” and “lef” have been swapped, just gives very acceptable results.

The code is a small example where one can experiment on this. It is a 2D model of a paralelipipedic electrical conductor (aka “bridge”), in which Laplace equation is solved.
The original feature is that the source of electrical current flowing in this conductor are placed on the top face only, by the current (or potential ?) with a model function “lambda” (supposed to originate from an electrical upper layer where current is flowing “horizontally” plus vertical leakage in the layer under study).
I tried to figure out the rule on ordering the list of borders for building the mesh, by first looking for a hint in the manual, and then by extensive attempts of the different configurations (with m assuming one value between 4 and 20):
It generates u=NANs for
rig(m)+lef(m)+bot(20*m)+top(20*m)
rig(m)+lef(m)+top(20*m)+bot(20*m)
rig(m)+top(20*m)+lef(m)+bot(20*m)
top(20*m)+rig(m)+bot(20*m)+lef(m)
top(20*m)+bot(20*m)+rig(m)+lef(m)
lef(m)+bot(20*m)+top(20*m)+rig(m)
lef(m)+top(20*m)+rig(m)+bot(20*m).
bot(20*m)+rig(m)+lef(m)+top(20*m)

The average value of u is 0 for
rig(m)+top(20*m)+bot(20*m)+lef(m),
top(20*m)+rig(m)+lef(m)+bot(20*m),

but this is not true for
rig(m)+bot(20*m)+top(20*m)+lef(m)
rig(m)+bot(20*m)+lef(m)+top(20*m)
top(20*m)+lef(m)+rig(m)+bot(20*m)
top(20*m)+lef(m)+bot(20*m)+rig(m)
top(20*m)+bot(20*m)+lef(m)+rig(m)
lef(m)+rig(m)+top(20*m)+bot(20*m)
lef(m)+rig(m)+bot(20*m)+top(20*m)
lef(m)+top(20*m)+bot(20*m)+rig(m)
lef(m)+bot(20*m)+rig(m)+top(20*m)
bot(20*m)+lef(m)+rig(m)+top(20*m)
bot(20*m)+lef(m)+top(20*m)+rig(m)
bot(20*m)+top(20*m)+lef(m)+rig(m)
bot(20*m)+top(20*m)+rig(m)+lef(m)
bot(20*m)+rig(m)+top(20*m)+lef(m)

Does anyone know what is the rule for directly writing the proper line for building a mesh ?
As only 2 out of 24 possibilities are optimal (and 8 out of 24 are absolutely wrong), it would be helpful to know beforehand…

Thank you very much in advance
Denis
1D-bridge_Single-metal_top-bias_Mesh-Border.edp (928 Bytes)

1 Like