29 Integer numberOfResolutionsPerSolvers,
35 , m_sub_domain(subDomain)
36 , m_aleph_number_of_resolutions_per_solvers(numberOfResolutionsPerSolvers)
41 m_aleph_kernel(
new AlephKernel(subDomain, underlyingSolver, numberOfCores))
46 , m_get_solution_idx(0)
48 info() << Trace::Color::cyan() <<
"[AlephSolver] New solver "
49 <<
"with " << numberOfResolutionsPerSolvers <<
" resolutions, "
50 <<
"underlying solver is '" << underlyingSolver <<
"', "
51 <<
"and numberOfCores is " << numberOfCores;
52 m_aleph_mat.resize(numberOfResolutionsPerSolvers);
53 m_aleph_rhs.resize(numberOfResolutionsPerSolvers);
54 m_aleph_sol.resize(numberOfResolutionsPerSolvers);
56 m_vector_zeroes.add(0.0);
61 info() << Trace::Color::cyan() <<
"[AlephSolver] Delet solver";
62 delete m_aleph_kernel;
63 delete m_aleph_params;
75 Real residual_norm[4];
77 indexs.
resize(m_aleph_number_of_resolutions_per_solvers);
78 values.
resize(m_aleph_number_of_resolutions_per_solvers);
81 i < m_aleph_number_of_resolutions_per_solvers;
83 postSingleResolution(cell_temperature,
85 i, m_delta_t, values[i], indexs[i]);
88 for (
int i = m_aleph_number_of_resolutions_per_solvers - 1; i >= 0; i -= 1) {
89 debug() << Trace::Color::cyan() <<
"[AlephSolver::launchResolutions] Getting solution #" << i;
90 AlephVector* solution = m_aleph_kernel->syncSolver(i, nb_iteration, &residual_norm[0]);
91 if (i != m_get_solution_idx)
93 info() << Trace::Color::cyan() <<
"Solved in \33[7m" << nb_iteration <<
"\33[m iterations,"
94 <<
"residuals=[\33[1m" << residual_norm[0] <<
"\33[m," << residual_norm[3] <<
"]";
95 debug() << Trace::Color::cyan() <<
"[AlephSolver::launchResolutions] Applying solution #" << m_get_solution_idx;
96 solution->getLocalComponents(values[i]);
97 m_get_solution_idx += 1;
99 m_get_solution_idx %= m_aleph_number_of_resolutions_per_solvers;
101 debug() << Trace::Color::cyan() <<
"[AlephSolver::launchResolutions] Now get our results";
103 cell_temperature[cell] =
104 values[m_get_solution_idx][m_aleph_kernel->indexing()->get(cell_temperature, *cell)];
105 debug() << Trace::Color::cyan() <<
"[AlephSolver::launchResolutions] done";
119 Real deltaT = (1.0 + (
Real)i) * optionDeltaT;
121 Real fake_residual_norm[4];
124 debug() << Trace::Color::cyan()
125 <<
"[AlephSolver::postSingleResolution] Resize (" << m_vector_zeroes.size()
126 <<
") + remplissage du second membre";
127 values.
resize(m_vector_zeroes.size());
128 indexs.
resize(m_vector_zeroes.size());
130 Integer row = m_aleph_kernel->indexing()->get(cell_temperature, cell);
133 values[row] = cell_temperature[cell];
136 debug() << Trace::Color::cyan() <<
"[AlephSolver::postSingleResolution] ENUMERATE_FACE";
138 if (!iFace->cell(0).isOwn())
140 values[m_aleph_kernel->indexing()->get(cell_temperature, iFace->cell(0))] +=
141 deltaT * (face_temperature[iFace]) / geoFaceSurface(*iFace,
nodesCoordinates());
145 m_aleph_mat.setAt(i, m_aleph_kernel->createSolverMatrix());
146 m_aleph_rhs.setAt(i, m_aleph_kernel->createSolverVector());
147 m_aleph_sol.setAt(i, m_aleph_kernel->createSolverVector());
149 m_aleph_mat.at(i)->create();
150 m_aleph_rhs.at(i)->create();
151 m_aleph_sol.at(i)->create();
152 m_aleph_mat.at(i)->reset();
155 setValues(cell_temperature, face_temperature, deltaT, m_aleph_mat.at(i));
156 m_aleph_mat.at(i)->assemble();
158 debug() << Trace::Color::cyan() <<
"[AlephSolver::postSingleResolution] setLocalComponents";
160 m_aleph_rhs.at(i)->setLocalComponents(values.
view());
161 m_aleph_rhs.at(i)->assemble();
164 m_aleph_sol.at(i)->setLocalComponents(m_vector_zeroes.view());
165 m_aleph_sol.at(i)->assemble();
167 debug() << Trace::Color::cyan() <<
"\33[37m[AlephSolver::postSingleResolution] Now solve with Aleph";
168 m_aleph_mat.at(i)->solve(m_aleph_sol.at(i),
171 &fake_residual_norm[0],
188 debug() << Trace::Color::cyan() <<
"[AlephSolver::setValues] inner-faces";
190 if (iFace->backCell().isOwn()) {
192 aleph_mat->
setValue(cell_temperature, iFace->backCell(),
193 cell_temperature, iFace->frontCell(),
195 coefs[iFace->backCell()] += 1.0 / surface;
197 if (iFace->frontCell().isOwn()) {
199 aleph_mat->
setValue(cell_temperature, iFace->frontCell(),
200 cell_temperature, iFace->backCell(),
202 coefs[iFace->frontCell()] += 1.0 / surface;
205 debug() << Trace::Color::cyan() <<
"[AlephSolver::setValues] outer-faces";
207 if (!iFace->cell(0).isOwn())
211 debug() << Trace::Color::cyan() <<
"[AlephSolver::setValues] diagonale";
213 aleph_mat->
setValue(cell_temperature, cell,
214 cell_temperature, cell,
215 1.0 + deltaT * coefs[cell]);
217 debug() << Trace::Color::cyan() <<
"[AlephSolver::setValues] done";
227 const Real3 xyz0 = nodes_coords[face.
node(0)];
228 const Real3 xyz1 = nodes_coords[face.
node(1)];
229 const Real3 xyz3 = nodes_coords[face.
node(3)];
230 return (xyz0 - xyz1).normL2() * (xyz0 - xyz3).normL2();
233 const Real3 xyz0 = nodes_coords[face.
node(0)];
234 const Real3 xyz1 = nodes_coords[face.
node(1)];
235 return (xyz0 - xyz1).normL2();
242 Integer m_aleph_number_of_resolutions_per_solvers;