From: michael Date: Sat, 1 May 2021 16:44:29 +0000 (+0200) Subject: Added computation of singular vectors in ProblemCoreFlows X-Git-Tag: V9_7_0~12 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=afd184b5bdd3f372bd8e373eeb801aca6e323259;p=tools%2Fsolverlab.git Added computation of singular vectors in ProblemCoreFlows --- diff --git a/CoreFlows/Models/inc/ProblemCoreFlows.hxx b/CoreFlows/Models/inc/ProblemCoreFlows.hxx index af16869..be45af3 100755 --- a/CoreFlows/Models/inc/ProblemCoreFlows.hxx +++ b/CoreFlows/Models/inc/ProblemCoreFlows.hxx @@ -116,7 +116,7 @@ public : /** \fn solveTimeStep * \brief calcule les valeurs inconnues au pas de temps +1 . - * \details c'est une fonction virtuelle , + * \details c'est une fonction virtuelle * @param void * \return Renvoie false en cas de problème durant le calcul (valeurs non physiques..) * */ @@ -483,6 +483,21 @@ public : _path=resultsPath; } + /** \fn getTimeScheme + * \brief returns the time scheme name + * \param [in] void + * \param [out] enum TimeScheme (explicit or implicit) + * */ + TimeScheme getTimeScheme(); + + /** \fn setNumericalScheme + * \brief sets the numerical method ( explicit vs implicit ) + * \details + * \param [in] TimeScheme + * \param [out] void + * */ + void setTimeScheme( TimeScheme method); + //Couplages Thermohydraulique-thermique-neutronique *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* /** \fn setHeatPowerField @@ -582,11 +597,13 @@ public : _system = system; }; - //Spectrum analysis + //Spectral analysis double getConditionNumber(bool isSingular=false, double tol=1e-6) const; std::vector< double > getEigenvalues (int nev, EPSWhich which=EPS_SMALLEST_MAGNITUDE, double tol=1e-6) const; std::vector< Vector > getEigenvectors(int nev, EPSWhich which=EPS_SMALLEST_MAGNITUDE, double tol=1e-6) const; Field getEigenvectorsField(int nev, EPSWhich which=EPS_SMALLEST_MAGNITUDE, double tol=1e-6) const; + std::vector< double > getSingularValues( int nsv, SVDWhich which=SVD_SMALLEST, double tol=1e-6) const; + std::vector< Vector > getSingularVectors(int nsv, SVDWhich which=SVD_SMALLEST, double tol=1e-6) const; // some supplementary functions @@ -597,7 +614,7 @@ public : * @param name, string, name or description of the matrix * @return displays the matrix on the terminal * */ - void displayMatrix(double *matrix, int size, string name); + static void displayMatrix(double *matrix, int size, string name="Vector coefficients :"); /** \fn displayMatrix * \brief displays a vector of size "size" for profiling @@ -606,23 +623,7 @@ public : * @param name, string, name or description of the vector * @return displays the vector on the terminal * */ - void displayVector(double *vector, int size, string name); - - /** \fn getTimeScheme - * \brief returns the time scheme name - * \param [in] void - * \param [out] enum TimeScheme (explicit or implicit) - * */ - TimeScheme getTimeScheme(); - - /** \fn setNumericalScheme - * \brief sets the numerical method ( explicit vs implicit ) - * \details - * \param [in] TimeScheme - * \param [out] void - * */ - void setTimeScheme( TimeScheme method); - + static void displayVector(double *vector, int size, string name="Matrix coefficients :"); protected : diff --git a/CoreFlows/Models/src/ProblemCoreFlows.cxx b/CoreFlows/Models/src/ProblemCoreFlows.cxx index 11f7e25..7d69103 100755 --- a/CoreFlows/Models/src/ProblemCoreFlows.cxx +++ b/CoreFlows/Models/src/ProblemCoreFlows.cxx @@ -622,6 +622,19 @@ ProblemCoreFlows::getEigenvectorsField(int nev, EPSWhich which, double tol) cons return my_eigenfield; } +std::vector< double > +ProblemCoreFlows::getSingularValues( int nsv, SVDWhich which, double tol) const +{ + SparseMatrixPetsc A = SparseMatrixPetsc(_A); + return A.getSingularValues( nsv, which, tol); +} +std::vector< Vector > +ProblemCoreFlows::getSingularVectors(int nsv, SVDWhich which, double tol) const +{ + SparseMatrixPetsc A = SparseMatrixPetsc(_A); + return A.getSingularVectors( nsv, which, tol); +} + Field ProblemCoreFlows::getUnknownField() const {