-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
204 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Definition of a "file_geometry" data. | ||
# | ||
# This file is used by the mesher. | ||
# Definition of the voxel structure. | ||
# | ||
# Thomas Guillod - Dartmouth College | ||
# Mozilla Public License Version 2.0 | ||
|
||
"mesh_type": "stl" | ||
"data_voxelize": | ||
"param": | ||
"d": [1.0e-3, 1.0e-3, 1.0e-3] | ||
"xyz_min": null | ||
"xyz_max": null | ||
"check": true | ||
"tol": 1.0e-6 | ||
"thr": 0.5 | ||
"pts": 1 | ||
"domain_stl": | ||
"core": [{"scale": 1.0e-3, "offset": [0.0, 0.0, 0.0], "filename": !path "stl/core.stl"}] | ||
"pri_coil": [{"scale": 1.0e-3, "offset": [0.0, 0.0, 0.0], "filename": !path "stl/pri_coil.stl"}] | ||
"pri_src": [{"scale": 1.0e-3, "offset": [0.0, 0.0, 0.0], "filename": !path "stl/pri_src.stl"}] | ||
"pri_sink": [{"scale": 1.0e-3, "offset": [0.0, 0.0, 0.0], "filename": !path "stl/pri_sink.stl"}] | ||
"sec_coil": [{"scale": 1.0e-3, "offset": [0.0, 0.0, 0.0], "filename": !path "stl/sec_coil.stl"}] | ||
"sec_src": [{"scale": 1.0e-3, "offset": [0.0, 0.0, 0.0], "filename": !path "stl/sec_src.stl"}] | ||
"sec_sink": [{"scale": 1.0e-3, "offset": [0.0, 0.0, 0.0], "filename": !path "stl/sec_sink.stl"}] | ||
"data_point": | ||
"check_cloud": true | ||
"filter_cloud": true | ||
"pts_cloud": [] | ||
"data_resampling": | ||
"use_reduce": false | ||
"use_resample": false | ||
"resampling_factor": [1, 1, 1] | ||
"data_conflict": | ||
"resolve_rules": true | ||
"resolve_random": false | ||
"conflict_rules": | ||
- {"domain_resolve": ["pri_coil"], "domain_keep": ["pri_src"]} | ||
- {"domain_resolve": ["pri_coil"], "domain_keep": ["pri_sink"]} | ||
- {"domain_resolve": ["sec_coil"], "domain_keep": ["sec_src"]} | ||
- {"domain_resolve": ["sec_coil"], "domain_keep": ["sec_sink"]} | ||
"data_integrity": | ||
"domain_connected": | ||
"pri_conductor": {"domain_group": [["pri_coil"], ["pri_src"], ["pri_sink"]], "connected": true} | ||
"sec_conductor": {"domain_group": [["sec_coil"], ["sec_src"], ["sec_sink"]], "connected": true} | ||
"insulation": {"domain_group": [["pri_coil"], ["sec_coil"], ["core"]], "connected": false} | ||
"domain_adjacent": | ||
"pri_terminal": {"domain_group": [["pri_src"], ["pri_sink"]], "connected": false} | ||
"sec_terminal": {"domain_group": [["sec_src"], ["sec_sink"]], "connected": false} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Definition of a "file_problem" data. | ||
# | ||
# This file is used by the solver. | ||
# Definition of the magnetic problem to be solved. | ||
# | ||
# Thomas Guillod - Dartmouth College | ||
# Mozilla Public License Version 2.0 | ||
|
||
"material_def": | ||
"pri_copper": | ||
"domain_list": ["pri_src", "pri_sink", "pri_coil"] | ||
"material_type": "electric" | ||
"orientation_type": "isotropic" | ||
"var_type": "lumped" | ||
"sec_copper": | ||
"domain_list": ["sec_src", "sec_sink", "sec_coil"] | ||
"material_type": "electric" | ||
"orientation_type": "isotropic" | ||
"var_type": "lumped" | ||
"core": | ||
"domain_list": ["core"] | ||
"material_type": "magnetic" | ||
"orientation_type": "isotropic" | ||
"var_type": "lumped" | ||
"source_def": | ||
"pri_src": | ||
"domain_list": ["pri_src"] | ||
"source_type": "voltage" | ||
"var_type": "lumped" | ||
"pri_sink": | ||
"domain_list": ["pri_sink"] | ||
"source_type": "voltage" | ||
"var_type": "lumped" | ||
"sec_src": | ||
"domain_list": ["sec_src"] | ||
"source_type": "voltage" | ||
"var_type": "lumped" | ||
"sec_sink": | ||
"domain_list": ["sec_sink"] | ||
"source_type": "voltage" | ||
"var_type": "lumped" | ||
"material_val": &material_val | ||
"pri_copper": {"rho_re": 1.75e-8, "rho_im": 0.0} | ||
"sec_copper": {"rho_re": 1.75e-8, "rho_im": 0.0} | ||
"core": { "chi_re": 150.0, "chi_im": 0.0 } | ||
"source_val": &source_val | ||
"pri_src": {"V_re": 1.0, "V_im": 0.0, "Z_re": 1.0e-3, "Z_im": 0.0} | ||
"pri_sink": {"V_re": 0.0, "V_im": 0.0, "Z_re": 1.0e-3, "Z_im": 0.0} | ||
"sec_src": {"V_re": 0.0, "V_im": 0.0, "Z_re": 1.0e+3, "Z_im": 0.0} | ||
"sec_sink": {"V_re": 0.0, "V_im": 0.0, "Z_re": 1.0e+3, "Z_im": 0.0} | ||
"sweep_solver": | ||
"sim_default": | ||
"init": null | ||
"param": | ||
"freq": 100.0e+3 | ||
"material_val": *material_val | ||
"source_val": *source_val |
Binary file not shown.
86 changes: 86 additions & 0 deletions
86
examples/examples_stl/transformer_core/stl/generate_stl.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
""" | ||
Build the CAD objects and export STL files. | ||
""" | ||
|
||
__author__ = "Thomas Guillod" | ||
__copyright__ = "Thomas Guillod - Dartmouth College" | ||
__license__ = "Mozilla Public License Version 2.0" | ||
|
||
import sys | ||
import cadquery as cq | ||
|
||
|
||
def get_cad(): | ||
""" | ||
Get the different CAD objects. | ||
""" | ||
|
||
coil = cq.Workplane("XY", origin=(0.0, 0.0, -2.5)) | ||
coil = coil.moveTo(+14.0, +2.0).rect(10.0, 46.0).extrude(1.0) | ||
coil = coil.moveTo(0.0, -16.0).rect(38.0, 10.0).extrude(1.0) | ||
coil = coil.moveTo(-14.0, 0.0).rect(10.0, 42.0).extrude(1.0) | ||
coil = coil.moveTo(-6.0, +16.0).rect(26.0, 10.0).extrude(1.0) | ||
|
||
coil = coil.faces(">Z").workplane() | ||
coil = coil.moveTo(+4.0, +16.0).rect(6.0, 10.0).extrude(1.0) | ||
|
||
coil = coil.faces(">Z").workplane() | ||
coil = coil.moveTo(+10.0, +16.0).rect(18.0, 10.0).extrude(1.0) | ||
coil = coil.moveTo(+14.0, 0.0).rect(10.0, 42.0).extrude(1.0) | ||
coil = coil.moveTo(0.0, -16.0).rect(38.0, 10.0).extrude(1.0) | ||
coil = coil.moveTo(-14.0, 0.0).rect(10.0, 42.0).extrude(1.0) | ||
coil = coil.moveTo(-10.0, +16.0).rect(18.0, 10.0).extrude(1.0) | ||
|
||
coil = coil.faces(">Z").workplane() | ||
coil = coil.moveTo(-4.0, +16.0).rect(6.0, 10.0).extrude(1.0) | ||
|
||
coil = coil.faces(">Z").workplane() | ||
coil = coil.moveTo(+6.0, +16.0).rect(26.0, 10.0).extrude(1.0) | ||
coil = coil.moveTo(+14.0, 0.0).rect(10.0, 42.0).extrude(1.0) | ||
coil = coil.moveTo(0.0, -16.0).rect(38.0, 10.0).extrude(1.0) | ||
coil = coil.moveTo(-14.0, +2.0).rect(10.0, 46.0).extrude(1.0) | ||
|
||
core = cq.Workplane("XZ") | ||
core = core.moveTo(0.0, 0.0).box(52.0, 19.0, 16.0) | ||
core = core.moveTo(0.0, 0.0).rect(28.0, 9.0).cutThruAll() | ||
|
||
src = cq.Workplane("XY").moveTo(+14.0, +25.5).rect(10.0, 1.0).extrude(1.0) | ||
sink = cq.Workplane("XY").moveTo(-14.0, +25.5).rect(10.0, 1.0).extrude(1.0) | ||
src = src.translate((0.0, 0.0, -2.5)) | ||
sink = sink.translate((0.0, 0.0, +1.5)) | ||
|
||
cad_dict = { | ||
"core": core, | ||
"pri_coil": coil.translate((+20.0, 0.0, 0.0)), | ||
"pri_src": src.translate((+20.0, 0.0, 0.0)), | ||
"pri_sink": sink.translate((+20.0, 0.0, 0.0)), | ||
"sec_coil": coil.mirror(mirrorPlane="XY").translate((-20.0, 0.0, 0.0)), | ||
"sec_src": src.mirror(mirrorPlane="XY").translate((-20.0, 0.0, 0.0)), | ||
"sec_sink": sink.mirror(mirrorPlane="XY").translate((-20.0, 0.0, 0.0)), | ||
} | ||
|
||
return cad_dict | ||
|
||
|
||
def write_cad(cad_dict, tol): | ||
""" | ||
Export CAD objects to STL files. | ||
""" | ||
|
||
for tag, cad in cad_dict.items(): | ||
if cad is not None: | ||
cad.val().exportStl("%s.stl" % tag, tolerance=tol) | ||
|
||
|
||
if __name__ == "__main__": | ||
# get the object tolerance | ||
tol = 1e-3 | ||
|
||
# get the CAD objects | ||
cad_dict = get_cad() | ||
|
||
# save STL/STEP files | ||
write_cad(cad_dict, tol) | ||
|
||
# exit | ||
sys.exit(0) |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.