genericROM.OperatorCompressors.Mechanical module

CompressOperator(collectionProblemData, operatorPreCompressionData, mesh, tolerance, listNameDualVarOutput=None, listNameDualVarGappyIndicesforECM=None, toleranceCompressSnapshotsForRedQuad=0.0, methodDualReconstruction='GappyPOD', timeSequenceForDualReconstruction=None)[source]

Operator compression step for the POD-ECM method for a mechanical problem Requires naming the displacement solution “U” and the stress solution “sigma”

Parameters:
  • collectionProblemData (CollectionProblemData) – definition of the training data in a CollectionProblemData object

  • operatorPreCompressionData (OperatorPreCompressionDataMechanical) – ata structure used in a precomputation step of the operator compression step of the POD-ECM method

  • mesh (MuscatMesh) – high-dimensional mesh

  • tolerance (float) – tolerance for the Empirical Cubature Method (ECM)

  • listNameDualVarOutput (list of strings, optional) – names of dual quantities to reconstruct on complete mesh

  • listNameDualVarGappyIndicesforECM (list of strings, optional) – names of dual quantities for which the indices of the POD are added to the reduced integration points list

  • toleranceCompressSnapshotsForRedQuad (float, optional) – if > 0., sigma is compressed using snapshots POD before applying ECM

  • methodDualReconstruction (str, optional) – method used to reconstruct the dual quantities from the reduced integration points to the complete mesh, “GappyPOD” or “MetaModel”

  • timeSequenceForDualReconstruction (list or 1D np.ndarray, optional) – time sequence used to train the dual quantities reconstruction algorithm

ComputeOnline(onlineProblemData, timeSequence, operatorCompressionData, tolerance, onlineData=None, callback=None)[source]

Compute the online stage using the method POD and ECM for a mechanical problem

Parameters:
  • onlineProblemData (OnlineProblemData) – containing the description of the problem for which a reduced solution is computed

  • operatorCompressionData (OperatorCompressionDataMecanical) – containing the data structure generated by the data compression step for POD-ECM for a mechanical problem

  • timeSequence (1D np.ndarray) – time sequence where the reduced solution is computed

  • tolerance (float) – stopping criterion for the Newton algorithm of the reduced problem

  • onlineData (OnlineDataMechanical, optional) – used in the online stage to store quantities required for the tracking of certain quantites, e.g. the internal state variable at the reduced integration points, required to compute the constitutive law.

  • callback (function, optional) – used to override console output messages during the reduced problem iterations

Returns:

onlineCompressedSolution, with time steps as keys and 1D np.ndarray of size (numberOfModes,)

Return type:

dict

ComputeReducedInternalForcesAndTangentMatrix(onlineProblemData, operatorCompressionData, before, after, time)[source]

Computes the reduced internal forces vector and tange

Parameters:
  • onlineProblemData (OnlineProblemData) – containing the description of the problem for which a reduced solution is computed

  • operatorCompressionData (OperatorCompressionDataMechanical) – used to store data during the operator compression step of the POD-ECM method.

  • before (1D np.ndarray) – of size (numberOfModes,), coefficients of the reduced solution at the previous time step

  • after (1D np.ndarray) – of size (numberOfModes,), coefficients of the reduced solution at the current time step, for which the residual will be computed during the reduced Newton algorithm

Returns:

  • 1D np.ndarray – reducedInternalForces, of size (numberOfModes,)

  • np.ndarray – reducedTangentMatrix, of size (numberOfModes,numberOfModes)

ComputeSigmaEpsilon(collectionProblemData, reducedEpsilonAtIntegPoints, tolerance, toleranceCompressSnapshotsForRedQuad)[source]

Computes sigma double contracted with epsilon at the reduced integration points: \(\sigma(u_i):\epsilon(\Psi)(x_k)\) where \(\sigma(u_i)\) are the stress snapshots, \(\Psi\) is a POD mode and \(x_k\) are the integration points

Parameters:
  • collectionProblemData (CollectionProblemData) – definition of the training data in a CollectionProblemData object

  • reducedEpsilonAtIntegPoints (np.ndarray) – of size (numberOfSigmaComponents, numberOfIntegrationPoints, numberOfModes), the reduced integrator

  • tolerance (float) – tolerance for the Empirical Cubature Method (ECM)

  • toleranceCompressSnapshotsForRedQuad (float) – if >0, the snigma snapshots are compressed before the ECM is applied, and this parameters defines the compression error

Returns:

sigmaEpsilon, of size (numberOfModes*(numberOfSnapshots-1),numberOfIntegrationPoints), the first sigma snapshots at the initial time is ignored

Return type:

np.ndarray

GetOnlineDualQuantityAtReducedIntegrationPoints(nameDualQuantity, onlineData, timeSequence)[source]

Reconstruct a dual quantitie using a trained algorithm

Parameters:
  • nameDualQuantity (str) – name of the dual quantity to reconstruct

  • onlineData (OnlineDataMechanical) – used in the online stage to store quantities required for the tracking of certain quantites, e.g. the internal state variable at the reduced integration points, required to compute the constitutive law.

  • timeSequence (1D np.ndarray, optional) – time sequence used to train the dual quantities reconstruction algorithm

Returns:

of size(nTimeSteps, nReducedIntegrationPoints), contains the online dual quantity of name “nameDualQuantity” at reduced integration points

Return type:

np.ndarray

LearnDualReconstruction(collectionProblemData, listNameDualVarOutput, reducedIntegrationPoints, methodDualReconstruction, timeSequenceForDualReconstruction=None, snapshotsAtReducedIntegrationPoints=None, regressor=None, paramGrid=None)[source]

Train the agorithm of reconstruction of the dual quantities from the reduced integration points to the complete mesh: “GappyPOD” or “MetaModel”

Parameters:
  • collectionProblemData (CollectionProblemData) – definition of the training data in a CollectionProblemData object

  • listNameDualVarOutput (list of strings, optional) – names of dual quantities to reconstruct on complete mesh

  • reducedIntegrationPoints (np.ndarray) – of size (nReducedIntegrationPoints,), dtype = int indices of the reduced integration points

  • methodDualReconstruction (str) – method used to reconstruct the dual quantities from the reduced integration points to the complete mesh, “GappyPOD” or “MetaModel”

  • timeSequenceForDualReconstruction (list or 1D np.ndarray, optional) – time sequence used to train the dual quantities reconstruction algorithm

  • snapshotsAtReducedIntegrationPoints (dict, optional) – dual quantity at reduced integrationPoints, for which reconstruction is trained

  • regressor (object satisfying the scikit-learn regressors API, optional) – regressor used for the method “MetaModel”

  • paramGrid (dict, optional) – of lists (of floats) containing hyperparameter values of the considered regressor

Returns:

dictionary containing data used for reconstructing dual quantities in the online stage, with key:values:

”methodDualReconstructionstr

”GappyPOD”, “MetaModel” or “None”

name of dual quantities (e.g. “evrcum”):

  • if “MetaModel” : tuple

model: sklearn.model_selection._search.GridSearchCV

scalerX: sklearn.preprocessing._data.StandardScaler

scalery: sklearn.preprocessing._data.StandardScaler

  • if “GappyPOD” : tuple

reducedOrderBasisAtReducedIntegrationPoints: np.ndarray of size (numberOfModes, nReducedIntegrationPoints)

  • if “None” : empty dict

Return type:

dict

Notes

Regressor and paramGrid mush be both None or both specified

PreCompressOperator(mesh, integrationRule=<Muscat.FE.IntegrationRules.MeshQuadrature object>)[source]

Preliminary operator compression step for the POD-ECM method for a mechanical problem, precomputing quantities that only depend on the mesh Requires naming the displacement solution “U” and the stress solution “sigma”

Parameters:

mesh (MuscatMesh) – high-dimensional mesh

Returns:

data structure used in a precomputation step of the operator compression step of the POD-ECM method

Return type:

OperatorPreCompressionDataMechanical

PrepareNewtonIterations(onlineProblemData, time, dtime)[source]

Prepares the Newton iteration by computing the reduced external forces vector (depending on the loading) and updating the temperature loading to the onlineData.

Parameters:
  • onlineProblemData (OnlineProblemData) – containing the description of the problem for which a reduced solution is computed

  • time (float) – previous time where the reduced solution hasbeen computed

  • dtime (float) – time increment

Returns:

reducedExternalForces, of size (numberOfModes,)

Return type:

1D np.ndarray

PrepareOnline(onlineProblemData, operatorCompressionData)[source]

Prepares a online computation by constructing an onlineData and adding it to the onlineProblemData

Parameters:
  • onlineProblemData (OnlineProblemData) – containing the description of the problem for which a reduced solution is computed

  • operatorCompressionData (OperatorCompressionDataMecanical) – containing the data structure generated by the data compression step for POD-ECM for a mechanical problem

ReconstructDualQuantity(nameDualQuantity, operatorCompressionData, onlineData, timeSequence)[source]

Reconstruct a dual quantitie using a trained algorithm

Parameters:
  • nameDualQuantity (str) – name of the dual quantity to reconstruct

  • operatorCompressionData (OperatorCompressionDataMechanical) – used in the operator compression step of the POD-ECM method.

  • onlineData (OnlineDataMechanical) – used in the online stage to store quantities required for the tracking of certain quantites, e.g. the internal state variable at the reduced integration points, required to compute the constitutive law.

  • timeSequence (1D np.ndarray, optional) – time sequence used to train the dual quantities reconstruction algorithm

Returns:

  • dict – with float as keys (time steps) and np.ndarray of size (numberOfModes) as values (reducedCoordinates of the reconstructed dual quantity)

  • list – of floats, contains the resitual of the reconstruction if “GappyPOD” is used, empty list otherwise

ReduceIntegrator(collectionProblemData, mesh)[source]

Computes the reduced integrator, named reducedEpsilonAtIntegPoints. \(\epsilon(u_t)(x_k)\), where u_t is a test displacement and x_k are the integration points is called integrator, since the internal forces vector is obtained using \(\sigma:\epsilon(u_t)(x_k)\). reducedEpsilonAtIntegPoints denotes \(\epsilon(\Psi)(x_k)\), where \(\Psi\) is a POD mode and \(x_k\) are the integration points.

Parameters:
  • collectionProblemData (CollectionProblemData) – definition of the training data in a CollectionProblemData object

  • mesh (MuscatMesh) – high-dimensional mesh

Returns:

reducedEpsilonAtIntegPoints, of size (numberOfSigmaComponents,numberOfIntegrationPoints,numberOfModes)

Return type:

np.ndarray