Skip to content

Add curl momentum diagnostics - #625

Draft
Ayesha714 wants to merge 15 commits into
geodynamics:mainfrom
Ayesha714:Curl_Momentum_Diagnostics
Draft

Add curl momentum diagnostics#625
Ayesha714 wants to merge 15 commits into
geodynamics:mainfrom
Ayesha714:Curl_Momentum_Diagnostics

Conversation

@Ayesha714

Copy link
Copy Markdown

I have added curls of advection, buoyancy, magnetic, coriolis, and pressure forces and tested against my own cases.

@Ayesha714
Ayesha714 marked this pull request as draft July 17, 2026 02:22
…n quantity codes (currently is mostly a copy of the momentum equation codes so not valid).
@cianwilson

Copy link
Copy Markdown
Member

Hi @Ayesha714 ,

Hope your trip back is going well.

I've just pushed a first draft (completely untested) implementation of the derivatives of the viscous force and an example implementation of the curl components curl_viscous_force_r, curl_viscous_force_theta and curl_viscous_force_phi.

Any chance you could try them out when you get back to work? I'm expecting that they will crash and I will have to debug them a bit more so please just let me know what fails.

You can also see the proposed updated documentation of the quantity codes here:
https://rayleigh-documentation--625.org.readthedocs.build/en/625/doc/source/diagnostic_codes/curl_momentum_equation.html
There are a few issues there to look into too.

Thank you!
Cian

cianwilson and others added 2 commits July 22, 2026 13:43
Hi Cian,

I have some questions:

Firstly, I am unsure about the correct formulation of the curl of the pressure term. The current implementation does not appear to be mathematically correct

The most important question is how I can use this new module now. Previously, I was simply adding the little routines directly in the Custom diagnostics, but with this new module, I am not sure what the correct procedure is for enabling and using it in the code.

Thanks,

Ayesha
@Ayesha714

Copy link
Copy Markdown
Author

One more clarification: I have not uncommented the lines related to the curl terms yet because these routines are not currently implemented in Diagnostics_Curl_Momentum.F90. I have only made the changes needed for the current diagnostics structure. Once the correct implementation/procedure is clear, I can add and enable the remaining terms.

@cianwilson

Copy link
Copy Markdown
Member

Hi @Ayesha714 ,

The diagnostics we've added should be available using the quantity codes you implemented on this branch. So if you compile your branch of the code and run it you should be able to add, for example, a global average of 1327, which should be the r component of the curl of the viscous force term, to the main input file.

Obviously, as you pointed out, those codes may yet change as we update the branch with the missing diagnostics.

Hope you got back home safely eventually!
Cheers,
Cian

Needed to add the quantity codes to the header file.
The logic was incorrect for when to evaluate the viscous forces as they now need to be evaluated when just the curl is requested.

Also fixing the logic for outputting of other curl quantities that previously required both the value and the square to be included.

The curl of the momentum terms was never called.

Adding an input file that doesn't currently run a test but it is what I've been using to debug these things.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants