-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mea column improvements #1077
base: main
Are you sure you want to change the base?
Mea column improvements #1077
Changes from 3 commits
bfd2663
7b15be2
6c01e78
e710e16
8d0adc2
4c9cf2b
34b4009
f120d92
5defb90
7f00584
4266820
fbc1e51
729463b
ff50c73
b665f91
1d5bd89
3db426a
6cae03f
18e8b65
117acd2
6cd3d05
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -761,11 +761,22 @@ def calculate_scaling_factors(self): | |
super().calculate_scaling_factors() | ||
# Get scaling factor defaults, if no scaling factor set | ||
for v in self.component_data_objects( | ||
(Constraint, Var, Expression), descend_into=False | ||
(Var, Expression), descend_into=False | ||
): | ||
if iscale.get_scaling_factor(v) is None: # don't replace if set | ||
name = v.getname().split("[")[0] | ||
index = v.index() | ||
sf = self.config.parameters.get_default_scaling(name, index) | ||
if sf is not None: | ||
iscale.set_scaling_factor(v, sf) | ||
|
||
for con in self.component_data_objects(Constraint, descend_into=False): | ||
# if con.name == 'stripper_section.stripper.liquid_phase.properties[0.0,0.8].appr_to_true_species[Liq,CO2]': | ||
# import pdb; pdb.set_trace() | ||
if iscale.get_constraint_transform_applied_scaling_factor(con) is None: | ||
name = con.getname().split("[")[0] | ||
index = con.index() | ||
sf = self.config.parameters.get_default_scaling(name, index) | ||
if sf is not None: | ||
iscale.constraint_scaling_transform(con, sf, overwrite=False) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a fairly significant change to what this method does - we probably need to discuss the implications of this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thinking a bit more (and repeating a comment from Slack for posterity) - I think this is the wrong way to go. IPOPT should be considered a special case, not the general case, in which case we need to set the scaling suffix for the constraints and then let the user decide what to do with them. IPOPT users can use the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removing the default status of IPOPT and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is fine to still use The point being this is not something we want baked in deep as it will be harder to change later - ideally we want to limit the use of this to the |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,7 +61,7 @@ | |
class SolventCondenserData(UnitModelBlockData): | ||
""" | ||
Condenser unit for solvent column models using separate property packages | ||
for liquid and vpor phases. | ||
for liquid and vapor phases. | ||
|
||
Unit model to condense the vapor from the top of a solvent column. | ||
""" | ||
|
@@ -321,11 +321,11 @@ def build(self): | |
flow_basis = self.liquid_phase[t_init].get_material_flow_basis() | ||
if flow_basis == MaterialFlowBasis.molar: | ||
fb = "flow_mole" | ||
elif flow_basis == MaterialFlowBasis.molar: | ||
fb = "flow_mass" | ||
# elif flow_basis == MaterialFlowBasis.mass: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Commented code |
||
# fb = "flow_mass" | ||
else: | ||
raise ConfigurationError( | ||
f"{self.name} SolventCondenser only supports mass or molar " | ||
f"{self.name} SolventCondenser only supports molar " | ||
f"basis for MaterialFlowBasis." | ||
) | ||
|
||
|
@@ -349,7 +349,7 @@ def rule_material_balance(blk, t, j): | |
elif j in self.liquid_phase.component_list: | ||
# Non-volatile component | ||
# No mass transfer term | ||
# Set liquid flowrate to an arbitary small value | ||
# Set liquid flowrate to an arbitrary small value | ||
return ( | ||
blk.liquid_phase[t].get_material_flow_terms("Liq", j) | ||
== blk.zero_flow_param | ||
|
@@ -450,7 +450,14 @@ def calculate_scaling_factors(self): | |
), | ||
) | ||
elif j in self.liquid_phase.component_list: | ||
iscale.constraint_scaling_transform(v, value(1 / self.zero_flow_param)) | ||
iscale.constraint_scaling_transform( | ||
v, | ||
iscale.get_scaling_factor( | ||
self.liquid_phase[t].get_material_flow_terms("Liq",j), | ||
default=1, | ||
warning=True, | ||
), | ||
) | ||
else: | ||
pass # no need to scale this constraint | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment needs to be removed.