28 #ifndef OOMPH_VORTICITY_SMOOTHER_HEADER
29 #define OOMPH_VORTICITY_SMOOTHER_HEADER
33 #include <oomph-lib-config.h>
46 namespace VorticityRecoveryHelpers
85 if ((max_deriv < -1) || (max_deriv > 3))
89 "Invalid input value! Should be between -1 and 3!",
90 OOMPH_CURRENT_FUNCTION,
91 OOMPH_EXCEPTION_LOCATION);
108 if ((max_deriv < 0) || (max_deriv > 1))
111 throw OomphLibError(
"Invalid input value! Should be between 0 and 3!",
112 OOMPH_CURRENT_FUNCTION,
113 OOMPH_EXCEPTION_LOCATION);
161 unsigned n_bins = n + n_dim - 1;
164 unsigned k = n_dim - 1;
177 for (
unsigned i = 0;
i < k; ++
i)
180 value *= (n_bins -
i);
222 template<
class ELEMENT>
283 unsigned n_vector = n_vort_deriv + n_veloc_deriv + 1;
289 for (
unsigned i = 0;
i < n_vort_deriv + 1;
i++)
296 for (
unsigned i = n_vort_deriv + 1;
i < n_vort_deriv + n_veloc_deriv + 1;
305 return vort_and_derivs;
316 const unsigned&
i)
const
326 if (n_vort_deriv + n_veloc_deriv + 1 == 0)
330 "Not recovering anything so this shouldn't be called.",
331 OOMPH_CURRENT_FUNCTION,
332 OOMPH_EXCEPTION_LOCATION);
337 unsigned max_vort_order =
341 unsigned max_veloc_order =
345 unsigned max_vort_recov = 0;
348 unsigned max_veloc_recov = 0;
351 for (
unsigned j = 0; j < max_vort_order + 1; j++)
358 for (
unsigned j = 1; j < max_veloc_order + 1; j++)
365 std::pair<unsigned, unsigned> container_id;
368 unsigned nprev_deriv = 0;
371 unsigned n_deriv = 0;
374 if (
i < max_vort_recov)
377 for (
unsigned jj = 0; jj < n_vort_deriv + 1; jj++)
383 nprev_deriv += n_deriv;
389 container_id.first = jj;
392 container_id.second =
i - (nprev_deriv - n_deriv);
400 else if (
i < max_vort_recov + max_veloc_recov)
404 nprev_deriv = max_vort_recov;
407 for (
unsigned jj = n_vort_deriv + 1;
408 jj < n_vort_deriv + n_veloc_deriv + 1;
415 nprev_deriv += n_deriv;
421 container_id.first = jj;
424 container_id.second =
i - (nprev_deriv - n_deriv);
434 std::ostringstream error_message_stream;
437 error_message_stream <<
"Dof number " <<
i <<
" not associated "
438 <<
"with a vorticity or velocity derivative!"
443 OOMPH_CURRENT_FUNCTION,
444 OOMPH_EXCEPTION_LOCATION);
461 const unsigned&
i)
const
464 std::pair<unsigned, unsigned> container_id;
467 unsigned derivative_index =
i;
471 int vector_index = -1;
480 for (
unsigned i = 0;
i < n_vort_derivs + 1;
i++)
499 if (vector_index == -1)
502 for (
unsigned i = 1;
i < n_veloc_derivs + 1;
i++)
508 vector_index = n_vort_derivs +
i;
523 if (vector_index == -1)
526 std::ostringstream error_message_stream;
529 error_message_stream <<
"Value of vector_index has not been set. "
530 <<
"Something's wrong!";
534 OOMPH_CURRENT_FUNCTION,
535 OOMPH_EXCEPTION_LOCATION);
540 container_id.first = vector_index;
543 container_id.second = derivative_index;
558 std::pair<unsigned, unsigned>
id =
562 unsigned vector_index =
id.first;
565 unsigned deriv_index =
id.second;
571 unsigned max_vort_recov =
575 if (vector_index < max_vort_recov + 1)
578 unsigned n_prev_deriv = 0;
581 for (
unsigned j = 0; j < vector_index; j++)
588 index += n_prev_deriv + deriv_index;
594 unsigned n_prev_deriv = 0;
597 for (
unsigned j = 0; j < max_vort_recov + 1; j++)
607 for (
unsigned j = 1; j < vector_index - n_vort_deriv; j++)
614 index += n_prev_deriv + deriv_index;
666 unsigned n_terms = 0;
686 unsigned n_terms = 0;
773 unsigned n_node = this->nnode();
779 this->
shape(s, psif);
782 for (
unsigned i = 0;
i <
N_dim;
i++)
785 unsigned u_nodal_index = this->u_index_nst(
i);
788 for (
unsigned l = 0; l < n_node; l++)
791 values[
i] += this->nodal_value(
t, l, u_nodal_index) * psif[l];
797 values[
N_dim] = this->interpolated_p_nst(
s);
804 unsigned nnod = this->nnode();
807 for (
unsigned j = 0; j < nnod; j++)
810 Node* nod_pt = this->node_pt(j);
826 const unsigned& nplot)
835 unsigned n_node = this->nnode();
841 outfile << this->tecplot_zone_string(nplot);
844 unsigned num_plot_points = this->nplot_points(nplot);
851 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
854 this->get_s_plot(iplot, nplot,
s);
857 for (
unsigned i = 0;
i <
N_dim;
i++)
860 x[
i] = this->interpolated_x(
s,
i);
863 outfile << x[
i] <<
" ";
867 outfile <<
"0.0 0.0 0.0 ";
874 unsigned n_vector = vort_and_derivs.size();
877 for (
unsigned i = 0;
i < n_vector;
i++)
880 unsigned i_entries = vort_and_derivs[
i].size();
883 for (
unsigned j = 0; j < i_entries; j++)
886 outfile << (vort_and_derivs[
i])[j] <<
" ";
891 outfile << std::endl;
895 this->write_tecplot_zone_footer(outfile, nplot);
908 unsigned n_node = this->nnode();
914 outfile << this->tecplot_zone_string(nplot);
924 unsigned num_plot_points = this->nplot_points(nplot);
927 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
930 this->get_s_plot(iplot, nplot,
s);
936 for (
unsigned i = 0;
i <
N_dim;
i++)
939 x[
i] = this->interpolated_x(
s,
i);
942 outfile << x[
i] <<
" ";
946 for (
unsigned i = 0;
i <
N_dim;
i++)
949 outfile << this->interpolated_u_nst(
s,
i) <<
" ";
953 outfile << this->interpolated_p_nst(
s) <<
" ";
961 unsigned n_vector = vort_and_derivs.size();
964 for (
unsigned i = 0;
i < n_vector;
i++)
967 unsigned i_entries = vort_and_derivs[
i].size();
970 for (
unsigned j = 0; j < i_entries; j++)
973 outfile << (vort_and_derivs[
i])[j] <<
" ";
978 outfile << std::endl;
982 this->write_tecplot_zone_footer(outfile, nplot);
997 const unsigned& nplot)
const
1003 unsigned num_plot_points = this->nplot_points_paraview(nplot);
1010 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
1013 this->get_s_plot(iplot, nplot,
s);
1019 file_out << this->interpolated_u_nst(
s,
i) << std::endl;
1025 file_out << this->interpolated_p_nst(
s) << std::endl;
1034 std::pair<unsigned, unsigned>
id =
1038 file_out << (vort_and_derivs[
id.first])[
id.second] << std::endl;
1045 std::stringstream error_stream;
1048 error_stream <<
"These VorticitySmoother elements only store "
1050 <<
"but i is currently: " <<
i << std::endl;
1054 OOMPH_CURRENT_FUNCTION,
1055 OOMPH_EXCEPTION_LOCATION);
1115 return "d^3/dx^2dy";
1118 return "d^3/dxdy^2";
1144 std::stringstream error_stream;
1145 error_stream <<
"These Navier Stokes elements only store "
1147 <<
"but i is currently: " <<
i << std::endl;
1151 error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
1159 void output(std::ostream& outfile,
const unsigned& nplot)
1168 unsigned n_node = this->nnode();
1174 outfile << this->tecplot_zone_string(nplot);
1177 unsigned num_plot_points = this->nplot_points(nplot);
1184 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
1187 this->get_s_plot(iplot, nplot,
s);
1190 this->
shape(s, psif);
1193 for (
unsigned i = 0;
i <
N_dim;
i++)
1196 x[
i] = this->interpolated_x(
s,
i);
1199 outfile << x[
i] <<
" ";
1203 for (
unsigned i = 0;
i <
N_dim;
i++)
1206 outfile << this->interpolated_u_nst(
s,
i) <<
" ";
1210 outfile << this->interpolated_p_nst(
s) <<
" ";
1216 unsigned n_vector = vort_and_derivs.size();
1219 for (
unsigned i = 0;
i < n_vector;
i++)
1222 unsigned i_entries = vort_and_derivs[
i].size();
1225 for (
unsigned j = 0; j < i_entries; j++)
1228 outfile << (vort_and_derivs[
i])[j] <<
" ";
1233 outfile << std::endl;
1237 this->write_tecplot_zone_footer(outfile, nplot);
1246 unsigned n_node = this->nnode();
1252 DShape dpsifdx(n_node, 2);
1255 this->dshape_eulerian(
s, psif, dpsifdx);
1261 for (
unsigned l = 0; l < n_node; l++)
1264 for (
unsigned j = 0; j < 2; j++)
1267 dveloc_dx[j] += this->nodal_value(l, 0) * dpsifdx(l, j);
1270 dveloc_dx[j + 2] += this->nodal_value(l, 1) * dpsifdx(l, j);
1278 const unsigned& index)
const
1281 unsigned n_node = this->nnode();
1287 DShape dpsifdx(n_node, 2);
1290 this->dshape_eulerian(
s, psif, dpsifdx);
1300 for (
unsigned l = 0; l < n_node; l++)
1303 dveloc_dx += this->nodal_value(l, 0) * dpsifdx(l, 0);
1308 for (
unsigned l = 0; l < n_node; l++)
1311 dveloc_dx += this->nodal_value(l, 0) * dpsifdx(l, 1);
1316 for (
unsigned l = 0; l < n_node; l++)
1319 dveloc_dx += this->nodal_value(l, 1) * dpsifdx(l, 0);
1324 for (
unsigned l = 0; l < n_node; l++)
1327 dveloc_dx += this->nodal_value(l, 1) * dpsifdx(l, 1);
1331 oomph_info <<
"Never get here!" << std::endl;
1341 unsigned n_node = this->nnode();
1347 DShape dpsifdx(n_node, 2);
1350 this->dshape_eulerian(
s, psif, dpsifdx);
1356 for (
unsigned l = 0; l < n_node; l++)
1359 for (
unsigned j = 0; j < 2; j++)
1370 double& dvorticity_dx,
1371 const unsigned& index)
const
1374 unsigned n_node = this->nnode();
1380 DShape dpsifdx(n_node, 2);
1383 this->dshape_eulerian(
s, psif, dpsifdx);
1386 dvorticity_dx = 0.0;
1393 for (
unsigned l = 0; l < n_node; l++)
1402 for (
unsigned l = 0; l < n_node; l++)
1410 oomph_info <<
"Never get here!" << std::endl;
1420 unsigned n_node = this->nnode();
1426 DShape dpsifdx(n_node, 2);
1429 this->dshape_eulerian(
s, psif, dpsifdx);
1435 for (
unsigned l = 0; l < n_node; l++)
1438 for (
unsigned j = 0; j < 2; j++)
1441 dvorticity_dxdy[j] +=
1446 dvorticity_dxdy[2] +=
1455 double& dvorticity_dxdy,
1456 const unsigned& index)
const
1459 unsigned n_node = this->nnode();
1465 DShape dpsifdx(n_node, 2);
1468 this->dshape_eulerian(
s, psif, dpsifdx);
1471 dvorticity_dxdy = 0.0;
1478 for (
unsigned l = 0; l < n_node; l++)
1488 for (
unsigned l = 0; l < n_node; l++)
1498 for (
unsigned l = 0; l < n_node; l++)
1507 oomph_info <<
"Never get here!" << std::endl;
1518 unsigned n_node = this->nnode();
1524 DShape dpsifdx(n_node, 2);
1527 this->dshape_eulerian(
s, psif, dpsifdx);
1533 for (
unsigned l = 0; l < n_node; l++)
1536 dvorticity_dxdxdy[0] +=
1540 dvorticity_dxdxdy[1] +=
1544 dvorticity_dxdxdy[2] +=
1548 dvorticity_dxdxdy[3] +=
1557 double& dvorticity_dxdxdy,
1558 const unsigned& index)
const
1561 unsigned n_node = this->nnode();
1567 DShape dpsifdx(n_node, 2);
1570 this->dshape_eulerian(
s, psif, dpsifdx);
1573 dvorticity_dxdxdy = 0.0;
1580 for (
unsigned l = 0; l < n_node; l++)
1583 dvorticity_dxdxdy +=
1590 for (
unsigned l = 0; l < n_node; l++)
1593 dvorticity_dxdxdy +=
1600 for (
unsigned l = 0; l < n_node; l++)
1603 dvorticity_dxdxdy +=
1610 for (
unsigned l = 0; l < n_node; l++)
1613 dvorticity_dxdxdy +=
1619 oomph_info <<
"Never get here!" << std::endl;
1636 if ((n_recovered_derivs == 0) || (
i >= n_recovered_derivs))
1639 throw OomphLibError(
"Can't calculate this; not recovering enough data.",
1640 OOMPH_CURRENT_FUNCTION,
1641 OOMPH_EXCEPTION_LOCATION);
1653 unsigned n_vector = synth_vort_and_derivs.size();
1656 double norm_squared = 0.0;
1659 unsigned n_node = this->nnode();
1665 DShape dpsifdx(n_node, 2);
1668 unsigned n_intpt = this->integral_pt()->nweight();
1677 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
1680 for (
unsigned ii = 0; ii <
N_dim; ii++)
1683 s[ii] = this->integral_pt()->knot(ipt, ii);
1687 this->interpolated_x(
s, x);
1690 double w = this->integral_pt()->weight(ipt);
1693 double J = this->dshape_eulerian(
s, psif, dpsifdx);
1699 double smoothed_vort = 0.0;
1702 for (
unsigned l = 0; l < n_node; l++)
1711 for (
unsigned jj = 0; jj < n_vector; jj++)
1725 double synth_quantity = 0.0;
1728 synth_quantity = (synth_vort_and_derivs[indices.first])[indices.second];
1731 norm_squared += pow(smoothed_vort - synth_quantity, 2) *
W;
1735 return norm_squared;
1744 unsigned n_node = this->nnode();
1750 this->
shape(s, psif);
1753 unsigned n_vector = vort_and_derivs.size();
1759 for (
unsigned i = 0;
i < n_vector;
i++)
1762 vort_and_derivs[
i].initialise(0.0);
1765 unsigned num_entries = vort_and_derivs[
i].size();
1768 for (
unsigned j = 0; j < num_entries; j++)
1771 for (
unsigned l = 0; l < n_node; l++)
1775 (vort_and_derivs[
i])[j] +=
1835 template<
class ELEMENT>
1867 std::ostringstream error_stream;
1884 psi_r[3] = x[0] * x[0];
1885 psi_r[4] = x[0] * x[1];
1886 psi_r[5] = x[1] * x[1];
1894 psi_r[3] = x[0] * x[0];
1895 psi_r[4] = x[0] * x[1];
1896 psi_r[5] = x[1] * x[1];
1897 psi_r[6] = x[0] * x[0] * x[0];
1898 psi_r[7] = x[0] * x[0] * x[1];
1899 psi_r[8] = x[0] * x[1] * x[1];
1900 psi_r[9] = x[1] * x[1] * x[1];
1905 error_stream <<
"Recovery shape functions for recovery order "
1907 <<
" haven't yet been implemented for 2D" << std::endl;
1911 OOMPH_CURRENT_FUNCTION,
1912 OOMPH_EXCEPTION_LOCATION);
1929 std::ostringstream error_stream;
1981 error_stream <<
"Recovery shape functions for recovery order "
1983 <<
" haven't yet been implemented for 2D" << std::endl;
1987 OOMPH_CURRENT_FUNCTION,
1988 OOMPH_EXCEPTION_LOCATION);
2004 adjacent_elements_pt.clear();
2007 std::map<Node*, Vector<ELEMENT*>*> aux_adjacent_elements_pt;
2011 unsigned ndisagree = 0;
2018 unsigned nelem = mesh_pt->
nelement();
2019 for (
unsigned e = 0;
e < nelem;
e++)
2021 ELEMENT* el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt->
element_pt(
e));
2032 unsigned nnod = el_pt->nnode();
2033 for (
unsigned n = 0; n < nnod; n++)
2036 Node* nod_pt = el_pt->node_pt(n);
2039 if (aux_adjacent_elements_pt[nod_pt] == 0)
2046 (*aux_adjacent_elements_pt[nod_pt]).push_back(el_pt);
2055 <<
"\n\n======================================================\n"
2057 << ndisagree <<
" out of " << mesh_pt->
nelement() <<
" elements"
2058 <<
"\nhave different preferences for the order of the recovery"
2059 <<
"\nshape functions. We are using: Recovery_order="
2062 <<
"======================================================\n\n";
2068 for (
unsigned e = 0;
e < nelem;
e++)
2070 ELEMENT* el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt->
element_pt(
e));
2073 unsigned n_node = el_pt->nvertex_node();
2074 for (
unsigned n = 0; n < n_node; n++)
2076 Node* nod_pt = el_pt->vertex_node_pt(n);
2079 if (adjacent_elements_pt[nod_pt] == 0)
2082 vertex_node_pt.push_back(nod_pt);
2088 unsigned nel = (*aux_adjacent_elements_pt[nod_pt]).size();
2089 for (
unsigned e = 0;
e < nel;
e++)
2091 (*adjacent_elements_pt[nod_pt])
2092 .push_back((*aux_adjacent_elements_pt[nod_pt])[
e]);
2100 aux_adjacent_elements_pt.begin();
2101 it != aux_adjacent_elements_pt.end();
2117 const unsigned& num_recovery_terms,
2122 unsigned nelem = patch_el_pt.size();
2125 ELEMENT* el_pt = patch_el_pt[0];
2132 int n_vort_derivs = el_pt->get_maximum_order_of_vorticity_derivative();
2135 int n_veloc_derivs = el_pt->get_maximum_order_of_velocity_derivative();
2138 if (n_vort_derivs + n_veloc_derivs == -1)
2141 std::ostringstream error_stream;
2144 error_stream <<
"Not recovering anything. Change the maximum number "
2145 <<
"of derivatives to recover.";
2149 OOMPH_CURRENT_FUNCTION,
2150 OOMPH_EXCEPTION_LOCATION);
2156 std::pair<unsigned, unsigned> container_id =
2157 el_pt->vorticity_dof_to_container_id(n_deriv);
2160 unsigned max_recoverable_vort_order =
2161 el_pt->get_maximum_order_of_recoverable_vorticity_derivative();
2164 unsigned max_recoverable_veloc_order =
2165 el_pt->get_maximum_order_of_recoverable_velocity_derivative();
2168 unsigned counter = 0;
2172 int case_value = -1;
2175 for (
unsigned i = 0;
i < max_recoverable_vort_order + 1;
i++)
2178 counter += el_pt->npartial_derivative(
i);
2182 if (n_deriv < counter)
2194 if (case_value == -1)
2197 for (
unsigned i = 1;
i < max_recoverable_veloc_order + 1;
i++)
2200 counter += 2 * el_pt->npartial_derivative(
i);
2204 if (n_deriv < counter)
2207 case_value = max_recoverable_vort_order +
i;
2217 if (case_value == -1)
2220 std::ostringstream error_message_stream;
2223 error_message_stream
2224 <<
"Case order has not been set. Something's wrong!";
2228 OOMPH_CURRENT_FUNCTION,
2229 OOMPH_EXCEPTION_LOCATION);
2234 double recovered_quantity = 0.0;
2238 num_recovery_terms, num_recovery_terms, 0.0);
2246 bool is_q_mesh =
true;
2261 for (
unsigned e = 0;
e < nelem;
e++)
2264 ELEMENT*
const el_pt = patch_el_pt[
e];
2273 unsigned n_intpt = integ_pt->
nweight();
2276 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
2279 for (
unsigned i = 0;
i < 2;
i++)
2282 s[
i] = integ_pt->
knot(ipt,
i);
2286 double w = integ_pt->
weight(ipt);
2289 double J = el_pt->J_eulerian(
s);
2295 el_pt->interpolated_x(
s, x);
2300 double W = w * J * (el_pt->geometric_jacobian(x));
2311 el_pt->get_vorticity(
s, vorticity);
2312 recovered_quantity = vorticity[0];
2317 el_pt->get_raw_vorticity_deriv(
2318 s, recovered_quantity, container_id.second);
2323 el_pt->get_raw_vorticity_second_deriv(
2324 s, recovered_quantity, container_id.second);
2329 el_pt->get_raw_vorticity_third_deriv(
2330 s, recovered_quantity, container_id.second);
2335 el_pt->get_raw_velocity_deriv(
2336 s, recovered_quantity, container_id.second);
2341 oomph_info <<
"Never get here." << std::endl;
2349 for (
unsigned l = 0; l < num_recovery_terms; l++)
2352 rhs[l] += recovered_quantity * psi_r[l] *
W;
2356 for (
unsigned l = 0; l < num_recovery_terms; l++)
2359 for (
unsigned l2 = 0; l2 < num_recovery_terms; l2++)
2362 recovery_mat(l, l2) += psi_r[l] * psi_r[l2] *
W;
2381 recovered_vorticity_coefficient_pt =
2385 for (
unsigned icoeff = 0; icoeff < num_recovery_terms; icoeff++)
2388 (*recovered_vorticity_coefficient_pt)[icoeff] = rhs[icoeff];
2420 std::ostringstream error_stream;
2428 OOMPH_CURRENT_FUNCTION,
2429 OOMPH_EXCEPTION_LOCATION);
2462 std::map<Node*, Vector<ELEMENT*>*> adjacent_elements_pt;
2468 setup_patches(mesh_pt, adjacent_elements_pt, vertex_node_pt);
2471 ELEMENT*
const el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt->
element_pt(0));
2474 unsigned smoothed_vorticity_index = el_pt->smoothed_vorticity_index();
2477 unsigned max_vort_order =
2478 el_pt->get_maximum_order_of_recoverable_vorticity_derivative();
2481 unsigned max_veloc_order =
2482 el_pt->get_maximum_order_of_recoverable_velocity_derivative();
2485 unsigned max_vort_recov = 0;
2488 unsigned max_veloc_recov = 0;
2491 for (
unsigned i = 0;
i < max_vort_order + 1;
i++)
2494 max_vort_recov += el_pt->npartial_derivative(
i);
2498 for (
unsigned i = 1;
i < max_veloc_order + 1;
i++)
2501 max_veloc_recov += 2 * el_pt->npartial_derivative(
i);
2505 unsigned n_recovered_vort_derivs =
2506 el_pt->nvorticity_derivatives_to_recover();
2509 unsigned n_recovered_veloc_derivs =
2510 el_pt->nvelocity_derivatives_to_recover();
2517 std::map<Node*, unsigned> count;
2520 unsigned nodal_dof = 0;
2523 for (
unsigned deriv = 0; deriv < max_vort_recov + max_veloc_recov;
2529 if ((
int(deriv) >
int(n_recovered_vort_derivs - 1)) &&
2530 (deriv < max_vort_recov))
2537 else if ((n_recovered_veloc_derivs == 0) && (deriv >= max_vort_recov))
2545 std::map<Node*, double> averaged_recovered_vort;
2552 adjacent_elements_pt.begin();
2553 it != adjacent_elements_pt.end();
2562 recovered_vorticity_coefficient_pt,
2569 unsigned nelem = (*(it->second)).size();
2572 for (
unsigned e = 0;
e < nelem;
e++)
2575 ELEMENT*
const el_pt = (*(it->second))[
e];
2578 unsigned nnode_el = el_pt->nnode();
2581 for (
unsigned j = 0; j < nnode_el; j++)
2584 Node* nod_pt = el_pt->node_pt(j);
2587 el_pt->local_coordinate_of_node(j,
s);
2590 el_pt->interpolated_x(
s, x);
2599 double recovered_vort = 0.0;
2602 for (
unsigned i = 0;
i < num_recovery_terms;
i++)
2606 (*recovered_vorticity_coefficient_pt)[
i] * psi_r[
i];
2610 averaged_recovered_vort[nod_pt] += recovered_vort;
2618 delete recovered_vorticity_coefficient_pt;
2621 recovered_vorticity_coefficient_pt = 0;
2625 unsigned nnod = mesh_pt->
nnode();
2628 for (
unsigned j = 0; j < nnod; j++)
2634 averaged_recovered_vort[nod_pt] /= count[nod_pt];
2637 nod_pt->
set_value(smoothed_vorticity_index + nodal_dof,
2638 averaged_recovered_vort[nod_pt]);
2650 adjacent_elements_pt.begin();
2651 it != adjacent_elements_pt.end();
2659 oomph_info <<
"Time for vorticity recovery [sec]: "
A Class for the derivatives of shape functions The class design is essentially the same as Shape,...
void pin(const unsigned &i)
Pin the i-th stored variable.
void set_value(const unsigned &i, const double &value_)
Set the i-th stored data value to specified value. The only reason that we require an explicit set fu...
Class of matrices containing doubles, and stored as a DenseMatrix<double>, but with solving functiona...
virtual void lubksub(DoubleVector &rhs)
LU backsubstitution.
virtual void ludecompose()
LU decomposition using DenseLU (default linea solver)
Information for documentation of results: Directory and file number to enable output in the form RESL...
void disable_doc()
Disable documentation.
2D Gaussian integration class. 2x2 integration points. This integration scheme can integrate up to th...
2D Gaussian integration class. 3x3 integration points. This integration scheme can integrate up to fi...
2D Gaussian integration class. 4x4 integration points. This integration scheme can integrate up to se...
Generic class for numerical integration schemes:
virtual double knot(const unsigned &i, const unsigned &j) const =0
Return local coordinate s[j] of i-th integration point.
virtual unsigned nweight() const =0
Return the number of integration points of the scheme.
virtual double weight(const unsigned &i) const =0
Return weight of i-th integration point.
GeneralisedElement *& element_pt(const unsigned long &e)
Return pointer to element e.
unsigned long nnode() const
Return number of nodes in the mesh.
Node *& node_pt(const unsigned long &n)
Return pointer to global node n.
unsigned long nelement() const
Return number of elements in the mesh.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
An OomphLibError object which should be thrown when an run-time error is encountered....
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
/////////////////////////////////////////////////////////////////// /////////////////////////////////...
2D Gaussian integration class for linear triangles. Three integration points. This integration scheme...
2D Gaussian integration class for quadratic triangles. Seven integration points. This integration sch...
2D Gaussian integration class for cubic triangles. Thirteen integration points. This integration sche...
void initialise(const _Tp &__value)
Iterate over all values and set to the desired value.
Class to indicate which derivatives of the vorticity/ velocity we want to recover....
int maximum_order_of_velocity_derivative() const
The maximum order of derivatives calculated in the velocity recovery.
unsigned Number_of_values_per_field
Number of values per field; how many of the following do we want: u,v,p,omega,d/dx,...
int Maximum_order_of_vorticity_derivative
Maximum number of derivatives to retain in the vorticity recovery. Note, the value -1 means we ONLY o...
void set_maximum_order_of_velocity_derivative(const int &max_deriv)
The maximum order of derivatives calculated in the velocity recovery.
RecoveryHelper()
Constructor.
void calculate_number_of_values_per_field()
Calculates the number of values per field given the number of vorticity and velocity derivatives to r...
int Maximum_order_of_velocity_derivative
Maximum number of derivatives to retain in the velocity recovery. Note, the value 0 means we don't ca...
unsigned ncont_interpolated_values() const
Number of continuously interpolated values:
unsigned npartial_derivative(const unsigned &n) const
Helper function that determines the number of n-th order partial derivatives in d-dimensions....
void set_maximum_order_of_vorticity_derivative(const int &max_deriv)
The maximum order of derivatives calculated in the vorticity recovery.
int maximum_order_of_vorticity_derivative() const
The maximum order of derivatives calculated in the vorticity recovery.
Overloaded element that allows projection of vorticity.
int get_maximum_order_of_velocity_derivative() const
The maximum order of derivatives calculated in the velocity recovery. Note, this value can only be se...
void vorticity_and_its_derivs(const Vector< double > &s, Vector< Vector< double >> &vort_and_derivs) const
Compute smoothed vorticity and its derivatives.
unsigned ncont_interpolated_values() const
Number of continuously interpolated values:
unsigned Smoothed_vorticity_index
Index of smoothed vorticity – followed by derivatives; in 2D this has value 3.
unsigned npartial_derivative(const unsigned &n) const
Call the function written in VorticityRecoveryHelpers.
void get_raw_vorticity_second_deriv(const Vector< double > &s, double &dvorticity_dxdy, const unsigned &index) const
Get raw derivative of smoothed derivative vorticity [0]: d^2/dx^2, [1]: d^2/dxdy, [2]: d^2/dy^2.
void get_interpolated_values(const Vector< double > &s, Vector< double > &values)
Get the function value u in Vector. Note: Given the generality of the interface (this function is usu...
unsigned smoothed_vorticity_index() const
Index of smoothed vorticity – followed by derivatives.
void(* ExactVorticityFctPt)(const Vector< double > &x, Vector< Vector< double >> &vort_and_derivs)
Typedef for pointer to function that specifies the exact vorticity and derivatives (for validation)
void scalar_value_paraview(std::ofstream &file_out, const unsigned &i, const unsigned &nplot) const
Write values of the i-th scalar field at the plot points. Needs to be implemented for each new specif...
ExactVorticityFctPt Exact_vorticity_fct_pt
Pointer to function that specifies exact vorticity and derivs (for validation).
double vorticity_error_squared(const unsigned &i)
Compute the element's contribution to the (squared) L2 norm of the difference between exact and smoot...
unsigned Maximum_order_of_recoverable_velocity_derivatives
The current maximum order of velocity derivatives that can be recovered. Currently,...
unsigned get_maximum_order_of_recoverable_vorticity_derivative() const
The maximum order of vorticity derivative that can be recovered. This is set in the constructor and s...
unsigned Maximum_order_of_recoverable_vorticity_derivatives
The current maximum order of vorticity derivatives that can be recovered. Currently,...
unsigned nscalar_paraview() const
Number of scalars/fields output by this element. Re-implements broken virtual function in base class.
unsigned nvorticity_derivatives_to_recover() const
The number of terms calculated in the vorticity recovery. Also includes the zeroth derivative,...
Vector< Vector< double > > create_container_for_vorticity_and_derivatives() const
Helper function to create a container for the vorticity and its partial derivatives....
void get_raw_velocity_deriv(const Vector< double > &s, Vector< double > &dveloc_dx) const
Get raw derivative of velocity.
VorticitySmootherElement()
Constructor.
void output(std::ostream &outfile, const unsigned &nplot)
Overloaded output function: Output velocity, pressure and the smoothed vorticity.
int Maximum_order_of_velocity_derivative
Maximum number of derivatives to retain in the velocity recovery. Note, the value 0 means we don't ca...
unsigned stored_dof_to_recoverable_dof(const unsigned &i) const
Given the STORED dof number, this function returns the global recovered number. For example,...
void output_smoothed_vorticity(std::ostream &outfile, const unsigned &nplot)
Output the velocity, smoothed vorticity and derivatives.
int get_maximum_order_of_vorticity_derivative() const
The maximum order of derivatives calculated in the vorticity recovery. Note, this value can only be s...
void get_raw_vorticity_third_deriv(const Vector< double > &s, Vector< double > &dvorticity_dxdxdy) const
Get raw derivative of smoothed derivative vorticity [0]: d^3/dx^3, [1]: d^3/dx^2dy,...
void get_raw_vorticity_deriv(const Vector< double > &s, double &dvorticity_dx, const unsigned &index) const
Get raw derivative of smoothed vorticity.
void get_interpolated_values(const unsigned &t, const Vector< double > &s, Vector< double > &values)
Get the function value u in Vector. Note: Given the generality of the interface (this function is usu...
unsigned Number_of_values_per_field
Number of values per field; how many of the following do we want: u,v,p,omega,d/dx,...
void get_raw_vorticity_deriv(const Vector< double > &s, Vector< double > &dvorticity_dx) const
Get raw derivative of smoothed vorticity.
unsigned get_maximum_order_of_recoverable_velocity_derivative() const
The maximum order of velocity derivative that can be recovered. This is set in the constructor and sh...
int Maximum_order_of_vorticity_derivative
Maximum number of derivatives to retain in the vorticity recovery. Note, the value -1 means we ONLY o...
unsigned required_nvalue(const unsigned &n) const
Number of values required at local node n. In order to simplify matters, we allocate storage for pres...
unsigned nvelocity_derivatives_to_recover() const
The number of derivatives calculated in the velocity recovery. This does NOT include the zeroth deriv...
void output_analytical_veloc_and_vorticity(std::ostream &outfile, const unsigned &nplot)
Output exact velocity, vorticity, derivatives and indicator based on functions specified by two funct...
void pin_smoothed_vorticity()
Pin all smoothed vorticity quantities.
ExactVorticityFctPt & exact_vorticity_fct_pt()
Access function: Pointer to function that specifies exact vorticity and derivatives (for validation).
std::pair< unsigned, unsigned > recovered_dof_to_container_id(const unsigned &i) const
Helper function that, given the local dof number of the i-th vorticity or velocity derivative,...
void get_raw_velocity_deriv(const Vector< double > &s, double &dveloc_dx, const unsigned &index) const
Get raw derivative of velocity.
void get_raw_vorticity_third_deriv(const Vector< double > &s, double &dvorticity_dxdxdy, const unsigned &index) const
Get raw derivative of smoothed derivative vorticity [0]: d^3/dx^3, [1]: d^3/dx^2dy,...
void get_raw_vorticity_second_deriv(const Vector< double > &s, Vector< double > &dvorticity_dxdy) const
Get raw derivative of smoothed derivative vorticity.
std::pair< unsigned, unsigned > vorticity_dof_to_container_id(const unsigned &i) const
Helper function that, given the local dof number of the i-th vorticity or velocity derivative,...
std::string scalar_name_paraview(const unsigned &i) const
Name of the i-th scalar field. Default implementation returns V1 for the first one,...
ExactVorticityFctPt exact_vorticity_fct_pt() const
Access function: Pointer to function that specifies exact vorticity and derivatives (for validation) ...
unsigned N_dim
Number of dimensions in the element.
/////////////////////////////////////////////////////////////////// /////////////////////////////////...
unsigned nrecovery_order() const
Get the recovery order.
void recover_vorticity(Mesh *mesh_pt, DocInfo &doc_info)
Recover vorticity from patches – output intermediate steps to directory specified by DocInfo object.
void recover_vorticity(Mesh *mesh_pt)
Recover vorticity from patches.
virtual ~VorticitySmoother()
Empty virtual destructor.
VorticitySmoother(const VorticitySmoother &)=delete
Broken copy constructor.
void shape_rec(const Vector< double > &x, Vector< double > &psi_r)
Recovery shape functions as functions of the global, Eulerian coordinate x of dimension dim....
Integral * integral_rec(const bool &is_q_mesh)
Integation scheme associated with the recovery shape functions must be of sufficiently high order to ...
unsigned & recovery_order()
Access function for order of recovery polynomials.
VorticitySmoother(const unsigned &recovery_order)
Constructor: Set order of recovery shape functions.
void operator=(const VorticitySmoother &)=delete
Broken assignment operator.
unsigned Recovery_order
Order of recovery polynomials.
void get_recovered_vorticity_in_patch(const Vector< ELEMENT * > &patch_el_pt, const unsigned &num_recovery_terms, Vector< double > *&recovered_vorticity_coefficient_pt, unsigned &n_deriv)
Given the vector of elements that make up a patch, compute the vector of recovered vorticity coeffici...
void setup_patches(Mesh *&mesh_pt, std::map< Node *, Vector< ELEMENT * > * > &adjacent_elements_pt, Vector< Node * > &vertex_node_pt)
Setup patches: For each vertex node pointed to by nod_pt, adjacent_elements_pt[nod_pt] contains the p...
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
void shape(const double &s, double *Psi)
Definition for 1D Lagrange shape functions. The value of all the shape functions at the local coordin...
std::string to_string(T object, unsigned float_precision=8)
Conversion function that should work for anything with operator<< defined (at least all basic types).
double timer()
returns the time in seconds after some point in past
class oomph::VorticityRecoveryHelpers::RecoveryHelper Recovery_helper
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
OomphInfo oomph_info
Single (global) instantiation of the OomphInfo object – this is used throughout the library as a "rep...