Stellarator-Tools
Loading...
Searching...
No Matches
v3fit_params::param_recon_class Type Reference

Class to hold variables needed when a parameter is a reconstruction parameter. More...

Inheritance diagram for v3fit_params::param_recon_class:
v3fit_params::param_class

Public Member Functions

FINAL param_recon_destruct (this)
 Deconstruct a param_recon_class object.
 
procedure set_value (this, a_model, value, eq_comm, is_central)
 Sets the parameter value.
 
procedure get_lower_range_value (this, a_model)
 Gets the lower boundary value.
 
procedure get_upper_range_value (this, a_model)
 Gets the upper boundary value.
 
procedure get_lower_range_type (this, a_model)
 Gets the lower boundary type description.
 
procedure get_upper_range_type (this, a_model)
 Gets the upper boundary type description.
 
procedure is_in_lower_range (this, a_model, value)
 Checks if the value is in the lower range.
 
procedure is_in_upper_range (this, a_model, value)
 Checks if the value is in the upper range.
 
procedure increment (this, a_model, eq_comm, is_central)
 Increments the parameter value.
 
procedure decrement (this, a_model, eq_comm)
 Decrements the parameter value.
 
procedure write (this, iou, index, a_model)
 Writes out a parameter to an output file.
 
procedure write_step_data_1 (this, a_model, result_ncid, current_step, index, param_value_id, param_sigma_id, param_corr_id, param_sem_id)
 Write out the parameter data for a step to the result netcdf file.
 
GENERIC write_step_data write_step_data_1
 
procedure restart (this, a_model, result_ncid, current_step, index, param_value_id, param_sigma_id, param_corr_id, eq_comm, is_central)
 Restart the parameter.
 
procedure sync_value (this, a_model, recon_comm, eq_comm, is_central)
 Syncronize the param value to children.
 
procedure send_delta (this, index, recon_comm)
 Sends the delta used.
 
procedure recv_delta (this, index, recon_comm)
 Receives the delta used.
 
procedure sync_delta (this, recon_comm)
 Sync the delta used.
 
procedure sync_child (this, a_model, index, recon_comm, eq_comm, is_central)
 Sync the parameter value from a child to the parent.
 
- Public Member Functions inherited from v3fit_params::param_class
FINAL param_destruct (this)
 Deconstruct a param_class object.
 
procedure get_value (this, a_model)
 Gets the parameter value.
 
procedure get_name (this, a_model)
 Gets the parameter name.
 
procedure write_short (this, iou, index, a_model)
 Writes out a parameter to an output file.
 
procedure write_correlation (this, iou, a_model)
 Writes out a parameter covariance matrix row.
 
procedure write_step_data_2 (this, a_model, result_ncid, current_step, index, param_value_id, param_sigma_id, param_corr_id)
 Write out the parameter data for a step to the result netcdf file.
 
GENERIC write_step_data write_step_data_2
 

Public Attributes

real(rprec) vrnc = 0.0
 The maximum increment size of the parameter for calculating the jacobian.
 
integer, dimension(2) range_type = param_range_no_type
 Type descriptor of the boundry type for the lower(1) and upper(2) ranges.
 
integer, dimension(2) range_id = data_no_id
 If the param_recon_class::range_type is param_range_parameter_type, this holds the parameter id's of the lower(1) and upper(2) boundary. Id's are provided by either the model or the equilibrium.
 
integer, dimension(2, data_max_indicesrange_indices = 0
 If the param_recon_class::range_type is param_range_parameter_type, this holds the parameter indices of the lower(1,:) and upper(2,:) boundary.
 
real(rprec), dimension(2) range_value = 0.0
 If the param_recon_class::range_type is param_range_value_type, this holds the value of the lower(1) and upper(2) boundary.
 
real(rprec) delta
 The contraints can change the normalization size of the patarameter when incrementing it. Store the actual change in parameter here for normalization. This value is set by param_increment.
 
real(rprec), dimension(:), pointer sem => null()
 Stored row of the signal effectiveness matrix.
 
- Public Attributes inherited from v3fit_params::param_class
integer param_id = data_no_id
 Id number of the parameter. Id's are provided by either the model or the equilibrium.
 
integer, dimension(data_max_indicesindices = 0
 The i and j indices of the parameter. These are only used if the parameter is the element of an array.
 
real(rprec) sigma = 0.0
 Stored value of the parameter uncertainty for the current reconstruction step. This value is calculated by reconstruction::reconstruction_eval_sem.
 
real(rprec), dimension(:), pointer correlation => null()
 Stored row of the correlation matrix. When the parameter is interpreted as a locking parameter, this array contains the parameter coefficents.
 

Detailed Description

Class to hold variables needed when a parameter is a reconstruction parameter.

Member Function/Subroutine Documentation

◆ decrement()

procedure v3fit_params::param_recon_class::decrement ( class (param_recon_class), intent(inout)  this,
class (model_class), intent(inout)  a_model,
integer, intent(in)  eq_comm 
)

Decrements the parameter value.

The value is decremented by the delta. The incrementing function has already performed the bounds checking so there is no need to do that here.

Parameters
[in]thisA param_class instance.
[in]a_modelA model instance.
[in]eq_commMPI communicator for the child equilibrium processes.

◆ get_lower_range_type()

procedure v3fit_params::param_recon_class::get_lower_range_type ( class (param_recon_class), intent(in)  this,
class (model_class), intent(in)  a_model 
)

Gets the lower boundary type description.

Gets lower boundary type description.

Parameters
[in]thisA param_recon_class instance.
[in]a_modelA model instance.
Returns
A string description of the lower boundary type.

◆ get_lower_range_value()

procedure v3fit_params::param_recon_class::get_lower_range_value ( class (param_recon_class), intent(in)  this,
class (model_class), intent(in)  a_model 
)

Gets the lower boundary value.

Gets lower boundary value. The results of this function are invalid if the bounding type is param_range_infinity_type or param_range_no_type.

Parameters
[in]thisA param_recon_class instance.
[in]a_modelA model instance.
Returns
The lower bounding value.

◆ get_upper_range_type()

procedure v3fit_params::param_recon_class::get_upper_range_type ( class (param_recon_class), intent(in)  this,
class (model_class), intent(in)  a_model 
)

Gets the upper boundary type description.

Gets upper boundary type description.

Parameters
[in]thisA param_recon_class instance.
[in]a_modelA model instance.
Returns
A string description of the upper boundary type.

◆ get_upper_range_value()

procedure v3fit_params::param_recon_class::get_upper_range_value ( class (param_recon_class), intent(in)  this,
class (model_class), intent(in)  a_model 
)

Gets the upper boundary value.

Gets upper boundary value. The results of this function are invalid if the bounding type is param_range_infinity_type or param_range_no_type.

Parameters
[in]thisA param_recon_class instance.
[in]a_modelA model instance.
Returns
The upper bounding value.

◆ increment()

procedure v3fit_params::param_recon_class::increment ( class (param_recon_class), intent(inout)  this,
class (model_class), intent(inout)  a_model,
integer, intent(in)  eq_comm,
logical, intent(in)  is_central 
)

Increments the parameter value.

The value is incremented by the vrnc. The incremented value is then checked if the new value is in range. If the value is out of range, the value is incremented in the opposite direction. If the incremented value is outside of both ranges, the step size value is halved and the procedure is repeated. Five attempts are made until the function quits with an error. If successful, the actual step size used is cached in param_recon_class::delta for normalization purposes.

If central differencing is used, both the upper and lower bounds must be checked. Starting with half the parameter vrnc, the change in parameter is divided until the change in parameter fits into both the upper and lower bounds.

Parameters
[in]thisA param_recon_class instance.
[in]a_modelA model instance.
[in]eq_commMPI communicator for the child equilibrium processes.
[in]is_centralCentral differencing is being used.

◆ is_in_lower_range()

procedure v3fit_params::param_recon_class::is_in_lower_range ( class (param_recon_class), intent(in)  this,
class (model_class), intent(in)  a_model,
real (rprec), intent(in)  value 
)

Checks if the value is in the lower range.

If the value is less than the bounding value, the parameter value is out of range.

Parameters
[in]thisA param_recon_class instance.
[in]a_modelA model instance.
[in]valueA parameter value to check.
Returns
True for in range and false for out of range.

◆ is_in_upper_range()

procedure v3fit_params::param_recon_class::is_in_upper_range ( class (param_recon_class), intent(in)  this,
class (model_class), intent(in)  a_model,
real (rprec), intent(in)  value 
)

Checks if the value is in the upper range.

If the value is greater than the bounding value, the parameter value is out of range.

Parameters
[in]thisA param_recon_class instance.
[in]a_modelA model instance.
[in]valueA parameter value to check.
Returns
True for in range and false for out of range.

◆ param_recon_destruct()

FINAL v3fit_params::param_recon_class::param_recon_destruct ( type (param_recon_class), intent(inout)  this)
final

Deconstruct a param_recon_class object.

Deallocates memory and uninitializes a param_recon_class object.

Parameters
[in,out]thisA param_recon_class object.

◆ recv_delta()

procedure v3fit_params::param_recon_class::recv_delta ( class (param_recon_class), intent(inout)  this,
integer, intent(in)  index,
integer, intent(in)  recon_comm 
)

Receives the delta used.

Receives the value of delta used in the child process. If MPI support is not compiled in this subroutine reduces to a no op.

Parameters
[in,out]thisA param_recon_class instance.
[in]indexIndex of the reconstruction parameter.
[in]recon_commA MPI recon_comm handle.

◆ restart()

procedure v3fit_params::param_recon_class::restart ( class (param_recon_class), intent(inout)  this,
class (model_class), intent(inout)  a_model,
integer, intent(in)  result_ncid,
integer, intent(in)  current_step,
integer, intent(in)  index,
integer, intent(in)  param_value_id,
integer, intent(in)  param_sigma_id,
integer, intent(in)  param_corr_id,
integer, intent(in)  eq_comm,
logical, intent(in)  is_central 
)

Restart the parameter.

Restarts a parameter from the result file. This reloads and sets the value, sigma and correlation. All other values are set when the namelist input file was read.

Parameters
[in,out]thisA param_recon_class instance.
[in]a_modelThe equilibrium model.
[in]result_ncidNetcdf if for the result file.
[in]current_stepStep number to restart from.
[in]indexA index of a parameter.
[in]param_value_idNetCDF variable id of the parameter value.
See also
v3fit_context
Parameters
[in]param_sigma_idNetCDF variable id of the parameter sigma.
See also
v3fit_context
Parameters
[in]param_corr_idNetCDF variable id of the parameter correlation.
See also
v3fit_context
Parameters
[in]eq_commMPI communicator for the child equilibrium processes.
[in]is_centralCentral differencing is being used.

◆ send_delta()

procedure v3fit_params::param_recon_class::send_delta ( class (param_recon_class), intent(inout)  this,
integer, intent(in)  index,
integer, intent(in)  recon_comm 
)

Sends the delta used.

Sends the value of delta used in the child process to the parent process. If MPI support is not compiled in this subroutine reduces to a no op.

Parameters
[in,out]thisA param_recon_class instance.
[in]indexIndex of the reconstruction parameter.
[in]recon_commA MPI intra_comm handle.

◆ set_value()

procedure v3fit_params::param_recon_class::set_value ( class (param_recon_class), intent(in)  this,
class (model_class), intent(inout)  a_model,
real (rprec), intent(in)  value,
integer, intent(in)  eq_comm,
logical, intent(in)  is_central 
)

Sets the parameter value.

Sets the value of a reconstruction parameter. If the parameter is outside one of the bounding parameters, the value is clamped to the bounding value. The resulting bounded parameter value is set by ether the model or the equilibrium.

If central differencing is used, both the upper and lower bounds must be checked. In this case both the upper and lower bounds need to be with in half the vrnc values. This ensures there is enough room to increment and decrement the values. If the bounds are so narrow such that the set value plus/minus half the vrnc is out of range of both bounds, then split the difference.

Parameters
[in]thisA param_recon_class instance.
[in,out]a_modelA model instance.
[in]valueThe value to set the parameter to.
[in]eq_commMPI communicator for the child equilibrium processes.
[in]is_centralCentral differencing is being used.

◆ sync_child()

procedure v3fit_params::param_recon_class::sync_child ( class (param_recon_class), intent(inout)  this,
class (model_class), intent(inout)  a_model,
integer, intent(in)  index,
integer, intent(in)  recon_comm,
integer, intent(in)  eq_comm,
logical, intent(in)  is_central 
)

Sync the parameter value from a child to the parent.

Syncs the value of delta from a child process to the parent. If MPI support is not compiled in this subroutine reduces to a no op.

Parameters
[in,out]thisA param_recon_class instance.
[in,out]a_modelA model instance.
[in]indexIndex of the reconstruction parameter.
[in]recon_commA MPI intra_comm handle.
[in]eq_commMPI communicator for the child equilibrium processes.
[in]is_centralCentral differencing is being used.

◆ sync_delta()

procedure v3fit_params::param_recon_class::sync_delta ( class (param_recon_class), intent(inout)  this,
integer, intent(in)  recon_comm 
)

Sync the delta used.

Syncs the value of delta from the parent process to the child. If MPI support is not compiled in this subroutine reduces to a no op.

Parameters
[in,out]thisA param_recon_class instance.
[in]recon_commA MPI recon_comm handle.

◆ sync_value()

procedure v3fit_params::param_recon_class::sync_value ( class (param_recon_class), intent(inout)  this,
class (model_class), intent(inout)  a_model,
integer, intent(in)  recon_comm,
integer, intent(in)  eq_comm,
logical, intent(in)  is_central 
)

Syncronize the param value to children.

Syncs data between the parent and child processes. If MPI support is not compiled in this subroutine reduces to a no op.

Parameters
[in,out]thisA param_recon_class instance.
[in,out]a_modelA model instance.
[in]recon_commA MPI intra_comm handle.
[in]eq_commMPI communicator for the child equilibrium processes.
[in]is_centralCentral differencing is being used.

◆ write()

procedure v3fit_params::param_recon_class::write ( class (param_recon_class), intent(in)  this,
integer, intent(in)  iou,
integer, intent(in)  index,
class (model_class), intent(in)  a_model 
)

Writes out a parameter to an output file.

Parameter information is formated as the index, name, index 1, index2, value, sigma, vrnc, upper and lower range types, values, and range indices.

Parameters
[in]thisA param_recon_class instance.
[in]iouInput/output unit representing the file to write to.
[in]indexThe index of a parameter.
[in]a_modelA model instance.
Note
Eventually parameter range informarion will be added as well.

◆ write_step_data_1()

procedure v3fit_params::param_recon_class::write_step_data_1 ( class (param_recon_class), intent(in)  this,
class (model_class), intent(in)  a_model,
integer, intent(in)  result_ncid,
integer, intent(in)  current_step,
integer, intent(in)  index,
integer, intent(in)  param_value_id,
integer, intent(in)  param_sigma_id,
integer, intent(in)  param_corr_id,
integer, intent(in)  param_sem_id 
)

Write out the parameter data for a step to the result netcdf file.

Writes out the parameter value, sigma and signal effectiveness matrix to the result file.

Parameters
[in]thisA param_recon_class instance.
[in]a_modelThe equilibrium model.
[in]result_ncidA NetCDF id of the result file.
[in]current_stepThe surrent reconstruction step.
[in]indexA index of a parameter.
[in]param_value_idNetCDF variable id of the parameter value.
See also
v3fit_context
Parameters
[in]param_sigma_idNetCDF variable id of the parameter sigma.
See also
v3fit_context
Parameters
[in]param_corr_idNetCDF variable id of the parameter correlation.
See also
v3fit_context
Parameters
[in]param_sem_idNetCDF variable id of the parameter signal effectiveness.
Note
This assumes that the parameter sigma has already been calculated. Name and index information is written when the result file is first created by v3fit_context::v3fit_context_write_step_data.

Member Data Documentation

◆ range_type

integer, dimension(2) v3fit_params::param_recon_class::range_type = param_range_no_type

Type descriptor of the boundry type for the lower(1) and upper(2) ranges.

Possible values are:

◆ vrnc

real (rprec) v3fit_params::param_recon_class::vrnc = 0.0

The maximum increment size of the parameter for calculating the jacobian.

See also
param_increment

The documentation for this type was generated from the following file: