Training data is generated from CoolProp.


In [1]:
import numpy as np
from sklearn import preprocessing

import CoolProp.CoolProp as CP

import matplotlib.pyplot as plt

from keras.models import Model
from keras.layers import Dense, Activation, Input, BatchNormalization, Dropout
from keras import layers
from keras.callbacks import ModelCheckpoint


def rho_TP_gen(x, fluid):
    rho = CP.PropsSI('D', 'T', x[0], 'P', x[1], fluid)
    return rho


Using TensorFlow backend.
The Neural network is build based on the popular resnet structure. ![Image of resnet] (https://github.com/uqyge/combustionML/blob/master/ANN_realgas/images/residual_block.png "Logo Title Text 1")

In [ ]:
def res_block(input_tensor, n_neuron, stage, block, bn=False):
    conv_name_base = 'res' + str(stage) + block + '_branch'
    bn_name_base = 'bn' + str(stage) + block + '_branch'

    x = Dense(n_neuron, name=conv_name_base + '2a')(input_tensor)
    if bn:
        x = BatchNormalization(axis=-1, name=bn_name_base + '2a')(x)
    x = Activation('relu')(x)

    x = Dense(n_neuron, name=conv_name_base + '2b')(x)
    if bn:
        x = BatchNormalization(axis=-1, name=bn_name_base + '2b')(x)
    x = layers.add([x, input_tensor])
    x = Activation('relu')(x)

    return x