V3FIT
Functions/Subroutines
v3fita.f File Reference

Contains the main routines for V3FIT. More...

Go to the source code of this file.

Functions/Subroutines

program v3fit
 V3FIT is a code for reconstructing 3D equilibria. V3FIT determined the optimal parameters of a 3D equilibrium by minimizing the missmatch between modeled and observed signals. V3FIT has been created with contributions from. More...
 
subroutine task_equilibrium (context)
 Solves the equilibrium. More...
 
subroutine task_v3post (context)
 Solves the equilibrium and calculates the modeled signals. More...
 
subroutine task_reconstruct (context)
 Reconstructs the equilibrium. More...
 
subroutine task_child_recon (context)
 Child task to compute jacobian. More...
 
subroutine task_child_equilibrium (context)
 Child task to compute equilibrium. More...
 
subroutine task_gsq_on_grid (context)
 Computes the g^2 value on a grid. More...
 
subroutine task_unit_tests
 Run unit tests. More...
 
subroutine init_equilibrium (context)
 Initialize an equilibrium. More...
 
subroutine init_vmec_equilibrium (context, force_solve)
 Initialize a vmec equilibrium. More...
 
subroutine init_vacuum_equilibrium (context, force_solve)
 Initialize a vacuum equilibrium. More...
 
subroutine init_siesta_equilibrium (context, force_solve)
 Initialize a siests equilibrium. More...
 
subroutine init_signals (context)
 Constructs the signal array. More...
 
subroutine init_magnetic_signals (context, signals_created)
 Constructs magnetic signals. More...
 
subroutine init_sxrem_signals (context, signals_created)
 Constructs sxrem signals. More...
 
subroutine init_intpol_signals (context, signals_created)
 Constructs intpol signals. More...
 
subroutine init_thomson_signals (context, signals_created)
 Constructs thomson signals. More...
 
subroutine init_extcurz_signals (context, signals_created)
 Constructs the extcurz signal. More...
 
subroutine init_mse_signals (context, signals_created)
 Constructs mse signals. More...
 
subroutine init_ece_signals (context, signals_created)
 Constructs ece signals. More...
 
subroutine init_limiter_signals (context, signals_created)
 Constructs limiter signals. More...
 
subroutine init_prior_signals (context, signals_created)
 Constructs prior signals. More...
 
subroutine init_sxrem_ratio_signals (context, signals_created)
 Constructs sxrem_ratio signals. More...
 
subroutine init_combination_signals (context, signals_created)
 Constructs signal::combination_class signals. More...
 
subroutine init_parameters (context)
 Constructs the v3fit_context::v3fit_context_class::params array. More...
 
subroutine init_gaussian_process (context)
 Constructs the v3fit_context::v3fit_context_class::gp array. More...
 
subroutine init_reconstruction (context)
 Initialize Reconstruction. More...
 
subroutine config_parallelism (context)
 Configure Parallelism. More...
 
subroutine cleanup_parallelism (context)
 Cleanup Parallelism. More...
 

Detailed Description

Contains the main routines for V3FIT.

Definition in file v3fita.f.

Function/Subroutine Documentation

◆ cleanup_parallelism()

subroutine cleanup_parallelism ( type (v3fit_context_class), intent(inout)  context)

Cleanup Parallelism.

Cleans up resources needed for parallelism.

Parameters
[in,out]contextAn instance of a v3fit_context object.

Definition at line 2364 of file v3fita.f.

◆ config_parallelism()

subroutine config_parallelism ( type (v3fit_context_class), intent(inout)  context)

Configure Parallelism.

When using OpenMP, this sets the maximum number of threads to use. Threads operate within a process and share memory with the main thread. With in parallel constructs, it's important to ensure that all code is thread safe to avoid unexpected behavior and race conditions. The maximum number of threads is controled using the -para command line argument. An argument of a negative values specifies to use the default behavior.

When using MPI, this sets and configures the processes. A unique directory needs to be generated for each process to avoid overwriting output files.

The default way is to create and distribute the threads externally. In this case, the number of processes is fixed. Each process will need to be reassigned a working directory. One process will be used like a parent process. The remaining processed will be retasked as child processes.

The second way is to spawn sub processes from a single parent process. In this case, the parent process will spawn subprocesses to operate the child task in a sub directory. The number of sub processes can be configured automatically or manually.

See also
cl_parsing_sec
Parameters
[in,out]contextAn instance of a v3fit_context object.

Definition at line 2172 of file v3fita.f.

◆ init_combination_signals()

subroutine init_combination_signals ( type (v3fit_context_class), intent(inout)  context,
integer, intent(inout)  signals_created 
)

Constructs signal::combination_class signals.

Parameters
[in,out]contextAn instance of a v3fit_context object.
[in,out]signals_createdCount of the current number of signals constructed.

Definition at line 1891 of file v3fita.f.

◆ init_ece_signals()

subroutine init_ece_signals ( type (v3fit_context_class), intent(inout)  context,
integer, intent(inout)  signals_created 
)

Constructs ece signals.

This constructs all ece signals from the specified v3fit_input::ece_dot_filename.

Parameters
[in,out]contextAn instance of a v3fit_context object.
[in,out]signals_createdCount of the current number of signals constructed.

Definition at line 1586 of file v3fita.f.

◆ init_equilibrium()

subroutine init_equilibrium ( type (v3fit_context_class), intent(inout)  context)

Initialize an equilibrium.

This constructs and initializes an equilibrium. Currently only vmec_equilibium, vacuum_equilibium and siesta_equilibium are supported.

Parameters
[in,out]contextAn instance of a v3fit_context object.

Definition at line 760 of file v3fita.f.

◆ init_extcurz_signals()

subroutine init_extcurz_signals ( type (v3fit_context_class), intent(inout)  context,
integer, intent(inout)  signals_created 
)

Constructs the extcurz signal.

This constructs the extcurz signal from v3fit_input::extcurz_s0 and v3fit_input::extcurz_u0.

Parameters
[in,out]contextAn instance of a v3fit_context object.
[in,out]signals_createdCount of the current number of signals constructed.

Definition at line 1461 of file v3fita.f.

◆ init_gaussian_process()

subroutine init_gaussian_process ( type (v3fit_context_class), intent(inout)  context)

Constructs the v3fit_context::v3fit_context_class::gp array.

This constructs all reconstruction guassian_process::gaussp_class objects.

Parameters
[in,out]contextAn instance of a v3fit_context object.

Definition at line 2061 of file v3fita.f.

◆ init_intpol_signals()

subroutine init_intpol_signals ( type (v3fit_context_class), intent(inout)  context,
integer, intent(inout)  signals_created 
)

Constructs intpol signals.

This constructs all intpol signals from the specified v3fit_input::ipch_dot_filename.

Parameters
[in,out]contextAn instance of a v3fit_context object.
[in,out]signals_createdCount of the current number of signals constructed.

Definition at line 1340 of file v3fita.f.

◆ init_limiter_signals()

subroutine init_limiter_signals ( type (v3fit_context_class), intent(inout)  context,
integer, intent(inout)  signals_created 
)

Constructs limiter signals.

Constructs all iso and grid based limiters.

Parameters
[in,out]contextAn instance of a v3fit_context object.
[in,out]signals_createdCount of the current number of signals constructed.

Definition at line 1648 of file v3fita.f.

◆ init_magnetic_signals()

subroutine init_magnetic_signals ( type (v3fit_context_class), intent(inout)  context,
integer, intent(inout)  signals_created 
)

Constructs magnetic signals.

This constructs all magnetic signals from the specified v3fit_input::mdsig_list_filename.

Parameters
[in,out]contextAn instance of a v3fit_context object.
[in,out]signals_createdCount of the current number of signals constructed.

Definition at line 1137 of file v3fita.f.

◆ init_mse_signals()

subroutine init_mse_signals ( type (v3fit_context_class), intent(inout)  context,
integer, intent(inout)  signals_created 
)

Constructs mse signals.

This constructs all mse signals from the specified v3fit_input::mse_dot_filename.

Parameters
[in,out]contextAn instance of a v3fit_context object.
[in,out]signals_createdCount of the current number of signals constructed.

Definition at line 1523 of file v3fita.f.

◆ init_parameters()

subroutine init_parameters ( type (v3fit_context_class), intent(inout)  context)

Constructs the v3fit_context::v3fit_context_class::params array.

This constructs all reconstruction v3fit_params::param_class and derived v3fit_params::param_class objects.

Parameters
[in,out]contextAn instance of a v3fit_context object.

Definition at line 1975 of file v3fita.f.

◆ init_prior_signals()

subroutine init_prior_signals ( type (v3fit_context_class), intent(inout)  context,
integer, intent(inout)  signals_created 
)

Constructs prior signals.

For now only prior_gaussian signals are constructed.

Parameters
[in,out]contextAn instance of a v3fit_context object.
[in,out]signals_createdCount of the current number of signals constructed.

Definition at line 1762 of file v3fita.f.

◆ init_reconstruction()

subroutine init_reconstruction ( type (v3fit_context_class), intent(inout)  context)

Initialize Reconstruction.

Parameters
[in,out]contextAn instance of a v3fit_context object.

Definition at line 2103 of file v3fita.f.

◆ init_siesta_equilibrium()

subroutine init_siesta_equilibrium ( type (v3fit_context_class), intent(inout)  context,
logical, intent(in)  force_solve 
)

Initialize a siests equilibrium.

This constructs and initializes a siesta_equilibrium.

Parameters
[in,out]contextAn instance of a v3fit_context object.
[in]force_solveIf true, forces the equilbirum to resolve every time.

Definition at line 953 of file v3fita.f.

◆ init_signals()

subroutine init_signals ( type (v3fit_context_class), intent(inout)  context)

Constructs the signal array.

This constructs all v3fit_context::v3fit_context_class::signals.

Parameters
[in,out]contextAn instance of a v3fit_context object.

Definition at line 1048 of file v3fita.f.

◆ init_sxrem_ratio_signals()

subroutine init_sxrem_ratio_signals ( type (v3fit_context_class), intent(inout)  context,
integer, intent(inout)  signals_created 
)

Constructs sxrem_ratio signals.

This constructs all sxrem_ratio signals from the specified v3fit_input::sxrem_ratio_dot_filename.

Parameters
[in,out]contextAn instance of a v3fit_context object.
[in,out]signals_createdCount of the current number of signals constructed.

Definition at line 1836 of file v3fita.f.

◆ init_sxrem_signals()

subroutine init_sxrem_signals ( type (v3fit_context_class), intent(inout)  context,
integer, intent(inout)  signals_created 
)

Constructs sxrem signals.

This constructs all sxrem signals from the specified v3fit_input::sxrch_dot_filename.

Parameters
[in,out]contextAn instance of a v3fit_context object.
[in,out]signals_createdCount of the current number of signals constructed.

Definition at line 1285 of file v3fita.f.

◆ init_thomson_signals()

subroutine init_thomson_signals ( type (v3fit_context_class), intent(inout)  context,
integer, intent(inout)  signals_created 
)

Constructs thomson signals.

This constructs all thomson signals from the specified v3fit_input::thscte_dot_filename.

Parameters
[in,out]contextAn instance of a v3fit_context object.
[in,out]signals_createdCount of the current number of signals constructed.

Definition at line 1405 of file v3fita.f.

◆ init_vacuum_equilibrium()

subroutine init_vacuum_equilibrium ( type (v3fit_context_class), intent(inout)  context,
logical, intent(in)  force_solve 
)

Initialize a vacuum equilibrium.

This constructs and initializes a vacuum_equilibrium.

Parameters
[in,out]contextAn instance of a v3fit_context object.
[in]force_solveIf true, forces the equilbirum to resolve every time.

Definition at line 904 of file v3fita.f.

◆ init_vmec_equilibrium()

subroutine init_vmec_equilibrium ( type (v3fit_context_class), intent(inout)  context,
logical, intent(in)  force_solve 
)

Initialize a vmec equilibrium.

This constructs and initializes a vmec_equilibrium.

Parameters
[in,out]contextAn instance of a v3fit_context object.
[in]force_solveIf true, forces the equilbirum to resolve every time.

Definition at line 822 of file v3fita.f.

◆ task_child_equilibrium()

subroutine task_child_equilibrium ( type (v3fit_context_class), intent(inout)  context)

Child task to compute equilibrium.

Task to compute the equilibrium in a sub process for parallelism.

Parameters
[in,out]contextAn instance of a v3fit_context object.

Definition at line 601 of file v3fita.f.

◆ task_child_recon()

subroutine task_child_recon ( type (v3fit_context_class), intent(inout)  context)

Child task to compute jacobian.

Task to compute the jacobian in a sub process for parallelism.

Parameters
[in,out]contextAn instance of a v3fit_context object.

Definition at line 513 of file v3fita.f.

◆ task_equilibrium()

subroutine task_equilibrium ( type (v3fit_context_class), intent(inout)  context)

Solves the equilibrium.

Task to just solve the equilibrium. This task is choosen by setting v3fit_input::my_task to 'equilibrium'.

Parameters
[in,out]contextAn instance of a v3fit_context object.

Definition at line 172 of file v3fita.f.

◆ task_gsq_on_grid()

subroutine task_gsq_on_grid ( type (v3fit_context_class), intent(inout)  context)

Computes the g^2 value on a grid.

Task to map out the chi^2 over a range of reconstruction parameters. This task is choosen by setting v3fit_input::my_task to 'gsq_on_grid'.

Parameters
[in,out]contextAn instance of a v3fit_context object.

Definition at line 659 of file v3fita.f.

◆ task_reconstruct()

subroutine task_reconstruct ( type (v3fit_context_class), intent(inout)  context)

Reconstructs the equilibrium.

Task to perform an equilibrium reconstruction. This task is choosen by setting v3fit_input::my_task to 'reconstruct'.

Parameters
[in,out]contextAn instance of a v3fit_context object.

Definition at line 329 of file v3fita.f.

◆ task_unit_tests()

subroutine task_unit_tests

Run unit tests.

This task is choosen by setting v3fit_input::my_task to 'unit_test'. Or by using the -test command line flag.

Definition at line 689 of file v3fita.f.

◆ task_v3post()

subroutine task_v3post ( type (v3fit_context_class), intent(inout)  context)

Solves the equilibrium and calculates the modeled signals.

Task to just compute modeled signals from an equilibrium. This task is choosen by setting v3fit_input::my_task to 'v3post'.

Parameters
[in,out]contextAn instance of a v3fit_context object.

Definition at line 227 of file v3fita.f.

◆ v3fit()

program v3fit

V3FIT is a code for reconstructing 3D equilibria. V3FIT determined the optimal parameters of a 3D equilibrium by minimizing the missmatch between modeled and observed signals. V3FIT has been created with contributions from.

Author
James D. Hanson
Mark Cianciosa
Steve Hirshman
Ed Lazarus
Lang Lao
Steve Knowlton
Gregorio L. Trevisan
Eric C. Howell

The theory behind V3FIT is outlined in Hanson et. al. doi:10.1088/0029-5515/49/7/075031

Below is a brief discription of the major top level objects of the code. For discriptions of lower level objects consult the referenced top level objects.

model defines the equilibrium model. signal defined the interface to the signals. reconstruction contain the minimization algorithm. data_parameters defined the various fixed parameters utility functions used throughout. v3fit_input Defines the V3FIT namelist input file. v3fit_context defined the main pointer to all allocated memory and objects. commandline_parser defines and parses commandline arguments.

V3FIT main program.

Highest level V3FIT routine.

Definition at line 47 of file v3fita.f.