def run_sol_liq_with_mockdb(db):
    base_obj = grab_thermo_Liq_Sol_FpcTP_base(db)

    # Our components for this problem are as follows:
    comp_list = ["H2O", "H_+", "OH_-", "Ca[OH]2", "Ca_2+", "CaOH_+"]

    # In this example, both Sol and Liq phases will be considered valid
    #   when searching for reactions in the database.
    phase_list = ["Sol", "Liq"]

    base_obj = get_components_and_add_to_idaes_config(db, base_obj, comp_list)

    # Create a reaction config
    react_base = grab_base_reaction_config(db)

    # Add reactions to the reaction base as 'equilibrium'
    react_base = add_equilibrium_reactions_by_phase_to_react_base(
        db, react_base, comp_list, phase_list)

    thermo_config = base_obj.idaes_config
    reaction_config = react_base.idaes_config

    #Prior to sending the config to the IDAES objects, we will manually modifiy the
    #   reaction order for the solubility equation.
    reaction_config["equilibrium_reactions"]["CaOH2_Ksp"]["parameter_data"][
        "reaction_order"][('Sol', 'Ca[OH]2')] = 0
    model = build_equilibrium_model(thermo_config, reaction_config)
    return model
Esempio n. 2
0
def run_vap_liq_with_mockdb(db):
    base_obj = grab_thermo_Liq_Vap_FpcTP_base(db)

    # Our components for this problem are as follows:
    comp_list = ["H2O", "H_+", "OH_-", "H2CO3", "HCO3_-", "CO3_2-", "CO2"]

    base_obj = get_components_and_add_to_idaes_config(db, base_obj, comp_list)

    # Create a reaction config
    react_base = grab_base_reaction_config(db)

    # Add reactions to the reaction base as 'equilibrium'
    react_base = add_equilibrium_reactions_to_react_base(db, react_base, comp_list)

    # Now, we can actually see if we created a correct model by looking
    #       for degrees of freedom, state variables, etc.
    thermo_config = base_obj.idaes_config
    reaction_config = react_base.idaes_config
    model = build_equilibrium_model(thermo_config, reaction_config)

    return model
def run_liq_only_with_mockdb(db):
    base_obj = grab_thermo_Liq_Sol_FpcTP_base(db)

    # Our components for this problem are as follows:
    comp_list = ["H2O", "H_+", "OH_-", "Ca[OH]2", "Ca_2+", "CaOH_+"]

    # In this example, both Sol and Liq phases will be considered valid
    #   when searching for reactions in the database.
    phase_list = ["Liq"]

    base_obj = get_components_and_add_to_idaes_config(db, base_obj, comp_list)

    # Create a reaction config
    react_base = grab_base_reaction_config(db)

    # Add reactions to the reaction base as 'equilibrium'
    react_base = add_equilibrium_reactions_by_phase_to_react_base(
        db, react_base, comp_list, phase_list)

    thermo_config = base_obj.idaes_config
    reaction_config = react_base.idaes_config
    model = build_equilibrium_model(thermo_config, reaction_config)
    return model