geodynamics / Rayleigh

Rayleigh: Pseudo-spectral MHD
GNU General Public License v3.0
59 stars 48 forks source link

Finite-Difference Mode: New Documentation and User Interface Revamp #496

Closed feathern closed 4 months ago

feathern commented 7 months ago

This PR revises the finite-difference interface such that:

  1. It is easier to specify a nonuniform grid directly through main_input.
  2. It is possible to specify a custom mesh in Python that can subsequently be passed to Rayleigh through a grid-specification file.

I've also added documentation for these features. It can be found in the 'User Guide / Setting up a Model / Grid Setup' section. The new main_input keywords that have been added are also defined in the quick reference section that describes the namelist inputs.

-Nick

feathern commented 7 months ago

I'm a little perplexed as to why the build is failing. It looks as though MPI_Bcast isn't being called correctly, but I'm unsure why. This compiles fine on my machine. If possible, could someone(s) start reviewing this while I dig a little more deeply in what's wrong here? It's probably an issue with the MPI datatypes vs. me just using an integer (though that's not what the documentation for Bcast says...).

tukss commented 7 months ago

Edit: I was too quick. This seems to be a different, possibly related issue.

I think that's the usual problem we get with certain MPI implementations and newer versions of gfortran. Because the F90 MPI API doesn't have a way to specify a generic type for the buffer, gfortran guesses the type from the first call and then compains if you call the same function with a different type later. This can be fixed in a few ways.

tukss commented 7 months ago

Ah, it's easy actually. You're passing the whole communicator type into MPI_Bcast instead of just the %comm element, that's integer that MPI wants. My gfortran was a bit more descriptive in its error message.

feathern commented 7 months ago

Thanks @tukss ! Good catch. Now I'm puzzled as to why my local compiler didn't complain + the code appeared to be broadcasting the correct information too. OK, this is ready for review now.

tukss commented 7 months ago

Now I'm puzzled as to why my local compiler didn't complain + the code appeared to be broadcasting the correct information too. OK, this is ready for review now.

Even though it's not guaranteed by the Fortran standard, passing a reference to the whole object is likely to be identical to a reference to the first element. So it's quite possible that the code ran correctly. I guess your compiler just wasn't doing any type checking for some reason.

tukss commented 7 months ago

@rpvin can you have a look at this? You're the main user of this feature at the moment.

feathern commented 5 months ago

Has anyone had a chance to look at this yet?

rpvin commented 5 months ago

Hi,

Unfortunately, not yet. I will try to do this by the end of next week.

Cheers, Rathish

On Thu, Mar 21, 2024 at 7:18 PM Nick Featherstone @.***> wrote:

Has anyone had a chance to look at this yet?

— Reply to this email directly, view it on GitHub https://github.com/geodynamics/Rayleigh/pull/496#issuecomment-2013406935, or unsubscribe https://github.com/notifications/unsubscribe-auth/A4B2HVREUE2IWM27BPQ5ZBTYZMXAFAVCNFSM6AAAAABCR2OWESVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJTGQYDMOJTGU . You are receiving this because you were mentioned.Message ID: @.***>

-- Cheers, Rathish Previn Ratnasingam PhD Applied Mathematics (Newcastle University) MSc Theoretical Physics(University of Edinburgh) BSc Physics(Imperial College London)

feathern commented 4 months ago

I'm going to go ahead and merge this. I tested it quite a bit before the initial commit 3 months ago. I would really like to get this wrapped into the code for a spring, pre-workshop release. We can address bugs, if any, at the workshop.