<jupyter_start><jupyter_text>Compare LES and RANS results1. Load the PKL file containing resampled P2. Show statistics of signals2. Load RANS data3. Plot both signals along x-axis<jupyter_code>import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import pickle, random

from math import pi
def ElliotBrooksCalc(x,l,H,d,u,g=9.81):
    '''
    l : bedform wavelenght
    H : dune height
    d : mean flow depth
    u : mean flow velocity
    g : gravity acc
    '''
    if H/d <= 0.34:
        n = 3./8.
    else:
        n = 3./2.
    
    hm = 0.28 * u**2/(2*g) * (H/d/0.34)**n
    k  = 2*pi/l
    h = hm * np.sin(k*x + pi/2)
    return h
# Load LES data
fpath = "pickledData_constg/PTX(3).pkl"
with open(fpath,'rb') as f: P_LES = pickle.load(f)

fpath = "/home/edsaa/nuModel/bioclogging/surfaceWater/runCases/RANS_3D/3mmx0.1mmXBump/RANS_p.result"
P_RAS = pd.read_csv(fpath)
P_RAS.rename(columns={"p_rho": "p"},inplace=True)
elliot_dict = dict(l=0.15, H=0.015, d=0.0975 ,u=0.15)
hElliot = ElliotBrooksCalc(P_RAS['X'],**elliot_dict)
fig, axs = plt.subplots(2,1,sharex=True,figsize=[8,6],\
                        gridspec_kw={'hspace':0,'height_ratios':[0.5,1]})
ax = axs[0]
ax.plot(P_RAS['X'],P_RAS['Y'],c='orange',lw=1,ls='dashed',label='Bedform')
ax.legend(loc='lower right')

ax = axs[1]
ax.plot(P_RAS['X'],P_RAS['p'],c='b',label='RANS')
ax.plot(P_RAS['X'],hElliot*9.81,c='g',lw=0.5,label='Elliot')
ax.plot(P_LES.columns,P_LES.mean(),c='k',label='mean(LESg)')
ax.legend(loc='lower right')
ax.set(xlim=[0,0.15])
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1884150222788033, 'fraction_numerical': 0.04073838319541693, 'mean_word_length': 4.070967741935484, 'pattern_counts': {'":': 1, '<': 6, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '474996', 'license': 'MIT', 'n_tokens_mistral': 734, 'n_tokens_neox': 701, 'n_words': 123, 'path': 'notebooks/LEStaskstream/7-CompareRANSnLES.ipynb', 'repo_name': 'edsaac/bioclogging', 'size': '1571'}