V3FIT
Data Types | Functions/Subroutines | Variables
pprofile_t Module Reference

Defines the base class of the type pprofile_class. This module contains all the code necessary to define parameterized profiles. More...

Data Types

type  pprofile_class
 Base class representing a parameterized profile. More...
 
interface  pprofile_get_gp
 Interface for the guassian process kernel values. More...
 
type  pprofile_pointer
 Pointer to a pprofile object. Used for creating arrays of pprofile pointers. This is needed because fortran does not allow arrays of pointers directly. More...
 

Functions/Subroutines

type(pprofile_class) function, pointer pprofile_construct (p_type, b, as, af)
 Construct a pprofile_class. More...
 
subroutine pprofile_destruct (this)
 Deconstruct a pprofile_class object. More...
 
real(rprec) function pprofile_get_value (this, s_arg)
 Gets the value of a profile at a radial position. More...
 
character(len=p_type_len) function pprofile_get_p_type_name (this)
 Gets the name of the profile type. More...
 
real(rprec) function pprofile_get_gp_ij (this, i, j)
 Get the guassian process kernel value for the two as indicies. More...
 
real(rprec) function pprofile_get_gp_pi (this, p, i)
 Get the guassian process kernel value for the point and index. More...
 
real(rprec) function pprofile_get_gp_pp (this, p1, p2)
 Get the guassian process kernel value for two points. More...
 
integer function pprofile_get_gp_num_hyper_param (this)
 Get the number of hyper parameters for guassian process kernel. More...
 
subroutine pprofile_write (this, id, iou)
 Write out the profile to an output file. More...
 
subroutine pprofile_save_state (this)
 Save the internal state of the profile. More...
 
subroutine pprofile_reset_state (this)
 Reset the internal state of the profile. More...
 
integer function, private findmaxindex (s_array)
 Finds the index of the maximum radial position. More...
 
pure real(rprec) function pprofile_gp_1d_sqexp_k (this, p1, p2)
 Evaluate the one dimensional squared exponential kernel. More...
 
pure real(rprec) function pprofile_gp_1d_sqexp_ln_k (this, p1, p2)
 Evaluate the one dimensional squared exponential kernel. More...
 

Variables

integer, parameter, public p_type_len =20
 Maximum size for parameter profile name lengths.
 
integer, parameter, public ilb_b = 0
 Lower array bound for function profiles.
 
integer, parameter, public iub_b = 21
 Upper array bound for function profiles.
 
integer, parameter, public iub_asf = 101
 Array size for spline profiles.
 
integer, parameter, private pprofile_none_type = -1
 No profile type.
 
integer, parameter, private pprofile_two_power_type = 0
 Two Power profile type.
 
integer, parameter, private pprofile_two_power_gs_type = 1
 Two Power with guassian profile type.
 
integer, parameter, private pprofile_power_series_type = 2
 Power Series profile type.
 
integer, parameter, private pprofile_cubic_spline_type = 3
 Cubic Spline profile type.
 
integer, parameter, private pprofile_akima_spline_type = 4
 Akima Spline profile type.
 
integer, parameter, private pprofile_line_segment_type = 5
 Line Segment profile type.
 
integer, parameter, private pprofile_two_power_r_type = 6
 Reverse Two Power profile type.
 
integer, parameter, private pprofile_gp_1d_sexp_type = 7
 Guassian process profile 1D square exponetal type.
 
integer, parameter, private pprofile_gp_1d_ln_sexp_type = 8
 Guassian process profile 1D square exponetal with the ln of sigma x type.
 

Detailed Description

Defines the base class of the type pprofile_class. This module contains all the code necessary to define parameterized profiles.

Function/Subroutine Documentation

◆ findmaxindex()

integer function, private pprofile_t::findmaxindex ( real(rprec), dimension(:), intent(in)  s_array)
private

Finds the index of the maximum radial position.

This assumes that the radials positions are specifed in increasing order.

Parameters
[in]s_arrayArray of radial positions
Returns
Index of the last position.

Definition at line 851 of file pprofile_T.f.

◆ pprofile_construct()

type (pprofile_class) function, pointer pprofile_t::pprofile_construct ( character (len=*), intent(in)  p_type,
real(rprec), dimension(:), intent(in)  b,
real(rprec), dimension(:), intent(in)  as,
real(rprec), dimension(:), intent(in)  af 
)

Construct a pprofile_class.

Allocates memory and initializes a pprofile_class.

Parameters
[in]p_typeProfile type discription.
[in]bArray of functional profile coefficients
[in]asArray of segmented radial positions.
[in]afArray of segmented profile values.
Returns
A pointer to a constructed pprofile_class object.

Definition at line 195 of file pprofile_T.f.

◆ pprofile_destruct()

subroutine pprofile_t::pprofile_destruct ( type (pprofile_class), pointer  this)

Deconstruct a pprofile_class object.

Deallocates memory and uninitializes a pprofile_class object.

Parameters
[in,out]thisA pprofile_class instance.

Definition at line 302 of file pprofile_T.f.

◆ pprofile_get_gp_ij()

real (rprec) function pprofile_t::pprofile_get_gp_ij ( type (pprofile_class), intent(in)  this,
integer, intent(in)  i,
integer, intent(in)  j 
)

Get the guassian process kernel value for the two as indicies.

Indicies are the index of the as array. Only valid for guassian process profiles.

Parameters
[in]thisA pprofile_class instance.
[in]iith profile position.
[in]jjth profile position.
Returns
The name of the profile type.

Definition at line 538 of file pprofile_T.f.

◆ pprofile_get_gp_num_hyper_param()

integer function pprofile_t::pprofile_get_gp_num_hyper_param ( type (pprofile_class), intent(in)  this)

Get the number of hyper parameters for guassian process kernel.

Hyper parameters must be set to maximise the log of the evidence. If this profile is not a guassian process return zero.

Parameters
[in]thisA pprofile_class instance.
Returns
Number of hyper parameters.

Definition at line 674 of file pprofile_T.f.

◆ pprofile_get_gp_pi()

real (rprec) function pprofile_t::pprofile_get_gp_pi ( type (pprofile_class), intent(in)  this,
real (rprec), intent(in)  p,
integer, intent(in)  i 
)

Get the guassian process kernel value for the point and index.

Index are the index of the as array. Point is a measurement point on the profile. Only valid for guassian process profiles.

Parameters
[in]thisA pprofile_class instance.
[in]pPoint to evaluate the kernel at.
[in]iProfile position index.
Returns
The value of the gp kernel function for p and i.

Definition at line 586 of file pprofile_T.f.

◆ pprofile_get_gp_pp()

real (rprec) function pprofile_t::pprofile_get_gp_pp ( type (pprofile_class), intent(in)  this,
real (rprec), intent(in)  p1,
real (rprec), intent(in)  p2 
)

Get the guassian process kernel value for two points.

Points are a measurement point on the profile. Only valid for guassian process profiles.

Parameters
[in]thisA pprofile_class instance.
[in]p1First point to evaluate the kernel at.
[in]p2SEOND point to evaluate the kernel at.
Returns
The value of the gp kernel function for p and i.

Definition at line 632 of file pprofile_T.f.

◆ pprofile_get_p_type_name()

character (len=p_type_len) function pprofile_t::pprofile_get_p_type_name ( type (pprofile_class), intent(in)  this)

Gets the name of the profile type.

Convertes a profile type to a string discription.

Parameters
[in]thisA pprofile_class instance.
Returns
The name of the profile type.

Definition at line 476 of file pprofile_T.f.

◆ pprofile_get_value()

real (rprec) function pprofile_t::pprofile_get_value ( type (pprofile_class), intent(in)  this,
real (rprec), intent(in)  s_arg 
)

Gets the value of a profile at a radial position.

Evaluates the profile at the specifed radial position. If the radial position is out side the plasma, it returns the baseline value. If there is no profile type specified return the default value.

Parameters
[in]thisA pprofile_class instance.
[in]s_argRadial position to evaluate the profile at.
Returns
The value of the profile.
Todo:
This function makes vmec specific assumptions of 1 being the maximum radial value.

Definition at line 350 of file pprofile_T.f.

◆ pprofile_gp_1d_sqexp_k()

pure real (rprec) function pprofile_t::pprofile_gp_1d_sqexp_k ( type (pprofile_class), intent(in)  this,
real (rprec), intent(in)  p1,
real (rprec), intent(in)  p2 
)

Evaluate the one dimensional squared exponential kernel.

The squared exponential kernel is defined as

b(0)^2*exp(-(x1 - x2)^2/2*b(1)^2) (1)

where b(0) and b(1) are the hyper parameters.

Parameters
[in]thisA pprofile_class instance.
[in]p1First position.
[in]p2Second position.
Returns
Value of the kernel.

Definition at line 885 of file pprofile_T.f.

◆ pprofile_gp_1d_sqexp_ln_k()

pure real (rprec) function pprofile_t::pprofile_gp_1d_sqexp_ln_k ( type (pprofile_class), intent(in)  this,
real (rprec), intent(in)  p1,
real (rprec), intent(in)  p2 
)

Evaluate the one dimensional squared exponential kernel.

This kernel is mathmatically the same as the squared exp kernel, but here we treat the amplitude [ b(0) ] differently. The value of b(0) used here is equal to the log of value of b(0) used in the 1d_sqexp. I'm testing this formulation to see if it helps convergence.

exp(2*b(0) - (x1- x2)**2)/2*b(1)**2) (1)

Parameters
[in]thisA pprofile_class instance.
[in]p1first position
[in]p2second position
[in]bArray of coefficients
Returns
Value of the kernel

Definition at line 917 of file pprofile_T.f.

◆ pprofile_reset_state()

subroutine pprofile_t::pprofile_reset_state ( type (pprofile_class), intent(inout)  this)

Reset the internal state of the profile.

Resets the profile af array if using the guassian process.

Parameters
[in,out]thisA pprofile_class instance.

Definition at line 814 of file pprofile_T.f.

◆ pprofile_save_state()

subroutine pprofile_t::pprofile_save_state ( type (pprofile_class), intent(inout)  this)

Save the internal state of the profile.

Saves the profile af array if using the guassian process.

Parameters
[in,out]thisA pprofile_class instance.

Definition at line 781 of file pprofile_T.f.

◆ pprofile_write()

subroutine pprofile_t::pprofile_write ( type (pprofile_class), intent(in)  this,
character (len=*), intent(in)  id,
integer, intent(in)  iou 
)

Write out the profile to an output file.

This formats and writes out information about a parameterized profile.

Parameters
[in]thisA pprofile_class instance.
[in]idIdentification of the profle.
[in]iouInput/output unit of the output file.

Definition at line 715 of file pprofile_T.f.