diff --git a/examples/gallery/01_bracket_scaffold.py b/examples/gallery/01_bracket_scaffold.py index c7b40a9d4a..0cb9e08865 100644 --- a/examples/gallery/01_bracket_scaffold.py +++ b/examples/gallery/01_bracket_scaffold.py @@ -74,9 +74,12 @@ # Get the part summary. # Display the model to show edges by connection. # Use keyboard shortcuts to switch between -# the surface (s) and wireframe (w) representation. +# the surface (``s``) and wireframe (``w``) representations. # Color code for edge connectivity: -# Red: free; Black: double; Purple: triple. +# +# - Red: free +# - Black: double +# - Purple: triple part = model.get_part_by_name('bracket_mid_surface-3') part_summary_res = part.get_summary(prime.PartSummaryParams(model, print_mesh=False)) diff --git a/examples/gallery/02_lucid_mixing_elbow.py b/examples/gallery/02_lucid_mixing_elbow.py index 3460863ffa..805c832125 100644 --- a/examples/gallery/02_lucid_mixing_elbow.py +++ b/examples/gallery/02_lucid_mixing_elbow.py @@ -11,7 +11,7 @@ ~~~~~~~~~ This example meshes a mixing elbow with polyhedral elements and wall boundary -layer refinement. You use several meshing utilities available in the ``lucid`` class for +layer refinement. It uses several meshing utilities available in the ``lucid`` class for convenience and ease. .. image:: ../../../images/elbow.png @@ -68,7 +68,7 @@ # Surface mesh # ~~~~~~~~~~~~ # Surface mesh the geometry setting minimum and maximum sizing -# to be used for curvature refinement. +# to use for curvature refinement. mesh_util.surface_mesh(min_size=5, max_size=20) diff --git a/examples/gallery/03_lucid_pipe_tee.py b/examples/gallery/03_lucid_pipe_tee.py index 9d42cbb6b6..dacf95bda1 100644 --- a/examples/gallery/03_lucid_pipe_tee.py +++ b/examples/gallery/03_lucid_pipe_tee.py @@ -62,8 +62,8 @@ # Read and display the geometry file. # The file contains several unmeshed parts, which is what you would get after you # import from a CAD file. -# For Windows OS users, scdoc is also available: -# pipe_tee = prime.examples.download_pipe_tee_scdoc() +# For Windows OS users, the SCDOC format is also available: +# ``pipe_tee = prime.examples.download_pipe_tee_scdoc()`` pipe_tee = prime.examples.download_pipe_tee_fmd() mesh_util.read(pipe_tee) diff --git a/examples/gallery/04_lucid_toy_car.py b/examples/gallery/04_lucid_toy_car.py index cc1ba794b2..bb7b0a9cef 100644 --- a/examples/gallery/04_lucid_toy_car.py +++ b/examples/gallery/04_lucid_toy_car.py @@ -76,7 +76,7 @@ # Coarse wrap to close the holes and delete the originals. # You could use leakage detection to close these regions. # This example uses a coarse wrap and disables feature edge refinement to walk over the holes. -# As this is not the final wrap, the example does not remesh after the wrap. +# As this is not the final wrap, this example does not remesh after the wrap. # Wrapping each object in turn avoids coarse wrap bridging across narrow gaps. coarse_wrap = {"cabin": 1.5, "exhaust": 0.6, "engine": 1.5} @@ -156,7 +156,7 @@ # The last label in the list wins. # Providing no ``label_expression`` flattens all labels into zones. # For example, if ``LabelA`` and ``LabelB`` are overlapping, three zones are -# createdL ``LabelA``, ``LabelB``, and ``LabelA_LabelB``. +# created: ``LabelA``, ``LabelB``, and ``LabelA_LabelB``. mesh_util.create_zones_from_labels() diff --git a/examples/gallery/05_pcb_stacker.py b/examples/gallery/05_pcb_stacker.py index 15169556bb..d0e6447711 100644 --- a/examples/gallery/05_pcb_stacker.py +++ b/examples/gallery/05_pcb_stacker.py @@ -10,9 +10,8 @@ Objective ~~~~~~~~~~ -In this example, you can mesh the solids of a printed circuit board, -using the volume sweeper, for a structural thermal analysis -using predominantly hexahedral elements. +This example uses the volume sweeper to mesh the solids of a printed circuit board for a +structural thermal analysis using predominantly hexahedral elements. .. image:: ../../../images/pcb_stacker.png :align: center @@ -25,7 +24,7 @@ * Read the CAD geometry. * Create a base face, projecting edge loops and imprinting to capture the geometry. * Surface mesh the base face with quad elements. -* Stack the base face mesh through the volumes to create mainly hexahedral volume mesh. +* Stack the base face mesh through the volumes to create a mainly hexahedral volume mesh. * Write the mesh for the structural thermal analysis. """ @@ -49,15 +48,15 @@ ############################################################################### # Import geometry # ~~~~~~~~~~~~~~~ -# Download the pcb geometry file (.pmdat). -# Import geometry. -# Display imported geometry. Purple edges indicate that the geometry is +# Download the PCB geometry (PMDAT) file. +# Import the geometry. +# Display the imported geometry. Purple edges indicate that the geometry is # connected and the topology is shared between the different volumes. -# This will mean the mesh will also be connected between volumes. +# This means that the mesh is also to be connected between volumes. -# For Windows OS users scdoc is also available. -# In order to read the geometry as connected with shared topology -# the WORKBENCH cad reader route must be used: +# For Windows OS users, SCDOC files are also available. +# To read the geometry as connected with shared topology, you must use +# the Workbench ``CadReaderRoute``: # mesh_util.read( # file_name=prime.examples.download_pcb_scdoc(), @@ -83,7 +82,7 @@ # # Create the base face from the part and volumes. # Define a label for the generated base faces and display. -# When coloured by ZONELET the display shows the imprints +# When coloured by zonelet, the display shows the imprints # on the base face. part = model.parts[0] @@ -128,7 +127,7 @@ ############################################################################### # Stack base face # ~~~~~~~~~~~~~~~~~~~~~~ -# Create mainly hexahedral volume mesh using the stacker method. +# Create a mainly hexahedral volume mesh using the stacker method. # Display the volume mesh. stackbase_results = sweeper.stack_base_face( diff --git a/examples/gallery/06_blade_morph.py b/examples/gallery/06_blade_morph.py index b25aa62c72..8bfbc8754d 100644 --- a/examples/gallery/06_blade_morph.py +++ b/examples/gallery/06_blade_morph.py @@ -13,7 +13,7 @@ ~~~~~~~~~~ This example appends a CDB mesh with a CAD geometry -and match morphes the mesh to the geometry. +and match morphs the mesh to the geometry. .. image:: ../../../images/turbine_blade.png :align: center @@ -81,7 +81,7 @@ # ~~~~~~~~~~~~~~~~ # Set the target type to be for topoface because the target is geometry. # Morph the source face zonelets of ``source_part`` to the -# target topo faces of the geometry. +# target topofaces of the geometry. morpher = prime.Morpher(model) match_pair = prime.MatchPair( diff --git a/examples/gallery/07_saddle_bracket.py b/examples/gallery/07_saddle_bracket.py index 53f34d307c..2a348cec16 100644 --- a/examples/gallery/07_saddle_bracket.py +++ b/examples/gallery/07_saddle_bracket.py @@ -11,7 +11,7 @@ Objective ~~~~~~~~~ -To create a mainly hexahedral mesh on a thin solid volume. +This example creates a mainly hexahedral mesh on a thin solid volume. .. image:: ../../../images/saddle_bracket.png :align: center @@ -23,7 +23,7 @@ * Launch Ansys Prime Server. * Import the CAD geometry. * Quad surface mesh the source face. -* Surface mesh the remaining unmeshed TopoFaces with tri. +* Surface mesh the remaining unmeshed TopoFaces with tri surface mesh. * Delete the topology. * Define volume meshing controls to use thin volume meshing. * Volume mesh with hexahedral and prism cells. @@ -145,11 +145,11 @@ # Specify source and target faces for the thin volume using imported labels. # Set the number of layers of cells through the thickness of the thin solid to be 4. # To create a fully hexahedral and prism mesh the side faces must be imprinted on -# the side faces. If needed, a buffer region at the sides of the volume can be -# defined where the volume fill type used for the volume mesh parameters will be -# used to infill. This is useful on more complex geometries, where it provides -# more robustness of the method. To create a buffer region set ``imprint_sides`` -# to False and specify how many rings of cells to ignore at the sides +# the side faces. If needed, a buffer region at the sides of the volume can be +# defined where the volume fill type used for the volume mesh parameters is +# used to infill. This is useful on more complex geometries, where it provides +# more robustness of the method. To create a buffer region set ``imprint_sides`` +# to ``False`` and specify how many rings of cells to ignore at the sides # using ``n_ignore_rings``. auto_mesh_params = prime.AutoMeshParams(model=model) diff --git a/examples/gallery/08_lucid_generic_f1_rear_wing.py b/examples/gallery/08_lucid_generic_f1_rear_wing.py index 03018a0155..64335e1ed2 100644 --- a/examples/gallery/08_lucid_generic_f1_rear_wing.py +++ b/examples/gallery/08_lucid_generic_f1_rear_wing.py @@ -5,16 +5,16 @@ Meshing a generic F1 car rear wing for external aero simulation ================================================================ -**Summary**: This example showcases the process of generating a mesh for a generic F1 rear wing +**Summary**: This example demonstrates how to generate a mesh for a generic F1 rear wing STL file model. Objective ~~~~~~~~~~ -The example demonstrates how to connect various parts of a rear wing from -a generic F1 car and volume mesh the resulting model using a poly-hexcore mesh containing prisms. -To simplify the process and enhance convenience, multiple meshing utilities provided in the -"lucid" class are used. +The example connects various parts of a rear wing from a generic F1 car +and volume meshes the resulting model using a poly-hexcore mesh containing prisms. +To simplify the process and enhance convenience, this example uses multiple +meshing utilities provided in the ``lucid`` class. .. image:: ../../../images/generic_rear_wing.png :align: center @@ -30,11 +30,11 @@ * Use the connect operation to join the components together. * Define local size controls on aero surfaces. * Generate a surface mesh with curvature sizing. -* Compute volume zones and define fluid zone type. -* Define boundary layer definition. +* Compute volume zones and define the fluid zone type. +* Define the boundary layer. * Generate a volume mesh using poly-hexcore elements and apply boundary layer refinement. * Print statistics on the generated mesh. -* Write a `.cas` file for use in the Fluent solver. +* Write a CAS file for use in the Fluent solver. * Exit the PyPrimeMesh session. """ @@ -59,7 +59,7 @@ ############################################################################### # Import geometry # ~~~~~~~~~~~~~~~ -# Download the generic F1 rear wing geometries (stl files). +# Download the generic F1 rear wing geometries (STL files). # Import each geometry and append to the model. # Display the imported geometry. @@ -80,7 +80,7 @@ # Merge parts # ~~~~~~~~~~~ # Establish the global size parameter to regulate mesh refinement. -# Merge all individual parts into a unified part named `f1_car_rear_wing`. +# Merge all individual parts into a unified part named ``f1_car_rear_wing``. # Define global sizes model.set_global_sizing_params(prime.GlobalSizingParams(model, min=4, max=32, growth_rate=1.2)) @@ -97,7 +97,7 @@ ############################################################################### # Mesh connect # ~~~~~~~~~~~~ -# In order to generate a volume mesh for a closed domain, it is necessary to ensure +# To generate a volume mesh for a closed domain, it is necessary to ensure # that the components of the rear wing are properly connected. # To achieve this, perform a connect operation using labels to join the components of # the rear wing. @@ -118,17 +118,17 @@ print(f"Total number of free edges present is {surf_report.n_free_edges}") ############################################################################### -# Define local size-control and generate size-field +# Define local size control and generate size-field # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# In order to accurately represent the physics of the DRS wing, a limitation of 8 mm +# To accurately represent the physics of the DRS wing, a limitation of 8 mm # is imposed on the mesh size of the wing. -# This is accomplished by implementing curvature size control, which refines the +# This is accomplished by implementing a curvature size control, which refines the # mesh according to the curvature of the DRS surfaces. # Additionally, to accurately capture the curved surfaces of other sections of the # wing, curvature control is defined with a normal angle of 18 degrees. # These controls are used during surface mesh generation. -# A volumetric size-field is then computed based on the defined size controls. -# The volumetric size-field plays a crucial role in controlling +# A volumetric size field is then computed based on the defined size controls. +# The volumetric size field plays a crucial role in controlling # the growth and refinement of the volume mesh. # Local curvature size control for DRS @@ -188,13 +188,13 @@ ############################################################################### # Define volume controls # ~~~~~~~~~~~~~~~~~~~~~~ -# In order to prevent the generation of a volume mesh within the solid wing, -# the type of a volume zone within the rear wing can be defined as "dead". +# To prevent the generation of a volume mesh within the solid wing, +# the type of a volume zone within the rear wing can be defined as "dead." # To accomplish this, Volume Control is utilized to assign the type for the # specific volume zone. # Expressions are employed to define the volume zones that need to be filled, with -# "* !f1_rw_enclosure" indicating that it applies to all volume zones except -# for "f1_rw_enclosure". +# ``* !f1_rw_enclosure`` indicating that it applies to all volume zones except +# for ``f1_rw_enclosure``. volume_control = model.control_data.create_volume_control() volume_control.set_params( @@ -213,7 +213,7 @@ # Define prism controls # ~~~~~~~~~~~~~~~~~~~~~ # A prism control can be used to define inflation layers on the external aero surfaces. -# Specify the aero surfaces using labels, here prism scope is defined on zones associated +# Specify the aero surfaces using labels. Here prism scope is defined on zones associated # with labels ``*drs*`` and ``*plane*``. # The growth for the prism layer is controlled by defining the offset type to # be ``uniform`` with a first height of 0.5mm . @@ -283,13 +283,13 @@ # Print statistics on meshed part print(part_summary_res) print( - "\nMaximum inverse-orthoginal quality of the Volume Mesh : ", + "\nMaximum inverse-orthoginal quality of the volume mesh : ", results.quality_results_part[0].max_quality, ) # Mesh check result = prime.VolumeMeshTool(model).check_mesh(part.id, params=prime.CheckMeshParams(model)) -print("\nMesh Check", result, sep="\n") +print("\nMesh check", result, sep="\n") scope = prime.ScopeDefinition(model, part_expression="*", label_expression="* !*enclosure*") display(scope=scope) @@ -297,7 +297,7 @@ ############################################################################### # Write mesh # ~~~~~~~~~~ -# Export as cas file for external aero simulations +# Export as CAS file for external aero simulations. with tempfile.TemporaryDirectory() as temp_folder: print(temp_folder) diff --git a/examples/gallery/09_multi_layer_quad_mesh_pcb.py b/examples/gallery/09_multi_layer_quad_mesh_pcb.py index a6fd993e0c..c382fe73ea 100644 --- a/examples/gallery/09_multi_layer_quad_mesh_pcb.py +++ b/examples/gallery/09_multi_layer_quad_mesh_pcb.py @@ -1,34 +1,34 @@ """ .. _ref_multi_layer_pcb_mesh: -================================================================== -Meshing a generic PCB geometry with multiple number of hexa layers -================================================================== +======================================================== +Meshing a generic PCB geometry with multiple hexa layers +======================================================== -**Summary**: This example showcases the process of generating a mesh for -a generic PCB geometry giving the possibbility to set the base mesh size -and the number of layers for each solid. +**Summary**: This example demostrates how to set the base mesh size and number of +layers for each solid in a generic PCB geometry and then generate a mesh. Objective ~~~~~~~~~~ -The example demonstrates how to use PyPrimeMesh to discretize a PCB CAD geometry by means of the -stacker technology. This script allows to easily setup the mesh size of the base face (xy plane +The example uses PyPrimeMesh to discretize a PCB CAD geometry by means of the +stacker technology. You can easily set up the mesh size of the base face (xy plane in this example) and the number of mesh layers along the sweep direction (z axis in this example). -The CAD edges along the z direction have been assigned with a named selection at CAD level in Ansys -Discovery/SpaceClaim. Have a close look at the Discovery's tree's snapshot that is provided in the -image below to understand the model's organization. Share topology in Discovery/SpaceClaim -guarantees the generation of a conformal mesh between the solids. Edges named selections will allow -specifying the number of mesh elements to be generated along the sweep direction. To simplify the -process and enhance convenience, multiple meshing utilities provided in the ``lucid`` class are -used. +The CAD edges along the z direction are assigned with a named selection at a CAD level in Ansys +Discovery/SpaceClaim. + +The following image provides a snapshot of the Discovery tree to help you to understand the model's +organization. Share topology in Discovery/SpaceClaim guarantees the generation of a conformal mesh +between the solids. Named selections of edges allow you to specify the number of mesh elements to generate +along the sweep direction. To simplify the process and enhance convenience, this example uses multiple +meshing utilities provided in the ``lucid`` class. .. image:: ../../../images/multi_layer_quad_mesh_pcb.png :align: center :width: 800 :alt: Generic PCB geometry. -The resulting mesh with 3 layers per solid will look as follows: +The resulting mesh with three layers per solid looks like this: .. image:: ../../../images/multi_layer_quad_mesh_pcb_3.png :align: center @@ -43,18 +43,18 @@ Procedure ~~~~~~~~~~ -- Import the fundamental libraries that are necessary to run the script +- Import the fundamental libraries that are necessary to run the script. - Launch an Ansys Prime Server instance and instantiate the meshing utilities from the ``lucid`` class. -- Define the main mesh parameters: base size and number of layers along the sweep direction. +- Define the main mesh parameters, which are the base size and number of layers along the sweep direction. - Import the CAD geometry. - Define the edge sizing along the sweep direction (based on pre-existing edges named selections). - Define the parameters for the volume sweeper. -- Setup, generate, and mesh the base face. +- Set up, generate, and mesh the base face. - Stack the base face along the sweep direction. -- Setup the zone naming before the mesh output. -- Write a `.cas` file for use in the Fluent solver. +- Set up the zone naming before the mesh output. +- Write a CAS file for use in the Fluent solver. - Exit the PyPrimeMesh session. """ @@ -62,8 +62,8 @@ ############################################################################### # Import all necessary modules # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# Notice that PyVista library must be installed to be able to run the visualization tools included -# in this script. +# Notice that you must install the PyVista library to be able to run the visualization +# tools included in this script. import os import tempfile @@ -72,8 +72,8 @@ from ansys.meshing.prime.graphics import Graphics ############################################################################### -# Launch Prime server and instantiate the lucid class -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Launch Prime server and instantiate the ``lucid`` class +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Launch an instance of Ansys Prime Server. # Connect the PyPrimeMesh client and get the model. # Instantiate meshing utilities from the ``lucid`` class. @@ -87,16 +87,16 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Define the number of layers per solid. # Define the size in mm of the quad-dominant mesh on the base size. -# Define the path to the CAD file to be meshed. -# Download the example CAD file using prime.examples function. Else, write the -# path to the desired CAD file on your machine. -# .scdoc/.dsco/.pmdb/ are supported. +# Define the path to the CAD file to mesh. +# Download the example CAD file using the ``prime.examples`` function. Otherwise, +# write the path to the desired CAD file on your machine. Supported file types +# are SCDOC, DSCO, and PMDB. # cad_file='/path/to/any/cad/file.dsco' cad_file = prime.examples.download_multi_layer_quad_mesh_pcb_pmdat() layers_per_solid = 4 # number of hexa mesh layers in each solid -base_face_size = 0.5 # the surface mesh size in mm on the base face -# Chose whether to display or not to Display the CAD/mesh at every stage +base_face_size = 0.5 # surface mesh size in mm on the base face +# Chose whether to display the CAD/mesh at every stage display_intermediate_steps = True # Use True/False @@ -104,11 +104,10 @@ # Import geometry # ~~~~~~~~~~~~~~~ # Import the geometry into Prime server. -# Use the WORKBENCH CadReaderRoute to ensure that the shared topology is kept. -# If you are using .scdoc/.dsco/.pmdb. +# Use the Workbench ``CadReaderRoute`` to ensure that the shared topology is kept. mesh_util.read(file_name=cad_file) -# Use the following command to open .scdoc/.dsco/.pmdb +# Use the following command to open CAD files of these types: SCDOC, DSCO, and PMDB. # mesh_util.read( # file_name = cad_file, # cad_reader_route = prime.CadReaderRoute.WORKBENCH) @@ -123,13 +122,13 @@ ############################################################################### # Define edge sizing constraints # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# Set generic global sizing from 0.002mm and 2mm. -# Extract the the edges length from the named selections such as "edge_1_0.50_mm" +# Set generic global sizing from 0.002mm to 2mm. +# Extract the the edge's length from the named selections, such as "edge_1_0.50_mm" # (extract 0.5 mm length) or "edge_23_0.27_mm" (extract 0.27mm length). -# Assign, on each edge, a size equal to the edge's length divided by the -# pre-defined number of layers per solid. +# On each edge, assign a size equal to the edge's length divided by the +# predefined number of layers per solid. -# Set generic global sizing from 0.002mm and 2mm. +# Set generic global sizing from 0.002mm to 2mm. model.set_global_sizing_params(prime.GlobalSizingParams(model, min=0.002, max=2.0)) ids = [] # collect the imported geometry @@ -137,14 +136,14 @@ for label in part.get_labels(): # Check whether the named selection's name starts with the string "edge" if label.startswith('edge'): - # Extract the edge's length splitting its name at every "_" string - # and collect the second-last number + # Extract the edge's length, splitting its name at every "_" string + # Collect the second to last number length = float(label.split("_")[-2]) # get 0.27 from "edge_23_0.27_mm" # Initialize a constant-size mesh control (SOFT) soft_size_control = model.control_data.create_size_control(prime.SizingType.SOFT) # Assign a mesh size equal to the edge's length/number of mesh layers soft_size_params = prime.SoftSizingParams(model=model, max=length / layers_per_solid) - # Finilize the creation of mesh sizing + # Finalize the creation of mesh sizing soft_size_control.set_soft_sizing_params(soft_size_params) soft_size_scope = prime.ScopeDefinition( model, @@ -158,12 +157,12 @@ ids.append(soft_size_control.id) ############################################################################### -# Define Controls for volume sweeper +# Define controls for volume sweeper # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Set the sweep direction vector. -# Setup the geometric tolerances for lateral and stacking defeature. -# Select the sweep direction as z axis (0,0,1). -# Append the ids of the soft local sizings that have been previously-defined on +# Set up the geometric tolerances for lateral and stacking defeature. +# Select the sweep direction as the z axis (0,0,1). +# Append the IDs of the soft local sizings that have been previously defined on # the edges. # Instantiate the volume sweeper @@ -176,18 +175,18 @@ lateral_defeature_tolerance=0.001, stacking_defeature_tolerance=0.001, size_control_ids=ids, -) # list of control ids to be respected by the stacker +) # list of control IDs to be respected by the stacker ############################################################################### -# Setup, generate, and mesh the base face -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Set up, generate, and mesh the base face +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Create a soft sizing control. -# Assign the previously defined base_face_size to the soft sizing. +# Assign the previously defined ``base_face_size`` function to the soft sizing. # Create the base face. # Mesh the base face. # Display the base face. -# Setup the necessary parameters for the generation of the base face. +# Set up the necessary parameters for the generation of the base face. soft_size_control = model.control_data.create_size_control(prime.SizingType.SOFT) soft_size_params = prime.SoftSizingParams(model=model, max=base_face_size) soft_size_control.set_soft_sizing_params(soft_size_params) @@ -197,7 +196,7 @@ soft_size_control.set_scope(soft_size_scope) soft_size_control.set_suggested_name("b_f_size") -# Create the base face appending the the stacker mesh parameters. +# Create the base face, appending the the stacker mesh parameters. createbase_results = sweeper.create_base_face( part_id=model.get_part_by_name(part.name).id, topo_volume_ids=model.get_part_by_name(part.name).get_topo_volumes(), @@ -227,12 +226,12 @@ ############################################################################### # Stack the base face using the volume sweeper # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# Use volume sweeper to stack the base face along the previously-defined sweep +# Use the volume sweeper to stack the base face along the previously defined sweep # direction. -# Include the previously-defined stacker parameters. +# Include the previously defined stacker parameters. # Display the final volume mesh. -# Use the stack_base_face function di generate the volume mesh +# Use the ``stack_base_face`` function to generate the volume mesh stackbase_results = sweeper.stack_base_face( part_id=model.get_part_by_name(part.name).id, base_face_ids=base_faces, @@ -248,33 +247,33 @@ display() ############################################################################### -# Setup the zone naming before the mesh output -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Set up the zone naming before the mesh output +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Delete the unnecessary topo entities. -# Name the walls of "solid" as "wall_solid" (ex if the solid's name is "A", the -# walls surrounding the solid will be named "wall_A"). +# Name the walls of ``solid`` as ``wall_solid``. For example, if the solid's name is ``A``, then +# name the walls surrounding the solid ``wall_A``). # Convert the labels to mesh zones. # Define deletion parameters deletion_params = prime.DeleteTopoEntitiesParams( model, delete_geom_zonelets=True, delete_mesh_zonelets=False ) -# Delete un-necessary geometrical entities. +# Delete unnecessary geometrical entities. part.delete_topo_entities(deletion_params) # Rename the walls surrounding any volume of the mesh by appending the string -# "wall_" to the solid's name. i.e. If a solid is named "my_solid", the -# surrounding walls will be named "wall_my_solid". +# ``wall_`` to the solid's name. For example, if the solid is named ``my_solid``, then +# name the walls surrounding the solid ``wall_my_solid``. for volume in part.get_volumes(): volume_zone_name = "wall_" + model.get_zone_name(part.get_volume_zone_of_volume(volume)) label_zonelets = part.get_face_zonelets_of_volumes([volume]) part.add_labels_on_zonelets([volume_zone_name], label_zonelets) -# Convert labels into mesh zones to be used in the solver. +# Convert labels into mesh zones to use in the solver. mesh_util_create_zones = mesh_util.create_zones_from_labels() ############################################################################### # Mesh output # ~~~~~~~~~~~ -# Create a temporary folder and use it to output the mesh in .cas format. +# Create a temporary folder and use it to output the mesh to a CAS file. with tempfile.TemporaryDirectory() as temp_folder: mesh_file = os.path.join(temp_folder, 'multi_layer_quad_mesh_pcb.cas')