MagCalc Program

Uses

  • program~~magcalc~~UsesGraph program~magcalc MagCalc ieee_arithmetic ieee_arithmetic program~magcalc->ieee_arithmetic iso_fortran_env iso_fortran_env program~magcalc->iso_fortran_env module~phys_consts phys_consts program~magcalc->module~phys_consts module~io io program~magcalc->module~io module~mesh mesh program~magcalc->module~mesh module~mpimod mpimod program~magcalc->module~mpimod module~grid grid program~magcalc->module~grid module~timeutils timeutils program~magcalc->module~timeutils module~phys_consts->iso_fortran_env module~io->ieee_arithmetic module~io->iso_fortran_env module~io->module~phys_consts module~io->module~mpimod module~io->module~grid module~pathlib pathlib module~io->module~pathlib iso_c_binding iso_c_binding module~io->iso_c_binding module~mesh->module~phys_consts module~mpimod->iso_fortran_env module~mpimod->module~phys_consts mpi mpi module~mpimod->mpi module~grid->iso_fortran_env module~grid->module~phys_consts module~grid->module~mesh module~grid->module~mpimod module~reader reader module~grid->module~reader module~timeutils->iso_fortran_env module~timeutils->module~phys_consts module~pathlib->iso_fortran_env module~reader->iso_fortran_env module~reader->module~phys_consts

Need program statement for FORD THIS IS THE MAIN PROGRAM FOR COMPUTING MAGNETIC FIELDS FROM OUTPUT FROM A SIMULATIONS DONE BY GEMINI3D. THIS PROGRAM VERY MUCH MIRRORS THE SETUP OF THE MAIN GEMINI.F90 CODE.

INITIALIZE MESSING PASSING VARIABLES, IDS ETC. CHECK THE GRID SIZE AND ESTABLISH A PROCESS GRID LOAD UP THE GRID STRUCTURE/MODULE VARS. FOR THIS SIMULATION - THIS ALSO PERMUTES DIMENSIONS OF 2D GRID, IF NEEDED read in a previously generated grid from filename listed in input file, distribute subgrids to individual workers a 2D simulation was done, which changes how the integrations go... this file contains the field points at which we are computing magnetic perturbations, it will be copied into the output directory

the integrations are being treated as Cartesian so flatten out the local spherical coordinates into cartesian, as well GET END VOLUMES SO THE INTEGRALS ARE 'COMPLETE' need to define the differential volume on the edge of this x3-slab in

COMPUTE NEEDED PROJECTIONS fourth dimension of unit vectors is the 3 Cartesian components of each vector DEALLOCATE GRID MODULE VARIABLES TO SAVE MEMORY (PROGRAM DOESN'T ACTUALLY NEED THESE ONCE X,Y,Z CREATED STORAGE FOR MAGNETIC FIELD CALCULATIONS latter is cell centered hence -1 in size, max is needed to prevent zero sized array only used by root, but I think workers need to have space allocated for this

MAIN LOOP FIXME: MAY BE MISSING A CORNER POINT HERE??? NO I THINK IT'S OKAY BASED ON SOME SQUARES I DREW, haha...

DO WE NEED TO CHECK HERE FOR DIV BY ZERO??? ALSO IN 2D WE KNOW THAT WE ARE ONLY DIVIDED IN THE 3 DIMENSION SO THERE IS NO NEED TO WORRY ABOUT ADDING A 'TOP' ETC.

without dim= input it just sums everything which is what we want

without dim= input it just sums everything which is what we want DEALLOCATE MAIN PROGRAM DATA SHUT DOWN MPI


Calls

program~~magcalc~~CallsGraph program~magcalc MagCalc interface~halo_end halo_end program~magcalc->interface~halo_end proc~mpi_manualgrid mpi_manualgrid program~magcalc->proc~mpi_manualgrid interface~output_magfields output_magfields program~magcalc->interface~output_magfields proc~mpigrid mpigrid program~magcalc->proc~mpigrid proc~clear_grid clear_grid program~magcalc->proc~clear_grid proc~mpisetup mpisetup program~magcalc->proc~mpisetup interface~input_plasma_currents input_plasma_currents program~magcalc->interface~input_plasma_currents proc~dateinc dateinc program~magcalc->proc~dateinc proc~mpibreakdown mpibreakdown program~magcalc->proc~mpibreakdown mpi_reduce mpi_reduce program~magcalc->mpi_reduce interface~read_grid read_grid program~magcalc->interface~read_grid interface~read_configfile read_configfile program~magcalc->interface~read_configfile interface~create_outdir_mag create_outdir_mag program~magcalc->interface~create_outdir_mag proc~grid_size grid_size program~magcalc->proc~grid_size interface~halo_end_23 halo_end_23 interface~halo_end->interface~halo_end_23 proc~id2grid ID2grid proc~mpi_manualgrid->proc~id2grid proc~output_magfields~2 output_magfields interface~output_magfields->proc~output_magfields~2 proc~mpigrid->proc~id2grid proc~clear_grav clear_grav proc~clear_grid->proc~clear_grav mpi_comm_rank mpi_comm_rank proc~mpisetup->mpi_comm_rank mpi_init mpi_init proc~mpisetup->mpi_init mpi_comm_size mpi_comm_size proc~mpisetup->mpi_comm_size proc~input_plasma_currents input_plasma_currents interface~input_plasma_currents->proc~input_plasma_currents proc~day_wrap day_wrap proc~dateinc->proc~day_wrap mpi_finalize mpi_finalize proc~mpibreakdown->mpi_finalize proc~read_grid read_grid interface~read_grid->proc~read_grid proc~read_configfile read_configfile interface~read_configfile->proc~read_configfile proc~create_outdir_mag create_outdir_mag interface~create_outdir_mag->proc~create_outdir_mag mpi_recv mpi_recv proc~grid_size->mpi_recv mpi_send mpi_send proc~grid_size->mpi_send interface~get_simsize3 get_simsize3 proc~grid_size->interface~get_simsize3 proc~day_wrap->proc~day_wrap proc~daysmonth daysmonth proc~day_wrap->proc~daysmonth interface~mkdir mkdir proc~create_outdir_mag->interface~mkdir interface~copyfile copyfile proc~create_outdir_mag->interface~copyfile proc~get_simsize3 get_simsize3 interface~get_simsize3->proc~get_simsize3 proc~read_grid_root read_grid_root proc~read_grid->proc~read_grid_root proc~read_grid_workers read_grid_workers proc~read_grid->proc~read_grid_workers proc~assert_file_exists assert_file_exists proc~read_configfile->proc~assert_file_exists proc~check_nml_io check_nml_io proc~read_configfile->proc~check_nml_io interface~assert_directory_exists assert_directory_exists proc~read_configfile->interface~assert_directory_exists proc~check_ini_io check_ini_io proc~read_configfile->proc~check_ini_io proc~expanduser expanduser proc~read_configfile->proc~expanduser proc~date_filename date_filename proc~output_magfields~2->proc~date_filename interface~input_root_currents input_root_currents proc~input_plasma_currents->interface~input_root_currents proc~input_workers_currents input_workers_currents proc~input_plasma_currents->proc~input_workers_currents proc~halo_end_23 halo_end_23 interface~halo_end_23->proc~halo_end_23 proc~input_root_currents input_root_currents interface~input_root_currents->proc~input_root_currents lx lx proc~get_simsize3->lx proc~mkdir mkdir interface~mkdir->proc~mkdir proc~read_grid_root->mpi_send g2 g2 proc~read_grid_root->g2 interface~bcast_send3d_x2i bcast_send3D_x2i proc~read_grid_root->interface~bcast_send3d_x2i interface~bcast_send1d_2 bcast_send1D_2 proc~read_grid_root->interface~bcast_send1d_2 interface~get_grid3 get_grid3 proc~read_grid_root->interface~get_grid3 g1 g1 proc~read_grid_root->g1 interface~bcast_send bcast_send proc~read_grid_root->interface~bcast_send interface~bcast_send3d_x3i bcast_send3D_x3i proc~read_grid_root->interface~bcast_send3d_x3i interface~bcast_send1d_3 bcast_send1D_3 proc~read_grid_root->interface~bcast_send1d_3 g3 g3 proc~read_grid_root->g3 interface~bcast_send3d_ghost bcast_send3D_ghost proc~read_grid_root->interface~bcast_send3d_ghost mpi_irecv mpi_irecv proc~halo_end_23->mpi_irecv mpi_waitall mpi_waitall proc~halo_end_23->mpi_waitall proc~grid2id grid2ID proc~halo_end_23->proc~grid2id mpi_isend mpi_isend proc~halo_end_23->mpi_isend proc~read_grid_workers->mpi_recv proc~read_grid_workers->g2 interface~bcast_recv1d_2 bcast_recv1D_2 proc~read_grid_workers->interface~bcast_recv1d_2 interface~bcast_recv3d_x2i bcast_recv3D_x2i proc~read_grid_workers->interface~bcast_recv3d_x2i interface~bcast_recv bcast_recv proc~read_grid_workers->interface~bcast_recv proc~read_grid_workers->g1 interface~bcast_recv3d_ghost bcast_recv3D_ghost proc~read_grid_workers->interface~bcast_recv3d_ghost interface~bcast_recv1d_3 bcast_recv1D_3 proc~read_grid_workers->interface~bcast_recv1d_3 interface~bcast_recv3d_x3i bcast_recv3D_x3i proc~read_grid_workers->interface~bcast_recv3d_x3i proc~read_grid_workers->g3 proc~assert_directory_exists assert_directory_exists interface~assert_directory_exists->proc~assert_directory_exists proc~utsec2filestem utsec2filestem proc~date_filename->proc~utsec2filestem proc~home home proc~expanduser->proc~home proc~copyfile copyfile interface~copyfile->proc~copyfile proc~input_workers_currents->interface~bcast_recv interface~bcast_recv1d_23_2 bcast_recv1D_23_2 interface~bcast_recv1d_2->interface~bcast_recv1d_23_2 interface~bcast_send3d_x2i_23 bcast_send3D_x2i_23 interface~bcast_send3d_x2i->interface~bcast_send3d_x2i_23 interface~bcast_recv3d_x2i_23 bcast_recv3D_x2i_23 interface~bcast_recv3d_x2i->interface~bcast_recv3d_x2i_23 proc~utsec2filestem->proc~day_wrap interface~bcast_send1d_23_2 bcast_send1D_23_2 interface~bcast_send1d_2->interface~bcast_send1d_23_2 proc~get_grid3 get_grid3 interface~get_grid3->proc~get_grid3 interface~bcast_recv2d_23 bcast_recv2D_23 interface~bcast_recv->interface~bcast_recv2d_23 interface~bcast_recv4d_23 bcast_recv4D_23 interface~bcast_recv->interface~bcast_recv4d_23 interface~bcast_recv3d_23 bcast_recv3D_23 interface~bcast_recv->interface~bcast_recv3d_23 interface~bcast_recv1d_23 bcast_recv1D_23 interface~bcast_recv->interface~bcast_recv1d_23 interface~bcast_recv3d_ghost_23 bcast_recv3D_ghost_23 interface~bcast_recv3d_ghost->interface~bcast_recv3d_ghost_23 interface~bcast_send1d_23 bcast_send1D_23 interface~bcast_send->interface~bcast_send1d_23 interface~bcast_send2d_23 bcast_send2D_23 interface~bcast_send->interface~bcast_send2d_23 interface~bcast_send4d_23 bcast_send4D_23 interface~bcast_send->interface~bcast_send4d_23 interface~bcast_send3d_23 bcast_send3D_23 interface~bcast_send->interface~bcast_send3d_23 interface~bcast_send3d_x3i_23 bcast_send3D_x3i_23 interface~bcast_send3d_x3i->interface~bcast_send3d_x3i_23 interface~bcast_send1d_23_3 bcast_send1D_23_3 interface~bcast_send1d_3->interface~bcast_send1d_23_3 proc~input_root_currents->proc~date_filename proc~input_root_currents->interface~bcast_send interface~bcast_recv1d_23_3 bcast_recv1D_23_3 interface~bcast_recv1d_3->interface~bcast_recv1d_23_3 interface~bcast_recv3d_x3i_23 bcast_recv3D_x3i_23 interface~bcast_recv3d_x3i->interface~bcast_recv3d_x3i_23 interface~bcast_send3d_ghost_23 bcast_send3D_ghost_23 interface~bcast_send3d_ghost->interface~bcast_send3d_ghost_23 proc~bcast_recv1d_23_3 bcast_recv1D_23_3 interface~bcast_recv1d_23_3->proc~bcast_recv1d_23_3 proc~bcast_recv2d_23 bcast_recv2D_23 interface~bcast_recv2d_23->proc~bcast_recv2d_23 proc~bcast_recv3d_x2i_23 bcast_recv3D_x2i_23 interface~bcast_recv3d_x2i_23->proc~bcast_recv3d_x2i_23 proc~bcast_send1d_23_3 bcast_send1D_23_3 interface~bcast_send1d_23_3->proc~bcast_send1d_23_3 proc~bcast_recv4d_23 bcast_recv4D_23 interface~bcast_recv4d_23->proc~bcast_recv4d_23 proc~bcast_send2d_23 bcast_send2D_23 interface~bcast_send2d_23->proc~bcast_send2d_23 proc~bcast_recv3d_23 bcast_recv3D_23 interface~bcast_recv3d_23->proc~bcast_recv3d_23 proc~bcast_send1d_23_2 bcast_send1D_23_2 interface~bcast_send1d_23_2->proc~bcast_send1d_23_2 proc~bcast_send3d_x2i_23 bcast_send3D_x2i_23 interface~bcast_send3d_x2i_23->proc~bcast_send3d_x2i_23 proc~bcast_recv3d_x3i_23 bcast_recv3D_x3i_23 interface~bcast_recv3d_x3i_23->proc~bcast_recv3d_x3i_23 proc~bcast_recv1d_23_2 bcast_recv1D_23_2 interface~bcast_recv1d_23_2->proc~bcast_recv1d_23_2 proc~bcast_recv3d_ghost_23 bcast_recv3D_ghost_23 interface~bcast_recv3d_ghost_23->proc~bcast_recv3d_ghost_23 proc~bcast_send4d_23 bcast_send4D_23 interface~bcast_send4d_23->proc~bcast_send4d_23 proc~bcast_send3d_ghost_23 bcast_send3D_ghost_23 interface~bcast_send3d_ghost_23->proc~bcast_send3d_ghost_23 proc~bcast_send3d_x3i_23 bcast_send3D_x3i_23 interface~bcast_send3d_x3i_23->proc~bcast_send3d_x3i_23 htmp htmp proc~get_grid3->htmp proc~bcast_send3d_23 bcast_send3D_23 interface~bcast_send3d_23->proc~bcast_send3d_23 proc~bcast_send1d_23_3->proc~id2grid proc~bcast_send3d_x3i_23->mpi_send proc~slabinds slabinds proc~bcast_send3d_x3i_23->proc~slabinds proc~bcast_recv4d_23->mpi_recv proc~bcast_recv3d_ghost_23->mpi_recv proc~bcast_recv2d_23->mpi_recv proc~bcast_recv3d_23->mpi_recv proc~bcast_send1d_23_2->proc~id2grid proc~bcast_send3d_x2i_23->mpi_send proc~bcast_send3d_x2i_23->proc~slabinds proc~bcast_send4d_23->mpi_send proc~bcast_send4d_23->proc~slabinds proc~bcast_recv1d_23_3->mpi_recv proc~bcast_send2d_23->mpi_send proc~bcast_send2d_23->proc~slabinds proc~bcast_send3d_23->mpi_send proc~bcast_send3d_23->proc~slabinds proc~bcast_recv3d_x3i_23->mpi_recv proc~bcast_recv1d_23_2->mpi_recv proc~bcast_recv3d_x2i_23->mpi_recv proc~bcast_send3d_ghost_23->mpi_send proc~bcast_send3d_ghost_23->proc~slabinds proc~slabinds->proc~id2grid

Contents


Variables

Type AttributesNameInitial
integer, dimension(3):: ymd

VARIABLES READ IN FROM CONFIG.DAT FILE year,month,day of simulation

real(kind=wp) :: UTsec

UT (s)

real(kind=wp) :: UTsec0

UT start time of simulation (s)

real(kind=wp) :: tdur

duration of simulation

real(kind=wp), dimension(3):: activ

f10.7a,f10.7,ap

real(kind=wp) :: tcfl

target CFL number

real(kind=wp) :: Teinf

exospheric temperature

integer :: potsolve

what type of potential solve

integer :: flagperiodic

toggles whether or not the grid is treated as periodic in the x3 dimension (affects some of the message passing)

integer :: flagoutput

what type of output to do (1 - everything; 2 - avg'd parms.; 3 - ne only)

integer :: flagcap

internal capacitance?

character(len=:), allocatable:: infile

INPUT AND OUTPUT FILES

character(len=:), allocatable:: outdir
character(len=:), allocatable:: indatsize
character(len=:), allocatable:: indatgrid
character(len=:), allocatable:: fieldpointfile

GRID STRUCTURE

type(curvmesh) :: x
real(kind=wp), dimension(:,:,:), allocatable:: J1
real(kind=wp), dimension(:,:,:), allocatable:: J2
real(kind=wp), dimension(:,:,:), allocatable:: J3
real(kind=wp) :: t =0._wp
real(kind=wp) :: dt
real(kind=wp) :: tout
real(kind=wp) :: dtout
real(kind=wp) :: tstart
real(kind=wp) :: tfin
integer :: it
integer :: isp
integer :: flag2D
real(kind=wp), dimension(:,:,:), allocatable:: xp
real(kind=wp), dimension(:,:,:), allocatable:: yp
real(kind=wp), dimension(:,:,:), allocatable:: zp
real(kind=wp), dimension(:), allocatable:: xf
real(kind=wp), dimension(:), allocatable:: yf
real(kind=wp), dimension(:), allocatable:: zf
real(kind=wp), dimension(:), allocatable:: r
real(kind=wp), dimension(:), allocatable:: theta
real(kind=wp), dimension(:), allocatable:: phi
real(kind=wp), dimension(:,:,:), allocatable:: dV
integer :: ipoints
integer :: lpoints
real(kind=wp), dimension(:,:,:), allocatable:: proj_e1er
real(kind=wp), dimension(:,:,:), allocatable:: proj_e2er
real(kind=wp), dimension(:,:,:), allocatable:: proj_e3er
real(kind=wp), dimension(:,:,:), allocatable:: proj_e1etheta
real(kind=wp), dimension(:,:,:), allocatable:: proj_e2etheta
real(kind=wp), dimension(:,:,:), allocatable:: proj_e3etheta
real(kind=wp), dimension(:,:,:), allocatable:: proj_e1ephi
real(kind=wp), dimension(:,:,:), allocatable:: proj_e2ephi
real(kind=wp), dimension(:,:,:), allocatable:: proj_e3ephi
real(kind=wp), dimension(:,:,:), allocatable:: Jx
real(kind=wp), dimension(:,:,:), allocatable:: Jy
real(kind=wp), dimension(:,:,:), allocatable:: Jz
real(kind=wp), dimension(:,:,:), allocatable:: Rx
real(kind=wp), dimension(:,:,:), allocatable:: Ry
real(kind=wp), dimension(:,:,:), allocatable:: Rz
real(kind=wp), dimension(:,:,:), allocatable:: Rcubed
real(kind=wp), dimension(:,:,:), allocatable:: integrand
real(kind=wp), dimension(:,:,:), allocatable:: integrandavg
real(kind=wp), dimension(:,:,:), allocatable:: alt
real(kind=wp), dimension(:), allocatable:: Br
real(kind=wp), dimension(:), allocatable:: Btheta
real(kind=wp), dimension(:), allocatable:: Bphi
real(kind=wp), dimension(:), allocatable:: Brall
real(kind=wp), dimension(:), allocatable:: Bthetaall
real(kind=wp), dimension(:), allocatable:: Bphiall
real(kind=wp), dimension(:,:), allocatable:: Jxend
real(kind=wp), dimension(:,:), allocatable:: Jyend
real(kind=wp), dimension(:,:), allocatable:: Jzend
real(kind=wp), dimension(:,:), allocatable:: Rxend
real(kind=wp), dimension(:,:), allocatable:: Ryend
real(kind=wp), dimension(:,:), allocatable:: Rzend
real(kind=wp), dimension(:,:), allocatable:: Rcubedend
real(kind=wp), dimension(:,:), allocatable:: dVend
real(kind=wp), dimension(:,:), allocatable:: integrandend
real(kind=wp), dimension(:,:), allocatable:: integrandavgend
real(kind=wp), dimension(:,:), allocatable:: Jxtop
real(kind=wp), dimension(:,:), allocatable:: Jytop
real(kind=wp), dimension(:,:), allocatable:: Jztop
real(kind=wp), dimension(:,:), allocatable:: Rxtop
real(kind=wp), dimension(:,:), allocatable:: Rytop
real(kind=wp), dimension(:,:), allocatable:: Rztop
real(kind=wp), dimension(:,:), allocatable:: Rcubedtop
real(kind=wp), dimension(:,:), allocatable:: dVtop
real(kind=wp), dimension(:,:), allocatable:: integrandtop
real(kind=wp), dimension(:,:), allocatable:: integrandavgtop
integer :: ix1
integer :: ix2
integer :: ix3
real(kind=wp) :: rmean
real(kind=wp) :: thetamean
integer :: flagdneu
integer :: interptype
real(kind=wp) :: dxn
real(kind=wp) :: drhon
real(kind=wp) :: dzn
real(kind=wp) :: sourcemlat
real(kind=wp) :: sourcemlon
character(len=:), allocatable:: sourcedir
real(kind=wp) :: dtneu
integer :: flagprecfile
real(kind=wp) :: dtprec
character(len=:), allocatable:: precdir

ELECTRIC FIELD FILE INPUT VARIABLES (UNUSED)

integer :: flagE0file
real(kind=wp) :: dtE0
character(len=:), allocatable:: E0dir

GLOW MODULE INPUT VARIABLES

integer :: flagglow
real(kind=wp) :: dtglow
real(kind=wp) :: dtglowout

FOR SPECIFYING THE PROCESS GRID

integer :: lid2in

FOR HANDLING INPUT

integer :: lid3in

FOR HANDLING INPUT

integer :: argc
integer :: ierr
character(len=256) :: argv
logical :: file_exists

REGULATOR FOR 1/R^3

real(kind=wp), parameter:: R3min =1d9
real(kind=wp), parameter:: Rmin =5d3

## MAIN PROGRAM