Revert "Work on Elmer sims"

This reverts commit cb81979a7f.
This commit is contained in:
jaseg 2024-10-08 16:18:57 +02:00
parent 8577c6209f
commit d310493e93
3 changed files with 13 additions and 34 deletions

View file

@ -1,21 +1,3 @@
Coil_Solver:
Equation: CoilSolver
Procedure: '"CoilSolver" "CoilSolver"'
Linear System Solver: Iterative
Linear System Preconditioning: ILU1
Linear System Max Iterations: 1000
Linear System Convergence Tolerance: 1e-10
Linear System Iterative Method: BiCGStab
Linear System Residual Output: 10
Steady State Convergence Tolerance: 1e-06
Normalize Coil Current: True
Nonlinear System Consistent Norm: True
Coil Closed: True
Narrow Interface: True
Save Coil Set: True
Save Coil Index: True
Calculate Elemental Fields: True
Static_Current_Conduction:
Equation: Static Current Conduction
Variable: Potential

View file

@ -208,13 +208,13 @@ def inductance(mesh_file, sim_dir, solver_method):
fr4 = elmer.load_material('fr4', sim, 'coil_mag_materials.yml')
copper = elmer.load_material('copper', sim, 'coil_mag_materials.yml')
solver_coil = elmer.load_solver('Coil_Solver', sim, 'coil_mag_solvers.yml')
solver_current = elmer.load_solver('Static_Current_Conduction', sim, 'coil_mag_solvers.yml')
solver_magdyn = elmer.load_solver('Magneto_Dynamics', sim, 'coil_mag_solvers.yml')
if solver_method:
solver_magdyn.data['Linear System Iterative Method'] = solver_method
solver_magdyn_calc = elmer.load_solver('Magneto_Dynamics_Calculations', sim, 'coil_mag_solvers.yml')
copper_eqn = elmer.Equation(sim, 'copperEqn', [solver_coil, solver_magdyn, solver_magdyn_calc])
copper_eqn = elmer.Equation(sim, 'copperEqn', [solver_current, solver_magdyn, solver_magdyn_calc])
air_eqn = elmer.Equation(sim, 'airEqn', [solver_magdyn, solver_magdyn_calc])
bdy_trace = elmer.Body(sim, 'trace', [physical['trace'][1]])
@ -237,20 +237,20 @@ def inductance(mesh_file, sim_dir, solver_method):
bdy_if_bottom.material = copper
bdy_if_bottom.equation = copper_eqn
comp_coil = elmer.Component(sim, 'Coil', [bdy_trace])
comp_coil.data['Desired Current Density'] = 'Real 1.0'
current_force = elmer.BodyForce(sim, 'Source', {
'Current Density 1': 'Equals "CoilCurrent e 1"',
'Current Density 2': 'Equals "CoilCurrent e 2"',
'Current Density 3': 'Equals "CoilCurrent e 3"',
})
bdy_trace.body_force = current_force
potential_force = elmer.BodyForce(sim, 'electric_potential', {'Electric Potential': 'Equals "Potential"'})
bdy_trace.body_force = potential_force
# boundaries
boundary_airbox = elmer.Boundary(sim, 'FarField', [physical['airbox_surface'][1]])
boundary_airbox.data['Electric Infinity BC'] = 'True'
boundary_vplus = elmer.Boundary(sim, 'Vplus', [physical['interface_top'][1]])
boundary_vplus.data['Potential'] = 1.0
boundary_vplus.data['Save Scalars'] = True
boundary_vminus = elmer.Boundary(sim, 'Vminus', [physical['interface_bottom'][1]])
boundary_vminus.data['Potential'] = 0.0
with tempfile.TemporaryDirectory() as tmpdir:
tmpdir = sim_dir if sim_dir else Path(tmpdir)
@ -261,8 +261,6 @@ def inductance(mesh_file, sim_dir, solver_method):
stdout_log=(tmpdir / 'ElmerGrid_stdout.log'),
stderr_log=(tmpdir / 'ElmerGrid_stderr.log'))
solver_stdout, solver_stderr = (tmpdir / 'ElmerSolver_stdout.log'), (tmpdir / 'ElmerSolver_stderr.log')
print('Solver stdout:', solver_stdout)
print('Solver stderr:', solver_stderr)
res = elmer_solver(tmpdir,
stdout_log=solver_stdout,
stderr_log=solver_stderr)

View file

@ -617,7 +617,6 @@ def print_valid_twists(ctx, param, value):
@click.option('--twists', type=int, default=1, help='Number of twists per revolution. Note that this number must be co-prime to the number of turns. Run with --show-twists to list valid values. (default: 1)')
@click.option('--circle-segments', type=int, default=64, help='When not using arcs, the number of points to use for arc interpolation per 360 degrees.')
@click.option('--show-twists', callback=print_valid_twists, expose_value=False, type=int, is_eager=True, help='Calculate and show valid --twists counts for the given number of turns. Takes the number of turns as a value.')
@click.option('--close-loop', is_flag=True, help='Close coil loop for simulation meshes')
@click.option('--clearance', type=float, default=None)
@click.option('--arc-tolerance', type=float, default=0.02)
@click.option('--mesh-split-out', type=click.Path(writable=True, dir_okay=False, path_type=Path))
@ -635,7 +634,7 @@ def generate(outfile, turns, outer_diameter, inner_diameter, via_diameter, via_d
footprint_name, layer_pair, twists, clipboard, counter_clockwise, keepout_zone, keepout_margin,
arc_tolerance, pcb, mesh_out, magneticalc_out, circle_segments, mesh_split_out, copper_thickness,
board_thickness, mesh_mutual_out, mutual_offset_x, mutual_offset_y, mutual_offset_z, mutual_rotation_z,
two_layer, svg_out, close_loop):
two_layer, svg_out):
if 'WAYLAND_DISPLAY' in os.environ:
copy, paste, cliputil = ['wl-copy'], ['wl-paste'], 'xclip'
@ -883,7 +882,7 @@ def generate(outfile, turns, outer_diameter, inner_diameter, via_diameter, via_d
svg_vias.append(Tag('circle', cx=xv, cy=yv, r=via_diameter/2, stroke='none', fill='white'))
svg_vias.append(Tag('circle', cx=xv, cy=yv, r=via_drill/2, stroke='none', fill='black'))
if i > 0 or close_loop:
if i > 0:
xv, yv = outer_via_ring_radius*cos(start_angle), outer_via_ring_radius*sin(start_angle)
pads.append(make_via(xv, yv, layer_pair))
if not isclose(via_offset, 0, abs_tol=1e-6):