Im experiencing misalignment of the crests in my normalized vertical velocity profiles when plotting multiple turbulence models; any suggestions on how to fix this?

1 Ansicht (letzte 30 Tage)
Basically I had a running code for radial velocity contours which was fixed an all the crests aligned. Now i have changed the input files and associated names in the codes but the crests are not aligning, any and all help will be apreciated
  2 Kommentare
Image Analyst
Image Analyst am 30 Jul. 2024
Why do you think that just because they aligned for one data file, that they should align for all other data files?
And you forgot to attach them so we can't even run your txt file, which is actually an m-file script.
If you have any more questions, then attach your data files with the paperclip icon after you read this:
Keith
Keith am 30 Jul. 2024
Bearbeitet: Keith am 30 Jul. 2024
I know that they are supposed to align and have the same starting point because thats the way they are plotted in reference papers and apologies I was not sure whether i am allowed to post my files here.
NOTE : attached files were .dat files and have been attached with the .txt extension

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Sivsankar
Sivsankar am 8 Aug. 2024
Hi Keith,
% Normalize radial distances and velocities
zeta_kep = v_kep / y0_5_kep;
U_Uc_kep = U_vertical_kep / max(U_vertical_kep);
zeta_sa = v_sa / y0_5_sa;
U_Uc_sa = U_vertical_sa / max(U_vertical_sa);
zeta_komega_sst = v_komega_sst / y0_5_komega_sst;
U_Uc_komega_sst = U_vertical_komega_sst / max(U_vertical_komega_sst);
zeta_komega_geko = v_komega_geko / y0_5_komega_geko;
U_Uc_komega_geko = U_vertical_komega_geko / max(U_vertical_komega_geko);
zeta_rsm_lps = v_rsm_lps / y0_5_rsm_lps;
U_Uc_rsm_lps = U_vertical_rsm_lps / max(U_vertical_rsm_lps);
From the idea of the above snippet, I assume that you want to normalise both radial distances and velocities. But from your screenshot I can see that your X axis (for r values) is not normalised. But you are trying to plot the normalised values of r.
Investigating into your ‘ensure_unique_and_sorted’ function I came across some discrepancies. Rewrite your function as follows:
function [r_unique_sorted, U_unique_sorted] = ensure_unique_and_sorted(r, U)
[U_unique_sorted, idx] = unique(U, 'stable');
r_unique_sorted = r(idx);
% Remove duplicates by averaging This code does the same as the above piece of code
% if length(U_unique) < length(U)
% [~, uniqueIdx] = unique(U, 'stable');
% U_unique = U(uniqueIdx);
% r_unique = r(uniqueIdx);
% end
% Sort the values based on r No need to sort
% [r_unique_sorted, sortIdx] = sort(r_unique);
% U_unique_sorted = U_unique(sortIdx);
end
I’ve commented out your if else case because it is redundant as it does the same thing as its above piece of code. I believe that you don’t need to sort the values in r because they are already in descending order and doing that operation would flip it and it would flip U as well. This would end up being wrong as you are using the values of U in finding the interpolation range rn. Upon running this updated code, I’ve got the result as follows:
Now I believe the crests are aligned. I hope this is your expected result. You could maybe adjust the interpolation range rn to property normalise the r values to get the X axis completely normalised.
Hope this helps. Feel free to correct me if I’m wrong. Thanks!

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by