Mordicus.Core.Containers.Solution module¶
- class Mordicus.Core.Containers.Solution.Solution(solutionName, nbeOfComponents, numberOfNodes, primality)[source]¶
Bases:
object
Class containing a solution
- solutionName¶
name of the solution field (e.g. “U”, “T”)
- Type
str
- nbeOfComponents¶
number of components of the solution (e.g. 3 for “U” in 3D, or 1 for “T”)
- Type
int
- numberOfNodes¶
number of nodes for the geometrical support of the solution
- Type
int
- numberOfDOFs¶
number of degrees of freedom = numberOfNodes * nbeOfComponents
- Type
int
- primality¶
True for a primal solution and False for a dual solution
- Type
bool
- snapshots¶
dictionary with time indices as keys and a np.ndarray of size (numberOfDOFs,) containing the solution data
- Type
dict
- compressedSnapshots¶
dictionary with time indices as keys and a np.ndarray of size (numberOfModes,) containing the coefficients of the reduced solution
- Type
dict
- AddCompressedSnapshots(compressedSnapshot, time)[source]¶
Adds a compressed snapshot at time time
- Parameters
compressedSnapshot (np.ndarray) – of size (numberOfModes,)
time (float) – time of the compressed snapshot
- AddSnapshot(snapshot, time)[source]¶
Adds a snapshot at time time
- Parameters
snapshot (np.ndarray) – of size (numberOfDOFs,)
time (float) – time of the snapshot
- CompressSnapshots(snapshotCorrelationOperator, reducedOrderBasis)[source]¶
Compress snapshots using the correlation operator between the snapshots defined by the matrix snapshotCorrelationOperator and reducedOrderBasis
- Parameters
snapshotCorrelationOperator (scipy.sparse.csr) – correlation operator between the snapshots
reducedOrderBasis (np.ndarray) – of size (numberOfModes, numberOfDOFs)
- ConvertCompressedSnapshotReducedOrderBasis(projectedReducedOrderBasis)[source]¶
Converts the reducedSnapshot from the current reducedOrderBasis to a newReducedOrderBasis using a projectedReducedOrderBasis between the current one and a new one
- Parameters
projectedReducedOrderBasis (np.ndarray) – of size (newNumberOfModes, numberOfModes)
- ConvertCompressedSnapshotReducedOrderBasisAtTime(projectedReducedOrderBasis, time)[source]¶
Converts the reducedSnapshot at time from the current reducedOrderBasis to a newReducedOrderBasis using a projectedReducedOrderBasis between the current one and a new one
- Parameters
projectedReducedOrderBasis (np.ndarray) – of size (newNumberOfModes, numberOfModes)
time (float) –
- GetCompressedSnapshot(time)[source]¶
Returns the compressed snapshot at time time
- Parameters
time (float) – time at which the compressed snapshot is retrieved
- Returns
compressed snapshot
- Return type
np.ndarray
- GetCompressedSnapshots()[source]¶
Returns the complete compressedSnapshots dictionary
- Returns
the compressed representation of the solution
- Return type
dict
- GetCompressedSnapshotsAtTime(time)[source]¶
- Parameters
time (float) – time at which the compressed snapshot is retrieved
- Returns
compressedSnapshot value at time, of size (numberOfModes), using PieceWiseLinearInterpolation
- Return type
np.ndarray
- GetCompressedSnapshotsAtTimes(times)[source]¶
Returns the compressed snapshot at a specitiy time (with time interpolation if needed)
- Parameters
times (list or 1D ndarray of floats) – times at which the compressed snapshot are retrieved
- Returns
compressedSnapshots values at times, of size (numberOfModes), using PieceWiseLinearInterpolationVectorized
- Return type
np.ndarray
- GetCompressedSnapshotsList()[source]¶
Returns the compressed snapshots in the form of a list
- Returns
list containing the snapshots of the solution
- Return type
list
- GetNbeOfComponents()[source]¶
Returns the number of components of the solution
- Returns
the number of components of the solution
- Return type
int
- GetNumberOfDofs()[source]¶
Returns the number of degrees of freedom of the solution
- Returns
the number of degrees of freedom of the solution
- Return type
int
- GetNumberOfNodes()[source]¶
Returns the number of nodes of the solution
- Returns
the number of degrees of nodes of the solution
- Return type
int
- GetNumberOfSnapshots()[source]¶
Returns the number of snapshots
- Returns
the number of snapshots (= time indices) of the solution
- Return type
int
- GetPrimality()[source]¶
Returns the primality of the solution
- Returns
the primality of the solution
- Return type
bool
- GetSnapshot(time)[source]¶
Returns the snapshot at time time
- Parameters
time (float) – time at which the snapshot is retrieved
- Returns
snapshot
- Return type
np.ndarray
- GetSnapshotAtTime(time)[source]¶
Returns the snapshots at a specitiy time (with time interpolation if needed)
- Parameters
time (float) – time at which the snapshot is retrieved
- Returns
snapshot at time, of size (numberOfDOFs), using PieceWiseLinearInterpolation
- Return type
np.ndarray
- GetSnapshots()[source]¶
Returns the complete snapshots dictionary
- Returns
the snapshots dictionary of the solution
- Return type
dict
- GetSnapshotsList()[source]¶
Returns the snapshots in the form of a list
- Returns
list containing the snapshots of the solution
- Return type
list
- GetSolutionName()[source]¶
Returns the name of the solution
- Returns
the name of the solution field
- Return type
str
- GetTimeSequenceFromCompressedSnapshots()[source]¶
Returns the time sequence from the compressedSnapshots dictionary
- Returns
list containing the time indices of the compressed snapshots
- Return type
list
- GetTimeSequenceFromSnapshots()[source]¶
Returns the time sequence from the snapshots dictionary
- Returns
list containing the time indices of the snapshots
- Return type
list
- RemoveSnapshot(time)[source]¶
Removes the snapshot at time time
- Parameters
time (float) – time of the snapshot
- RemoveSnapshots(timeSequence)[source]¶
Removes the snapshot at times timeSequence
- Parameters
time (list or 1d-np.ndarray of floats) – times of the snapshot
- SetCompressedSnapshots(compressedSnapshots)[source]¶
Sets the compressed representation of the solution
- Parameters
compressedSnapshots (dict) –
- UncompressSnapshotAtTime(reducedOrderBasis, time)[source]¶
Uncompress snapshot at time using reducedOrderBasis
- Parameters
reducedOrderBasis (np.ndarray) – of size (numberOfModes, numberOfDOFs)
time (float) –