13#include "arcane/utils/ScopedPtr.h"
15#include "arcane/aleph/tests/AlephTest.h"
16#include "arcane/aleph/tests/AlephIndexTest.h"
17#include "arcane/aleph/tests/AlephIndexTest_axl.h"
28using namespace Arcane;
34:
public ArcaneAlephIndexTestObject
39 ~AlephIndexTest(
void);
73, m_get_solution_idx(0)
83 debug() <<
"[AlephIndexTest::AlephIndexTest] Delete & Free";
92 m_nb_solver =
options()->alephNumberOfSolvers;
94 m_aleph_mat.resize(m_nb_solver);
95 m_aleph_rhs.resize(m_nb_solver);
96 m_aleph_sol.resize(m_nb_solver);
97 m_aleph_params.resize(m_nb_solver);
104 m_face_temperature.fill(
options()->initTemperature());
107 for (
int i =
options()->boundaryCondition.size() - 1; i >= 0; --i) {
108 Real temperature =
options()->boundaryCondition[i]->value();
112 m_face_temperature[iFace] = temperature;
114 mesh()->checkValidMeshFull();
124 m_vector_zeroes.add(0.0);
137 Real residual_norm[4];
139 if (m_nb_solver == 0) {
144 indexs.
resize(m_nb_solver);
145 values.
resize(m_nb_solver);
146 for (
int i = 0; i < m_nb_solver; ++i)
147 postSolver(i,
options()->deltaT, values[i], indexs[i]);
150 for (
int i = m_nb_solver - 1; i >= 0; --i) {
151 debug() <<
"[AlephIndexTest::compute] Getting solution #" << i;
153 if (i != m_get_solution_idx)
155 debug() <<
"Solved in \33[7m" << nb_iteration <<
"\33[m iterations,"
156 <<
"residuals=[\33[1m" << residual_norm[0] <<
"\33[m," << residual_norm[3] <<
"]";
157 debug() <<
"[AlephIndexTest::compute] Applying solution #" << m_get_solution_idx;
158 solution->getLocalComponents(values[i]);
159 m_get_solution_idx += 1;
161 m_get_solution_idx %= m_nb_solver;
164 debug() <<
"[AlephIndexTest::compute] Now get our results";
170 subDomain()->timeLoopMng()->stopComputeLoop(true);
172 debug() <<
"[AlephIndexTest::compute] done";
184 Real deltaT = (1.0 + (
Real)i) * optionDeltaT;
186 Real fake_residual_norm[4];
188 m_aleph_params[i] =
new AlephParams(
traceMng(),
203 "SolveErrorAlephMatrix.dbg",
212 TypesSolver::SymHybGSJ_smoother,
213 TypesSolver::ParallelRugeStuben,
214 TypesSolver::CG_coarse_solver,
220 debug() <<
"[AlephIndexTest::compute] Resize (" << m_vector_zeroes.size() <<
") + filling the right-hand side";
221 values.resize(m_vector_zeroes.size());
222 indexs.resize(m_vector_zeroes.size());
229 debug() <<
"[AlephIndexTest::compute] ENUMERATE_FACE";
231 if (!iFace->cell(0).isOwn())
234 deltaT * (m_face_temperature[iFace]) / geoFaceSurface(*iFace,
nodesCoordinates());
238 m_aleph_mat[i] = m_aleph_kernel->createSolverMatrix();
239 m_aleph_rhs[i] = m_aleph_kernel->createSolverVector();
240 m_aleph_sol[i] = m_aleph_kernel->createSolverVector();
242 m_aleph_mat[i]->create();
243 m_aleph_rhs[i]->create();
244 m_aleph_sol[i]->create();
245 m_aleph_mat[i]->reset();
248 setValues(deltaT, m_aleph_mat[i]);
249 m_aleph_mat[i]->assemble();
251 debug() <<
"[AlephIndexTest::job] setLocalComponents";
253 m_aleph_rhs[i]->setLocalComponents(values.view());
254 m_aleph_rhs[i]->assemble();
257 m_aleph_sol[i]->setLocalComponents(m_vector_zeroes.view());
258 m_aleph_sol[i]->assemble();
259 debug() <<
"[AlephIndexTest::job] done setLocalComponents";
263 debug() <<
"[AlephIndexTest::job] Now solve with Aleph";
264 m_aleph_mat[i]->solve(m_aleph_sol[i],
267 &fake_residual_norm[0],
270 debug() <<
"[AlephIndexTest::job] done with Aleph solve";
277void AlephIndexTest::setValues(
const Real deltaT, AlephMatrix* aleph_mat)
281 m_cell_coefs[iCell] = 0.;
283 debug() <<
"[AlephIndexTest::setValues] inner-faces";
285 if (iFace->backCell().isOwn()) {
286 const Real surface = geoFaceSurface(*iFace, nodesCoordinates());
287 aleph_mat->setValue(m_cell_temperature, iFace->backCell(),
288 m_cell_temperature, iFace->frontCell(),
290 m_cell_coefs[iFace->backCell()] += 1.0 / surface;
292 if (iFace->frontCell().isOwn()) {
293 const Real surface = geoFaceSurface(*iFace, nodesCoordinates());
294 aleph_mat->setValue(m_cell_temperature, iFace->frontCell(),
295 m_cell_temperature, iFace->backCell(),
297 m_cell_coefs[iFace->frontCell()] += 1.0 / surface;
300 debug() <<
"[AlephIndexTest::setValues] outer-faces";
302 if (!iFace->cell(0).isOwn())
304 m_cell_coefs[iFace->cell(0)] += 1.0 / geoFaceSurface(*iFace,
nodesCoordinates());
306 debug() <<
"[AlephIndexTest::setValues] diagonal";
310 1.0 + deltaT * m_cell_coefs[cell]);
312 debug() <<
"[AlephIndexTest::setValues] done";
321 const Real3 xyz0 = nodes_coords[face.
node(0)];
322 const Real3 xyz1 = nodes_coords[face.
node(1)];
323 const Real3 xyz3 = nodes_coords[face.
node(3)];
324 return (xyz0 - xyz1).normL2() * (xyz0 - xyz3).normL2();
327 const Real3 xyz0 = nodes_coords[face.
node(0)];
328 const Real3 xyz1 = nodes_coords[face.
node(1)];
329 return (xyz0 - xyz1).normL2();
331 throw FatalErrorException(
"geoFace",
"Nb nodes != 4 !=2");
337ARCANE_DEFINE_STANDARD_MODULE(AlephIndexTest, AlephIndexTest);
void init(void)
points d'entrée
Generation de la classe de base du Module.
CaseOptionsAlephIndexTest * options() const
Options du jeu de données du module.
Arcane::VariableCellReal m_cell_temperature
Variables du module.
ITraceMng * traceMng() const override
Trace manager.
ISubDomain * subDomain() const override
Sub-domain associated with the module.
AlephVector * syncSolver(Integer, Integer &, Real *)
Matrix of a linear system.
void setValue(const VariableRef &, const Item &, const VariableRef &, const Item &, const Real)
setValue from arguments in IVariables, Items, and Real
Vector of a linear system.
Base class for 1D data vectors.
void resize(Int64 s)
Changes the number of elements in the array to s.
Int32 globalIteration() const
Current iteration number.
VariableScalarReal m_global_deltat
Global Delta T.
virtual ITimeLoopMng * timeLoopMng()=0
Returns the time loop manager.
virtual void stopComputeLoop(bool is_final_time, bool has_error=false)=0
Indicates that the compute loop must stop.
virtual void flush()=0
Flushes all streams.
Node node(Int32 i) const
i-th node of the entity
Int32 nbNode() const
Number of nodes of the entity.
CellGroup allCells() const
Returns the group containing all cells.
CellGroup ownCells() const
Returns the group containing all cells specific to this domain.
VariableNodeReal3 & nodesCoordinates() const
Returns the coordinates of the mesh nodes.
Information for building a module.
TraceMessageDbg debug(Trace::eDebugLevel=Trace::Medium) const
Flow for a debug message.
1D data vector with value semantics (STL style).
ItemGroupT< Face > FaceGroup
Group of faces.
ItemVariableScalarRefT< Real3 > VariableItemReal3
3D coordinate type quantity
Int32 Integer
Type representing an integer.
double Real
Type representing a real number.