Mordicus.Core.Containers.CollectionProblemData module¶
- class Mordicus.Core.Containers.CollectionProblemData.CollectionProblemData[source]¶
Bases:
object
Class containing a set of collection of problemData
- problemDatas¶
dictionary with problem tags (str) as keys and problemDatas (ProblemData) as values
- Type
dict(str: ProblemData)
- reducedOrderBases¶
dictionary with solutionNames (str) as keys and reducedOrderBases (np.ndarray of size (numberOfModes, numberOfDOFs)) as values
- Type
dict(str: np.ndarray)
- solutionStructures¶
dictionary with solutionNames (str) as keys and SolutionStructure as values
- Type
dict(str: SolutionStructure)
- variabilityDefinition¶
defines the problem variability, dictionary with variability names (typically, names of parameters) as keys
- Type
dict(str: dict)
- variabilitySupport¶
defines the allowed values for parameters (definition domain), dictionary with the parameter sampling as values
- Type
dict(str or tuple: ndarray)
- quantityDefinition¶
defines a new quantity for results, dictionary with solutionNames (str) as keys and a couple for strings (solution description, unit) as values
- Type
dict(str: (str,str))
- templateDataset¶
dataset to solve the HF problem for a new set of parameter values, contains a input_instruction_file with keywords to replace
- Type
- reducedTemplateDataset¶
dataset to solve the reduced problem for a new set of parameter values, contains a input_instruction_file with keywords to replace
- Type
- specificDatasets¶
dictonary with the name of the operation as key and corresponding SolverDataset as value
- Type
dict(str: SolverDataset)
- dataCompressionData¶
dictionary with solutionNames (str) as keys and data structure generated by the data compression step as values
- Type
dict(str: custom_data_structure)
- operatorCompressionData¶
dictionary with solutionNames (str) as keys and data structure generated by the operator compression step as values
- Type
dict(str: custom_data_structure)
- AddProblemData(problemData, **kwargs)[source]¶
Adds a problemData to the structure
- Parameters
problemData (ProblemData) – to add to the problemDatas dictionary
kwargs – same type as the axes of variability, gives the point in parameter space at which to add data
- AddReducedOrderBasis(solutionName, reducedOrderBasis)[source]¶
Adds a reducedOrderBasis corresponding to solution solutionName
- Parameters
solutionName (str) – name of the solution for which reducedOrderBasis is a reduced order basis
reducedOrderBasis (np.ndarray) – of size (numberOfModes, numberOfDOFs)
- AddVariabilityAxis(varname, vartype, **kwargs)[source]¶
- Sets the axes of variability: names to be served as keys
to collect ProblemData instances and documenting properties
- Parameters
varname (str) – name of the axis, to be served as keys
vartype (type) – type of the expected values for this axis
quantity (tuple) – (optional) describes the physical quantity of the parameter. For now a tuple (full name, unit)
description (str) – (optional) describes the role of the axis of variability
- CompressSolutions(solutionName, snapshotCorrelationOperator=None)[source]¶
Compress solutions of name “solutionName” from all ProblemDatas in collectionProblemData, and update to corresponding solution.compressedSnapshots.
- Parameters
solutionName (str) – name of the solutions to compress
snapshotCorrelationOperator (scipy.sparse.csr, optional) – correlation operator between the snapshots
- CompressedSnapshotsIterator(solutionName, skipFirst=False)[source]¶
Constructs an iterator over compressedSnapshots of solutions of name “solutionName” in all problemDatas.
- Parameters
solutionName (str) – name of the solutions on which we want to iterate over compressedSnapshots
skipFirst (bool) – (optional) True for skipping first time step of each ProblemData
- Returns
an iterator over compressedSnapshots of solutions of name “solutionName” in all problemDatas
- Return type
iterator
- ComputeReducedOrderBasisProjection(solutionName, newReducedOrderBasis, snapshotCorrelationOperator=None)[source]¶
Computes the projection of reducedOrderBasis[solutionName] on newReducedOrderBases
- Parameters
solutionName (str) – name of the solutions to compress
newReducedOrderBasis (np.ndarray) – of size (newNumberOfModes, numberOfDOFs)
snapshotCorrelationOperator (scipy.sparse.csr, optional) – correlation operator between the snapshots
- Returns
of size (newNumberOfModes, numberOfModes)
- Return type
np.ndarray
- ConvertCompressedSnapshotReducedOrderBasis(solutionName, projectedReducedOrderBasis)[source]¶
Converts the reducedSnapshot from the current reducedOrderBasis to a newReducedOrderBasis using a projectedReducedOrderBasis between the current one and a new one
- Parameters
solutionName (str) – name of the solution whose compressedSnapshot is to convert
projectedReducedOrderBasis (np.ndarray) – of size (newNumberOfModes, numberOfModes)
- DefineQuantity(key, full_name='', unit='')[source]¶
Define a new quantity for results
- Parameters
key (str) – Key to be served in ProblemData to retrieve the result
full_name (str) – Full name of the quantity, e.g. “velocity”
unit (str) – Measuring unit, e.g. “meter”
- DefineVariabilityAxes(names, types, quantities=None, descriptions=None)[source]¶
- Sets the axes of variability: names to be served as keys
to collect ProblemData instances and documenting properties
- Parameters
names (tuple) – names of axes, to be served as keys
types (type) – type of the expected values for this axis
quantities (iterable) – (optional) describes the physical quantity of the parameter. For now an iterable of tuples (full name, unit)
descriptions (iterable) – (optional) describes the role of the axis of variability
- DefineVariabilitySupport(parameters, ndarrays)[source]¶
- Parameters
parameters (iterable) – iterable over the identifiers (str or tuple(str)) of parameters
ndarrays (iterable) – iterable over the discrete support for each identifier
Note
Parameters may have a tuple of parameters as a component, when the discrete support along these two or more parameters is not cartesian.
Then, the corresponding ndarray has shape (numberOfPoints, numerOfParametersInTuple)
The whole discrete support is generated as a cartesian product of discrete supports.
- GenerateVariabilitySupport()[source]¶
Realizes the catersian product to generate full grid for variability support
- Returns
ndarray of shape(totalNumberOfPoints, numberOfParameters) with the coordinates of points
- Return type
ndarray
Note
On the last axis, parameters values are those of the parameters in the order they were declared in defineVariabilitySupport
- GetCompressedSnapshots(solutionName, skipFirst=False)[source]¶
Returns compressed snapshots of solution solutionName from all problemDatas, in a numpy array
- Parameters
solutionName (str) – name of the solutions on which we want to iterate over compressedSnapshots
skipFirst (bool) – (optional) True for skipping first time step of each ProblemData
- Returns
of size (nbSnapshots, numberOfModes)
- Return type
np.ndarray
- GetCompressedSnapshotsAtTimes(solutionName, timeSequence)[source]¶
Returns compressed snapshots of solution solutionName from all problemDatas and for a given time sequence, in a numpy array
- Parameters
solutionName (str) – name of the solutions on which we want to iterate over compressedSnapshots
timeSequence (list or numpy array) – time steps for snapshot retrieving (doing time interpolation if needed)
- Returns
of size (nbSnapshots, numberOfModes)
- Return type
np.ndarray
- GetDataCompressionData(key)[source]¶
Get a precomputed dataCompressionData for key
- Parameters
key (str) – key for which dataCompressionData corresponds
- Return type
dataCompressionData type
- GetGlobalNumberOfSnapshots(solutionName, skipFirst=False)[source]¶
Iterates over problemDatas to return the complete number of snpashots for solutions of name “solutionName”
- Parameters
solutionName (str) – name of the solutions for which we want to compute the total number of snapshots
- Returns
number of snpashots for solutions of name “solutionName”
- Return type
int
- GetLoadingsOfType(type)[source]¶
Returns a list of loadings of a given type
- Parameters
type (str) – type of loadings (eg. pressure) as defined in the LoadingBase structure
- Returns
of Loadings
- Return type
list
- GetNumberOfProblemDatas()[source]¶
Returns the number of problemDatas
- Returns
the number of problemDatas
- Return type
int
- GetNumberOfVariabilityAxes()[source]¶
Gets the number of variability axes.
- Returns
number of variability axes
- Return type
int
- GetOperatorCompressionData()[source]¶
Get the operatorCompressionData
- Returns
custom data structure
- Return type
operatorCompressionData
- GetParameterDimension()[source]¶
Asserts that the parameters of all problemDatas have the same parameterDimension and returns this size
- Returns
parameterDimension of problemDatas
- Return type
int
- GetProblemData(**kwargs)[source]¶
Returns a specific problemData
- Parameters
kwargs – same type as the axes of variability, gives the point in parameter space at which to add data
- Returns
retrieved problemData
- Return type
- GetProblemDatas()[source]¶
Returns the complete problemDatas dictionary
- Returns
problemDatas of the collectionProblemData
- Return type
dict
- GetProblemSampling()[source]¶
Return the tags of problemDatas
- Returns
list of tuples containing the computed parameter points of the available problemDatas
- Return type
list
- GetReducedOrderBases()[source]¶
Get the dictionary of precomputed reducedOrderBases
- Returns
reducedOrderBases – dictionary with solutionNames (str) as keys and reducedOrderBases (np.ndarray of size (numberOfModes, numberOfDOFs)) as values
- Return type
dict
- GetReducedOrderBasis(solutionName)[source]¶
Get a precomputed reducedOrderBases for solution solutionName
- Parameters
solutionName (str) – name of the solution for which the reducedOrderBases is retrieved
- Returns
of size (numberOfModes, numberOfDOFs)
- Return type
np.ndarray
- GetReducedOrderBasisNumberOfModes(solutionName)[source]¶
Get the number of modes of a precomputed reducedOrderBases for solution solutionName
- Parameters
solutionName (str) – name of the solution for which the reducedOrderBases is retrieved
- Returns
numberOfModes
- Return type
int
- GetSnapshots(solutionName, skipFirst=False)[source]¶
Returns snapshots in a numpy array
- Parameters
solutionName (str) – name of the solutions on which we want to iterate over snapshots
skipFirst (bool) – (optional) True for skipping first time step of each ProblemData
- Returns
of size (nbSnapshots, numberOfDofs)
- Return type
np.ndarray
- GetSnapshotsAtTimes(solutionName, timeSequence)[source]¶
Returns snapshots of solution solutionName from all problemDatas and for a given time sequence, in a numpy array
- Parameters
solutionName (str) – name of the solutions on which we want to iterate over compressedSnapshots
timeSequence (list or numpy array) – time steps for snapshot retrieving (doing time interpolation if needed)
- Returns
of size (nbSnapshots, numberOfDofs)
- Return type
np.ndarray
- GetSolutionStructure(solutionName)[source]¶
- Parameters
solutionName (str) – identifier of the physical quantity, e.g. “U”, “sigma”
- Returns
solution structure for the demanded solution
- Return type
- GetSolutionTimeSteps(solutionName, skipFirst=False)[source]¶
GetTimeSteps
- Parameters
solutionName (str) – name of the solutions for which we want to compute the total number of snapshots
- GetSolutionsNumberOfComponents(solutionName)[source]¶
Asserts that the solutions of name “solutionName” in all problemDatas have same nbeOfComponents and return this size
- Parameters
solutionName (str) – name of the solutions for which we want to return the nbeOfComponents
- Returns
nbeOfComponents of solutions of name “solutionName”
- Return type
int
- GetSolutionsNumberOfDofs(solutionName)[source]¶
Asserts that the solutions of name “solutionName” in all problemDatas have same nbeOfDofs and return this size
- Parameters
solutionName (str) – name of the solutions for which we want to return the nbeOfDofs
- Returns
nbeOfDofs of solutions of name “solutionName”
- Return type
int
- GetSolutionsNumberOfNodes(solutionName)[source]¶
Asserts that the solutions of name “solutionName” in all problemDatas have same nbeOfNodes and return this size
- Parameters
solutionName (str) – name of the solutions for which we want to return the nbeOfNodes
- Returns
nbeOfNodes of solutions of name “solutionName”
- Return type
int
- SetDataCompressionData(key, dataCompressionData)[source]¶
Adds a dataCompressionData corresponding to key
- Parameters
key (any type) – key for which dataCompressionData corresponds
- SetOperatorCompressionData(operatorCompressionData)[source]¶
Sets the operatorCompressionData
- Parameters
operatorCompressionData (custom data structure) –
- SetReducedTemplateDataset(reducedTemplateDataset)[source]¶
Template dataset to compute reduced solution
- Parameters
reducedTemplateDataset (Dataset) –
- SetSolutionStructure(solutionName, solutionStructure)[source]¶
- Parameters
solutionName (str) – identifier of the physical quantity, e.g. “U”, “sigma”
solutionStructure (SolutionStructureBase) – solution structure for the demanded solution
- SetTemplateDataset(templateDataset)[source]¶
Template dataset to compute high-fidelity solution
- Parameters
templateDataset (Dataset) –
- SnapshotsIterator(solutionName, skipFirst=False)[source]¶
Constructs an iterator over snapshots of solutions of name “solutionName” in all problemDatas.
- Parameters
solutionName (str) – name of the solutions on which we want to iterate over snapshots
- Returns
an iterator over snapshots of solutions of name “solutionName” in all problemDatas
- Return type
iterator
- Solve(**kwargs)[source]¶
New high-fidelity model evaluation
- Parameters
kwargs ((parameter_name=value) name of the variability as key and value stays value.) –
- class Mordicus.Core.Containers.CollectionProblemData.NoAxisDuplicateDict[source]¶
Bases:
dict
A dict imposing that (‘a’, ‘b’) is invalid key if ‘a’ is a existing key