Model.optimsmooth#
- Model.optimsmooth(smoothcollection, anchorcollection, criteria_filename, feature_angle, target_QI, max_iterations, time_limit)#
One or more nodes may be specified as being anchored in place and not movable. The function optimizes nodes location to reach the specified target Q.I. of the selected elements aggregate according to a given quality criteria. It moves nodes through the surface boundaries unless the boundaries are strong feature lines or component boundaries. The optimization process may be interrupted if the target Q.I. has been reached or a time limit is specified. The optimization may be applied recurrently with a given maximum number of iterations.
- Parameters:
smoothcollection (Collection) – The collection containing the element entities to be smoothed. Does not need to be a contiguous block.
anchorcollection (Collection) – The collection containing the node entities on elements that are not adjustable.
criteria_filename (hwString) – The path of the file containing quality criteria or “dummy” for pre-set criteria.
feature_angle (double) –
The angle in degrees specifying the feature lines (18-90 degrees). This is approximately the minimal angle between the elements adjacent to a feature line.
If a negative value is used, this enables the option to maintain nodes on geometry edges and the absolute value is used for the feature angle.
target_QI (double) – The target Q.I. for optimization.
max_iterations (int) – The maximum number of recursive applications of the optimization procedure.
time_limit (int) – Time limit in minutes for the optimization. If
time_limit=0, the time constraint is not applied.
Examples#
Smooth elements with IDs 100 - 110 with fixed nodes with IDs 15 , 17 , and 14 use the quality criteria file , “ c:/mycriteria / durability.txt “ , the feature angle = 30.0 degrees , the target Q.I = 0.2 , recursive optimization with maximum five iterations and with no time limit applied#import hm import hm.entities as ent model = hm.Model() element_collection = hm.Collection(model, ent.Element, list(range(100, 111))) node_elem_collection = hm.Collection(model, ent.Node, [15, 17, 14]) model.optimsmooth( smoothcollection=element_collection, anchorcollection=node_elem_collection, criteria_filename="c:/mycriteria/durability.txt", feature_angle=30.0, target_QI=0.2, max_iterations=5, time_limit=0, )
Smooth all plate elements with fixed nodes with IDs 257 and 678 use the quality criteria specified in the example with the feature angle = 40 degrees , target Q.I. = 0.3 , no recursive optimization , time limit 60 minutes#import hm import hm.entities as ent model = hm.Model() quality_string_list = [ " 0 penalty value 0.00 0.00 0.80 1.00 10.00", " 1 min length 1 1.0 3.000 2.749 1.502 1.000 0.749 1", " 2 max length 1 1.0 3.000 3.600 4.500 6.000 9.000 0", " 3 aspect ratio 1 1.0 1.000 2.000 4.400 5.000 10.000 0", " 4 warpage 1 1.0 0.000 5.000 13.000 15.000 30.000 0", " 5 max angle quad 1 1.0 90.000 110.000 134.000 140.000 160.000 0", " 6 min angle quad 1 1.0 90.000 70.000 46.000 40.000 20.000 0", " 7 max angle tria 1 1.0 60.000 80.000 112.000 120.000 150.000 0", " 8 min angle tria 1 1.0 60.000 50.000 34.000 30.000 15.000 0", " 9 skew 1 1.0 0.000 10.000 34.000 40.000 70.000 0", "10 jacobian 1 1.0 1.000 0.900 0.700 0.600 0.300 0", "11 chordal dev 0 1.0 0.000 0.300 0.800 1.000 2.000 0", "12 taper 1 1.0 0.000 0.200 0.500 0.600 0.900 0", "13 % of trias 1 1.0 0.000 6.000 10.000 15.000 20.000 0", ] model.setqualitycriteria(string_array=quality_string_list, mode=0) element_collection = hm.Collection(model, ent.Element) node_elem_collection = hm.Collection(model, ent.Node, [257, 678]) model.optimsmooth( smoothcollection=element_collection, anchorcollection=node_elem_collection, criteria_filename="dummy", feature_angle=40.0, target_QI=0.3, max_iterations=1, time_limit=60, )