Mordicus.Containers.Solution

class 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

reducedCoordinates

dictionary with time indices as keys and a np.ndarray of size (numberOfModes,) containing the coefficients of the reduced solution

Type:

dict

AddReducedCoordinates(reducedCoordinates, time)[source]

Adds a compressed snapshot at time time

Parameters:
  • reducedCoordinates (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)

ConvertReducedCoordinatesReducedOrderBasis(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)

ConvertReducedCoordinatesReducedOrderBasisAtTime(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) –

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

GetReducedCoordinates()[source]

Returns the complete reducedCoordinates dictionary

Returns:

the compressed representation of the solution

Return type:

dict

GetReducedCoordinatesAtTime(time)[source]
Parameters:

time (float) – time at which the compressed snapshot is retrieved

Returns:

reducedCoordinates value at time, of size (numberOfModes), using PieceWiseLinearInterpolation

Return type:

np.ndarray

GetReducedCoordinatesAtTimes(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:

reducedCoordinates values at times, of size (numberOfModes), using PieceWiseLinearInterpolationVectorized

Return type:

np.ndarray

GetReducedCoordinatesList()[source]

Returns the compressed snapshots in the form of a list

Returns:

list containing the snapshots of the solution

Return type:

list

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

GetTimeSequenceFromReducedCoordinates()[source]

Returns the time sequence from the reducedCoordinates 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

SetReducedCoordinates(reducedCoordinates)[source]

Sets the compressed representation of the solution

Parameters:

reducedCoordinates (dict) –

SetSnapshots(snapshots)[source]

Sets the snapshots of the solution

Parameters:

snapshots (dict) –

UncompressSnapshotAtTime(reducedOrderBasis, time)[source]

Uncompress snapshot at time using reducedOrderBasis

Parameters:
  • reducedOrderBasis (np.ndarray) – of size (numberOfModes, numberOfDOFs)

  • time (float) –

UncompressSnapshots(reducedOrderBasis)[source]

Uncompress snapshots using reducedOrderBasis

Parameters:

reducedOrderBasis (np.ndarray) – of size (numberOfModes, numberOfDOFs)