[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Getfem-commits] (no subject)
From: |
Konstantinos Poulios |
Subject: |
[Getfem-commits] (no subject) |
Date: |
Tue, 23 Jan 2024 05:31:40 -0500 (EST) |
branch: add-umfpack-interface
commit 0534ebd1d8da9030871e8d8b7bc813e3c8520a07
Author: Konstantinos Poulios <logari81@gmail.com>
AuthorDate: Tue Jan 23 11:31:15 2024 +0100
Convert file to utf8 and add option for umfpack solver
---
contrib/icare/icare.cc | 43 ++++++++++++++++++++++++-------------------
1 file changed, 24 insertions(+), 19 deletions(-)
diff --git a/contrib/icare/icare.cc b/contrib/icare/icare.cc
index 10846366..0cb77ae1 100644
--- a/contrib/icare/icare.cc
+++ b/contrib/icare/icare.cc
@@ -1,6 +1,6 @@
/*===========================================================================
- Copyright (C) 2002-2020 Michel Fourni�, Julien Pommier,
+ Copyright (C) 2002-2020 Michel Fournié, Julien Pommier,
This file is a part of GetFEM
@@ -972,7 +972,7 @@ void navier_stokes_problem::solve_PREDICTION_CORRECTION2() {
}
- //Prise en compte de fa�on faible
+ //Prise en compte de façon faible
plain_vector HP(nbdof_p);
{ plain_vector A(nbdof_p);
getfem::generic_assembly assem;
@@ -987,14 +987,14 @@ void
navier_stokes_problem::solve_PREDICTION_CORRECTION2() {
//K2(nbdof_p,nbdof_p) = 0.0;
*/
- //Prise en compte de fa�on forte
+ //Prise en compte de façon forte
for (unsigned i=0; i <= nbdof_p; ++i) {
K2(nbdof_p,i) = K2(i,nbdof_p) = 1.0; // mean value of the pressure = 0
//K2(nbdof_p, 0) = K2(0, nbdof_p) = 1.0; // set the first pressure dof to 0
}
K2(nbdof_p,nbdof_p) = 0.0;
-#if !defined(GMM_USES_MUMPS)
+#if !defined(GMM_USES_MUMPS) && defined(GMM_USES_SUPERLU)
gmm::SuperLU_factor<double> SLUsys2;
SLUsys2.build_with(K2);
#endif
@@ -1029,7 +1029,7 @@ void
navier_stokes_problem::solve_PREDICTION_CORRECTION2() {
std::ofstream coeffTP("coeffTP.data");
std::ofstream ptPartData("ptPart.data");
- // Recherche d'un point de r�ference pour le calcul des coeff de train�e ...
+ // Recherche d'un point de réference pour le calcul des coeff de trainée ...
scalar_type BoxXmin = PARAM.real_value("BOXXmin", "Particular Point xMin");
scalar_type BoxXmax = PARAM.real_value("BOXXmax", "Particular Point xMax");
@@ -1063,7 +1063,7 @@ void
navier_stokes_problem::solve_PREDICTION_CORRECTION2() {
bgeot::base_node BN = mf_u.point_of_basic_dof(i);
if (BN[0]==ptPartP[0] && BN[1]==ptPartP[1] ) {
cout << "Point Part in Box -- i on mf_u= " << i
<<",x="<<BN[0]<<",y="<<BN[1]<< endl;
- // Attention c'est vectoriel => en sortie i <-> pt sur la derni�re
composante de la vitesse
+ // Attention c'est vectoriel => en sortie i <-> pt sur la dernière
composante de la vitesse
// Vitesse =(U,V,W) alors en 2D --> sur V, en 3D --> sur W
// D'ou la modif dans ptPartU[2]
ptPartU[0] = BN[0];
@@ -1092,7 +1092,7 @@ void
navier_stokes_problem::solve_PREDICTION_CORRECTION2() {
bgeot :: base_node BN = mf_u.point_of_basic_dof(i);
if (BN[0]==ptPartP[0] && BN[1]==ptPartP[1]&& BN[2]==ptPartP[2] ) {
cout << "Point Part in Box -- i on mf_u= " << i
<<",x="<<BN[0]<<",y="<<BN[1]<<",z="<<BN[2]<< endl;
- // Attention c'est vectoriel => en sortie i <-> pt sur la derni�re
composante de la vitesse
+ // Attention c'est vectoriel => en sortie i <-> pt sur la dernière
composante de la vitesse
// Vitesse =(U,V,W) alors en 2D --> sur V, en 3D --> sur W
// D'ou la modif dans ptPartU[3]
ptPartU[0] = BN[0];
@@ -1134,14 +1134,13 @@ void
navier_stokes_problem::solve_PREDICTION_CORRECTION2() {
gmm :: sub_interval SUB_CT_V(0,nbdof_u);
gmm :: sub_interval SUB_CT_P(0,nbdof_p);
-// id�ees
//gmm::copy(gmm::sub_vector(F1generic,SUB_CT_V1full),F1full);
//gmm::copy(gmm::sub_vector(X1full,SUB_CT_V),X1);
//gmm::copy(gmm::sub_vector(X2full,SUB_CT_V),X2);
//gmm::copy(X1,gmm::sub_vector(USTAR,gmm::sub_slice(0,nbdof_u,2)));
//gmm::copy(X2,gmm::sub_vector(USTAR,gmm::sub_slice(1,nbdof_u,2)));
-#if !defined(GMM_USES_MUMPS)
+#if !defined(GMM_USES_MUMPS) && defined(GMM_USES_SUPERLU)
gmm::SuperLU_factor<double> SLUsys3;
#endif
for (scalar_type t = Tinitial + dt; t <= T; t += dt) {
@@ -1178,7 +1177,7 @@ void
navier_stokes_problem::solve_PREDICTION_CORRECTION2() {
//gmm::add(gmm::scaled(A2u,-1.0),A2v);
//cout <<"A2 "<< gmm::mat_norminf(A2v) << endl;
-#if !defined(GMM_USES_MUMPS)
+#if !defined(GMM_USES_MUMPS) && defined(GMM_USES_SUPERLU)
SLUsys3.build_with(A2u);
#endif
}
@@ -1203,7 +1202,7 @@ void
navier_stokes_problem::solve_PREDICTION_CORRECTION2() {
gmm::copy(gmm::transposed(HNR), gmm::sub_matrix(A2, I1, I4));
// Factorization LU
- //SLUsys3.build_with(A2); // pb en (u,v) coupl�
+ //SLUsys3.build_with(A2); // pb en (u,v) couple
gmm::clear(A2u);
//gmm::clear(A2v);
@@ -1211,7 +1210,7 @@ void
navier_stokes_problem::solve_PREDICTION_CORRECTION2() {
gmm::copy(gmm::sub_matrix(A2,SUB_CT_Vu,SUB_CT_Vu),A2u);
//gmm::copy(gmm::sub_matrix(A2,SUB_CT_Vv,SUB_CT_Vv),A2v);
-#if !defined(GMM_USES_MUMPS)
+#if !defined(GMM_USES_MUMPS) && defined(GMM_USES_SUPERLU)
SLUsys3.build_with(A2u);
#endif
}
@@ -1334,7 +1333,7 @@ void
navier_stokes_problem::solve_PREDICTION_CORRECTION2() {
{
plain_vector VV(mf_mult.nb_dof());
gmm::clear(VV);
- // getfem::asm_source_term(VV, mim, mf_mult, mf_rhs, F, mpinonrefrg); //
CL P�riodiques
+ // getfem::asm_source_term(VV, mim, mf_mult, mf_rhs, F, mpinonrefrg); //
CL Périodiques
if (non_reflective_bc == 0) {
asm_basic_non_reflective_bc(VV, mim, mf_u, Un0, mf_mult, dt,
mpinonrefrg);
} else {
@@ -1383,7 +1382,7 @@ void
navier_stokes_problem::solve_PREDICTION_CORRECTION2() {
gmm::MUMPS_solve(A1,X,Y);
//#elif (GETFEM_PARA_LEVEL==0 && GMM_USES_MUMPS)
//MUMPS_solve(A1,X,Y);
-#else
+#elif defined(GMM_USES_SUPERLU)
// SuperLU_solve(A1, X, Y, rcond);
//gmm::copy(gmm::sub_vector(Y,SUB_CT_Vu),Yu);
@@ -1418,11 +1417,13 @@ void
navier_stokes_problem::solve_PREDICTION_CORRECTION2() {
// gmm::bicgstab(A1,X,Y,gmm::identity_matrix(),iter);
// ??
gmm::bicgstab(A1,X,Y,gmm::diagonal_precond<sparse_matrix>(A1),iter);
// if (noisy) cout << "condition number: " << 1.0/rcond << endl;
+#else
+ gmm::UMFPACK_solve(A1,X,Y);
#endif
gmm::copy(gmm::sub_vector(X, I1), USTAR);
//??// gmm::copy(gmm::sub_vector(X, I3C), lambda);
- // Relation de compatibilit� int_domaine div(ustar)=0 //
+ // Relation de compatibilité int_domaine div(ustar)=0 //
scalar_type delta_in;
sparse_matrix Bbc_flux_in(nbdof_p, nbdof_u);
asm_B_boundary(Bbc_flux_in, mim, mf_u,
mf_p,mf_u.linked_mesh().get_mpi_sub_region(DIRICHLET_BOUNDARY_NUM));
@@ -1516,7 +1517,7 @@ void
navier_stokes_problem::solve_PREDICTION_CORRECTION2() {
MUMPS_solve(K2,X,Z);
//#elif (GETFEM_PARA_LEVEL==0 && GMM_USES_MUMPS)
//MUMPS_solve(K2,X,Z);
-#else
+#elif defined(GMM_USES_SUPERLU)
//SuperLU_solve(K2,X,Z,rcond);
if (time_order == 1 || t == Tinitial+dt) { //time_order = 1 or first
iterations with time_order = 2
SLUsys2.solve(X, Z);
@@ -1530,6 +1531,8 @@ void
navier_stokes_problem::solve_PREDICTION_CORRECTION2() {
// gmm::bicgstab(K2,X,Z,gmm::identity_matrix(),iter);
// ??
gmm::bicgstab(K2,X,Z,gmm::diagonal_precond<sparse_matrix>(K2),iter);
// if (noisy) cout << "condition number: " << 1.0/rcond << endl;
+#else
+ UMFPACK_solve(K2,X,Z);
#endif
gmm::copy(gmm::sub_vector(X, IP), Phi);
}
@@ -1578,7 +1581,7 @@ void
navier_stokes_problem::solve_PREDICTION_CORRECTION2() {
MUMPS_solve(A2,X,Y);
//#elif (GETFEM_PARA_LEVEL==0 && defined(GMM_USES_MUMPS))
//MUMPS_solve(A2,X,Y);
-#else
+#elif defined(GMM_USES_SUPERLU)
//SuperLU_solve(A2, X, Y, rcond);
//SLUsys3.solve(X, Y);
@@ -1598,11 +1601,13 @@ void
navier_stokes_problem::solve_PREDICTION_CORRECTION2() {
//gmm::bicgstab(A2,X,Y,gmm::identity_matrix(),iter);
// ??
gmm::bicgstab(A2,X,Y,gmm::diagonal_precond<sparse_matrix>(A2),iter);
// if (noisy) cout << "condition number: " << 1.0/rcond << endl;
+#else
+ UMFPACK_solve(A2,X,Y);
#endif
//gmm:: clear(Un1);
gmm::copy(gmm::sub_vector(X, I1), Un1);
- // Relation de compatibilit� int_domaine div(ustar)=0 //
+ // Relation de compatibilité int_domaine div(ustar)=0 //
scalar_type delta;
gmm :: resize(lambda, nbdof_nonref);
gmm:: clear(lambda);
@@ -1670,7 +1675,7 @@ void
navier_stokes_problem::solve_PREDICTION_CORRECTION2() {
do_export(t);
//
- // SORTIES : Coefficient de Train� (Cd) et de Portance (Cl)
+ // SORTIES : Coefficient de Traine (Cd) et de Portance (Cl)
//
if (N == 2) {
std::vector<scalar_type> Cxn(1), Cxp(1), Cyn(1), Cyp(1);