Ejemplo n.º 1
0
def get_pipe_true(setting):
    pipe = SemiLinSystem(c_sound=setting.get('c_sound'),
                         t_final=setting.get('t_final'),
                         x_l=setting.get('x_l'),
                         x_r=setting.get('x_r'),
                         dx=setting.get('dx'),
                         lambda_len=len(get_true_friction()),
                         eps=setting.get('boundary_eps'))

    return pipe
Ejemplo n.º 2
0
def get_pipe_from_file_df(setting):
    pipe = SemiLinSystem(c_sound=setting.get('c_sound'),
                         t_final=setting.get('t_final'),
                         x_l=setting.get('x_l'),
                         x_r=setting.get('x_r'),
                         dx=setting.get('dx'),
                         lambda_len=setting.get('expan_coef'),
                         eps=setting.get('boundary_eps'))

    return pipe
Ejemplo n.º 3
0
    def __init__(self, c_sound, t_final, x_l, x_r, dx, expan_coef,
                 boundary_eps, time_ins):
        from UQuant.SemilinearSystem import SemiLinSystem

        self.c_sound, self.t_final = c_sound, t_final

        self.x_l, self.x_r = x_l, x_r

        self.dx, self.expan_coef, self.boundary_eps = dx, expan_coef, boundary_eps

        self.time_ins = time_ins

        self.pipe = SemiLinSystem(c_sound, t_final, x_l, x_r, dx, expan_coef,
                                  boundary_eps)
Ejemplo n.º 4
0
Archivo: uq.py Proyecto: hajians/UQ
initial_point_mcmc = [0.45, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04]
expan_coef = 7

# physical settings
c_sound = 1.0
t_final = 5.0
x_l, x_r = [0.0, 1.0]
dx = 0.005
boundary_eps = 0.05

# true friction coefficient
true_friction = [0.075, 0.015, 0.035, 0.025, 0.035, 0.001, 0.03]
time_ins = 20

# construct and run the true pipe
pipe_true = SemiLinSystem(c_sound, t_final, x_l, x_r, dx, expan_coef,
                          boundary_eps)
pipe_true.run(true_friction)
y_obs = normal(0.0, 0.1, time_ins) + \
        pipe_true.get_presure_drop(time_instance=time_ins, inplace=False)

# construct a pipe for computation
pipe = SemiLinSystem(c_sound, t_final, x_l, x_r, dx, expan_coef, boundary_eps)


def uni_prior(x):
    '''
    uniform prior

    Parameters
    ----------
Ejemplo n.º 5
0
import matplotlib.pyplot as plt

from UQuant.SemilinearSystem import SemiLinSystem

# build a pipe
pipe = SemiLinSystem(1.0, 5.0, 0.0, 1.0, 0.005, 7, 0.05)
# get the info of the pipe
pipe.info()

# check how pressure drop behaves when the friction coefficient is
# updated. Theoretically we have continuous dependence which can
# be seen also numerically.
coef = 0.0
for i in range(0, 100):
    vec_c = [0.05 + coef, 0.01, 0.0, 0.04, 0.0, 0.005, 0.005]
    pipe.run(vec_c)
    pipe.get_lambda_average(vec_c)
    pipe.get_presure_drop(time_instance=13)
    if i % 10 == 1:
        plt.plot(pipe.timeslices,
                 pipe.pressure_drop,
                 "-o",
                 label="cf = " + str(0.05 + coef))
    coef += 0.001

print ">> Computation Done"

plt.legend(loc=2, borderaxespad=0.0)
plt.xticks([round(tn, 2) for tn in pipe.timeslices])
plt.xlabel("$t_n$", fontsize=24)
plt.ylabel("$\delta p_h(t_n)$", fontsize=24)
Ejemplo n.º 6
0
## reading data
# "results/samples-11-v0.0.dat"
df = pd.read_csv("results/uq_pcn.dat", header=None)

threshold = 0.75

df = df[df.iloc[:, -1] > df.iloc[:, -1].max() * threshold].iloc[:, :-1]

## physical settings
c_sound = 1.0
t_final = 5.0
x_l, x_r = [0.0, 1.0]
dx = 0.005
boundary_eps = 0.05
expan_coef = len(df.columns)
pipe = SemiLinSystem(c_sound, t_final, x_l, x_r, dx, expan_coef, boundary_eps)

## true friction coefficient
true_friction = [0.185938, -0.0519335, 0., 0., -0.0696583, 0.0336323, 0., 0., \
                 0.0348292, -0.0121076, 0., 0., -0.00773981, 0.00105987, 0., 0., 0., \
                 -0.000641154, 0., 0., -0.00278633, 0.00250158, 0., 0., 0.00386991, \
                 -0.00179107, 0., 0., -0.0014216, 0.000230816, 0., 0., 0., \
                 -0.000179701, 0., 0., -0.000859979, 0.000838478, 0., 0., 0.00139317]

pipe_true = SemiLinSystem(c_sound, t_final, x_l, x_r, dx, len(true_friction),
                          boundary_eps)

time_ins = 20

## clustering
X = df.values
Ejemplo n.º 7
0
dx = 0.005
boundary_eps = 0.05

# true friction coefficient
true_friction = [0.185938, -0.0519335, 0., 0., -0.0696583, 0.0336323, 0., 0., \
                 0.0348292, -0.0121076, 0., 0., -0.00773981, 0.00105987, 0., 0., 0., \
                 -0.000641154, 0., 0., -0.00278633, 0.00250158, 0., 0., 0.00386991, \
                 -0.00179107, 0., 0., -0.0014216, 0.000230816, 0., 0., 0., \
                 -0.000179701, 0., 0., -0.000859979, 0.000838478, 0., 0., 0.00139317]

true_expan_coef = len(true_friction)

time_ins = 20

# construct and run the true pipe
pipe_true = SemiLinSystem(c_sound, t_final, x_l, x_r, dx, true_expan_coef,
                          boundary_eps)
pipe_true.run(true_friction)
y_obs = normal(0.0, 0.1, time_ins) + \
        pipe_true.get_presure_drop(time_instance=time_ins, inplace=False)

# construct a pipe for computation
pipe = SemiLinSystem(c_sound, t_final, x_l, x_r, dx, expan_coef, boundary_eps)

filename = "results/samples-9-v7.0.dat"
dfRaw = pd.read_csv(filename, header=None)
df = dfRaw.iloc[:, :-1]
prob = dfRaw.iloc[:, -1]
#sorted_prob_idx = prob.loc[9000:15000].sort_values(ascending=False).index.values
sorted_prob_idx = prob.loc[19000:21000].sort_values(
    ascending=False).index.values
sorted_prob_idx = prob.loc[30000:35000].sort_values(