ConnectTool
 All Classes Namespaces Files Functions Variables Pages
Functions | Variables
model_corfield_pfss Namespace Reference

Launch Corfield/PFSS model (see https://gitlab.irap.omp.eu/motcor_models/CORFIELD_MOTCOR.git). More...

Functions

def compute_field
 Computes magnetic field lines associated to seed_points from/to solar surface to/from solar source surface with a given magnetogram. More...
 
def create_simu_folder
 Create corfield simulation arborescence. More...
 
def create_input_file
 Create input file in corfield simulation folder. More...
 
def init_buffer
 Initialise a buffer for output exchange. More...
 
def decode_buffer
 Read a formatted buffer. More...
 
def get_datacube_output
 From simu_absolute_path, get datacube output file absolute path. More...
 
def get_fieldline_output
 From simu_absolute_path, get fieldline output file absolute path. More...
 
def get_bssmap_output
 From simu_absolute_path, get bss map output file absolute path. More...
 

Variables

tuple template_relative_path = os.path.join('dir.corona','input_corfield_pfss','corfield_params.nml.template')
 Where template file for Corfield/PFSS input file is stored. More...
 
tuple db_connect_tool_path = os.path.join(module_corona.path_corfield_pfss,'dir.data_connect_tool')
 Local Connect tool DB in Corfield. More...
 
int nmax_integration = 999
 Maximum length of a Corfield fieldline. More...
 

Detailed Description

Launch Corfield/PFSS model (see https://gitlab.irap.omp.eu/motcor_models/CORFIELD_MOTCOR.git).

For an example of how to use this module, see its unit test unittest_model_corfield_pfss.

Function Documentation

def model_corfield_pfss.compute_field (   seed_phi,
  seed_the 
)

Computes magnetic field lines associated to seed_points from/to solar surface to/from solar source surface with a given magnetogram.

Use Corfield-PFSS model. Must have these parameters filled in module_corona.

  • seed_type 'LIST' | 'GRID'
  • seed_pos 'top' | 'bot' (only for GRID case)
  • magmappath Absolute path to magnetogram
  • magmapsrc Src of magnetogram
  • magmapext Extension of magnetogram
  • magmaptype Type of time (smap or cmap)
  • magmapdate Date of magnetogram in YYYYMMDDHHMMSS format
  • magmapcarr Carrington rotation of magnetogram
  • writelines1file Choose if Corfield-fortran write fieldlines
  • write3d Write 3D cube

Prepare a corfield simulation folder, call corfield python wrapper and manage its output.
Before, must have compiled corfield wrapper in corfield_path folder (cf Readme of Corfield/Python wrapper).
Workflow:

Parameters
[in]seed_phiLongitude (in degree) of seed point list
[in]seed_latLatitude (in degree) of seed point list
Returns
List of module_fieldline.Fieldline object with as many elements as seed_phi.

Checking:

  • len(seed_phi) == len(seed_the)

Here is the call graph for this function:

Here is the caller graph for this function:

def model_corfield_pfss.create_input_file (   template_absolute_path,
  simu_absolute_path,
  seed_phi,
  seed_the 
)

Create input file in corfield simulation folder.

In simu_absolute_path/dir.input:
Create a symbolic link to the magnetogram wanted.
Use template_absolute_path to write corfield_params.nml input file replacing some values from module_corona:

  • magmappath
  • magmapsrc
  • magmaptype
  • magmapcarr
  • magmapdate
  • magmapext
  • seed_type
  • seed_n
  • seed_phi
  • seed_theta
  • writelines1file
  • rss

Here is the caller graph for this function:

def model_corfield_pfss.create_simu_folder ( )

Create corfield simulation arborescence.

Built folders:
db_connect_tool_path/simu_name/dir.input+dir.output
With simu_name = YYYYMMDDTHHMMSSms_pid

Here is the caller graph for this function:

def model_corfield_pfss.decode_buffer (   buffer_s)

Read a formatted buffer.

  • buffer_s[0]: buffer length size
  • buffer_s[1]: number of lines (nlines)
  • buffer_s[1+beg_i]: nsize_i. Nsize of i-th fieldline
  • buffer_s[1+beg_i+0*nsize_i+1:1+beg_i+1*nsize_i]: curv(1..nsize)
  • buffer_s[1+beg_i+1*nsize_i+1:1+beg_i+2*nsize_i]: r(1..nsize)
  • buffer_s[1+beg_i+2*nsize_i+1:1+beg_i+3*nsize_i]: phi(1..nsize)
  • buffer_s[1+beg_i+3*nsize_i+1:1+beg_i+4*nsize_i]: the(1..nsize)
  • buffer_s[1+beg_i+4*nsize_i+1:1+beg_i+5*nsize_i]: br(1..nsize)
  • buffer_s[1+beg_i+5*nsize_i+1:1+beg_i+6*nsize_i]: bphi(1..nsize)
  • buffer_s[1+beg_i+6*nsize_i+1:1+beg_i+7*nsize_i]: bthe(1..nsize)

where beg_i = 1 + sum_{k=1}^{i-1} 7*nsize_k is the first index of fieldline i

Returns a list fieldlines such as each element contains:

  • iline : integer line number
  • nsize : integer number of element of the field line
  • r : real(1..nsize) radius of the field line (km)
  • phi : real(1..nsize) longitude of the field line (degree)
  • theta : real(1..nsize) latitude of the field line (degree)
  • br : real(1..nsize) br
  • bphi : real(1..nsize) bp
  • btheta : real(1..nsize) bt

Here is the caller graph for this function:

def model_corfield_pfss.get_bssmap_output (   simu_absolute_path,
  map2D_src 
)

From simu_absolute_path, get bss map output file absolute path.

Bss map file is something like: map2Dtype_bss.dat

Parameters
[in]simu_absolute_pathfolder if the corfield simulation
[in]map2D_srcmagnetogram source (NSO or WSO or ADAPT)
Returns
bss_corfield_path Absolute path of Bss map file.

Here is the caller graph for this function:

def model_corfield_pfss.get_datacube_output (   simu_absolute_path,
  map2D_type,
  map2D_src 
)

From simu_absolute_path, get datacube output file absolute path.

Datacube output file is something like:

  • map2Dtype_CRXXXX_datacube.dat
  • map2Dtype_YYYYMMDDHHMMSS_datacube.dat
  • adapt_YYYYMMDDHHMMSS_R001_datacube.dat
Parameters
[in]simu_absolute_pathfolder if the corfield simulation
[in]map2D_typecrmap or smap
[in]map2D_srcmagnetogram source (NSO or WSO or ADAPT)
Returns
cube3D_corfield_path Absolute path of Datacube file.

Here is the caller graph for this function:

def model_corfield_pfss.get_fieldline_output (   simu_absolute_path,
  map2D_type,
  map2D_src 
)

From simu_absolute_path, get fieldline output file absolute path.

Fiedlines output file is something like:

  • map2Dtype_CRXXXX_lines.dat
  • map2Dtype_YYYYMMDDHHMMSS_lines.dat
  • adapt_YYYYMMDDHHMMSS_R001_lines.dat
Parameters
[in]simu_absolute_pathfolder of the corfield simulation
[in]map2D_typecrmap or smap
[in]map2D_srcmagnetogram source (NSO or WSO or ADAPT)
Returns
fieldlines_corfield_path Absolute path of Fieldlines file.

Here is the caller graph for this function:

def model_corfield_pfss.init_buffer (   seed_n)

Initialise a buffer for output exchange.

Here is the caller graph for this function:

Variable Documentation

model_corfield_pfss.db_connect_tool_path = os.path.join(module_corona.path_corfield_pfss,'dir.data_connect_tool')

Local Connect tool DB in Corfield.

Corfield model has a local folder where all simulations launched by Connect_tool are stored.

model_corfield_pfss.nmax_integration = 999

Maximum length of a Corfield fieldline.

Given in corfield_trace.f90 routine.

Todo:
Must wrap a corfield_constant routine.
model_corfield_pfss.template_relative_path = os.path.join('dir.corona','input_corfield_pfss','corfield_params.nml.template')

Where template file for Corfield/PFSS input file is stored.