User Defined Magnetic Field Initial Condition

Hi Rayleigh support team,

Is there a documented example on using in /Rayleigh/tests/generic_input/script to create a user defined magnetic field initial condition in Rayleigh? I see the example for temperature under Physics Controls

Physics Controls — Rayleigh documentation (

However, there doesn’t seem to be a straightforward example using init_type=8 and

C_init_file = ‘’ !! Poloidal magnetic potential
A_init_file = ‘’ !! Toroidal magnetic potential

I’m trying to understand how equations (10) - (12) in Christensen et al. (2001) are developed in Rayleigh.

Thank you,

Hi Eric,

I’m afraid you’ve found the documented example in the test that you reference. I think the only trick compared to temperature is that you have to provide the initial (or boundary) conditions for the poloidal, C(r,theta,phi), and toroidal, A(r,theta,phi), magnetic field components rather than spherical components, Br(r,theta,phi), Btheta(r,theta,phi), Bphi(r,theta,phi). Beyond that behaves the same for the vector fields as for the documented scalar case and can either be used in script mode or (as in as a python module.

In terms of Christensen I based what you see in on Benchmark_Insulating_Init() (magnetic_init_type = 1) in Initial_Conditions.F90. The main difference being that I describe the initial conditions in r,theta,phi whereas they are described in r,l,m space in the fortran equivalent. The goal of that test was to show that the generic input routines could generate the same as the hard-coded original so I was happy once it did that and didn’t ponder the Br, Btheta, Bphi conversion to C and A much more than that.

Hope that helps!

Hi Cian,

Thanks for your response. I think what you are saying is that I can get Br, Btheta, Bphi if I present both the C and A magnetic field components to I suppose the next question is, how exactly do I do that? I am not familiar with the nomenclature for C and A. I am only familiar with the B field from my electrodynamics classes. I also suspect that the A field should not be confused with the magnetic vector potential A (i.e. B = curl(A)).

Maybe it would help for me to describe what I’m trying to do in Rayleigh. I want to initialize a run with a dipole field. I saw somewhere in the code that magnetic_init_type=10 might do this for me; however, when I try doing a rayleigh run with magnetic_init_type=10 rayleigh doesn’t seem to recognize it. What I mean is that when the job started, the rayleigh output mentioned using the Christensen 2001 benchmark for both temperature and magnetic field initial conditions. This might mean that magnetic_init_type=10 is not a vaild choice or that I am interpreting something incorrectly.

Thank you,

Hi Cian,

When I run Rayleigh I see the following information from the initialization of the run:

Initializating Rayleigh…

– Initalizing MPI…
---- Specified parameters:
---- NCPU : 8
---- NPROW : 2
---- NPCOL : 4
– MPI initialized.

– Initalizing Grid…
---- Specified parameters ----
---- N_R : 64
---- N_THETA : 96
---- Ell_MAX : 63
---- R_MIN : 5.38462E-01
---- R_MAX : 1.53846E+00
---- Chebyshev Domains : 1

    Domain 1
      Grid points           :  64
      Dealiased Polynomials :  42
      Domain Lower Bound    :  5.38462E-01
      Domain Upper Bound    :  1.53846E+00

– Grid initialized.

– Benchmarking Mode is Activated.
– Selected Benchmark : Christensen et al. 2001 (MHD, Case 1)

– Initalizing Reference State…
---- Specified parameters:
---- Reference type : Boussinesq (Non-dimensional)
---- Rayleigh Number : 1.00000E+05
---- Ekman Number : 1.00000E-03
---- Prandtl Number : 1.00000E+00
---- Magnetic Prandtl Number : 5.00000E+00
– Reference State initialized.

– Initializing Fields…
---- Specified parameters:
---- Hydro Init Type : Benchmark (Christensen et al. 2001)
---- Magnetic Init Type : Benchmark (Christensen et al. 2001)
– Fields initialized.

Initialization Complete.

I would expect the bolded section to change based on choosing magnetic_init_type=10 instead of 1 which is the default setting for benchmark_diagnostics_input found in the input_examples folder. Is there something else that I need to do to initialize a dipole magnetic field?

Thank you,