def test_state_block_basic_attributes(model): assert isinstance(model.fs.state[0].flow_mass_comp, Var) # All variables are stale, so DoF should be 0 assert len(unused_variables_set(model.fs.state[0])) == 4 assert degrees_of_freedom(model.fs.state[0]) == 0 for p in model.fs.state[0].phase_list: for j in model.fs.state[0].component_list: assert (model.fs.state[0].get_material_flow_terms(p, j) is model.fs.state[0].flow_mass_comp[j]) assert (model.fs.state[0].get_material_density_terms(p, j) is model.fs.state[0].conc_mass_comp[j]) assert (model.fs.state[0].default_material_balance_type() is MaterialBalanceType.componentTotal) assert model.fs.state[0].default_energy_balance_type( ) is EnergyBalanceType.none assert model.fs.state[0].define_state_vars() == { "flow_mass_comp": model.fs.state[0].flow_mass_comp } assert model.fs.state[0].define_display_vars() == { "Volumetric Flowrate": model.fs.state[0].flow_vol, "Mass Concentration": model.fs.state[0].conc_mass_comp, } assert model.fs.state[0].get_material_flow_basis( ) is MaterialFlowBasis.mass
def test_build(self, iron_oc): assert hasattr(iron_oc.fs.unit, "gas_inlet") assert len(iron_oc.fs.unit.gas_inlet.vars) == 4 assert isinstance(iron_oc.fs.unit.gas_inlet.flow_mol, Var) assert isinstance(iron_oc.fs.unit.gas_inlet.mole_frac_comp, Var) assert isinstance(iron_oc.fs.unit.gas_inlet.temperature, Var) assert isinstance(iron_oc.fs.unit.gas_inlet.pressure, Var) assert hasattr(iron_oc.fs.unit, "solid_inlet") assert len(iron_oc.fs.unit.solid_inlet.vars) == 3 assert isinstance(iron_oc.fs.unit.solid_inlet.flow_mass, Var) assert isinstance(iron_oc.fs.unit.solid_inlet.mass_frac_comp, Var) assert isinstance(iron_oc.fs.unit.solid_inlet.temperature, Var) assert hasattr(iron_oc.fs.unit, "gas_outlet") assert len(iron_oc.fs.unit.gas_outlet.vars) == 4 assert isinstance(iron_oc.fs.unit.gas_outlet.flow_mol, Var) assert isinstance(iron_oc.fs.unit.gas_outlet.mole_frac_comp, Var) assert isinstance(iron_oc.fs.unit.gas_outlet.temperature, Var) assert isinstance(iron_oc.fs.unit.gas_outlet.pressure, Var) assert hasattr(iron_oc.fs.unit, "solid_outlet") assert len(iron_oc.fs.unit.solid_outlet.vars) == 3 assert isinstance(iron_oc.fs.unit.solid_outlet.flow_mass, Var) assert isinstance(iron_oc.fs.unit.solid_outlet.mass_frac_comp, Var) assert isinstance(iron_oc.fs.unit.solid_outlet.temperature, Var) assert isinstance(iron_oc.fs.unit.isothermal_gas_phase, Constraint) assert isinstance(iron_oc.fs.unit.isothermal_solid_phase, Constraint) assert number_variables(iron_oc) == 579 assert number_total_constraints(iron_oc) == 503 assert number_unused_variables(iron_oc) == 55 print(unused_variables_set(iron_oc))
def test_build(self, iron_oc): assert isinstance(iron_oc.fs.unit.volume_bed_constraint, Constraint) assert isinstance(iron_oc.fs.unit.volume_solid_constraint, Constraint) assert isinstance(iron_oc.fs.unit.solids_material_holdup_constraints, Constraint) assert isinstance(iron_oc.fs.unit .solids_material_accumulation_constraints, Constraint) assert isinstance(iron_oc.fs.unit.mass_solids_constraint, Constraint) assert isinstance(iron_oc.fs.unit.sum_component_constraint, Constraint) assert number_variables(iron_oc) == 3044 assert number_total_constraints(iron_oc) == 2319 assert number_unused_variables(iron_oc) == 206 print(unused_variables_set(iron_oc))
def test_build(self, iron_oc): assert hasattr(iron_oc.fs.unit, "gas_inlet") assert len(iron_oc.fs.unit.gas_inlet.vars) == 4 assert isinstance(iron_oc.fs.unit.gas_inlet.flow_mol, Var) assert isinstance(iron_oc.fs.unit.gas_inlet.mole_frac_comp, Var) assert isinstance(iron_oc.fs.unit.gas_inlet.temperature, Var) assert isinstance(iron_oc.fs.unit.gas_inlet.pressure, Var) assert hasattr(iron_oc.fs.unit, "solid_inlet") assert len(iron_oc.fs.unit.solid_inlet.vars) == 4 assert isinstance(iron_oc.fs.unit.solid_inlet.flow_mass, Var) assert isinstance(iron_oc.fs.unit.solid_inlet.particle_porosity, Var) assert isinstance(iron_oc.fs.unit.solid_inlet.mass_frac_comp, Var) assert isinstance(iron_oc.fs.unit.solid_inlet.temperature, Var) assert hasattr(iron_oc.fs.unit, "gas_outlet") assert len(iron_oc.fs.unit.gas_outlet.vars) == 4 assert isinstance(iron_oc.fs.unit.gas_outlet.flow_mol, Var) assert isinstance(iron_oc.fs.unit.gas_outlet.mole_frac_comp, Var) assert isinstance(iron_oc.fs.unit.gas_outlet.temperature, Var) assert isinstance(iron_oc.fs.unit.gas_outlet.pressure, Var) assert hasattr(iron_oc.fs.unit, "solid_outlet") assert len(iron_oc.fs.unit.solid_outlet.vars) == 4 assert isinstance(iron_oc.fs.unit.solid_outlet.flow_mass, Var) assert isinstance(iron_oc.fs.unit.solid_outlet.particle_porosity, Var) assert isinstance(iron_oc.fs.unit.solid_outlet.mass_frac_comp, Var) assert isinstance(iron_oc.fs.unit.solid_outlet.temperature, Var) assert isinstance(iron_oc.fs.unit.gas_energy_balance_out, Constraint) assert isinstance(iron_oc.fs.unit.solid_energy_balance_out, Constraint) assert isinstance(iron_oc.fs.unit.isothermal_gas_emulsion, Constraint) assert isinstance(iron_oc.fs.unit.isothermal_solid_emulsion, Constraint) assert isinstance(iron_oc.fs.unit.isothermal_bubble, Constraint) assert number_variables(iron_oc) == 1144 assert number_total_constraints(iron_oc) == 1039 assert number_unused_variables(iron_oc) == 80 print(unused_variables_set(iron_oc))