Skip to content

Commit 7e13757

Browse files
committed
describe the solver and mesher output data
1 parent 7a96cdd commit 7e13757

29 files changed

+70
-70
lines changed

pypeec/run/mesher.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -197,16 +197,16 @@ def _run_finalize(n, d, c, domain_def, reference, data_geometry):
197197

198198
# assemble the data
199199
data_geom = {
200-
"n": n,
201-
"d": d,
202-
"s": s,
203-
"c": c,
204-
"voxel_status": voxel_status,
205-
"pts_cloud": pts_cloud,
206-
"domain_def": domain_def,
207-
"graph_def": graph_def,
208-
"connect_def": connect_def,
209-
"reference": reference,
200+
"d": d, # tuple with the size of a single voxel
201+
"n": n, # tuple with the number of voxels composing structure
202+
"s": s, # tuple with the total size of the structure
203+
"c": c, # tuple with the center of the voxel structure
204+
"voxel_status": voxel_status, # dict with a summary of the voxel structure
205+
"pts_cloud": pts_cloud, # array with coordinates of the point cloud
206+
"domain_def": domain_def, # dict with the indices of the different domains
207+
"graph_def": graph_def, # list with the indices of the connected components
208+
"connect_def": connect_def, # dict describing the connected/adjacent domains
209+
"reference": reference, # dict with the faces and points of the original geometry
210210
}
211211

212212
return data_geom

pypeec/run/solver.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ def _run_solver_sweep(data_solver, data_internal, data_param, sol_init):
445445
del fct_conv
446446

447447
# compute convergence
448-
has_converged = solver_ok and condition_ok
448+
solution_ok = solver_ok and condition_ok
449449

450450
# extract the solution
451451
with LOGGER.BlockTimer("extract_solution"):
@@ -572,17 +572,17 @@ def _run_solver_sweep(data_solver, data_internal, data_param, sol_init):
572572

573573
# assign the results (will be merged in the solver output)
574574
data_sweep = {
575-
"freq": freq,
576-
"has_converged": has_converged,
577-
"solver_ok": solver_ok,
578-
"condition_ok": condition_ok,
579-
"solver_status": solver_status,
580-
"condition_status": condition_status,
581-
"solver_convergence": solver_convergence,
582-
"integral_total": integral_total,
583-
"material_losses": material_losses,
584-
"source_values": source_values,
585-
"field_values": field_values,
575+
"freq": freq, # frequency of the solution
576+
"solution_ok": solution_ok, # boolean describing if the solution is good
577+
"solver_ok": solver_ok, # boolean describing if the iterative solver has converged
578+
"condition_ok": condition_ok, # boolean indicating if the equation system condition is good
579+
"solver_status": solver_status, # dict describing the iterative solver status
580+
"condition_status": condition_status, # dict describing the equation system condition
581+
"solver_convergence": solver_convergence, # dict with the solver convergence and residuum
582+
"integral_total": integral_total, # integral of the losses, energy, and power
583+
"material_losses": material_losses, # dict with the losses in the different materials
584+
"source_values": source_values, # dict with the terminal current, voltage, and power
585+
"field_values": field_values, # dict with the field variables
586586
}
587587

588588
return data_sweep, sol
@@ -610,7 +610,7 @@ def _get_data(data_init, data_sweep, timestamp):
610610
# get status
611611
status = True
612612
for data_sweep_tmp in data_sweep.values():
613-
status = status and data_sweep_tmp["has_converged"]
613+
status = status and data_sweep_tmp["solution_ok"]
614614
status = status and data_sweep_tmp["solver_ok"]
615615
status = status and data_sweep_tmp["condition_ok"]
616616

tests/code/test_generate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ def _get_solver(data_sweep):
3333

3434
# extract the data
3535
freq = data_sweep["freq"]
36-
has_converged = data_sweep["has_converged"]
36+
solution_ok = data_sweep["solution_ok"]
3737
P_total = data_sweep["integral_total"]["P_total"]
3838
W_total = data_sweep["integral_total"]["W_total"]
3939

4040
# assemble results
4141
solver = {
4242
"freq": float(freq),
43-
"has_converged": bool(has_converged),
43+
"solution_ok": bool(solution_ok),
4444
"P_total": float(P_total),
4545
"W_total": float(W_total),
4646
}

tests/code/test_workflow.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,21 @@ def _check_solver(self, solver, solver_ref, test_tol):
4646

4747
# get the results
4848
freq_ref = solver_ref["freq"]
49-
has_converged_ref = solver_ref["has_converged"]
49+
solution_ok_ref = solver_ref["solution_ok"]
5050
P_total_ref = solver_ref["P_total"]
5151
W_total_ref = solver_ref["W_total"]
5252

5353
# extract the solution
5454
freq = solver["freq"]
55-
has_converged = solver["has_converged"]
55+
solution_ok = solver["solution_ok"]
5656
P_total = solver["P_total"]
5757
W_total = solver["W_total"]
5858

5959
# check solution
60-
self.assertEqual(has_converged, has_converged_ref, msg="invalid convergence")
61-
self.assertAlmostEqual(freq, freq_ref, delta=test_tol * freq_ref, msg="invalid frequency")
62-
self.assertAlmostEqual(P_total, P_total_ref, delta=test_tol * P_total_ref, msg="invalid losses")
63-
self.assertAlmostEqual(W_total, W_total_ref, delta=test_tol * W_total_ref, msg="invalid energy")
60+
self.assertEqual(solution_ok, solution_ok_ref, msg="invalid solution status")
61+
self.assertAlmostEqual(freq, freq_ref, delta=test_tol * freq_ref, msg="invalid frequency value")
62+
self.assertAlmostEqual(P_total, P_total_ref, delta=test_tol * P_total_ref, msg="invalid loss value")
63+
self.assertAlmostEqual(W_total, W_total_ref, delta=test_tol * W_total_ref, msg="invalid energy value")
6464

6565
def _check_results(self, mesher, solver, mesher_ref, solver_ref, test_tol):
6666
"""

tests/data/examples_png/gerber.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"solver": {
1111
"sim_default": {
1212
"freq": 1000000.0,
13-
"has_converged": true,
13+
"solution_ok": true,
1414
"P_total": 2.7868281646041186,
1515
"W_total": 1.9441629983823946e-07
1616
}

tests/data/examples_png/inductor_gap.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"solver": {
1111
"sim_default": {
1212
"freq": 0.0,
13-
"has_converged": true,
13+
"solution_ok": true,
1414
"P_total": 11.906591688172142,
1515
"W_total": 0.02042818007465582
1616
}

tests/data/examples_png/inductor_pot.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"solver": {
1111
"sim_default": {
1212
"freq": 0.0,
13-
"has_converged": true,
13+
"solution_ok": true,
1414
"P_total": 1.8095736575936958e-05,
1515
"W_total": 2.506167432430112e-08
1616
}

tests/data/examples_png/inductor_spiral.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"solver": {
1111
"sim_default": {
1212
"freq": 1000000.0,
13-
"has_converged": true,
13+
"solution_ok": true,
1414
"P_total": 1.1188705178196872,
1515
"W_total": 3.2557855644348145e-07
1616
}

tests/data/examples_png/iron_core.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"solver": {
1111
"sim_default": {
1212
"freq": 1000.0,
13-
"has_converged": true,
13+
"solution_ok": true,
1414
"P_total": 0.00014636971137275102,
1515
"W_total": 1.717903297278407e-08
1616
}

tests/data/examples_png/shield.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"solver": {
1111
"sim_default": {
1212
"freq": 0.0,
13-
"has_converged": true,
13+
"solution_ok": true,
1414
"P_total": 0.00037190323170274784,
1515
"W_total": 7.91342652253322e-09
1616
}

0 commit comments

Comments
 (0)