82 temperatures.reset(this->maskedMesh->size(), inittemp);
84 thickness.reset(this->maskedMesh->getElementsCount(),
NAN);
86 for (
auto elem: this->maskedMesh->elements())
88 if (!
isnan(thickness[
elem.getIndex()]))
continue;
89 auto material = this->geometry->getMaterial(
elem.getMidpoint());
90 double top =
elem.getUpper1(), bottom =
elem.getLower1();
93 size_t c =
elem.getIndex0();
94 for (
size_t r =
row; r > 0; r--) {
95 auto e = this->mesh->element(c, r-1);
96 auto m = this->geometry->getMaterial(
e.getMidpoint());
98 bottom =
e.getLower1();
103 for (
size_t r =
elem.getIndex1()+1; r < this->mesh->axis[1]->size()-1; r++) {
104 auto e = this->mesh->element(c, r);
105 auto m = this->geometry->getMaterial(
e.getMidpoint());
112 double h = top - bottom;
114 size_t idx = this->maskedMesh->element(c, r).getIndex();
390 this->initCalculation();
395 auto btemperature = temperature_boundary(this->maskedMesh, this->geometry);
397 size_t size = this->maskedMesh->size();
399 std::unique_ptr<FemMatrix>
pA(this->getMatrix());
401 std::unique_ptr<FemMatrix>
pB(this->getMatrix());
405 maxT = *std::max_element(temperatures.begin(), temperatures.end());
408 if (!temperatures.unique()) this->
writelog(
LOG_DEBUG,
"Temperature data held by something else...");
410 temperatures = temperatures.claim();
415 size_t r = rebuildfreq,
419 for (
double t = 0.; t < time; t += timestep) {
421 if (rebuildfreq && r == 0)
427 B.mult(temperatures, X);
428 for (std::size_t i = 0; i < X.size(); ++i) X[i] +=
F[i];
432 A.solverhs(T, temperatures);
434 if (logfreq && l == 0)
436 maxT = *std::max_element(temperatures.begin(), temperatures.end());
443 elapstime += timestep;
446 elapstime -= timestep;
447 outTemperature.fireChanged();
448 outHeatFlux.fireChanged();
458 fluxes.reset(this->maskedMesh->getElementsCount());
460 for (
auto e: this->maskedMesh->elements())
463 auto material = this->geometry->getMaterial(
midpoint);
478 std::tie(kx,ky) = std::tuple<double,double>(material->thermk(
temp,
leaf->getBoundingBox().height()));
480 std::tie(kx,ky) = std::tuple<double,double>(material->thermk(
temp));
483 fluxes[
e.getIndex()] =
vec(
487 + temperatures[
upleftno] + temperatures[
uprghtno]) / (
e.getUpper1() -
e.getLower1()));
531 auto point = flags.wrap(dest_mesh->at(i));
532 size_t x = solver->mesh->axis[0]->findUpIndex(point[0]),
533 y = solver->mesh->axis[1]->findUpIndex(point[1]);
534 if (x == 0 || y == 0 || x == solver->mesh->axis[0]->size() || y == solver->mesh->axis[1]->size())
537 auto elem = solver->maskedMesh->element(x-1, y-1);
538 auto material = solver->geometry->getMaterial(
elem.getMidpoint());
539 size_t idx =
elem.getIndex();
541 return material->thermk(temps[idx], solver->thickness[idx]);