Skip to content

Commit

Permalink
Remove ratio_type from beso_conf; value is always 'relative'
Browse files Browse the repository at this point in the history
  • Loading branch information
gbroques committed Sep 11, 2020
1 parent a070ef2 commit e39ad93
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
1 change: 0 additions & 1 deletion beso/beso_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@

mass_addition_ratio = 0.01 # mass to be added in each iteration
mass_removal_ratio = 0.03 # mass to be removed in each iteration
ratio_type = "relative" # "relative" - ratios of actual mass
compensate_state_filter = True # True - if state filter changes iteration mass, next iteration will compensate it
# False - do nothing

Expand Down
28 changes: 13 additions & 15 deletions beso/beso_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
sensitivity_averaging = False
mass_addition_ratio = 0.01
mass_removal_ratio = 0.03
ratio_type = "relative"
compensate_state_filter = False
tolerance = 1e-3
displacement_graph = []
Expand Down Expand Up @@ -121,7 +120,6 @@
msg += ("reference_points = %s\n" % reference_points)
msg += ("mass_addition_ratio = %s\n" % mass_addition_ratio)
msg += ("mass_removal_ratio = %s\n" % mass_removal_ratio)
msg += ("ratio_type = %s\n" % ratio_type)
msg += ("compensate_state_filter = %s\n" % compensate_state_filter)
msg += ("sensitivity_averaging = %s\n" % sensitivity_averaging)
msg += ("tolerance = %s\n" % tolerance)
Expand Down Expand Up @@ -179,17 +177,17 @@
# iterations limit - default "auto"matic setting
iterations_limit = 0
m = mass[0] / mass_full
if ratio_type == "relative":
it = 0
if mass_removal_ratio - mass_addition_ratio > 0:
while m > mass_goal_ratio:
m -= m * (mass_removal_ratio - mass_addition_ratio)
it += 1
else:
while m < mass_goal_ratio:
m += m * (mass_addition_ratio - mass_removal_ratio)
it += 1
iterations_limit = it + 25
# if ratio_type == "relative":
it = 0
if mass_removal_ratio - mass_addition_ratio > 0:
while m > mass_goal_ratio:
m -= m * (mass_removal_ratio - mass_addition_ratio)
it += 1
else:
while m < mass_goal_ratio:
m += m * (mass_addition_ratio - mass_removal_ratio)
it += 1
iterations_limit = it + 25
print("\niterations_limit set automatically to %s" % iterations_limit)
msg = ("\niterations_limit = %s\n" % iterations_limit)
logging.info(msg)
Expand Down Expand Up @@ -537,8 +535,8 @@
mass_goal_i = mass_goal_ratio * mass_full

# switch element states
if ratio_type == "relative":
mass_referential = mass[i - 1]
# if ratio_type == "relative"
mass_referential = mass[i - 1]
[elm_states, mass] = beso_lib.switching(elm_states, domains_from_config, domain_optimized, domains, FI_step_max,
domain_density, domain_thickness, domain_shells, area_elm, volume_elm,
sensitivity_number, mass, mass_referential, mass_addition_ratio,
Expand Down

0 comments on commit e39ad93

Please sign in to comment.