conesToolBox package

Submodules

conesToolBox.conesClasses module

class conesToolBox.conesClasses.conesClip(name)[source]

Bases: object

A Class for clippings

Author:

Paolo Errante

Version:

1.0.0

get_clip_data(globalCellList)[source]

Reads and sets the clippings cell lists

Parameters:

globalCellList (list) – List of global cells ids

Returns:

None

report()[source]

Print to stdout a report of the clipping object

class conesToolBox.conesClasses.conesEnKF(region)[source]

Bases: object

A class containing all the basic elements to perform the Ensemble Kalman filter analysis phase

KalmanGain()[source]

Checks for matrix inversion and set the Kalman Gain

Returns:

None

anomaly(x)[source]

Calculate an anomaly matrix

Parameters:

x (numpy ndarray) – Matrix containing the ensemble members data

Returns:

The anomaly matrix

Return type:

numpy ndarray

dump_error_convergence()[source]

Dumps in file “err.log” the norm of the difference between observation and model sampling

Returns:

None

dump_params_convergence()[source]

Dumps in file “par.log” the updated parameter ensemble mean and standard deviation

Returns:

None

full_report()[source]

Prints and extended report of the EnKF main features.

Returns:

None

inflate(arr, infl)[source]

Applies stochastic inflation on a matrix

Parameters:
  • arr (numpy ndarray) – the matrix to be inflated

  • infl (float) – inflation coefficient

Returns:

arr

Return type:

numpy ndarray

inflateParams(infl)[source]

Stochastic inflation of the updated parameters matrix

Parameters:

infl (float) – The inflation coefficient

Returns:

None

inflateState(infl)[source]

Stochastic inflation of the updated state matrix

Parameters:

infl (float) – The inflation coefficient

Returns:

None

setH()[source]

Returns the EnKF sampling matrix

Returns:

H

Return type:

numpy ndarray

setObs()[source]

Add noise to the observation vector

Returns:

y

Return type:

numpy ndarray

setParams(params)[source]

Set the EnKF parameters

Parameters:

params (numpy ndarray) – The parameters vector

Returns:

None

setR()[source]

Set the observation covariance matrix from the conesRegions observations

Returns:

R

Return type:

numpy ndarray

setSampling(sampling)[source]

Set the EnKF sampling H(x)

Parameters:

sampling (numpy ndarray) – The sampling matrix

Returns:

None

setState(state)[source]

Set the EnKF state

Parameters:

state (numpy ndarray) – The state vector

Returns:

None

small_report()[source]

Prints to stdout a smaller report of the EnKF

Returns:

None

update()[source]

Updates the state and parameters matrix

Returns:

None

updateParams()[source]

Sets the updated parameters matrix

Returns:

None

updateState()[source]

Sets the updated state matrix

Returns:

None

class conesToolBox.conesClasses.conesParams[source]

Bases: object

A Class for Parameters. It has to be developed.

class conesToolBox.conesClasses.conesRegion[source]

Bases: object

A class to define a Data Assimilation region

addObs(obs)[source]

Method to include an observation to the region

Parameters:

obs (conesStaticObservation) – The observation

Returns:

None

filterSampling(sampling)[source]
filterState(state, stateCells)[source]
full_report()[source]

Prints an extended report of the region to stdout

report()[source]

Prints a report of the region to stdout

setParams(params)[source]

Set the parameters associated to the region

Parameters:

params (numpy ndarray) – array of parameters

Returns:

None

setRanks()[source]

Set the number of ranks that spans the region

Returns:

None

setState(state)[source]

Set the state vector for the region

Parameters:

state (numpy ndarray) – State Matrix

Returns:

None

splitState()[source]
class conesToolBox.conesClasses.conesSettings(casePath)[source]

Bases: object

A class that groups settings for cones

checkPath(path)[source]

Check if path exists

Parameters:

path (str) – The file directory

Returns:

Boolean

Return type:

bool

clipByRank()[source]

A function that separates clipping by rank :returns: list of clips :rtype: list

get_clippings()[source]

Function that reads the clippings in polyMesh/sets/ Returns a list of clippings

Returns:

list of clippings

Return type:

list

get_option(keyword, dictionary)[source]

A function to get options in an OpenFOAM dictionary :param keyword: the name of the option to get :type keyword: str :param dictionary: the name of the dictionary that contains the keyword :type dictionary: str :returns: The value set for the keyword

get_ranks()[source]

A function that get the number of ranks in a OpenFOAM simulation

Returns:

the number of processors of the original simulation

Return type:

int

mergeClips()[source]

Given a list of conesClip, finds clippings that shares cells and merge them

Returns:

the list of conesClip after merge

Return type:

list

report_regions()[source]

Prints to stdout reports of conesRegions

setGlobalCells()[source]

Generate a list of global cell ids splitted by ranks

Returns:

list of global cells ids

Return type:

list

setGlobalStateCells()[source]

Sets a list of global cell ids belonging from which state variables are extracted

Returns:

None

setLocalCells()[source]

Generate a list of local cells ids splitted by ranks

Returns:

list of local cells ids

Return type:

list

setLocalStateCells()[source]

Sets a list of local (rank) cell ids belonging from which state variables are extracted

Returns:

None

class conesToolBox.conesClasses.conesStaticObservation[source]

Bases: object

report()[source]

conesToolBox.conesErrors module

exception conesToolBox.conesErrors.conesPathNotFound(path)[source]

Bases: Exception

Exception raised when the files are not found

exception conesToolBox.conesErrors.obsNotInClippingsError[source]

Bases: Exception

conesToolBox.conesFunctions module

conesToolBox.conesFunctions.global2Local(globalID, globalCellList)[source]
conesToolBox.conesFunctions.local2Global(localID, globalCellList, rank)[source]
conesToolBox.conesFunctions.mergeClips(clipList, globalCellList)[source]

Given a list of conesClip, finds clippings that shares cells and merge them

Parameters:
  • clipList (list) – the list of clippings

  • globalCellList (list) – the list of global cell ids

Returns:

the list of global cells id of merged clips

Return type:

list

conesToolBox.conesFunctions.printCones(*args)[source]

Prints a message including the name of the function from which it was called.

conesToolBox.conesMPI module

Module contents