Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions applications/compute_conditional_mean_will.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,24 @@ def radial_mean(
# Read all the fields you want
for filename, field_name in zip(field_file, field_names):
val_dict = {}
field_tmp, _ = read_field(case_folder, time_folder, field_name)
try:
field_tmp, _ = read_field(case_folder, time_folder, field_name)
except FileNotFoundError:
if field_name == "Ualpha.liquid":
alpha_tmp, _ = read_field(
case_folder, time_folder, "alpha.liquid"
)
U_tmp, _ = read_field(case_folder, time_folder, "U.liquid")
field_tmp = alpha_tmp[:, np.newaxis] * U_tmp
else:
raise NotImplementedError(
f"{field_name} is not a valid field name"
)
if len(field_tmp.shape) == 2 and field_tmp.shape[1] == 3:
# You read a velocity I'm assuming you need the axial one
logger.warning(
f"You read a velocity I'm assuming you need the axial one along the direction {vert_ind}"
)
field_tmp = field_tmp[:, vert_ind]

if heights is None:
Expand Down Expand Up @@ -228,7 +243,7 @@ def make_plot(fields_cond: dict, heights: list[float], field_names=list[str]):
fields_cond = radial_mean(
case_folder=None,
heights=[5.2, 6.2, 6.3],
field_names=["U.liquid", "alpha.gas"],
field_names=["U.liquid", "alpha.gas", "Ualpha.liquid"],
vert_ind=1,
window_ave=2,
n_bins=32,
Expand All @@ -240,5 +255,5 @@ def make_plot(fields_cond: dict, heights: list[float], field_names=list[str]):
make_plot(
fields_cond=fields_cond,
heights=[5.2, 6.2, 6.3],
field_names=["U.liquid", "alpha.gas"],
field_names=["U.liquid", "alpha.gas", "Ualpha.liquid"],
)
Loading