From 8577c6209fd11c71298e8b92cf7df0b3600a22bc Mon Sep 17 00:00:00 2001 From: jaseg Date: Tue, 8 Oct 2024 16:15:28 +0200 Subject: [PATCH] Revert "More Elmer WIP" This reverts commit 80294f98c29b741c077ec0a0192852cb44300aa7. --- Simulation Plots.ipynb | 2 +- coil_mag_solvers.yml | 16 ++++++------- coil_parasitics.py | 31 ++++++++----------------- self_capacitance_sim.yml | 14 ------------ self_capacitance_solvers.yml | 44 ------------------------------------ 5 files changed, 18 insertions(+), 89 deletions(-) delete mode 100644 self_capacitance_sim.yml delete mode 100644 self_capacitance_solvers.yml diff --git a/Simulation Plots.ipynb b/Simulation Plots.ipynb index 335d7d4..0f8874c 100644 --- a/Simulation Plots.ipynb +++ b/Simulation Plots.ipynb @@ -836,7 +836,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.5" + "version": "3.11.5" } }, "nbformat": 4, diff --git a/coil_mag_solvers.yml b/coil_mag_solvers.yml index 2a55105..1265bea 100644 --- a/coil_mag_solvers.yml +++ b/coil_mag_solvers.yml @@ -2,18 +2,18 @@ Coil_Solver: Equation: CoilSolver Procedure: '"CoilSolver" "CoilSolver"' Linear System Solver: Iterative - Linear System Preconditioning: ILU3 - Linear System Max Iterations: 25000 - Linear System Convergence Tolerance: 1e-6 + Linear System Preconditioning: ILU1 + Linear System Max Iterations: 1000 + Linear System Convergence Tolerance: 1e-10 Linear System Iterative Method: BiCGStab - Linear System Residual Output: 1 + Linear System Residual Output: 10 Steady State Convergence Tolerance: 1e-06 Normalize Coil Current: True Nonlinear System Consistent Norm: True - Coil Closed: False - Narrow Interface: 'Logical True' - Save Coil Set: 'Logical True' - Save Coil Index: 'Logical True' + Coil Closed: True + Narrow Interface: True + Save Coil Set: True + Save Coil Index: True Calculate Elemental Fields: True Static_Current_Conduction: diff --git a/coil_parasitics.py b/coil_parasitics.py index 79c5374..fed54a8 100644 --- a/coil_parasitics.py +++ b/coil_parasitics.py @@ -208,14 +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_coil = elmer.load_solver('Coil_Solver', sim, 'coil_mag_solvers.yml') solver_magdyn = elmer.load_solver('Magneto_Dynamics', sim, 'coil_mag_solvers.yml') - solver_current = elmer.load_solver('Static_Current_Conduction', 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_current, solver_magdyn, solver_magdyn_calc]) + copper_eqn = elmer.Equation(sim, 'copperEqn', [solver_coil, 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]]) @@ -241,29 +240,17 @@ def inductance(mesh_file, sim_dir, solver_method): 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"', - # }) - potential_force = elmer.BodyForce(sim, 'electric_potential', {'Electric Potential': 'Equals "Potential"'}) - bdy_trace.body_force = potential_force - #bdy_trace.body_force = current_force + 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 # 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['Coil Start'] = True - #boundary_vplus.data['A re {e}'] = 'Real 0' - 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['Coil End'] = True - boundary_vminus.data['Potential'] = 0.0 - with tempfile.TemporaryDirectory() as tmpdir: tmpdir = sim_dir if sim_dir else Path(tmpdir) @@ -304,7 +291,7 @@ def inductance(mesh_file, sim_dir, solver_method): assert math.isclose(V, 1.0, abs_tol=1e-3) print(f'Total magnetic field energy: {format_si(U_mag, "J")}') - print(f'Reference coil current: {format_si(I, "A")}') + print(f'Reference coil current: {format_si(I, "Ω")}') print(f'Coil resistance calculated by solver: {format_si(R, "Ω")}') print(f'Inductance calucated from field: {format_si(L, "H")}') diff --git a/self_capacitance_sim.yml b/self_capacitance_sim.yml deleted file mode 100644 index f2200e6..0000000 --- a/self_capacitance_sim.yml +++ /dev/null @@ -1,14 +0,0 @@ -3D_steady: - Mesh Levels: 1 - Max Output Level: 7 - Coordinate System: Cartesian - Coordinate Mapping(3): 1 2 3 - Simulation Type: Steady state - Steady State Max Iterations: 1 - Output Intervals: 1 - Timestepping Method: BDF - Simulation Timing: True - BDF Order: 1 - Solver Input File: case.sif - Post File: case.vtu - Output File: case.result diff --git a/self_capacitance_solvers.yml b/self_capacitance_solvers.yml deleted file mode 100644 index d531f40..0000000 --- a/self_capacitance_solvers.yml +++ /dev/null @@ -1,44 +0,0 @@ -StaticCurrent: - Equation: Static Current Conduction - Variable: PotentialStat - Variable DOFs: 1 - Procedure: '"StatCurrentSolve" "StatCurrentSolver"' - Calculate Volume Current: True - Calculate Joule Heating: False - Optimize Bandwidth: True - Nonlinear System Max Iterations: 1 - Linear System Solver: Iterative - Linear System Iterative Method: CG - Linear System Max Iterations: 10000 - Linear System Convergence Tolerance: 1e-10 - Linear System Preconditioning: ILU3 - Linear System ILUT Tolerance: 0.001 - Linear System Abort Not Converged: False - Linear System Residual Output: 20 - Linear System Precondition Recompute: 1 - -Electrostatics: - Equation: Electrostatics - Procedure: '"StatElecSolve" "StatElecSolver"' - Variable: Potential - Variable DOFs: 1 - Calculate Electric Field: True - Calculate Electric Flux: True - Calculate Electric Energy: True - Steady State Convergence Tolerance: 1e-05 - Nonlinear System Convergence Tolerance: 1e-07 - Nonlinear System Max Iterations: 20 - Nonlinear System Newton After Iterations: 3 - Nonlinear System Newton After Tolerance: 0.001 - Nonlinear System Relaxation Factor: 1 - Linear System Solver: Iterative - Linear System Iterative Method: BiCGStab - Linear System Max Iterations: 5000 - Linear System Convergence Tolerance: 1e-10 - BiCGstabl polynomial degree: 2 - Linear System Preconditioning: none - Linear System ILUT Tolerance: 0.001 - Linear System Abort Not Converged: False - Linear System Residual Output: 10 - Potential Difference: 1.0 -