V3FIT
Data Types | Functions/Subroutines
signal Module Reference

Defines the base class of the type signal_class. More...

Data Types

type  signal_class
 Base class representing a signal. More...
 
interface  signal_construct
 Interface for the construction of signal_class types using signal_construct_magnetic, signal_construct_sxrem, signal_construct_intpol, signal_construct_thomson, signal_construct_extcurz, signal_construct_mse, signal_construct_ece, signal_construct_limiter, signal_construct_prior_gaussian, signal_construct_feedback, signal_construct_combination or signal_construct_diagnostic_netcdf. More...
 
type  signal_pointer
 Pointer to a signal object. Used for creating arrays of signal pointers. This is needed because fortran does not allow arrays of pointers directly. More...
 

Functions/Subroutines

subroutine signal_construct_new (this, s_name, l_name, units, observed, sigma, weight, s_index, o_index)
 Construct new signal_class object. More...
 
subroutine signal_construct_diagnostic_netcdf (this, mdsig_iou, observed, sigma, weight, s_index, o_index)
 Construct a signal_class containing a diagnostic object. More...
 
subroutine signal_destruct (this)
 Deconstruct a signal_class object. More...
 
real(rprec) function, dimension(4) signal_get_modeled_signal_cache (this, a_model, sigma, use_cache, last_value)
 Calculates the modeled signal. More...
 
real(rprec) function, dimension(4) signal_get_modeled_signal_last (this, a_model, sigma, last_value)
 Calculates the modeled signal. More...
 
real(rprec) function signal_get_observed_signal (this, a_model)
 Calculates the observed signal. More...
 
real(rprec) function signal_get_g2 (this, a_model, use_cache, last_value)
 Calculates the g^2 contribution of a signal. More...
 
real(rprec) function signal_get_e (this, a_model, use_cache, last_value)
 Calculates the e contribution of a signal. More...
 
real(rprec) function signal_get_sigma2 (this)
 Calculates the total sigma^2 of a signal. More...
 
character(len=data_name_length) function signal_get_type (this)
 Gets a discription of the signal type. More...
 
subroutine signal_get_header (this, header)
 Gets a discription of the model and model sigma array indices. More...
 
real(rprec) function signal_get_gp_i (this, a_model, i, flags)
 Gets the guassian process kernel for a signal and a position. More...
 
real(rprec) function signal_get_gp_s (this, a_model, signal, flags)
 Gets the guassian process kernel for a signal and a signal. More...
 
real(rprec) function signal_get_gp_x (this, a_model, x_cart, flags)
 Gets the guassian process kernel for a signal and cartesian position. More...
 
subroutine signal_scale_and_offset (this, a_model, value)
 Apply scale and offset to the value. More...
 
character(len=data_short_name_length) function signal_make_short_name (name, index)
 Generate a short name by appending an index. More...
 
subroutine signal_write (this, iou, index, a_model)
 Write out the signal information to an output file. More...
 
subroutine signal_write_header (this, iou)
 Write out the signal header information to an output file. More...
 
subroutine signals_write_auxiliary (this, iou, index, a_model)
 Write out any auxiliary signal information to an output file. More...
 
subroutine signal_write_step_data (this, a_model, result_ncid, current_step, index, signal_model_value_id, signal_sigma_value_id)
 Write out the signal data for a step to the result netcdf file. More...
 
subroutine signal_sync_child (this, index, recon_comm)
 Syncronize a child signal state to the parent. More...
 

Detailed Description

Defines the base class of the type signal_class.

signal Sub Classes: magnetic, sxrem, intpol, thomson, extcurz, mse, ece, limiter, prior_gaussian, and feedback

Function/Subroutine Documentation

◆ signal_construct_diagnostic_netcdf()

subroutine signal::signal_construct_diagnostic_netcdf ( class (signal_class), intent(inout)  this,
integer, intent(in)  mdsig_iou,
real(rprec), intent(in)  observed,
real(rprec), intent(in)  sigma,
real(rprec), intent(in)  weight,
integer, intent(in)  s_index,
integer, intent(in)  o_index 
)

Construct a signal_class containing a diagnostic object.

Reads the s_name, l_name and units from a netcdf file. Used for constructing the magnetic objects.

Parameters
[in,out]signal_classAn instance of a signal_class.
[in]mdsig_iouNetCDF id of the opened mdsig file.
[in]observedObserved value of the signal.
[in]sigmaObserved sigma of the signal.
[in]weightWeight factor of the signal.
[in]s_indexIndex of the model signal scale factor.
[in]o_indexIndex of the model signal offset factor.
Returns
Apointer to a constructed signal_class object.

Definition at line 206 of file signal.f.

◆ signal_construct_new()

subroutine signal::signal_construct_new ( class (signal_class), intent(inout)  this,
character(len=*), intent(in)  s_name,
character(len=*), intent(in)  l_name,
character(len=*), intent(in)  units,
real(rprec), intent(in)  observed,
real(rprec), intent(in)  sigma,
real(rprec), intent(in)  weight,
integer, intent(in)  s_index,
integer, intent(in)  o_index 
)

Construct new signal_class object.

Allocates memory and initializes a signal_class object.

Parameters
[in,out]thisAn instance of a signal_class.
[in]s_nameThe short name of the signal.
[in]l_nameThe short name of the signal.
[in]unitsThe units of the signal.
[in]observedObserved value of the signal.
[in]sigmaObserved sigma of the signal.
[in]weightWeight factor of the signal.
[in]s_indexIndex of the model signal scale factor.
[in]o_indexIndex of the model signal offset factor.

Definition at line 145 of file signal.f.

◆ signal_destruct()

subroutine signal::signal_destruct ( type (signal_class), intent(inout)  this)

Deconstruct a signal_class object.

Deallocates memory and uninitializes a signal_class object.

Parameters
[in,out]thisA signal_class instance.

Definition at line 251 of file signal.f.

◆ signal_get_e()

real (rprec) function signal::signal_get_e ( class (signal_class), intent(inout)  this,
type (model_class), pointer  a_model,
logical, intent(in)  use_cache,
real (rprec), dimension(4), intent(in)  last_value 
)

Calculates the e contribution of a signal.

Gets the e contribution of an individual signal. e = SQRT(W)*(O - M)/SQRT(sigma_o^2 + sigma_m^2)

Parameters
[in,out]thisA diagnostic_class instance.
[in,out]a_modelA model instance.
[in]use_cacheIf the signals have been already calculated this should be false. Otherwise set to true.
[in]last_valueLast good value in case the signal did not change.
Returns
The e value.

Definition at line 460 of file signal.f.

◆ signal_get_g2()

real (rprec) function signal::signal_get_g2 ( class (signal_class), intent(inout)  this,
type (model_class), pointer  a_model,
logical, intent(in)  use_cache,
real (rprec), dimension(4), intent(in)  last_value 
)

Calculates the g^2 contribution of a signal.

Gets the g^2 contribution of an individual signal. g^2 = W*(O - M)^2/(sigma_o^2 + sigma_m^2) = e*e

Parameters
[in,out]thisA diagnostic_class instance.
[in,out]a_modelA model instance.
[in]use_cacheIf the signals have been already calculated this should be false. Otherwise set to true.
[in]last_valueLast good value in case the signal did not change.
Returns
The g^2 value.

Definition at line 423 of file signal.f.

◆ signal_get_gp_i()

real (rprec) function signal::signal_get_gp_i ( class (signal_class), intent(in)  this,
type (model_class), pointer  a_model,
integer, intent(in)  i,
integer, intent(in)  flags 
)

Gets the guassian process kernel for a signal and a position.

This method is meant to be overwritten by a subclass method. As a result, returns the get_gp_i method of the subclass instance signal_class was constructed with.

See also
sxrem::sxrem_get_gp_i
intpol::intpol_get_gp_i
thomson::thomson_get_gp_i
ece::ece_get_gp_i
prior_gaussian::prior_gaussian_get_gp_i
Parameters
[in]thisA signal_class instance.
[in]a_modelA model_class instance.
[in]iIndex of the position for the kernel.
[in]flagsState flags to send to the kernel.
Returns
Kernel value for the position and the signal.

Definition at line 635 of file signal.f.

◆ signal_get_gp_s()

real (rprec) function signal::signal_get_gp_s ( class (signal_class), intent(in)  this,
type (model_class), pointer  a_model,
class (signal_class), pointer  signal,
integer, intent(in)  flags 
)

Gets the guassian process kernel for a signal and a signal.

This method is meant to be overwritten by a subclass method. As a result, returns the get_gp_s method of the subclass instance signal_class was constructed with. The second signal is cast to a void pointer so it can be send to the subclass instance.

See also
sxrem::sxrem_get_gp_s
intpol::intpol_get_gp_s
thomson::thomson_get_gp_s
ece::ece_get_gp_s
prior_gaussian::prior_gaussian_get_gp_s
Parameters
[in]thisA signal_class instance.
[in]a_modelA model_class instance.
[in]signalA signal_class instance for the second signal.
[in]flagsState flags to send to the kernel.
Returns
Kernel value for the signal and the signal.

Definition at line 677 of file signal.f.

◆ signal_get_gp_x()

real (rprec) function signal::signal_get_gp_x ( class (signal_class), intent(in)  this,
type (model_class), pointer  a_model,
real (rprec), dimension(3), intent(in)  x_cart,
integer, intent(in)  flags 
)

Gets the guassian process kernel for a signal and cartesian position.

This method is meant to be overwritten by a subclass method. As a result, returns the get_gp_x method of the subclass instance signal_class was constructed with.

See also
sxrem::sxrem_get_gp_x
intpol::intpol_get_gp_x
thomson::thomson_get_gp_x
ece::ece_get_gp_x
prior_gaussian::prior_gaussian_get_gp_x
Parameters
[in]thisA signal_class instance.
[in]a_modelA model_class instance.
[in]x_cartThe cartesian position of to get the kernel at.
[in]flagsState flags to send to the kernel.
Returns
Kernel value for position and the signal.

Definition at line 714 of file signal.f.

◆ signal_get_header()

subroutine signal::signal_get_header ( class (signal_class), intent(in)  this,
character (len=data_name_length), dimension(7), intent(inout)  header 
)

Gets a discription of the model and model sigma array indices.

This method is meant to be overwritten by a subclass method. As a result, returns the get_header method of the subclass instance signal_class was constructed with.

See also
magnetic::magnetic_get_header
mse::mse_get_header
ece::ece_get_header
limiter::limiter_get_header
feedback::feedback_get_header
combination_get_header
gaussp_get_header
Parameters
[in]thisA signal_class instance.
[in,out]headerBuffer arrays to write header strings to.

Definition at line 591 of file signal.f.

◆ signal_get_modeled_signal_cache()

real (rprec) function, dimension(4) signal::signal_get_modeled_signal_cache ( class (signal_class), intent(inout)  this,
type (model_class), pointer  a_model,
real (rprec), dimension(:), intent(out)  sigma,
logical, intent(in)  use_cache,
real (rprec), dimension(4), intent(in)  last_value 
)

Calculates the modeled signal.

This method is checks if the cached vales should be used first otherwise calls the subclass method.

Parameters
[in,out]thisA diagnostic_class instance.
[in]a_modelA model instance.
[out]sigmaThe modeled sigma.
[in]use_cacheIf false calculate the signal and sigma and write them to the cache. Otherwise read from the cache without recalculating the signal.
[in]last_valueLast good value in case the signal did not change.
Returns
The model value.

Definition at line 291 of file signal.f.

◆ signal_get_modeled_signal_last()

real (rprec) function, dimension(4) signal::signal_get_modeled_signal_last ( class (signal_class), intent(inout)  this,
type (model_class), pointer  a_model,
real (rprec), dimension(4), intent(out)  sigma,
real (rprec), dimension(4), intent(in)  last_value 
)

Calculates the modeled signal.

This method is meant to be overwritten by a subclass method. As a result, returns the get_modeled_signal method of the subclass instance signal_class was constructed with unless the signal is read from the cached value. Read from the cached value when the signal doesn't need to be recalulated. If the signal is to be recalculated, write these to the cache.

See also
magnetic::magnetic_get_modeled_signal
sxrem::sxrem_get_modeled_signal
intpol::intpol_get_modeled_signal
thomson::thomson_te_get_modeled_signal
thomson::thomson_p_get_modeled_signal
thomson::thomson_ne_get_modeled_signal
extcurz::extcurz_get_modeled_signal
mse::mse_get_modeled_signal
ece::ece_get_modeled_signal
limiter::limiter_get_modeled_signal
prior_guassian::prior_guassian_get_modeled_signal
sxrem_ratio::sxrem_ratio_get_modeled_signal
combination::combination_get_modeled_signal
Parameters
[in,out]thisA signal_class instance.
[in]a_modelA model instance.
[out]sigmaThe modeled sigma.
[in]last_valueLast good value in case the signal did not change.
Returns
The model value.

Definition at line 353 of file signal.f.

◆ signal_get_observed_signal()

real (rprec) function signal::signal_get_observed_signal ( class (signal_class), intent(in)  this,
type (model_class), intent(in)  a_model 
)

Calculates the observed signal.

This method is meant to be overwritten by a subclass method. As a result, returns the get_modeled_signal method of the subclass instance signal_class was constructed with. All signals expect feed back signals use a fixed observed value.

See also
feedback::feedback_get_modeled_signal
Parameters
[in]thisA diagnostic_class instance.
[in]a_modelA model instance.
Returns
The observed value.

Definition at line 388 of file signal.f.

◆ signal_get_sigma2()

real (rprec) function signal::signal_get_sigma2 ( class (signal_class), intent(in)  this)

Calculates the total sigma^2 of a signal.

Gets the total sigma^2 of an individual signal. sigma^2 = sigma_o^2 + sigma_m^2

Parameters
[in]thisA diagnostic_class instance.
Returns
The e value.
Note
this assumes that modeled sigma value has already been cached by a call to signal_get_modeled_signal

Definition at line 511 of file signal.f.

◆ signal_get_type()

character (len=data_name_length) function signal::signal_get_type ( class (signal_class), intent(in)  this)

Gets a discription of the signal type.

This method is meant to be overwritten by a subclass method. As a result, returns the get_type method of the subclass instance signal_class was constructed with.

See also
magnetic::magnetic_get_type
sxrem::sxrem_get_type
intpol::intpol_get_type
thomson::thomson_get_type
extcurz::extcurz_get_type
mse::mse_get_type
ece::ece_get_type
limiter::limiter_get_type
prior_guassian::prior_guassian_get_type
sxrem_ratio::sxrem_ratio_get_type
combination::combination_get_type
Parameters
[in]thisA signal_class instance.
Returns
A string describing the signal type.

Definition at line 555 of file signal.f.

◆ signal_make_short_name()

character (len=data_short_name_length) function signal::signal_make_short_name ( character (len=*), intent(in)  name,
integer, intent(in)  index 
)

Generate a short name by appending an index.

Returns an appended string with no leading spaces. This check the number of digits in the index then chooses the appropriate formatting.

Parameters
[in]nameA name of a signal to append to.
[in]indexA index of a signal to append.
Returns
A string an appended string.

Definition at line 775 of file signal.f.

◆ signal_scale_and_offset()

subroutine signal::signal_scale_and_offset ( class (signal_class), intent(in)  this,
type (model_class), intent(in)  a_model,
real (rprec), intent(inout)  value 
)

Apply scale and offset to the value.

Modeled signals can contain an extra scaling and offset. Apply these to the value. These are obtained from the model.

Parameters
[in]thisA intpol_class instance.
[in]a_modelA model instance.
[in,out]valueThe value to scale and offset.

Definition at line 744 of file signal.f.

◆ signal_sync_child()

subroutine signal::signal_sync_child ( class (signal_class), intent(inout)  this,
integer, intent(in)  index,
integer, intent(in)  recon_comm 
)

Syncronize a child signal state to the parent.

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

Parameters
[in,out]thisA signal_class instance.
[in]indexReconstruction rank to sync.
[in]recon_commMPI communicator for the reconstruction processes.

Definition at line 1031 of file signal.f.

◆ signal_write()

subroutine signal::signal_write ( class (signal_class), intent(inout)  this,
integer, intent(in)  iou,
integer, intent(in)  index,
type (model_class), pointer  a_model 
)

Write out the signal information to an output file.

Signals information is formated as the index, signal type, s_name, g^2, weight, observed value, observed sigma, modeled value and modeled sigma.

Parameters
[in,out]thisA signal_class instance.
[in]iouA input/output representing the file to write to.
[in]indexA index of a signal.
[in,out]a_modelThe equilibrium model.
Note
This assumes that signals have already been calculated. The model isn't used by signal_get_g2 since it is reading from the cache but must be passed in anyway.

Definition at line 819 of file signal.f.

◆ signal_write_header()

subroutine signal::signal_write_header ( class (signal_class), intent(in)  this,
integer, intent(in)  iou 
)

Write out the signal header information to an output file.

Signals information is formated as a the index, signal type, s_name, g^2, weight, observed value, observed sigma, modeled value and modeled sigma.

Parameters
[in]thisA signal_class instance.
[in]iouA input/output representing the file to write to.
Note
This should only be called when the type of signal changes.

Definition at line 868 of file signal.f.

◆ signal_write_step_data()

subroutine signal::signal_write_step_data ( class (signal_class), intent(inout)  this,
type (model_class), pointer  a_model,
integer, intent(in)  result_ncid,
integer, intent(in)  current_step,
integer, intent(in)  index,
integer, intent(in)  signal_model_value_id,
integer, intent(in)  signal_sigma_value_id 
)

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

Writes out the observed, modeled and total sigma value of the signal.

Parameters
[in,out]thisA diagnostic_class instance.
[in,out]a_modelThe equilibrium model.
[in]result_ncidA NetCDF id of the result file.
[in]current_stepThe surrent reconstruction step.
[in]indexA index of a signal.
[in]signal_model_value_idNetCDF variable id of the model value.
[in]signal_sigma_value_idNetCDF variable id of the total sigma.
Note
This assumes that signals have already been calculated. The model isn't used by signal_get_g2 since it is reading from the cache but must be passed in anyway.

Definition at line 952 of file signal.f.

◆ signals_write_auxiliary()

subroutine signal::signals_write_auxiliary ( class (signal_class), intent(in)  this,
integer, intent(in)  iou,
integer, intent(in)  index,
type (model_class), intent(in)  a_model 
)

Write out any auxiliary signal information to an output file.

This method is meant to be overwritten by a subclass method if need be. As a result, returns the write_auxiliary method of the subclass instance signal_class was constructed with. Otherwise uses the default. nothing is written.

See also
sxrem_ratio::sxrem_ratio_write_auxilary
prior_gaussian::prior_gaussian_write_auxiliary
combination::combination_write_auxiliary
Parameters
[in]thisA signal_class instance.
[in]iouA input/output representing the file to write to.
[in]indexA index of a signal.
[in]a_modelThe equilibrium model.

Definition at line 911 of file signal.f.