PartMC 2.1.2
Data Types | Functions/Subroutines
pmc_gas_state Module Reference

The gas_state_t structure and associated subroutines. More...

Data Types

type  gas_state_t
 Current state of the gas mixing ratios in the system. More...

Functions/Subroutines

subroutine gas_state_allocate (gas_state)
 Allocate storage for gas species.
subroutine gas_state_allocate_size (gas_state, n_spec)
 Allocate storage for gas species of the given size.
subroutine gas_state_deallocate (gas_state)
 Free all storage.
subroutine gas_state_zero (gas_state)
 Zeros the state.
subroutine gas_state_copy (from_state, to_state)
 Copy to an already allocated to_state.
subroutine gas_state_scale (gas_state, alpha)
 Scale a gas state.
subroutine gas_state_add (gas_state, gas_state_delta)
 Adds the given gas_state_delta.
subroutine gas_state_sub (gas_state, gas_state_delta)
 Subtracts the given gas_state_delta.
subroutine gas_state_axpy (alpha, gas_state_x, gas_state_y)
 Sets y = a * x + y.
subroutine gas_state_ensure_nonnegative (gas_state)
 Set any negative values to zero.
subroutine gas_state_interp_1d (gas_state_list, time_list, rate_list, time, gas_state, rate)
 Determine the current gas_state and rate by interpolating at the current time with the lists of gas_states and rates.
subroutine spec_file_read_gas_state (file, gas_data, gas_state)
 Read gas state from the file named on the line read from file.
subroutine spec_file_read_gas_states_times_rates (file, gas_data, times, rates, gas_states)
 Read an array of gas states with associated times and rates from the file named on the line read from the given file.
subroutine gas_state_mix (val)
 Average val over all processes.
subroutine gas_state_reduce_avg (val)
 Average val over all processes, with the result only on the root process.
integer pmc_mpi_pack_size_gas_state (val)
 Determines the number of bytes required to pack the given value.
subroutine pmc_mpi_pack_gas_state (buffer, position, val)
 Packs the given value into the buffer, advancing position.
subroutine pmc_mpi_unpack_gas_state (buffer, position, val)
 Unpacks the given value from the buffer, advancing position.
subroutine pmc_mpi_reduce_avg_gas_state (val, val_avg)
 Computes the average of val across all processes, storing the result in val_avg on the root process.
subroutine gas_state_output_netcdf (gas_state, ncid, gas_data)
 Write full state.
subroutine gas_state_input_netcdf (gas_state, ncid, gas_data)
 Read full state.

Detailed Description

The gas_state_t structure and associated subroutines.


Function/Subroutine Documentation

subroutine pmc_gas_state::gas_state_add ( type(gas_state_t),intent(inout)  gas_state,
type(gas_state_t),intent(in)  gas_state_delta 
)

Adds the given gas_state_delta.

Parameters:
gas_stateExisting gas state.
gas_state_deltaIncremental state.

Definition at line 119 of file gas_state.F90.

subroutine pmc_gas_state::gas_state_allocate ( type(gas_state_t),intent(out)  gas_state)

Allocate storage for gas species.

Parameters:
gas_stateGas state to be allocated.

Definition at line 35 of file gas_state.F90.

subroutine pmc_gas_state::gas_state_allocate_size ( type(gas_state_t),intent(out)  gas_state,
integer,intent(in)  n_spec 
)

Allocate storage for gas species of the given size.

Parameters:
gas_stateGas state to be allocated.
n_specNumber of species.

Definition at line 47 of file gas_state.F90.

subroutine pmc_gas_state::gas_state_axpy ( real(kind=dp),intent(in)  alpha,
type(gas_state_t),intent(in)  gas_state_x,
type(gas_state_t),intent(inout)  gas_state_y 
)

Sets y = a * x + y.

Parameters:
alphaCoefficient.
gas_state_xIncremental state.
gas_state_yExisting gas state.

Definition at line 147 of file gas_state.F90.

subroutine pmc_gas_state::gas_state_copy ( type(gas_state_t),intent(in)  from_state,
type(gas_state_t),intent(inout)  to_state 
)

Copy to an already allocated to_state.

Parameters:
from_stateExisting gas state.
to_stateMust be allocated already.

Definition at line 86 of file gas_state.F90.

subroutine pmc_gas_state::gas_state_deallocate ( type(gas_state_t),intent(inout)  gas_state)

Free all storage.

Parameters:
gas_stateGas state to be freed.

Definition at line 62 of file gas_state.F90.

subroutine pmc_gas_state::gas_state_ensure_nonnegative ( type(gas_state_t)  gas_state)

Set any negative values to zero.

Parameters:
gas_stateGas state.

Definition at line 163 of file gas_state.F90.

subroutine pmc_gas_state::gas_state_input_netcdf ( type(gas_state_t),intent(inout)  gas_state,
integer,intent(in)  ncid,
type(gas_data_t),intent(in)  gas_data 
)

Read full state.

Parameters:
gas_stateGas state to read.
ncidNetCDF file ID, in data mode.
gas_dataGas data.

Definition at line 579 of file gas_state.F90.

subroutine pmc_gas_state::gas_state_interp_1d ( type(gas_state_t),dimension(:),intent(in)  gas_state_list,
real(kind=dp),dimension(size(gas_state_list)),intent(in)  time_list,
real(kind=dp),dimension(size(gas_state_list)),intent(in)  rate_list,
real(kind=dp),intent(in)  time,
type(gas_state_t),intent(inout)  gas_state,
real(kind=dp),intent(out)  rate 
)

Determine the current gas_state and rate by interpolating at the current time with the lists of gas_states and rates.

Parameters:
gas_state_listGas states.
time_listTimes (s).
rate_listRates (s^{-1}).
timeCurrent time (s).
gas_stateCurrent gas state.
rateCurrent rate (s^{-1}).

Definition at line 176 of file gas_state.F90.

subroutine pmc_gas_state::gas_state_mix ( type(gas_state_t),intent(inout)  val)

Average val over all processes.

Parameters:
valValue to average.

Definition at line 427 of file gas_state.F90.

subroutine pmc_gas_state::gas_state_output_netcdf ( type(gas_state_t),intent(in)  gas_state,
integer,intent(in)  ncid,
type(gas_data_t),intent(in)  gas_data 
)

Write full state.

Parameters:
gas_stateGas state to write.
ncidNetCDF file ID, in data mode.
gas_dataGas data.

Definition at line 542 of file gas_state.F90.

subroutine pmc_gas_state::gas_state_reduce_avg ( type(gas_state_t),intent(inout)  val)

Average val over all processes, with the result only on the root process.

Parameters:
valValue to average.

Definition at line 447 of file gas_state.F90.

subroutine pmc_gas_state::gas_state_scale ( type(gas_state_t),intent(inout)  gas_state,
real(kind=dp),intent(in)  alpha 
)

Scale a gas state.

Parameters:
gas_stateExisting gas state.
alphaScale factor.

Definition at line 105 of file gas_state.F90.

subroutine pmc_gas_state::gas_state_sub ( type(gas_state_t),intent(inout)  gas_state,
type(gas_state_t),intent(in)  gas_state_delta 
)

Subtracts the given gas_state_delta.

Parameters:
gas_stateExisting gas state.
gas_state_deltaIncremental state.

Definition at line 133 of file gas_state.F90.

subroutine pmc_gas_state::gas_state_zero ( type(gas_state_t),intent(inout)  gas_state)

Zeros the state.

Parameters:
gas_stateGas state.

Definition at line 74 of file gas_state.F90.

subroutine pmc_gas_state::pmc_mpi_pack_gas_state ( character,dimension(:),intent(inout)  buffer,
integer,intent(inout)  position,
type(gas_state_t),intent(in)  val 
)

Packs the given value into the buffer, advancing position.

Parameters:
bufferMemory buffer.
positionCurrent buffer position.
valValue to pack.

Definition at line 481 of file gas_state.F90.

integer pmc_gas_state::pmc_mpi_pack_size_gas_state ( type(gas_state_t),intent(in)  val)

Determines the number of bytes required to pack the given value.

Parameters:
valValue to pack.

Definition at line 468 of file gas_state.F90.

subroutine pmc_gas_state::pmc_mpi_reduce_avg_gas_state ( type(gas_state_t),intent(in)  val,
type(gas_state_t),intent(inout)  val_avg 
)

Computes the average of val across all processes, storing the result in val_avg on the root process.

Parameters:
valValue to average.
val_avgResult.

Definition at line 528 of file gas_state.F90.

subroutine pmc_gas_state::pmc_mpi_unpack_gas_state ( character,dimension(:),intent(inout)  buffer,
integer,intent(inout)  position,
type(gas_state_t),intent(inout)  val 
)

Unpacks the given value from the buffer, advancing position.

Parameters:
bufferMemory buffer.
positionCurrent buffer position.
valValue to pack.

Definition at line 504 of file gas_state.F90.

subroutine pmc_gas_state::spec_file_read_gas_state ( type(spec_file_t),intent(inout)  file,
type(gas_data_t),intent(in)  gas_data,
type(gas_state_t),intent(inout)  gas_state 
)

Read gas state from the file named on the line read from file.

Parameters:
fileFile to read gas state from.
gas_dataGas data.
gas_stateGas data to read.

Definition at line 216 of file gas_state.F90.

subroutine pmc_gas_state::spec_file_read_gas_states_times_rates ( type(spec_file_t),intent(inout)  file,
type(gas_data_t),intent(in)  gas_data,
real(kind=dp),dimension(:),pointer  times,
real(kind=dp),dimension(:),pointer  rates,
type(gas_state_t),dimension(:),pointer  gas_states 
)

Read an array of gas states with associated times and rates from the file named on the line read from the given file.

Parameters:
fileSpec file.
gas_dataGas data.
timesTimes (s).
ratesRates (s^{-1}).
gas_statesGas states.

Definition at line 285 of file gas_state.F90.