@@ -447,7 +447,7 @@ Compute L2 error norm for velocity and pressure for TGV2D case. https://doi.org/
447447"""
448448function compute_error (simcase:: TaylorGreen{Periodic} , params:: Dict{Symbol,Any} , tn:: Float64 , fields:: Tuple )
449449 uh, ph = fields
450- @unpack U,P = params
450+ @unpack U,P,V,Q = params
451451 uh_analytic = simcase. bc_type. a_solution[:velocity ](tn) # Compute analytic velocity at tn
452452 ph_analytic = simcase. bc_type. a_solution[:pressure ](tn) # Compute analytic pressure at tn
453453
@@ -458,7 +458,12 @@ function compute_error(simcase::TaylorGreen{Periodic}, params::Dict{Symbol,Any},
458458 eu = uh_analytic - uh # error velocity
459459 ep = ph_analytic - ph # error pressure
460460
461+ # m_eu = maximum(norm(eu))
462+ m_eu = maximum (norm .(get_free_dof_values ((interpolate (eu, V (tn))))))
463+ m_ep = maximum (abs .(get_free_dof_values ((interpolate (ep, Q (tn))))))
461464
465+ println (m_eu)
466+ println (m_ep)
462467
463468
464469 # L2 norm error velocity and pressure
@@ -476,21 +481,28 @@ function compute_error(simcase::TaylorGreen{Periodic}, params::Dict{Symbol,Any},
476481 # Construct data array dynamically
477482 data_rel = [tn]
478483 data_abs = [tn]
484+ data_max = [tn]
485+
479486 headers = [" time" ]
480487 if " VelocityError" in selected_exports
481488 push! (data_rel, l2eu_rel)
482489 push! (data_abs, l2eu_abs)
490+ push! (data_max, m_eu)
491+
483492 push! (headers, " VelocityError" )
484493 end
485494 if " PressureError" in selected_exports
486495 push! (data_rel, l2ep_rel)
487496 push! (data_abs, l2ep_abs)
497+ push! (data_max, m_ep)
488498 push! (headers, " PressureError" )
489499
490500 end
491501
492502 write_to_csv (" TGV_L2_relative_ERRRORS.csv" , data_rel, headers, parts)
493503 write_to_csv (" TGV_L2_absolute_ERRRORS.csv" , data_abs, headers, parts)
504+ write_to_csv (" TGV_max_absolute_ERRRORS.csv" , data_max, headers, parts)
505+
494506
495507end
496508
0 commit comments