SOCA
soca_fields_mod::soca_fields Type Reference

A collection of soca_field types representing a collective state or increment. More...

Inheritance diagram for soca_fields_mod::soca_fields:
Collaboration diagram for soca_fields_mod::soca_fields:

Public Member Functions

constructors / destructors
procedure create => soca_fields_create
 Create a new set of fields, allocate space for them, and initialize to zero. More...
 
procedure copy => soca_fields_copy
 Copy the contents of rhs to self. More...
 
procedure delete => soca_fields_delete
 delete all the fields More...
 
field getters/checkers
procedure get => soca_fields_get
 Get a pointer to the soca_field with the given name. More...
 
procedure has => soca_fields_has
 Returns whether a field with the given name exists. More...
 
procedure check_congruent => soca_fields_check_congruent
 Make sure two sets of fields are the same shape (same variables, same resolution) More...
 
procedure check_subset => soca_fields_check_subset
 make sure two sets of fields are the same shape for fields they have in common More...
 
math operators
procedure add => soca_fields_add
 Add two sets of fields together. More...
 
procedure axpy => soca_fields_axpy
 Add two fields (multiplying the rhs first) More...
 
procedure dot_prod => soca_fields_dotprod
 Calculate the global dot product of two sets of fields. More...
 
procedure gpnorm => soca_fields_gpnorm
 calculate global statistics for each field (min, max, average) More...
 
procedure mul => soca_fields_mul
 Multiply a set of fields by a constant. More...
 
procedure sub => soca_fields_sub
 subtract two sets of fields More...
 
procedure ones => soca_fields_ones
 Set the value of all fields to one. More...
 
procedure zeros => soca_fields_zeros
 Reset the value of all fields to zero. More...
 
I/O
procedure read => soca_fields_read
 read a set of fields from a file More...
 
procedure write_file => soca_fields_write_file
 Save soca fields to file using fms write_data. More...
 
procedure write_rst => soca_fields_write_rst
 Save soca fields in a restart format. More...
 
misc
procedure update_halos => soca_fields_update_halos
 Update the halo region of all fields. More...
 
procedure colocate => soca_fields_colocate
 Colocate by interpolating from one c-grid location to another. More...
 
serialization
procedure serial_size => soca_fields_serial_size
 Number of elements to return in the serialized array. More...
 
procedure serialize => soca_fields_serialize
 Return the fields as a serialized array. More...
 
procedure deserialize => soca_fields_deserialize
 Deserialize, creating fields from a single serialized array. More...
 

Public Attributes

type(soca_geom), pointer geom => null()
 Pointer to the relevant soca_geom_mod::soca_geom. More...
 
type(soca_field), dimension(:), pointer fields => null()
 The soca_field instances that make up the fields. More...
 

Related Functions

(Note that these are not member functions.)

subroutine soca_fields_init_vars (self, vars)
 For a given list of field names, initialize the properties of those fields. More...
 
subroutine soca_fields_create (self, geom, vars)
 Create a new set of fields, allocate space for them, and initialize to zero. More...
 
subroutine soca_fields_delete (self)
 delete all the fields More...
 
subroutine soca_fields_copy (self, rhs)
 Copy the contents of rhs to self. More...
 
subroutine soca_fields_get (self, name, field)
 Get a pointer to the soca_field with the given name. More...
 
logical function soca_fields_has (self, name)
 Returns whether a field with the given name exists. More...
 
subroutine soca_fields_update_halos (self)
 Update the halo region of all fields. More...
 
subroutine soca_fields_ones (self)
 Set the value of all fields to one. More...
 
subroutine soca_fields_zeros (self)
 Reset the value of all fields to zero. More...
 
subroutine soca_fields_add (self, rhs)
 Add two sets of fields together. More...
 
subroutine soca_fields_sub (self, rhs)
 subtract two sets of fields More...
 
subroutine soca_fields_mul (self, zz)
 Multiply a set of fields by a constant. More...
 
subroutine soca_fields_axpy (self, zz, rhs)
 Add two fields (multiplying the rhs first) More...
 
subroutine soca_fields_dotprod (self, rhs, zprod)
 Calculate the global dot product of two sets of fields. More...
 
subroutine soca_fields_read (self, f_conf, vdate)
 read a set of fields from a file More...
 
subroutine soca_fields_gpnorm (self, nf, pstat)
 calculate global statistics for each field (min, max, average) More...
 
subroutine soca_fields_check_congruent (self, rhs)
 Make sure two sets of fields are the same shape (same variables, same resolution) More...
 
subroutine soca_fields_check_subset (self, rhs)
 make sure two sets of fields are the same shape for fields they have in common More...
 
subroutine soca_fields_write_file (self, filename)
 Save soca fields to file using fms write_data. More...
 
subroutine soca_fields_write_rst (self, f_conf, vdate)
 Save soca fields in a restart format. More...
 
subroutine soca_fields_colocate (self, cgridlocout)
 Colocate by interpolating from one c-grid location to another. More...
 
subroutine soca_fields_serial_size (self, geom, vec_size)
 Number of elements to return in the serialized array. More...
 
subroutine soca_fields_serialize (self, geom, vec_size, vec)
 Return the fields as a serialized array. More...
 
subroutine soca_fields_deserialize (self, geom, vec_size, vec, index)
 Deserialize, creating fields from a single serialized array. More...
 

Detailed Description

A collection of soca_field types representing a collective state or increment.

The base class for soca_increment_mod::soca_increment and soca_state_mod::soca_state

Definition at line 109 of file soca_fields_mod.F90.

Member Function/Subroutine Documentation

◆ add()

procedure soca_fields_mod::soca_fields::add

Add two sets of fields together.

See also
soca_fields_add

Definition at line 155 of file soca_fields_mod.F90.

◆ axpy()

procedure soca_fields_mod::soca_fields::axpy

Add two fields (multiplying the rhs first)

See also
soca_fields_axpy

Definition at line 158 of file soca_fields_mod.F90.

◆ check_congruent()

procedure soca_fields_mod::soca_fields::check_congruent

Make sure two sets of fields are the same shape (same variables, same resolution)

See also
soca_fields_check_congruent

Definition at line 144 of file soca_fields_mod.F90.

◆ check_subset()

procedure soca_fields_mod::soca_fields::check_subset

make sure two sets of fields are the same shape for fields they have in common

See also
soca_fields_check_subset

Definition at line 147 of file soca_fields_mod.F90.

◆ colocate()

procedure soca_fields_mod::soca_fields::colocate

Colocate by interpolating from one c-grid location to another.

See also
soca_fields_colocate

Definition at line 201 of file soca_fields_mod.F90.

◆ copy()

procedure soca_fields_mod::soca_fields::copy

Copy the contents of rhs to self.

See also
soca_fields_copy

Definition at line 127 of file soca_fields_mod.F90.

◆ create()

procedure soca_fields_mod::soca_fields::create

Create a new set of fields, allocate space for them, and initialize to zero.

See also
soca_fields_create

Definition at line 124 of file soca_fields_mod.F90.

◆ delete()

procedure soca_fields_mod::soca_fields::delete

delete all the fields

See also
soca_fields_delete

Definition at line 130 of file soca_fields_mod.F90.

◆ deserialize()

procedure soca_fields_mod::soca_fields::deserialize

Deserialize, creating fields from a single serialized array.

See also
soca_fields_deserialize

Definition at line 214 of file soca_fields_mod.F90.

◆ dot_prod()

procedure soca_fields_mod::soca_fields::dot_prod

Calculate the global dot product of two sets of fields.

See also
soca_fields_dotprod

Definition at line 161 of file soca_fields_mod.F90.

◆ get()

procedure soca_fields_mod::soca_fields::get

Get a pointer to the soca_field with the given name.

See also
soca_fields_get

Definition at line 138 of file soca_fields_mod.F90.

◆ gpnorm()

procedure soca_fields_mod::soca_fields::gpnorm

calculate global statistics for each field (min, max, average)

See also
soca_fields_gpnorm

Definition at line 164 of file soca_fields_mod.F90.

◆ has()

procedure soca_fields_mod::soca_fields::has

Returns whether a field with the given name exists.

See also
soca_fields_has

Definition at line 141 of file soca_fields_mod.F90.

◆ mul()

procedure soca_fields_mod::soca_fields::mul

Multiply a set of fields by a constant.

See also
soca_fields_mul

Definition at line 167 of file soca_fields_mod.F90.

◆ ones()

procedure soca_fields_mod::soca_fields::ones

Set the value of all fields to one.

See also
soca_fields_ones

Definition at line 173 of file soca_fields_mod.F90.

◆ read()

procedure soca_fields_mod::soca_fields::read

read a set of fields from a file

See also
soca_fields_read

Definition at line 184 of file soca_fields_mod.F90.

◆ serial_size()

procedure soca_fields_mod::soca_fields::serial_size

Number of elements to return in the serialized array.

See also
soca_fields_serial_size

Definition at line 208 of file soca_fields_mod.F90.

◆ serialize()

procedure soca_fields_mod::soca_fields::serialize

Return the fields as a serialized array.

See also
soca_fields_serialize

Definition at line 211 of file soca_fields_mod.F90.

◆ sub()

procedure soca_fields_mod::soca_fields::sub

subtract two sets of fields

See also
soca_fields_sub

Definition at line 170 of file soca_fields_mod.F90.

◆ update_halos()

procedure soca_fields_mod::soca_fields::update_halos

Update the halo region of all fields.

See also
soca_fields_update_halos

Definition at line 198 of file soca_fields_mod.F90.

◆ write_file()

procedure soca_fields_mod::soca_fields::write_file

Save soca fields to file using fms write_data.

See also
soca_fields_write_file

Definition at line 187 of file soca_fields_mod.F90.

◆ write_rst()

procedure soca_fields_mod::soca_fields::write_rst

Save soca fields in a restart format.

See also
soca_fields_write_rst

Definition at line 190 of file soca_fields_mod.F90.

◆ zeros()

procedure soca_fields_mod::soca_fields::zeros

Reset the value of all fields to zero.

See also
soca_fields_zeros

Definition at line 176 of file soca_fields_mod.F90.

Friends And Related Function Documentation

◆ soca_fields_add()

subroutine soca_fields_add ( class(soca_fields), intent(inout)  self,
class(soca_fields), intent(in)  rhs 
)
related

Add two sets of fields together.

\( self = self + rhs \)

Exceptions
abor1_ftnaborts if two fields are not congruent
Parameters
[in]rhsother field to add

Definition at line 585 of file soca_fields_mod.F90.

◆ soca_fields_axpy()

subroutine soca_fields_axpy ( class(soca_fields), intent(inout)  self,
real(kind=kind_real), intent(in)  zz,
class(soca_fields), intent(in)  rhs 
)
related

Add two fields (multiplying the rhs first)

\(self = self + zz * rhs\)

Exceptions
abor1_ftnaborts if is not a subset of \rhs
Parameters
[in]zzconstant by which to multiply other rhs
[in]rhsother field to add

Definition at line 645 of file soca_fields_mod.F90.

◆ soca_fields_check_congruent()

subroutine soca_fields_check_congruent ( class(soca_fields), intent(in)  self,
class(soca_fields), intent(in)  rhs 
)
related

Make sure two sets of fields are the same shape (same variables, same resolution)

Exceptions
abor1_ftnaborts if two fields are not congruent.
Parameters
[in]rhsother fields to check for congruency

Definition at line 1016 of file soca_fields_mod.F90.

◆ soca_fields_check_subset()

subroutine soca_fields_check_subset ( class(soca_fields), intent(in)  self,
class(soca_fields), intent(in)  rhs 
)
related

make sure two sets of fields are the same shape for fields they have in common

Exceptions
abor1_ftnaborts if self is not a subset of rhs
Parameters
[in]rhsother field that self should be subset of

Definition at line 1044 of file soca_fields_mod.F90.

◆ soca_fields_colocate()

subroutine soca_fields_colocate ( class(soca_fields), intent(inout)  self,
character(len=1), intent(in)  cgridlocout 
)
related

Colocate by interpolating from one c-grid location to another.

Warning
only works on the "h" grid currently (not the "u" or "v" grid)
Parameters
[in]cgridlocoutcolocate to cgridloc (u, v or h)

Definition at line 1181 of file soca_fields_mod.F90.

◆ soca_fields_copy()

subroutine soca_fields_copy ( class(soca_fields), intent(inout)  self,
class(soca_fields), intent(in)  rhs 
)
related

Copy the contents of rhs to self.

self will be initialized with the variable names in rhs if not already initialized.

See also
soca_fields_init_vars
Parameters
[in]rhsfields to copy from

Definition at line 459 of file soca_fields_mod.F90.

◆ soca_fields_create()

subroutine soca_fields_create ( class(soca_fields), intent(inout)  self,
type(soca_geom), intent(inout), pointer  geom,
type(oops_variables), intent(inout)  vars 
)
related

Create a new set of fields, allocate space for them, and initialize to zero.

See also
soca_fields_init_vars
Parameters
[in,out]geomgeometry to associate with the fields
[in,out]varslist of field names to create

Definition at line 405 of file soca_fields_mod.F90.

◆ soca_fields_delete()

subroutine soca_fields_delete ( class(soca_fields), intent(inout)  self)
related

delete all the fields

Definition at line 436 of file soca_fields_mod.F90.

◆ soca_fields_deserialize()

subroutine soca_fields_deserialize ( class(soca_fields), intent(inout)  self,
type(soca_geom), intent(in)  geom,
integer, intent(in)  vec_size,
real(kind=kind_real), dimension(vec_size), intent(in)  vec,
integer, intent(inout)  index 
)
related

Deserialize, creating fields from a single serialized array.

See also
soca_fields_serialize
Parameters
[in]geomtodo remove this, not needed?
[in]vec_sizesize of vec
[in]vecvector to deserialize
[in,out]indexindex in vec at which to start deserializing

Definition at line 1302 of file soca_fields_mod.F90.

◆ soca_fields_dotprod()

subroutine soca_fields_dotprod ( class(soca_fields), intent(in)  self,
class(soca_fields), intent(in)  rhs,
real(kind=kind_real), intent(out)  zprod 
)
related

Calculate the global dot product of two sets of fields.

Exceptions
abor1_ftnaborts if two fields are not congruent
Parameters
[in]rhsfield 2 of dot product
[out]zprodThe resulting dot product

Definition at line 670 of file soca_fields_mod.F90.

◆ soca_fields_get()

subroutine soca_fields_get ( class(soca_fields), intent(in)  self,
character(len=*), intent(in)  name,
type(soca_field), intent(out), pointer  field 
)
related

Get a pointer to the soca_field with the given name.

Note
use soca_fields::has() if you need to check for optional fields
Exceptions
abor1_ftnIf no field exists with that name, the prorgam aborts
Parameters
[in]namename of field to find
[out]fielda pointer to the resulting field

Definition at line 493 of file soca_fields_mod.F90.

◆ soca_fields_gpnorm()

subroutine soca_fields_gpnorm ( class(soca_fields), intent(in)  self,
integer, intent(in)  nf,
real(kind=kind_real), dimension(3, nf), intent(out)  pstat 
)
related

calculate global statistics for each field (min, max, average)

Parameters
[in]nfThe number of fields, should be equal to the size of soca_fields::fields
[out]pstata 2D array with shape (i,j). For each field index i is set as 0 = min, 1 = max, 2 = average, for j number of fields.

Definition at line 973 of file soca_fields_mod.F90.

Here is the call graph for this function:

◆ soca_fields_has()

logical function soca_fields_has ( class(soca_fields), intent(in)  self,
character(len=*), intent(in)  name 
)
related

Returns whether a field with the given name exists.

Parameters
[in]namename of field to find

Definition at line 517 of file soca_fields_mod.F90.

◆ soca_fields_init_vars()

subroutine soca_fields_init_vars ( class(soca_fields), intent(inout)  self,
character(len=:), dimension(:), intent(in), allocatable  vars 
)
related

For a given list of field names, initialize the properties of those fields.

Parameters
[in]varsList of variables to initialize. They must be present in the configuration file used to create soca_fields_metadata_mod::soca_fields_metadata
Exceptions
abor1_ftnaborts if illegal grid or levels specified

Definition at line 338 of file soca_fields_mod.F90.

◆ soca_fields_mul()

subroutine soca_fields_mul ( class(soca_fields), intent(inout)  self,
real(kind=kind_real), intent(in)  zz 
)
related

Multiply a set of fields by a constant.

\( self = zz * self \)

Parameters
[in]zzthe constant by which to multipy the field

Definition at line 627 of file soca_fields_mod.F90.

◆ soca_fields_ones()

subroutine soca_fields_ones ( class(soca_fields), intent(inout)  self)
related

Set the value of all fields to one.

Definition at line 552 of file soca_fields_mod.F90.

◆ soca_fields_read()

subroutine soca_fields_read ( class(soca_fields), intent(inout)  self,
type(fckit_configuration), intent(in)  f_conf,
type(datetime), intent(inout)  vdate 
)
related

read a set of fields from a file

Parameters
[in]f_conf: Configuration with the following parameters
  • "read_from_file" :
    • 0 = Invent the state
    • 1 = read state
    • 2 = (nothing]
    • 3 = read increment
  • "remap_filename" : (optional) the filename containing "h" to perform the vertical remapping of these fields after they are loaded.
  • "date" : (required if read_from_file == 0)
  • "basename" : The common part of the path prepended to the following *_filename parameters
  • "ocn_filename" : ocean filename
  • "sfc_filename" : (optional) surface field filename
  • "ice_filename" : (optional) ice field filename
  • "wav_filename" : (optoinal) wave field filename
[in,out]vdate: If fields are being invented (read_from_file == 0), the vdate is used as the valid date of the fields. If the fields are being read in as a state (read_from_file == 1), vdate is set the the date from the files

Definition at line 732 of file soca_fields_mod.F90.

Here is the call graph for this function:

◆ soca_fields_serial_size()

subroutine soca_fields_serial_size ( class(soca_fields), intent(in)  self,
type(soca_geom), intent(in)  geom,
integer, intent(out)  vec_size 
)
related

Number of elements to return in the serialized array.

See also
soca_fields_serialize
Parameters
[in]geomtodo remove, not needed?
[out]vec_sizeresulting size of vector

Definition at line 1258 of file soca_fields_mod.F90.

◆ soca_fields_serialize()

subroutine soca_fields_serialize ( class(soca_fields), intent(in)  self,
type(soca_geom), intent(in)  geom,
integer, intent(in)  vec_size,
real(kind=kind_real), dimension(vec_size), intent(out)  vec 
)
related

Return the fields as a serialized array.

See also
soca_fields_serial_size
Parameters
[in]geomtodo remove this, not needed?
[in]vec_sizesize of vector to return
[out]vecfields as a serialized vector

Definition at line 1279 of file soca_fields_mod.F90.

◆ soca_fields_sub()

subroutine soca_fields_sub ( class(soca_fields), intent(inout)  self,
class(soca_fields), intent(in)  rhs 
)
related

subtract two sets of fields

\( self = self - rhs \)

Exceptions
abor1_ftnaborts if two fields are not congruent
Parameters
[in]rhsother field to subtract

Definition at line 607 of file soca_fields_mod.F90.

◆ soca_fields_update_halos()

subroutine soca_fields_update_halos ( class(soca_fields), intent(inout)  self)
related

Update the halo region of all fields.

Definition at line 538 of file soca_fields_mod.F90.

◆ soca_fields_write_file()

subroutine soca_fields_write_file ( class(soca_fields), intent(in)  self,
character(len=*), intent(in)  filename 
)
related

Save soca fields to file using fms write_data.

Parameters
[in]filename: The name of the file to save to

Definition at line 1071 of file soca_fields_mod.F90.

◆ soca_fields_write_rst()

subroutine soca_fields_write_rst ( class(soca_fields), intent(inout)  self,
type(fckit_configuration), intent(in)  f_conf,
type(datetime), intent(inout)  vdate 
)
related

Save soca fields in a restart format.

TODO this can be generalized even more

Parameters
[in,out]selfFields
[in]f_confConfiguration
[in,out]vdateDateTime

Definition at line 1097 of file soca_fields_mod.F90.

Here is the call graph for this function:

◆ soca_fields_zeros()

subroutine soca_fields_zeros ( class(soca_fields), intent(inout)  self)
related

Reset the value of all fields to zero.

Definition at line 567 of file soca_fields_mod.F90.

Member Data Documentation

◆ fields

type(soca_field), dimension(:), pointer soca_fields_mod::soca_fields::fields => null()

The soca_field instances that make up the fields.

Definition at line 117 of file soca_fields_mod.F90.

◆ geom

type(soca_geom), pointer soca_fields_mod::soca_fields::geom => null()

Pointer to the relevant soca_geom_mod::soca_geom.

Note
This should never remain null() after initialization of the class.

Definition at line 114 of file soca_fields_mod.F90.


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