The LTR developer pages contain information & diagrams specific to code development of model coupling.

LFM-Para

LFM-MIX

LFM-MIX is a coupled model between LFM and MIX. MIX provides an inner boundary condition for the LFM global MHD model. LFM computes and MIX solves the potential in the equation

Pseudo-code

Convention:

  • at time
  • LFM startup: Read step , , ( if starting from scratch) from file
  • Loop
    1. mhd.Boundary() updates the Solar Wind boundary condition
    2. How big of a step do we take on iteration ?
      = mhd.courant()
    3. Advance LFM, obtaining new values
      mhd.step, ,
    4. Do we exchange with MIX?
      1. Yes?
        1. Send UT time of the current step to MIX
        2. Send , , from LFM to MIX
      2. Solve for potential with MIX
      3. Is this an I/O step for MIX?
        1. Yes? Write to mix_step-i.hdf
        2. MHD Receives
    5. Is this an I/O step for LFM?
      1. Yes? Write , , to mhd_step-i.dmp

What is the maximal number of processors I can use for my grid?

There are three constraints to determine the maximum number of processors that should be used for a particular grid:

  • The LFM uses a 8th-order spatial method in each of the i, j and k directions. Therefore, each processor should have a ''minimum of 8 cells'' in each direction.
  • The grid is decomposed spatially in terms of XY planes (i.e. in i-j space). The grid is currently not parallelized in the k direction.
  • The grid decomposition only works for np > 1. Using a single processor (np=1) may give unexpected results.

A formula to determine the number of processors is:

Example 1: 53x24x32

For example, using the default on a 53x24x32 grid, and . So

So you can use up to 18 processors on a 53x24x32 grid.

Example 2: 106x48x64

On a 106x48x64 grid, and . So

So you can use up to 78 processors on a 106x48x64 grid.

LFM-MIX-RCM(-TIEGCM)

Exchange Diagram

This diagram shows the order of data exchanges between LFM, MIX, TIEGCM and RCM. Click for a larger version:

Order of Exchanges

Sequence Type definition

  • start: Occurs only once, at the beginning of a sequence:
  • loop, middle: Occurs one or more times within time loop. Prefixed/suffixed by one start & stop exchange.
  • start: Occurs only once, at the end of a sequence:

Exchange ordering table

Sequence Type

Exchange Order

UT

LFM

MIX

RCM

start

1

4:00:00

Send to MIX

Recv from LFM

 

start

 

4:00:00

 

Compute Potential

 

start

2

4:00:00

Recv from MIX

Send to LFM

 

start

3

4:00:00

Send to RCM

 

Recv from LFM

start

4

4:00:00

 

Send to RCM

Recv from MIX

 

 

 

 

 

 

loop

 

4:00:10

Send to MIX

Recv from LFM

 

loop

 

4:00:10

 

Compute Potential

 

loop

 

4:00:10

Recv from MIX

Send to LFM

 

loop

...

 

 

 

 

 

 

 

 

 

 

middle

1

4:02:00

Recv from RCM

 

Send to LFM

middle

2

4:02:00

Send to MIX

Recv from LFM

 

middle

3

4:02:00

 

Recv from RCM

Send to MIX

middle

 

4:02:00

 

Compute Potential

 

middle

4

4:02:00

Recv from MIX

Send to LFM

 

middle

5

4:02:00

 

Send to RCM

Recv from MIX

middle

6

4:02:00

Send to RCM

 

Recv from LFM

 

 

 

 

 

 

loop

 

4:02:10

Send to MIX

Recv from LFM

 

loop

 

4:02:10

 

Compute Potential

 

loop

 

4:02:10

Recv from MIX

Send to LFM

 

loop

...

 

 

 

 

 

 

 

 

 

 

end

1

4:04:00

Recv from RCM

 

Send to LFM

end

2

4:04:00

Send to MIX

Recv from LFM

 

end

3

4:04:00

 

Recv from RCM

Send to MIX

end

 

4:04:00

 

Compute Potential

 

end

4

4:04:00

Recv from MIX

Send to LFM

 

Inter-model Communication

Shared Variables

Handshake Variables

RCM Intermediate Grid

Send Order

IC Variable

Variable(s)

Dimensions/Size

Type

Units

Notes

1

im-mhd_ig_size

Nx, Ny, Nz

1d array (len=3)

int

n/a

1xN broadcast

2

im-mhd_igx

X

1d array (Nx)

float

m (SM Coord)

1xN broadcast

3

im-mhd_igy

Y

1d array (Ny)

float

m (SM Coord)

1xN broadcast

4

im-mhd_igz

Z

1d array (Nz)

float

m (SM Coord)

1xN broadcast

LFM Grid

Send Order

IC Variable

Variable(s)

Dimensions/Size

Type

Units

5

mhd-im_lfm_size

Ni, Nj, Nk

1d array (len=3)

int

n/a

6

mhd-im_lfmx

X cell center

3d array (Ni+1,Nj+1,Nk+1)

float

m (SM Coord)

7

mhd-im_lfmy

Y cell center

3d array (Ni+1,Nj+1,Nk+1)

float

m (SM Coord)

8

mhd-im_lfmz

Z cell center

3d array (Ni+1,Nj+1,Nk+1)

float

m (SM Coord)

Other

Send Order

IC Variable

Variable(s)

Dimensions/Size

Type

Units

Notes

9

mhd-im_dipole_moment

Dipole Moment

scalar

float

m k s

1xN broadcast

Accumulate Variables (LFM -> RCM)

Click here for a description of the Accumulate routine.

Send Order

IC Variable

Variable(s)

Dimensions/Size

Type

Units

1

mhd-im_density

rho

1-d (Nx*Ny*Nz) on intermediate grid

float

SI units

2

mhd-im_pressure

P

1-d (Nx*Ny*Nz) on intermediate grid

float

SI units

3

mhd-im_bx

Bx

1-d (Nx*Ny*Nz) on intermediate grid

float

SI units

4

mhd-im_by

By

1-d (Nx*Ny*Nz) on intermediate grid

float

SI units

5

mhd-im_bz

Bz

1-d (Nx*Ny*Nz) on intermediate grid

float

SI units

6

mhd-im_v

magnitude(v)

1-d (Nx*Ny*Nz) on intermediate grid

float

SI units

Bleed Variables (RCM -> LFM)

Send Order

IC_Variable

Variable(s)

Dimensions/Size

Type

Units

Notes

1

im-mhd_density

rho

3-d (Ni+1,Nj+1,Nk+1) LFM cell-centered

float

SI units

 

2

im-mhd_pressure

P

3-d (Ni+1,Nj+1,Nk+1) LFM cell-centered

float

SI units

 

3

im-mhd_rcm_mask

mask

3-d (Ni+1,Nj+1,Nk+1) LFM cell-centered

int

N/A

0 - not part of RCM
1 - part of RCM

Ionosphere Handhsake

RCM Ionosphere Grid

Send Order

IC Variable

Variable(s)

Dimensions/Size

Type

Units

Notes

1

im-cpl_im_size

nLon, nLat

1-d array (len=2)

int

N/A

nLon+1 brings you back to the periodic point

2

cpl-im_r_i

R_i

scalar

float

m

Radius of Ionosphere; IM exits if its value of RION is different in CPL

3

im-cpl_latitude

latitude

1-d array (nLat)

float

co-latitude from pole (SM, radians)

 

4

im-cpl_longitude

longitude

1-d array (nLon)

float

0 at noon (SM, radians)

 

Ionospheric Variables

Important Notes:

  • RCM only needs one hemisphere of data
  • MIX: J: Positive is down in the Northern hemisphere
  • Ionosphere handshake occurs after MHD (LFM) handshake.

RCM Ionosphere information (i.e. sent to LFM/MIX)

Send Order

IC Variable

Variable(s)

Dimensions/Size

Type

Units

Notes

1

im-cpl_avg_energy

E_av (Avg Eng)

2-d (nLat, nLon)

float

J (SI)

Unused by MIX as of r1268 (April 2010)

2

im-cpl_avg_flux

F_e (Energy Flux)

2-d (nLat, nLon)

float

W/(m*m) (SI)

Unused by MIX as of r1268 (April 2010)

3

im-cpl_fac

J (total FAC density)

2-d (nLat, nLon)

float

A/(m*m) (SI)

Unused by MIX as of r1268 (April 2010); How does MIX split the total FAC, which is defined once for half-grid?

LFM/MIX ionosphere information (i.e. sent to RCM)

Send Order

IC Variable

Variable(s)

Dimensions/Size

Type

Units

Notes

1

cpl-im_potential

phi (potential

2-d (nLat, nLon) - on RCM grid

float

V (SI)

 

2

cpl-im_sigma_p

Pedersen Conductance

2-d (nLat, nLon) - on RCM grid

float

 

 

3

cpl-im_sigma_h

Hall conductance

2-d (nLat, nLon) - on RCM grid

float

 

 

Note: MIX currently sends the Potential and conductances for the Northern hemisphere only! In the future we need to somehow average or sum over both hemispheres.

Time Exchange

All time exchanges occur as a UT floating-point array (Year, Month, Day, Hour, Minute, Second). Note we pack extra information into the array for clean, efficient data transfer between the code.

Handshake

Send Order

IC Variable

Variable(s)

Dimensions/Size

Type

Units

Notes

1

mhd-im_startup_scalars

kill signal, Start UT, delta t (in seconds)

1-d (8 elements)

int

Kill_signal, Y, M, D, H, M, S, dt

1xN broadcast

At each exchange...

Send Order

IC Variable

Variable(s)

Dimensions/Size

Type

Units

Notes

1

mhd-im_scalars

kill signal, current UT

1-d (8 elements)

int

Kill_signal, Y, M, D, H, M, S

1xN broadcast

Kill_signal:

  • 0: OK, keep time stepping.
  • 111: LFM has finished, kill.
  • 222: second-to last exchange.
  • No labels