Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug report: Wrong model aspect ratio in the diagnostic if setting it after specifying the basis #14

Closed
jodemaey opened this issue Oct 3, 2022 · 2 comments
Assignees
Labels
bug Something isn't working fixed

Comments

@jodemaey
Copy link
Member

jodemaey commented Oct 3, 2022

What

If during the initialization of the model the aspect ratio n is changed after the setting of the basis of functions, like in :

# Model parameters instantiation with some non-default specs
model_parameters = QgParams({'phi0_npi': np.deg2rad(50.)/np.pi, 'hd':0.3})
# Mode truncation at the wavenumber 2 in both x and y spatial coordinate
model_parameters.set_atmospheric_channel_fourier_modes(2, 2)


model_parameters.set_params({'n': 0.3})

then the model core compute the trajectories with the right aspect ratio, but the diagnostic classes are not. You can thus trust the model output but not the diagnostic ones (see temporary solution below).

Consequences

Due to the fact that the aspect ratio n is incorrect in the diagnostics, it can lead to aberrant spatial field renditions (again, in the spectral domain the model results are correct). For instance, for the example above, the Fourier basis function 2 * sin (y) * cos(n * y) is rendered as

qgs_bug

where many maxima and minima can be seen over the domain, instead of only one maxima and one minima (see below). Aliasing due to an incorrect sampling can also be seen.

Again, this impact only your results when you use diagnostic classes to obtain spatial fields.

Temporary solution

Presently, the simplest way to avoid this bug is to instantiate the QgParams object for the model configuration directly with the desired aspect ratio:

# Model parameters instantiation with some non-default specs
model_parameters = QgParams({'phi0_npi': np.deg2rad(50.)/np.pi, 'hd':0.3, 'n':0.3})
# Mode truncation at the wavenumber 2 in both x and y spatial coordinate
model_parameters.set_atmospheric_channel_fourier_modes(2, 2)

This ensures that the aspect ratio is properly communicated to the diagnostics. In this case, the Fourier basis function above is rendered as:

correct_qgs_bug

Final solution

This bug will be resolved soon, but we are in the middle of a very thorough modification of the model's core and thus we need to wait that other issues are resolved before moving to this one. The final bugfix should come at the end of 2022.

@jodemaey jodemaey added bug Something isn't working critical labels Oct 3, 2022
@jodemaey jodemaey self-assigned this Oct 3, 2022
@jodemaey jodemaey pinned this issue Oct 3, 2022
jodemaey added a commit that referenced this issue Nov 26, 2022
Pass the aspect ratio from the model params object to the diagnostic
each time a new such object is provided to the diagnostic.
@jodemaey
Copy link
Member Author

jodemaey commented Nov 26, 2022

Solved by #15 . Will be merged to master soon with a new release.

@jodemaey jodemaey reopened this Nov 26, 2022
@jodemaey
Copy link
Member Author

jodemaey commented Dec 1, 2022

Solved by merging develop to master.

@jodemaey jodemaey closed this as completed Dec 1, 2022
@jodemaey jodemaey unpinned this issue Dec 5, 2022
@jodemaey jodemaey added fixed and removed critical labels Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed
Projects
None yet
Development

No branches or pull requests

1 participant