This commit is contained in:
J.E. Garay Labra 2021-03-24 17:00:14 +01:00
parent 3599c030b4
commit 842a3fbcc6
2 changed files with 29 additions and 22 deletions

View File

@ -52,30 +52,37 @@ def plot_parameters(dat, input_file, deparameterize=False, ref=None):
inputfile = yaml.full_load(file) inputfile = yaml.full_load(file)
#true_val = [10,250,250,250,30] #true_val = [10,250,250,250,30]
true_val = [10,60,220,160,100] true_values = {
3: 10,
4: 60,
5: 220,
6: 160,
2: 100
}
current_val = [] current_val = []
labels = [] labels = []
ids = []
for bnd_c in inputfile['estimation']['boundary_conditions']: for bnd_c in inputfile['estimation']['boundary_conditions']:
if 'windkessel' in bnd_c['type']: if 'windkessel' in bnd_c['type']:
for bnd_set in inputfile['boundary_conditions']: for bnd_set in inputfile['boundary_conditions']:
if bnd_c['id'] == bnd_set['id']: if bnd_c['id'] == bnd_set['id']:
ids.append(bnd_c['id'])
current_val.append(bnd_set['value'][0]) current_val.append(bnd_set['value'][0])
labels.append('R_' + str(bnd_c['id'])) labels.append('R_' + str(bnd_c['id']))
elif 'dirichlet' in bnd_c['type']: elif 'dirichlet' in bnd_c['type']:
current_val.append(inputfile['boundary_conditions'][1]['parameters']['U']) current_val.append(inputfile['boundary_conditions'][1]['parameters']['U'])
ids.append(bnd_c['id'])
labels.append('U') labels.append('U')
dim = dat['theta'].shape[-1] dim = dat['theta'].shape[-1]
fig1, axes = plt.subplots(1,1,figsize=(8,6)) fig1, axes = plt.subplots(1,1,figsize=(8,6))
axes.set_ylabel(r'$\theta$',fontsize=18) axes.set_ylabel(r'$\theta$',fontsize=18)
t = dat['times'] t = dat['times']
@ -104,7 +111,7 @@ def plot_parameters(dat, input_file, deparameterize=False, ref=None):
color=col_) color=col_)
true_level = np.log(true_val[i]/current_val[i])/np.log(2) true_level = np.log(true_values[ids[i]]/current_val[i])/np.log(2)
axes.plot(t,1.5*i + t*0 + true_level , color=col_,ls='--') axes.plot(t,1.5*i + t*0 + true_level , color=col_,ls='--')
col_ = next(col) col_ = next(col)
legends_=next(legends) legends_=next(legends)
@ -115,8 +122,8 @@ def plot_parameters(dat, input_file, deparameterize=False, ref=None):
# print('theta_peak: \t {}'.format(theta[round(len(theta)/2), :])) # print('theta_peak: \t {}'.format(theta[round(len(theta)/2), :]))
print('Final value theta: \t {}'.format(theta[-1, :])) print('Final value theta: \t {}'.format(theta[-1, :]))
print('Deparameterized: 2^theta_end: \t {}'.format(2**theta[-1, :])) print('Deparameterized: 2^theta_end: \t {}'.format(2**theta[-1, :]))
print('Real values: \t {}'.format(true_val)) print('Real values: \t {}'.format(true_values))
print('Recon values: \t {}'.format(np.round(2**theta[-1, :]*current_val,2))) print('Recon values: \t {a}:{b} '.format(a=ids[:],b=np.round(2**theta[-1, :]*current_val,2)))

View File

@ -40,31 +40,31 @@ boundary_conditions:
- -
id: 3 id: 3
type: 'windkessel' type: 'windkessel'
#value: [10,0,0] value: [10,0,0]
value: [10,0.0008,2400] #value: [10,0.0008,2400] # [R_p,C,R_d] SEPARAR
p0: [80,1333.223874] #p0: [80,1333.223874]
#p0: [0,1333.223874] p0: [0,1333.223874]
- -
id: 4 id: 4
type: 'windkessel' type: 'windkessel'
value: [60,0,0] value: [60,0,0]
#value: [60,0.00034,4200] #value: [60,0.00034,4200]
p0: [80,1333.223874] #p0: [80,1333.223874]
#p0: [0,1333.223874] p0: [0,1333.223874]
- -
id: 5 id: 5
type: 'windkessel' type: 'windkessel'
value: [220,0,0] value: [220,0,0]
#value: [220,0.00034,11000] #value: [220,0.00034,11000]
p0: [80,1333.223874] #p0: [80,1333.223874]
#p0: [0,1333.223874] p0: [0,1333.223874]
- -
id: 6 id: 6
type: 'windkessel' type: 'windkessel'
value: [160,0,0] value: [160,0,0]
#value: [160,0.00034,7800] #value: [160,0.00034,7800]
p0: [80,1333.223874] #p0: [80,1333.223874]
#p0: [0,1333.223874] p0: [0,1333.223874]
timemarching: timemarching:
velocity_pressure_coupling: 'fractionalstep' # monolithic, fractionalstep velocity_pressure_coupling: 'fractionalstep' # monolithic, fractionalstep
@ -128,14 +128,14 @@ linear_solver:
estimation: estimation:
boundary_conditions: boundary_conditions:
-
id: 3
type: 'windkessel'
initial_stddev: 1
#- #-
# id: 4 # id: 3
# type: 'windkessel' # type: 'windkessel'
# initial_stddev: 1 # initial_stddev: 1
-
id: 4
type: 'windkessel'
initial_stddev: 1
#- #-
# id: 5 # id: 5
# type: 'windkessel' # type: 'windkessel'