void VolumeIntegralValueHeat::calculateVariables(int i) { result = 0.0; if (Util::scene()->problemInfo()->problemType == ProblemType_Planar) { h1_integrate_expression(value1[i]); } else { h1_integrate_expression(2 * M_PI * x[i] * value1[i]); } averageTemperature += result; }
// Integral over the active core. double integrate(MeshFunction* sln, int marker) { Quad2D* quad = &g_quad_2d_std; sln->set_quad_2d(quad); double integral = 0.0; Element* e; Mesh* mesh = sln->get_mesh(); for_all_active_elements(e, mesh) { if (e->marker == marker) { update_limit_table(e->get_mode()); sln->set_active_element(e); RefMap* ru = sln->get_refmap(); int o = sln->get_fn_order() + ru->get_inv_ref_order(); limit_order(o); sln->set_quad_order(o, H2D_FN_VAL); scalar *uval = sln->get_fn_values(); double* x = ru->get_phys_x(o); double result = 0.0; h1_integrate_expression(x[i] * uval[i]); integral += result; } } return 2.0 * M_PI * integral; }
// Integral over the active core. double integrate(MeshFunction<double>* sln, std::string area) { Quad2D* quad = &g_quad_2d_std; sln->set_quad_2d(quad); double integral = 0.0; Element* e; Mesh* mesh = const_cast<Mesh*>(sln->get_mesh()); int marker = mesh->get_element_markers_conversion().get_internal_marker(area).marker; for_all_active_elements(e, mesh) { if (e->marker == marker) { update_limit_table(e->get_mode()); sln->set_active_element(e); RefMap* ru = sln->get_refmap(); int o = sln->get_fn_order() + ru->get_inv_ref_order(); limit_order(o, e->get_mode()); sln->set_quad_order(o, H2D_FN_VAL); double *uval = sln->get_fn_values(); double* x = ru->get_phys_x(o); double result = 0.0; h1_integrate_expression(x[i] * uval[i]); integral += result; } } return 2.0 * M_PI * integral; }
// function used to calculate L2 norm of the solution double norm_fn_l2_axisym(MeshFunction* sln, RefMap* ru) { Quad2D* quad = sln->get_quad_2d(); int o = 2 *sln->get_fn_order() + ru->get_inv_ref_order(); limit_order_nowarn(o); sln->set_quad_order(o, H2D_FN_VAL); scalar* uval = sln->get_fn_values(); double* x = ru->get_phys_x(o); double result = 0.0; h1_integrate_expression(x[i]*sqr(uval[i])); return 2*M_PI*result; }
// Function used to calculate H1 norm of the solution. double norm_fn_h1_axisym(MeshFunction* sln, RefMap* ru) { Quad2D* quad = sln->get_quad_2d(); int o = 2 * sln->get_fn_order() + ru->get_inv_ref_order(); limit_order_nowarn(o); sln->set_quad_order(o); scalar *uval, *dudx, *dudy; uval = sln->get_fn_values(); sln->get_dx_dy_values(dudx, dudy); double* x = ru->get_phys_x(o); double result = 0.0; h1_integrate_expression(x[i] * (sqr(uval[i]) + sqr(dudx[i]) + sqr(dudy[i])) ); return 2*M_PI*result; }
// function used to calculate error in L2 norm double error_fn_l2_axisym(MeshFunction* sln1, MeshFunction* sln2, RefMap* ru, RefMap* rv) { Quad2D* quad = sln1->get_quad_2d(); int o = 2*std::max(sln1->get_fn_order(), sln2->get_fn_order()) + ru->get_inv_ref_order(); limit_order_nowarn(o); sln1->set_quad_order(o, H2D_FN_VAL); sln2->set_quad_order(o, H2D_FN_VAL); scalar *uval, *vval; uval = sln1->get_fn_values(); vval = sln2->get_fn_values(); double* x = ru->get_phys_x(o); double result = 0.0; h1_integrate_expression(x[i]*sqr(uval[i] - vval[i])); return 2*M_PI*result; }
// Function used to calculate error in H1 norm. double error_fn_h1_axisym(MeshFunction* sln1, MeshFunction* sln2, RefMap* ru, RefMap* rv) { Quad2D* quad = sln1->get_quad_2d(); int o = 2*std::max(sln1->get_fn_order(), sln2->get_fn_order()) + ru->get_inv_ref_order(); limit_order_nowarn(o); sln1->set_quad_order(o); sln2->set_quad_order(o); scalar *uval, *vval, *dudx, *dudy, *dvdx, *dvdy; uval = sln1->get_fn_values(); vval = sln2->get_fn_values(); sln1->get_dx_dy_values(dudx, dudy); sln2->get_dx_dy_values(dvdx, dvdy); double* x = ru->get_phys_x(o); double result = 0.0; h1_integrate_expression(x[i] * (sqr(uval[i] - vval[i]) + sqr(dudx[i] - dvdx[i]) + sqr(dudy[i] - dvdy[i])) ); return 2*M_PI*result; }