Exemple #1
0
def test_gas_custom_dict_methods():
    """Test the to/from dict methods."""
    co2_gap = EnergyWindowMaterialGasCustom('CO2', 0.0125, 0.0146, 0.000014, 827.73)
    co2_gap.specific_heat_ratio = 1.4
    co2_gap.molecular_weight = 44
    material_dict = co2_gap.to_dict()
    new_material = EnergyWindowMaterialGasCustom.from_dict(material_dict)
    assert material_dict == new_material.to_dict()
def material_window_gas_custom(directory):
    co2_gap = EnergyWindowMaterialGasCustom('CO2', 0.0125, 0.0146, 0.000014,
                                            827.73)
    co2_gap.specific_heat_ratio = 1.4
    co2_gap.molecular_weight = 44
    dest_file = os.path.join(directory, 'material_window_gas_custom.json')
    with open(dest_file, 'w') as fp:
        json.dump(co2_gap.to_dict(), fp, indent=4)