From 945579ec4ef90eef19639ae2174c58404e3afe91 Mon Sep 17 00:00:00 2001 From: bangerth Date: Thu, 15 May 2008 14:07:54 +0000 Subject: [PATCH] Leave one more comment. git-svn-id: https://svn.dealii.org/trunk@16102 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-33/step-33.cc | 60 ++++++++++++++++------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/deal.II/examples/step-33/step-33.cc b/deal.II/examples/step-33/step-33.cc index dc091aa3fd..4a2edfc2e8 100644 --- a/deal.II/examples/step-33/step-33.cc +++ b/deal.II/examples/step-33/step-33.cc @@ -1687,34 +1687,40 @@ void ConsLaw::postprocess() { fe_v_unit.get_function_grads(solution, dU); fe_v.get_function_values(solution, UU); - for (unsigned int q = 0; q < fe_v.get_fe().base_element(0).n_dofs_per_cell(); q++) { - unsigned int didx = fe_v.get_fe().component_to_system_index(EulerEquations::density_component, q); - unsigned int eidx = fe_v.get_fe().component_to_system_index(EulerEquations::energy_component, q); - double rho_normVsqr = 0; - for (unsigned int d = 0; d < dim; d++) { - unsigned int vidx = fe_v.get_fe().component_to_system_index(d, q); - ppsolution(dofs[vidx]) = solution(dofs[vidx])/solution(dofs[didx]); - rho_normVsqr += solution(dofs[vidx])*solution(dofs[vidx]); - } - rho_normVsqr /= solution(dofs[didx]); - // Pressure - ppsolution(dofs[eidx]) = (EulerEquations::gas_gamma-1.0)*(solution(dofs[eidx]) - 0.5*rho_normVsqr); - - // Either output density or gradient - // squared of density, depending on - // what the user wants. + for (unsigned int q = 0; q < fe_v.get_fe().base_element(0).n_dofs_per_cell(); q++) + { + unsigned int didx + = fe_v.get_fe().component_to_system_index(EulerEquations::density_component, q); + unsigned int eidx + = fe_v.get_fe().component_to_system_index(EulerEquations::energy_component, q); + double rho_normVsqr = 0; + for (unsigned int d = 0; d < dim; d++) + { + unsigned int vidx = fe_v.get_fe().component_to_system_index(d, q); + ppsolution(dofs[vidx]) = solution(dofs[vidx])/solution(dofs[didx]); + rho_normVsqr += solution(dofs[vidx])*solution(dofs[vidx]); + } + rho_normVsqr /= solution(dofs[didx]); + // Pressure + ppsolution(dofs[eidx]) + = (EulerEquations::gas_gamma-1.0)*(solution(dofs[eidx]) - 0.5*rho_normVsqr); + + // Either output density or gradient + // squared of density, depending on + // what the user wants. //TODO: if schlieren plot then simply use a postprocessor - if (output_params.schlieren_plot == false) - ppsolution(dofs[didx]) = solution(dofs[didx]); - else - { - double ng = 0; - for (unsigned int i = 0; i < dim; i++) ng += dU[q][EulerEquations::density_component][i]*dU[q][EulerEquations::density_component][i]; - ng = std::sqrt(ng); - ppsolution(dofs[didx]) = ng; - } - } - + if (output_params.schlieren_plot == false) + ppsolution(dofs[didx]) = solution(dofs[didx]); + else + { + double ng = 0; + for (unsigned int i = 0; i < dim; i++) + ng += dU[q][EulerEquations::density_component][i]*dU[q][EulerEquations::density_component][i]; + ng = std::sqrt(ng); + ppsolution(dofs[didx]) = ng; + } + } + } // cell } -- 2.39.5