@@ -218,6 +218,12 @@ def __init__(self):
218
218
self .constraints = Constraint ()
219
219
self .contacts = ContactGroup ()
220
220
self .entities = []
221
+ self .have_accuracy = False
222
+ self .have_energy = False
223
+ self .have_hourglass = False
224
+ self .have_bulk_viscosity = False
225
+ self .have_control_shell = False
226
+
221
227
222
228
def get_stub ():
223
229
"""Get the stub of this DynaBase object."""
@@ -280,16 +286,19 @@ def set_accuracy(
280
286
bool
281
287
"True" when successful, "False" when failed
282
288
"""
283
- ret = self .stub .CreateControlAccuracy (
284
- ControlAccuracyRequest (
285
- osu = objective_stress_updates .value ,
286
- inn = invariant_node_number .value ,
287
- pidosu = partsetid_for_objective_stress_updates ,
288
- iacc = implicit_accuracy_flag .value ,
289
- exacc = explicit_accuracy_flag .value ,
289
+ ret = True
290
+ if not self .have_accuracy :
291
+ ret = self .stub .CreateControlAccuracy (
292
+ ControlAccuracyRequest (
293
+ osu = objective_stress_updates .value ,
294
+ inn = invariant_node_number .value ,
295
+ pidosu = partsetid_for_objective_stress_updates ,
296
+ iacc = implicit_accuracy_flag .value ,
297
+ exacc = explicit_accuracy_flag .value ,
298
+ )
290
299
)
291
- )
292
- logging .info ("Control Accuracy Created..." )
300
+ self . have_accuracy = True
301
+ logging .info ("Control Accuracy Created..." )
293
302
return ret
294
303
295
304
def set_energy (
@@ -324,16 +333,19 @@ def set_energy(
324
333
bool
325
334
"True" when successful, "False" when failed
326
335
"""
327
- ret = self .stub .CreateControlEnergy (
328
- ControlEnergyRequest (
329
- hgen = hourglass_energy .value ,
330
- rwen = rigidwall_energy .value ,
331
- slnten = sliding_interface_energy .value ,
332
- rylen = rayleigh_energy .value ,
333
- irgen = initial_reference_geometry_energy .value ,
336
+ ret = True
337
+ if not self .have_energy :
338
+ ret = self .stub .CreateControlEnergy (
339
+ ControlEnergyRequest (
340
+ hgen = hourglass_energy .value ,
341
+ rwen = rigidwall_energy .value ,
342
+ slnten = sliding_interface_energy .value ,
343
+ rylen = rayleigh_energy .value ,
344
+ irgen = initial_reference_geometry_energy .value ,
345
+ )
334
346
)
335
- )
336
- logging .info ("Control Energy Created..." )
347
+ self . have_energy = True
348
+ logging .info ("Control Energy Created..." )
337
349
return ret
338
350
339
351
def set_output (
@@ -385,8 +397,11 @@ def set_hourglass(self, controltype=HourglassControl.STANDARD_VISCOSITY_FORM, co
385
397
bool
386
398
"True" when successful, "False" when failed
387
399
"""
388
- ret = self .stub .CreateControlHourgalss (ControlHourglassRequest (ihq = controltype .value , qh = coefficient ))
389
- logging .info ("Control Hourglass Created..." )
400
+ ret = True
401
+ if not self .have_hourglass :
402
+ ret = self .stub .CreateControlHourgalss (ControlHourglassRequest (ihq = controltype .value , qh = coefficient ))
403
+ self .have_hourglass = True
404
+ logging .info ("Control Hourglass Created..." )
390
405
return ret
391
406
392
407
def set_bulk_viscosity (
@@ -411,14 +426,17 @@ def set_bulk_viscosity(
411
426
bool
412
427
"True" when successful, "False" when failed
413
428
"""
414
- ret = self .stub .CreateControlBulkViscosity (
415
- ControlBulkViscosityRequest (
416
- q1 = quadratic_viscosity_coeff ,
417
- q2 = linear_viscosity_coeff ,
418
- type = bulk_viscosity_type .value ,
429
+ ret = True
430
+ if not self .have_bulk_viscosity :
431
+ ret = self .stub .CreateControlBulkViscosity (
432
+ ControlBulkViscosityRequest (
433
+ q1 = quadratic_viscosity_coeff ,
434
+ q2 = linear_viscosity_coeff ,
435
+ type = bulk_viscosity_type .value ,
436
+ )
419
437
)
420
- )
421
- logging .info ("Control Bulk Viscosity Created..." )
438
+ self . have_bulk_viscosity = True
439
+ logging .info ("Control Bulk Viscosity Created..." )
422
440
return ret
423
441
424
442
def set_init_temperature (self , temp = 0 ):
@@ -482,20 +500,23 @@ def create_control_shell(
482
500
bool
483
501
"True" when successful, "False" when failed
484
502
"""
485
- ret = self .stub .CreateControlShell (
486
- ControlShellRequest (
487
- wrpang = wrpang ,
488
- esort = esort ,
489
- irnxx = irnxx ,
490
- istupd = istupd ,
491
- theory = theory ,
492
- bwc = bwc ,
493
- miter = miter ,
494
- proj = proj ,
495
- irquad = irquad ,
503
+ ret = True
504
+ if not self .have_control_shell :
505
+ ret = self .stub .CreateControlShell (
506
+ ControlShellRequest (
507
+ wrpang = wrpang ,
508
+ esort = esort ,
509
+ irnxx = irnxx ,
510
+ istupd = istupd ,
511
+ theory = theory ,
512
+ bwc = bwc ,
513
+ miter = miter ,
514
+ proj = proj ,
515
+ irquad = irquad ,
516
+ )
496
517
)
497
- )
498
- logging .info ("Control Shell Created..." )
518
+ self . have_control_shell = True
519
+ logging .info ("Control Shell Created..." )
499
520
return ret
500
521
501
522
def create_control_solid (
0 commit comments