inline double myStep3::postprocess()
{
QGauss<1> face_quadrature_formula(3);
const unsigned int n_face_q_points = face_quadrature_formula.size();
FEFaceValues<2> fe_face_values(fe, face_quadrature_formula,
update_gradients | update_normal_vectors | update_JxW_values);
long double summe_q_boundary = 0.0;
long double summe_abs_q_boundary = 0.0;
std::vector<MyBoundary> theBCs;
theBCs = myBCSet.getAllBC();
typedef std::vector<MyBoundary>::iterator BC_Itterator;
for (BC_Itterator it = theBCs.begin(); it != theBCs.end(); ++it)
{
int bcNummer = it->get_Nummer();
long double summe_q_face = 0.0;
DoFHandler<2>::active_cell_iterator cell = dof_handler.begin_active(),
endc = dof_handler.end();
for (; cell != endc; ++cell)
{
// Lambda der Zelle bestimmen
long double lambda = myMatSet.getLambdaByNummer(
static_cast<int>(cell->material_id()));
// alle Faces der Zelle abarbeiten
for (unsigned int face = 0; face < GeometryInfo<2>::faces_per_cell;
++face)
if (cell->face(face)->at_boundary()
&& (cell->face(face)->boundary_indicator() == bcNummer))
{
// das Face liegt auf der aktuellen Boundary, also integrieren
fe_face_values.reinit(cell, face);
// gradienten der Lösung auf der Oberfläche bestimmen
std::vector<dealii::Tensor<1, 2>> grads(n_face_q_points);
fe_face_values.get_function_gradients(solution, grads);
for (unsigned int q = 0; q < n_face_q_points; ++q)
{
// Wärmestromdichte = -k*grad(T)
double summand = -1.0 * lambda * fe_face_values.JxW(q)
* (grads[q] * fe_face_values.normal_vector(q));
// naive addition, funktioniert aber mit double
summe_q_face += summand;
}
}
}
std::cout.setf(std::ios::fixed, std::ios::floatfield);
std::cout.precision(12);
std::cout << "Wärmestrom Boundary Nr " << bcNummer << " ist : "
<< summe_q_face << " W/m" << std::endl;
summe_q_boundary += summe_q_face;
summe_abs_q_boundary += abs(summe_q_face);
}
std::cout << "Summe Wärmeströme : " << summe_q_boundary << " W/m"
<< std::endl;
std::cout << "Summe Absolute Wärmeströme : " << summe_abs_q_boundary
<< " W/m" << "\n" << std::endl;
std::cout << "Fehler : "
<< abs(summe_q_boundary) / summe_abs_q_boundary * 100.0 << "% \n\n"
<< std::endl;
konvergenz << dof_handler.n_dofs() << "\t";
konvergenz << abs(summe_q_boundary) / summe_abs_q_boundary * 100.0 << "\n";
return summe_abs_q_boundary;
}
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dealii+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Hi Helmut,
thank you for making it more clear for me. One more question: Did you check that all the desired faces on the boundary are integrated as expected? How do you colorize your grid? Is the colorization inherited in the adaptive refinement?
Best,
Bärbel
is there a way to output a (refined) grid with colorization (eg. with boundary-id and material-id as number) just to be sure that the inheritance is performed properly ? Which other way would be thinkable ?
for (unsigned int cell_counter =0; cell!=endc; ++cell,++cell_counter)
material_ids(cell_counter) = int(cell->material_id());
// Add to DataOut object
data_out.add_data_vector (material_ids, "Material IDs");
I don't know that you can output boundary ids to visualize easily, at least I typically don't. You can, however, do the same sort of thing but give cells with certain boundary faces different values in the data vector.
-Scott
--
stringstream ss2;
ss2 << "grid-" << cycle << ".ucd";
GridOut myGridOut;
GridOutFlags::Ucd flags;
flags.write_faces = true;
flags.write_lines = true;
myGridOut.set_flags(flags);
std::ofstream output(ss2.str());
myGridOut.write_ucd(triangulation, output);
ERROR: In /Users/kitware/Dashboards/MyTests/NightlyMaster/ParaViewSuperbuild-Release/paraview/src/paraview/Utilities/VisItBridge/databases/AvtAlgorithms/vtkAvtSTMDFileFormatAlgorithm.cxx, line 122
vtkVisItCEAucdReader (0x10b664120): Unable to find any meshes