@@ -144,6 +144,54 @@ def plot_boundary_conditions(x_b1, y_b1, bc_1, x_b2, y_b2, bc_2, x_b3, y_b3,
144144 plt .show ()
145145
146146
147+
148+
149+ def plot_boundary_conditions2 (x_b1 , y_b1 , bc_1 , x_b2 , y_b2 , bc_2 ,
150+ x_b3 , y_b3 , bc_3 , x_b4 , y_b4 , bc_4 ,
151+ x_c , y_c , results_dir ):
152+ plt .figure (figsize = (width , height ), dpi = dpi )
153+
154+ # Compute vmin and vmax across all boundary condition values
155+ all_bc_values = np .concatenate ([bc_1 , bc_2 , bc_3 , bc_4 ])
156+ vmin = np .min (all_bc_values )
157+ vmax = np .max (all_bc_values )
158+
159+ s = 10
160+
161+ # Plot the first boundary condition and link it to the colorbar
162+ sc = plt .scatter (x_b1 , y_b1 , c = bc_1 , marker = 'x' , vmin = 0 , vmax = 2 ,
163+ label = 'P[0,y] = 0' , cmap = cm .jet , s = s )
164+
165+ # Remaining boundary conditions
166+ plt .scatter (x_b2 , y_b2 , c = bc_2 , marker = '^' , vmin = 0 , vmax = 2 ,
167+ label = 'P[1,y] = y' , cmap = cm .jet , s = s )
168+ plt .scatter (x_b3 , y_b3 , c = bc_3 , marker = '*' , vmin = 0 , vmax = 2 ,
169+ label = '$\\ partial P/\\ partial y[x,0] = 0$' , cmap = cm .jet , s = s )
170+ plt .scatter (x_b4 , y_b4 , c = bc_4 , marker = 'o' , vmin = 0 , vmax = 2 ,
171+ label = '$\\ partial P/\\ partial y[x,1] = 0$' , cmap = cm .jet , s = s )
172+
173+ # Collocation points
174+ plt .scatter (x_c , y_c , c = 'k' , marker = '.' , alpha = 0.5 ,
175+ label = 'Collocation points' , s = 5 )
176+
177+ # Labels and colorbar
178+ plt .xlabel ('$X$' )
179+ plt .ylabel ('$Y$' )
180+ cbar = plt .colorbar (sc , aspect = 30 ) # Link to actual scatter plot
181+ cbar .set_label ('Pressure (kPa)' )
182+
183+ plt .legend ()
184+ plt .tight_layout ()
185+
186+ figure_name = 'bcs_collocs'
187+ plt .savefig (results_dir + figure_name + figure_format ,
188+ dpi = dpi ,
189+ format = figure_format .strip ('.' ),
190+ bbox_inches = 'tight' )
191+ plt .show ()
192+
193+
194+
147195def save_legend_as_image (results_dir ):
148196 plt .figure (figsize = (width , height ), dpi = dpi )
149197 fig , ax = plt .subplots ()
@@ -193,6 +241,8 @@ def save_legend_as_image(results_dir):
193241 plt .close ()
194242
195243
244+
245+
196246#%% plot for pinn loss
197247def plot_pinn_training (all_losses , all_epochs , title , fig_name , results_dir ):
198248 plt .figure (figsize = (width , height ), dpi = dpi )
@@ -232,6 +282,7 @@ def plot_2d_pressure_distribution(X, Y, pressure, cbar_lebel, title, fig_name,
232282 plt .ylabel ('$Y$' )
233283 filename = fig_name + '.png'
234284 plt .savefig (results_dir + filename , dpi = dpi )
285+ plt .show ()
235286
236287
237288def plot_pressure_along_x (X , Y , pressure , title , fig_name , results_dir ):
@@ -298,10 +349,11 @@ def plot_2d_pressure_distribution_masked(X, Y, pressure, perm_field,
298349 plt .savefig (results_dir + filename , dpi = dpi )
299350 # Set masked values to zero
300351 pressure_with_zeros = masked_pressure .filled (0 )
301-
352+ plt . show ()
302353 return pressure_with_zeros
303354
304355
356+
305357def plot_gradient_field (X , Y , grad_head_x , grad_head_y , fig_title , scale ,
306358 results_dir ):
307359 plt .figure (figsize = (width , height ), dpi = dpi )
0 commit comments