TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
IJK_SolveSys_FD_thermal.cpp
1/****************************************************************************
2* Copyright (c) 2023, 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 <IJK_SolveSys_FD_thermal.h>
17#include <Param.h>
18#include <Solv_Gmres.h>
19#include <Solv_Petsc.h>
20
21Implemente_instanciable( IJK_SolveSys_FD_thermal, "IJK_SolveSys_FD_thermal", SolveurSys ) ;
22
23Sortie& IJK_SolveSys_FD_thermal::printOn( Sortie& os ) const
24{
25 os << " ";
26 SolveurSys::printOn( os );
27 return os;
28}
29
30Entree& IJK_SolveSys_FD_thermal::readOn( Entree& is )
31{
32 Param param(que_suis_je());
33 Nom solver_name;
34 // Put any string to read the following word
35 param.ajouter("thermal_fd_solver",&solver_name, Param::REQUIRED);
36 param.lire_sans_accolade(is);
37
38 if (solver_name == "direct")
40 else if (solver_name == "iterative")
42 else
43 {
44 Nom prefix = "Solv_";
45 if (solver_name.debute_par(prefix))
46 solver_name = Motcle((solver_name.getString()).substr(prefix.getString().length()));
47 Nom type_solv_sys(prefix);
48 type_solv_sys+=solver_name;
49 typer(type_solv_sys);
50 nommer(Nom("thermal_fd_solver_") + solver_name);
51 is >> valeur();
52 }
53 return is;
54}
55
57{
59 nommer(Nom("thermal_fd_solver_") + iterative_solver_by_default_);
60 /*
61 * Fill the required params (example)
62 */
63 Solv_Gmres& gmres_solver = ref_cast(Solv_Gmres, valeur());
64 gmres_solver.set_seuil(default_seuil);
65}
66
68{
70 nommer(Nom("thermal_fd_solver_") + direct_solver_by_default_ + Nom("_") + petsc_solver_by_default_);
71 Solv_Petsc& petsc_solver = ref_cast(Solv_Petsc, valeur());
72 Nom solver_params("");
73 Nom left_bracket("{");
74 Nom right_bracket("}");
75 Nom spacing(" ");
76 solver_params += petsc_solver_by_default_ + spacing + left_bracket + spacing;
77 /*
78 * Add params by default
79 */
80 solver_params += Nom("nb_it_max") + spacing + Nom(default_nb_iter_max) + spacing;
81 solver_params += right_bracket;
82 Cerr << "Thermal F-D Solver:" << solver_params << finl;
83 istringstream solver_params_istringstream(solver_params.getChar());
84 istream& solver_params_istream = solver_params_istringstream;
85 Entree solver_params_entry(solver_params_istream);
86 /*
87 * Fake a readOn
88 */
89 //solver_params_entry >> solver_params;
90 petsc_solver.nommer(le_nom());
91 solver_params_entry >> petsc_solver;
92}
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
const char * getChar() const
Definition Nom.h:91
virtual int debute_par(const char *const n) const
Definition Nom.cpp:319
const std::string & getString() const
Definition Nom.h:92
@ REQUIRED
Definition Param.h:115
class SolveurSys Un SolveurSys represente n'importe qu'elle classe
Definition SolveurSys.h:32
void nommer(const Nom &nom) override
Definition SolveurSys.h:37
const Nom & le_nom() const override
Definition SolveurSys.h:36
Classe de base des flux de sortie.
Definition Sortie.h:52
void set_seuil(double s)