TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
SolveurPP1B.cpp
1/****************************************************************************
2* Copyright (c) 2025, CEA
3* All rights reserved.
4*
5* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9*
10* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
12* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13*
14*****************************************************************************/
15
16#include <SolveurPP1B.h>
17#include <Champ_P1_isoP1Bulle.h>
18#include <Solv_AMG.h>
19#include <Perf_counters.h>
20
21Implemente_instanciable(SolveurPP1B,"SolveurPP1B",SolveurSys_base);
22
23// printOn
25{
26 return s << que_suis_je();
27}
28
29
30// readOn
32{
33 return is;
34}
35
36static int nw=0;
38 const DoubleVect& second_membre,
39 DoubleVect& x)
40{
41 // Stop the solv_sys_counter_ counter to not count the changing base
42 statistics().end_count(STD_COUNTERS::system_solver,-1,0);
43 b_ = second_membre;
44 assembleur_pression_->changer_base_second_membre(b_);
45 assembleur_pression_->changer_base_pression(x);
46 int nb_iter=solveur_pression_.resoudre_systeme(A,b_,x);
47 // Advice to use AMG solver based on PCFieldsplit from PETSc
48 if (!sub_type(Solv_AMG, solveur_pression_.valeur()))
49 {
50 nw++;
51 if (nw<100 && x.size_array()*Process::nproc()>100000)
52 {
53 Cerr << finl;
54 Cerr << "************** Advice (printed only on the first 100 time steps) **************" << finl;
55 Cerr << "You should use AMG (Algebric Multigrid) solver for your pressure solver problem" << finl;
56 Cerr << "which benefits from the block P0P1 structure of the pressure matrix." << finl;
57 Cerr << "Something like: solveur_pression AMG GCP { atol|rtol XXX impr } " << finl;
58 Cerr << "For the caracteristics of your problem, it will have much faster convergence !" << finl;
59 Cerr << "*******************************************************************************" << finl << finl;
60 }
61 }
62 assembleur_pression_->changer_base_pression_inverse(x);
63 statistics().begin_count(STD_COUNTERS::system_solver,statistics().get_last_opened_counter_level()+1);
64 return nb_iter;
65}
66
67
68
70 const DoubleVect& b,
71 DoubleVect& x,
72
73 int niter_max)
74{
76}
77
78
79// Affectation de l'assembleur et du solveur en pression
80int SolveurPP1B::associer(const Assembleur_P_VEFPreP1B& assembleur_pression, const SolveurSys& solveur_pression)
81{
82 assembleur_pression_=assembleur_pression;
83 solveur_pression_=solveur_pression;
84 fixer_limpr(-1); // Pas d'impression
85 return 0;
86}
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Classe Matrice_Base Classe de base de la hierarchie des matrices.
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
static int nproc()
renvoie le nombre de processeurs dans le groupe courant Voir Comm_Group::nproc() et PE_Groups::curren...
Definition Process.cpp:104
AMD solver wrapper to switch to the more robust/performant AMG preconditioner on CPU/GPU Nvidia/GPU A...
Definition Solv_AMG.h:28
int associer(const Assembleur_P_VEFPreP1B &, const SolveurSys &)
SolveurSys solveur_pression_
Definition SolveurPP1B.h:42
int resoudre_systeme(const Matrice_Base &, const DoubleVect &, DoubleVect &) override
DoubleVect b_
Definition SolveurPP1B.h:44
void fixer_limpr(int l)
class SolveurSys Un SolveurSys represente n'importe qu'elle classe
Definition SolveurSys.h:32
Classe de base des flux de sortie.
Definition Sortie.h:52
_SIZE_ size_array() const