I really appreciate your feedback, dokken. I understand about the MWE. In your MWE though, you seem to inject a current (J) but it doesnât leave the material, or at least I donât see where. I will stick to my weak form for now at least.
Thanks to your code, I am now able to reach a convergence in 1 step. I have many questions. And some observations.
First, I get a convergence in 1 step, regardless whether I choose to use the bcs or not, which is a good thing.
[comment 0] I still get a different value for the resistance: about -3.88 vs -3.87, this is very strange to me. I am expecting a much better agreement, especially with the solver tolerance. In order to investigate which value I could trust, I have set up a different mesh, a simple square where I inject the current on 1 side, and it leaves on the other side. I think this is very similar to your MWE. The geo file is
SetFactory("OpenCASCADE");
Rectangle(1) = {0, 0, 0, 1, 1, 0};
Physical Curve("left_end", 5) = {4};
Physical Curve("right_end", 6) = {2};
Physical Surface("rod", 7) = {1};
Injecting a current of 1 A, with a resistivity of 1 ohm m, this makes the resistance worth 1 ohm. I therefore tested my code, but adapted to this mesh:
from dolfinx import log
from dolfinx.fem import (Constant, Function, FunctionSpace, assemble_scalar,
dirichletbc, form, locate_dofs_geometrical, VectorFunctionSpace,
locate_dofs_topological, Expression)
from dolfinx.fem.petsc import NonlinearProblem
from dolfinx.io import XDMFFile, gmshio
from dolfinx.nls.petsc import NewtonSolver
from mpi4py import MPI
from petsc4py import PETSc
from petsc4py.PETSc import ScalarType
from ufl import (FiniteElement, Measure, MixedElement, SpatialCoordinate,
TestFunction, TrialFunction, as_tensor, dot, dx, grad, inner,
inv, split, derivative, FacetNormal, div)
from mpi4py import MPI
import gmsh
from dolfinx.io import gmshio, VTXWriter, XDMFFile
# Reminder of the mesh:
#Physical Curve("left_end", 5) = {4};
#Physical Curve("right_end", 6) = {2};
#Physical Surface("rod", 7) = {1};
def resistance(meshfile):
mesh, cell_markers, facet_markers = gmshio.read_from_msh(meshfile, MPI.COMM_WORLD, gdim=2)
the_current = 1.0
current_curves=(5,6)
voltages_curves=(5,6)
inj_current_curve, out_current_curve = current_curves
reading_voltage_curve_0, reading_voltage_curve_1 = voltages_curves
# Define FE function space
deg = 1
el = FiniteElement("CG", mesh.ufl_cell(), deg)
V = FunctionSpace(mesh, el)
v = TestFunction(V)
volt = Function(V)
rho = 1
sigma = 1.0 / rho
# Define the boundary conditions
left_facets = facet_markers.find(inj_current_curve)
right_facets = facet_markers.find(out_current_curve)
left_dofs = locate_dofs_topological(V, mesh.topology.dim-1, left_facets)
V_current_contact_out = 0
bcs = [dirichletbc(ScalarType(V_current_contact_out), left_dofs, V)]
x = SpatialCoordinate(mesh)
dx = Measure("dx", domain=mesh, subdomain_data=cell_markers)
ds = Measure("ds", domain=mesh, subdomain_data=facet_markers)
J = the_current / assemble_scalar(form(1 * ds(inj_current_curve, domain=mesh)))
#J = the_current / mesh.comm.allreduce(assemble_scalar(form(1 * ds)), op=MPI.SUM)
# Weak form.
F_V = -dot(grad(v), sigma * grad(volt))*dx - v * J * ds(out_current_curve) + v * J * ds(inj_current_curve)
weak_form = F_V
# Solve the PDE.
from dolfinx.fem.petsc import NonlinearProblem
from dolfinx.nls.petsc import NewtonSolver
print(f''' ------- Pre-processing --------
Current density: {J}
Length of the side where current is injected: {assemble_scalar(form(1 * ds(inj_current_curve, domain=mesh)))}
Length of the side where current leaves the wire: {assemble_scalar(form(1 * ds(out_current_curve, domain=mesh)))}
This should correspond to the current injected: {assemble_scalar(form(J*ds(out_current_curve)))}
''')
# Solve the PDE.
problem = NonlinearProblem(weak_form, volt)
solver = NewtonSolver(MPI.COMM_WORLD, problem)
ksp = solver.krylov_solver
opts = PETSc.Options()
option_prefix = ksp.getOptionsPrefix()
opts[f"{option_prefix}ksp_type"] = "preonly"
opts[f"{option_prefix}pc_type"] = "lu"
opts[f"{option_prefix}pc_factor_mat_solver_type"] = "mumps"
# Option to support solving a singular matrix
opts[f"{option_prefix}mat_mumps_icntl_24"] = 1
opts[f"{option_prefix}mat_mumps_icntl_25"] = 0
ksp.setFromOptions()
nullspace = PETSc.NullSpace().create(constant=True) # type: ignore
PETSc.Mat.setNearNullSpace(solver.A, nullspace)
log.set_log_level(log.LogLevel.INFO)
n, converged = solver.solve(volt)
assert (converged)
print(f'''------- Processing --------
Number of interations: {n:d}''')
avg_voltage_curve_integral_0 = assemble_scalar(form(volt * ds(reading_voltage_curve_0, domain=mesh))) / assemble_scalar(form(1 * ds(reading_voltage_curve_0, domain=mesh)))
avg_voltage_curve_integral_1 = assemble_scalar(form(volt * ds(reading_voltage_curve_1, domain=mesh))) / assemble_scalar(form(1 * ds(reading_voltage_curve_1, domain=mesh)))
voltage_diff = avg_voltage_curve_integral_1 - avg_voltage_curve_integral_0
resistance = voltage_diff / assemble_scalar(form(J*ds(out_current_curve)))
return resistance
res = resistance("meshes/rectangle.msh")
print(res)
Surprisingly, with or without the bcs, I get almost the same result: -1.0000000000000044
without bcs versus -1.0000000000000033
if I make the change to problem = NonlinearProblem(weak_form, volt, bcs=bcs)
. Both results are correct here, I unfortunately cannot say one is wrong, unlike with my original problem where there is a clearer discrepancy.
[comment 1] I have also commented these 2 lines: opts[f"{option_prefix}mat_mumps_icntl_24"] = 1 opts[f"{option_prefix}mat_mumps_icntl_25"] = 0
but I didnât see any difference, the results looked the same.
[comment 2] I suppose your change in the current: from J = the_current / assemble_scalar(form(1 * ds(inj_current_curve, domain=mesh)))
to J = the_current / mesh.comm.allreduce(assemble_scalar(form(1 * ds)), op=MPI.SUM)
makes the code execute in parallel over several cores. However, since I print (J) as a âdebugâ message, this makes it âwrongâ, I got 0.25 instead of 1.0, I am guessing this is because I have 4 cores and because I didnât execute the code with mpi. Could you confirm? Since I donât care that much for speed for now, I stick with my original version, but thatâs good to know, thanks a lot.
[comment 3] I still donât know how you managed to get my code to converge within 1 step. I guess itâs due to the NullSpace code that you added that made it.
[comment 4] To get a MWE, you can use my code in post #1, with the following file.msh (I have made it coarser so I can paste it here):
$MeshFormat
4.1 0 8
$EndMeshFormat
$PhysicalNames
3
1 12 "bottom_left"
1 13 "top_right"
2 11 "material"
$EndPhysicalNames
$Entities
5 4 1 0
0 0.3 0 0 0
1 0 0 0 0
2 0.1 0 0 0
3 0.3 0.2 0 0
4 0.3 0.3 0 0
1 0 0 0 0.1 0 0 1 12 2 1 -2
2 0.1000000000000001 0 0 0.3 0.2 0 0 2 2 -3
3 0.3 0.2 0 0.3 0.3 0 1 13 2 3 -4
4 0 2.775557561562891e-17 0 0.3 0.3 0 0 2 4 -1
1 0 0 0 0.3 0.3 0 1 11 4 1 2 3 4
$EndEntities
$Nodes
9 49 1 49
0 1 0 1
1
0 0 0
0 2 0 1
2
0.1 0 0
0 3 0 1
3
0.3 0.2 0
0 4 0 1
4
0.3 0.3 0
1 1 0 2
5
6
0.03333333333325102 0 0
0.06666666666657722 0 0
1 2 0 7
7
8
9
10
11
12
13
0.1038429439423803 0.03901806451898689 0
0.1152240935962743 0.07653668671089414 0
0.1337060777469523 0.1111140469144082 0
0.1585786441003551 0.141421356574974 0
0.1888859536863945 0.1662939226544912 0
0.2234633137657499 0.1847759066011582 0
0.2609819357260938 0.1961570561063693 0
1 3 0 2
14
15
0.3 0.2333333333332429 0
0.3 0.2666666666665726 0
1 4 0 11
16
17
18
19
20
21
22
23
24
25
26
0.2608421422178005 0.2974334583968472 0
0.222354286247288 0.2897777478272476 0
0.1851949699472492 0.277163859611218 0
0.149999999603689 0.2598076209065213 0
0.1173715708373174 0.2380060017343492 0
0.08786796515531267 0.2121320338672412 0
0.06199399755946106 0.1826284282423582 0
0.04019237862615604 0.1499999995868845 0
0.02283614010033391 0.1148050293563756 0
0.01022225204799443 0.07764571328710894 0
0.002566541571773218 0.03915785754384799 0
2 1 0 23
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
0.0413979112448767 0.05504386686537008 0
0.2478738417556512 0.2607948122182109 0
0.1172559504083849 0.1501325043815482 0
0.189491751213472 0.2035707026394489 0
0.06199399765141789 0.1173715710024526 0
0.1497187591145245 0.1825592211061508 0
0.2259535988020302 0.2245187058007437 0
0.07650739812244896 0.0720990456391345 0
0.1534697101733109 0.2210249121950804 0
0.1146622665772489 0.1853377342766507 0
0.1869726972776099 0.2409512587658482 0
0.09733385725251832 0.1083273105897004 0
0.07049813283566345 0.03352290142560477 0
0.04259153983341438 0.08739304523008834 0
0.07792997143130471 0.1471803928066659 0
0.2583016659779281 0.2296274481583706 0
0.2767193656010433 0.2489749153694481 0
0.2148288145545207 0.2589214124439176 0
0.04289251713042833 0.02554492516696457 0
0.2797986583751052 0.2184712890889483 0
0.2766891191412518 0.2751340016931657 0
0.1261616008303159 0.2111500161994755 0
0.08880964708989009 0.1746225430370515 0
$EndNodes
$Elements
3 76 1 76
1 1 1 3
1 1 5
2 5 6
3 6 2
1 3 1 3
4 3 14
5 14 15
6 15 4
2 1 2 70
7 26 1 5
8 26 5 45
9 31 34 38
10 38 29 41
11 34 31 40
12 6 2 39
13 19 35 37
14 2 7 39
15 32 30 35
16 12 13 33
17 29 10 32
18 11 30 32
19 18 19 37
20 34 8 38
21 35 30 37
22 31 38 41
23 29 32 36
24 9 29 38
25 27 26 45
26 33 13 42
27 16 17 28
28 25 26 27
29 19 20 35
30 7 8 34
31 30 12 33
32 41 29 49
33 23 24 31
34 9 10 29
35 11 12 30
36 10 11 32
37 27 34 40
38 33 28 44
39 28 33 42
40 34 27 39
41 30 33 37
42 8 9 38
43 25 27 40
44 7 34 39
45 32 35 48
46 4 16 47
47 13 3 46
48 31 24 40
49 24 25 40
50 23 31 41
51 22 23 41
52 29 36 49
53 5 6 45
54 36 32 48
55 17 18 44
56 15 4 47
57 20 21 48
58 6 39 45
59 21 22 49
60 21 36 48
61 16 28 47
62 36 21 49
63 14 15 43
64 28 17 44
65 18 37 44
66 37 33 44
67 35 20 48
68 3 14 46
69 14 43 46
70 39 27 45
71 28 42 43
72 43 42 46
73 28 43 47
74 22 41 49
75 42 13 46
76 43 15 47
$EndElements
With this coarse mesh, without the bcs part, I get:
Info : Reading 'meshes/quarter_annulus.msh'...
Info : 10 entities
Info : 49 nodes
Info : 76 elements
Info : Done reading 'meshes/quarter_annulus.msh'
2024-03-30 14:23:51.312 (3259.473s) [main ] utils.cpp:612 INFO| Compute partition of cells across ranks
2024-03-30 14:23:51.312 (3259.473s) [main ] graphbuild.cpp:533 INFO| Building mesh dual graph
2024-03-30 14:23:51.312 (3259.473s) [main ] graphbuild.cpp:396 INFO| Build local part of mesh dual graph
2024-03-30 14:23:51.312 (3259.473s) [main ] graphbuild.cpp:89 INFO| Build nonlocal part of mesh dual graph
2024-03-30 14:23:51.312 (3259.473s) [main ] graphbuild.cpp:545 INFO| Graph edges (local: 184, non-local: 0)
2024-03-30 14:23:51.312 (3259.473s) [main ] partitioners.cpp:316 INFO| Compute graph partition using PT-SCOTCH
2024-03-30 14:23:51.313 (3259.473s) [main ] MPI.cpp:155 INFO| Computing communicaton graph edges (using NBX algorithm). Number of input edges: 1
2024-03-30 14:23:51.313 (3259.474s) [main ] MPI.cpp:218 INFO| Finished graph edge discovery using NBX algorithm. Number of discovered edges 1
2024-03-30 14:23:51.313 (3259.474s) [main ] graphbuild.cpp:396 INFO| Build local part of mesh dual graph
2024-03-30 14:23:51.313 (3259.474s) [main ] ordering.cpp:202 INFO| GPS pseudo-diameter:(23) 39-0
2024-03-30 14:23:51.313 (3259.474s) [main ] Topology.cpp:923 INFO| Create topology
2024-03-30 14:23:51.313 (3259.474s) [main ] MPI.cpp:155 INFO| Computing communicaton graph edges (using NBX algorithm). Number of input edges: 0
2024-03-30 14:23:51.313 (3259.474s) [main ] MPI.cpp:218 INFO| Finished graph edge discovery using NBX algorithm. Number of discovered edges 0
2024-03-30 14:23:51.313 (3259.474s) [main ] partition.cpp:232 INFO| Compute ghost indices
2024-03-30 14:23:51.313 (3259.474s) [main ] MPI.cpp:155 INFO| Computing communicaton graph edges (using NBX algorithm). Number of input edges: 0
2024-03-30 14:23:51.314 (3259.474s) [main ] MPI.cpp:218 INFO| Finished graph edge discovery using NBX algorithm. Number of discovered edges 0
2024-03-30 14:23:51.314 (3259.474s) [main ] MPI.cpp:155 INFO| Computing communicaton graph edges (using NBX algorithm). Number of input edges: 0
2024-03-30 14:23:51.314 (3259.474s) [main ] MPI.cpp:218 INFO| Finished graph edge discovery using NBX algorithm. Number of discovered edges 0
2024-03-30 14:23:51.314 (3259.474s) [main ] MPI.cpp:155 INFO| Computing communicaton graph edges (using NBX algorithm). Number of input edges: 0
2024-03-30 14:23:51.314 (3259.474s) [main ] MPI.cpp:218 INFO| Finished graph edge discovery using NBX algorithm. Number of discovered edges 0
2024-03-30 14:23:51.314 (3259.474s) [main ] MPI.cpp:155 INFO| Computing communicaton graph edges (using NBX algorithm). Number of input edges: 0
2024-03-30 14:23:51.314 (3259.475s) [main ] MPI.cpp:218 INFO| Finished graph edge discovery using NBX algorithm. Number of discovered edges 0
2024-03-30 14:23:51.314 (3259.475s) [main ] MPI.cpp:155 INFO| Computing communicaton graph edges (using NBX algorithm). Number of input edges: 0
2024-03-30 14:23:51.314 (3259.475s) [main ] MPI.cpp:218 INFO| Finished graph edge discovery using NBX algorithm. Number of discovered edges 0
2024-03-30 14:23:51.314 (3259.475s) [main ] MPI.cpp:155 INFO| Computing communicaton graph edges (using NBX algorithm). Number of input edges: 0
2024-03-30 14:23:51.314 (3259.475s) [main ] MPI.cpp:218 INFO| Finished graph edge discovery using NBX algorithm. Number of discovered edges 0
2024-03-30 14:23:51.314 (3259.475s) [main ] MPI.cpp:155 INFO| Computing communicaton graph edges (using NBX algorithm). Number of input edges: 0
2024-03-30 14:23:51.314 (3259.475s) [main ] MPI.cpp:218 INFO| Finished graph edge discovery using NBX algorithm. Number of discovered edges 0
2024-03-30 14:23:51.314 (3259.475s) [main ] MPI.h:367 INFO| Number of neighbourhood source ranks in distribute_to_postoffice: 0
2024-03-30 14:23:51.314 (3259.475s) [main ] MPI.cpp:155 INFO| Computing communicaton graph edges (using NBX algorithm). Number of input edges: 0
2024-03-30 14:23:51.314 (3259.475s) [main ] MPI.cpp:218 INFO| Finished graph edge discovery using NBX algorithm. Number of discovered edges 0
2024-03-30 14:23:51.314 (3259.475s) [main ] MPI.h:499 INFO| Neighbourhood destination ranks from post office in distribute_data (rank, num dests, num dests/mpi_size): 0, 0, 0
2024-03-30 14:23:51.315 (3259.475s) [main ] xdmf_utils.cpp:449 INFO| XDMF distribute entity data
2024-03-30 14:23:51.315 (3259.475s) [main ] xdmf_utils.cpp:499 INFO| XDMF send entity nodes size:(49)
2024-03-30 14:23:51.315 (3259.475s) [main ] xdmf_utils.cpp:580 INFO| XDMF send entity keys size: (70)
2024-03-30 14:23:51.315 (3259.475s) [main ] xdmf_utils.cpp:651 INFO| XDMF return entity and value data size:(70)
2024-03-30 14:23:51.315 (3259.475s) [main ] xdmf_utils.cpp:684 INFO| XDMF build map
2024-03-30 14:23:51.315 (3259.475s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 2 - 0
2024-03-30 14:23:51.315 (3259.476s) [main ] MeshTags.h:140 INFO| Building MeshTgas object from tagged entities (defined by vertices).
2024-03-30 14:23:51.315 (3259.476s) [main ] Topology.cpp:1204 INFO| Build list if mesh entity indices from the entity vertices.
2024-03-30 14:23:51.315 (3259.476s) [main ] xdmf_utils.cpp:449 INFO| XDMF distribute entity data
2024-03-30 14:23:51.315 (3259.476s) [main ] xdmf_utils.cpp:499 INFO| XDMF send entity nodes size:(49)
2024-03-30 14:23:51.315 (3259.476s) [main ] xdmf_utils.cpp:580 INFO| XDMF send entity keys size: (6)
2024-03-30 14:23:51.315 (3259.476s) [main ] xdmf_utils.cpp:651 INFO| XDMF return entity and value data size:(6)
2024-03-30 14:23:51.315 (3259.476s) [main ] xdmf_utils.cpp:684 INFO| XDMF build map
2024-03-30 14:23:51.315 (3259.476s) [main ]topologycomputation.cpp:746 INFO| Computing mesh entities of dimension 1
2024-03-30 14:23:51.316 (3259.476s) [main ] MPI.cpp:155 INFO| Computing communicaton graph edges (using NBX algorithm). Number of input edges: 0
2024-03-30 14:23:51.316 (3259.476s) [main ] MPI.cpp:218 INFO| Finished graph edge discovery using NBX algorithm. Number of discovered edges 0
2024-03-30 14:23:51.316 (3259.477s) [main ] MPI.cpp:155 INFO| Computing communicaton graph edges (using NBX algorithm). Number of input edges: 0
2024-03-30 14:23:51.316 (3259.477s) [main ] MPI.cpp:218 INFO| Finished graph edge discovery using NBX algorithm. Number of discovered edges 0
2024-03-30 14:23:51.316 (3259.477s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 1 - 2
2024-03-30 14:23:51.316 (3259.477s) [main ]topologycomputation.cpp:650 INFO| Computing mesh connectivity 1 - 2 from transpose.
2024-03-30 14:23:51.316 (3259.477s) [main ] MeshTags.h:140 INFO| Building MeshTgas object from tagged entities (defined by vertices).
2024-03-30 14:23:51.316 (3259.477s) [main ] Topology.cpp:1204 INFO| Build list if mesh entity indices from the entity vertices.
2024-03-30 14:23:51.324 (3259.484s) [main ]topologycomputation.cpp:746 INFO| Computing mesh entities of dimension 0
2024-03-30 14:23:51.324 (3259.484s) [main ] MPI.cpp:155 INFO| Computing communicaton graph edges (using NBX algorithm). Number of input edges: 0
2024-03-30 14:23:51.324 (3259.484s) [main ] MPI.cpp:218 INFO| Finished graph edge discovery using NBX algorithm. Number of discovered edges 0
2024-03-30 14:23:51.324 (3259.485s) [main ] MPI.cpp:155 INFO| Computing communicaton graph edges (using NBX algorithm). Number of input edges: 0
2024-03-30 14:23:51.324 (3259.485s) [main ] MPI.cpp:218 INFO| Finished graph edge discovery using NBX algorithm. Number of discovered edges 0
2024-03-30 14:23:51.324 (3259.485s) [main ] MPI.cpp:155 INFO| Computing communicaton graph edges (using NBX algorithm). Number of input edges: 0
2024-03-30 14:23:51.324 (3259.485s) [main ] MPI.cpp:218 INFO| Finished graph edge discovery using NBX algorithm. Number of discovered edges 0
2024-03-30 14:23:51.324 (3259.485s) [main ] MPI.cpp:155 INFO| Computing communicaton graph edges (using NBX algorithm). Number of input edges: 0
2024-03-30 14:23:51.324 (3259.485s) [main ] MPI.cpp:218 INFO| Finished graph edge discovery using NBX algorithm. Number of discovered edges 0
2024-03-30 14:23:51.324 (3259.485s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 1 - 2
2024-03-30 14:23:51.330 (3259.491s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 1 - 2
2024-03-30 14:23:51.330 (3259.491s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 2 - 1
2024-03-30 14:23:51.330 (3259.491s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 1 - 2
2024-03-30 14:23:51.330 (3259.491s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 2 - 1
2024-03-30 14:23:51.335 (3259.495s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 1 - 2
2024-03-30 14:23:51.335 (3259.495s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 2 - 1
2024-03-30 14:23:51.335 (3259.495s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 1 - 2
2024-03-30 14:23:51.335 (3259.495s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 2 - 1
2024-03-30 14:23:51.339 (3259.500s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 1 - 2
2024-03-30 14:23:51.339 (3259.500s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 2 - 1
2024-03-30 14:23:51.339 (3259.500s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 1 - 2
2024-03-30 14:23:51.339 (3259.500s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 2 - 1
------- Pre-processing --------
Current density: 10.0
Length of the side where current is injected: 0.1
Length of the side where current leaves the wire: 0.09999999999999998
This should correspond to the current injected: 0.9999999999999998
2024-03-30 14:23:51.671 (3259.832s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 1 - 2
2024-03-30 14:23:51.671 (3259.832s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 2 - 1
2024-03-30 14:23:51.671 (3259.832s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 1 - 2
2024-03-30 14:23:51.671 (3259.832s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 2 - 1
2024-03-30 14:23:52.046 (3260.207s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 1 - 2
2024-03-30 14:23:52.046 (3260.207s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 2 - 1
2024-03-30 14:23:52.046 (3260.207s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 1 - 2
2024-03-30 14:23:52.046 (3260.207s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 2 - 1
------- Processing --------
Number of interations: 1
-3.8548389568554344
2024-03-30 14:23:52.361 (3260.522s) [main ] SparsityPattern.cpp:389 INFO| Column ghost size increased from 0 to 0
2024-03-30 14:23:52.362 (3260.523s) [main ] NewtonSolver.cpp:36 INFO| Newton iteration 0: r (abs) = 0.745356 (tol = 1e-10) r (rel) = inf(tol = 1e-09)
2024-03-30 14:23:52.362 (3260.523s) [main ] petsc.cpp:677 INFO| PETSc Krylov solver starting to solve system.
2024-03-30 14:23:52.363 (3260.524s) [main ] NewtonSolver.cpp:36 INFO| Newton iteration 1: r (abs) = 4.5343e-15 (tol = 1e-10) r (rel) = 3.72362e-16(tol = 1e-09)
2024-03-30 14:23:52.363 (3260.524s) [main ] NewtonSolver.cpp:255 INFO| Newton solver finished in 1 iterations and 1 linear solver iterations.
2024-03-30 14:23:52.367 (3260.528s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 1 - 2
2024-03-30 14:23:52.367 (3260.528s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 2 - 1
2024-03-30 14:23:52.367 (3260.528s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 1 - 2
2024-03-30 14:23:52.367 (3260.528s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 2 - 1
2024-03-30 14:23:52.371 (3260.532s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 1 - 2
2024-03-30 14:23:52.371 (3260.532s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 2 - 1
2024-03-30 14:23:52.371 (3260.532s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 1 - 2
2024-03-30 14:23:52.371 (3260.532s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 2 - 1
2024-03-30 14:23:52.375 (3260.535s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 1 - 2
2024-03-30 14:23:52.375 (3260.535s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 2 - 1
2024-03-30 14:23:52.375 (3260.535s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 1 - 2
2024-03-30 14:23:52.375 (3260.535s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 2 - 1
2024-03-30 14:23:52.379 (3260.539s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 1 - 2
2024-03-30 14:23:52.379 (3260.539s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 2 - 1
2024-03-30 14:23:52.379 (3260.539s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 1 - 2
2024-03-30 14:23:52.379 (3260.539s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 2 - 1
2024-03-30 14:23:52.382 (3260.543s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 1 - 2
2024-03-30 14:23:52.382 (3260.543s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 2 - 1
2024-03-30 14:23:52.382 (3260.543s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 1 - 2
2024-03-30 14:23:52.382 (3260.543s) [main ]topologycomputation.cpp:786 INFO| Requesting connectivity 2 - 1
With the bcs I get a similar output but with a resistance of -3.847426332583171
.
So this MWE displays the same behavior: -3.8548389568554344
vs -3.847426332583171
. For my purpose, I absolutely need to know which one is correct, the error would be too big otherwise.
Thanks again if you have any insight (and please consider my file.msh + original code as a sort of MWE even though it is in 2 files and could be trimmed).