From b211a33a09c24e6c59dd93fa2f7f7e8bafdc231a Mon Sep 17 00:00:00 2001 From: michael Date: Mon, 13 Sep 2021 14:26:21 +0200 Subject: [PATCH] Use function getNumberOfElement instead of getNumberOfCells (Finite volumes) and getNumberOfNodes(Finite Elements) --- .../validationStationaryDiffusionEquation.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/CoreFlows/examples/Python/Convergence/StationaryDiffusion/validationStationaryDiffusionEquation.py b/CoreFlows/examples/Python/Convergence/StationaryDiffusion/validationStationaryDiffusionEquation.py index d6d869b..baba489 100644 --- a/CoreFlows/examples/Python/Convergence/StationaryDiffusion/validationStationaryDiffusionEquation.py +++ b/CoreFlows/examples/Python/Convergence/StationaryDiffusion/validationStationaryDiffusionEquation.py @@ -199,14 +199,10 @@ def SolveStationaryDiffusionEquation(my_mesh,resolution,MeshType,method,BC): max_sol_num=my_ResultField.max() min_sol_num=my_ResultField.min() erreur_abs=0 - if method =='FE': - for i in range(my_mesh.getNumberOfNodes()) : - if erreur_abs < abs(my_RHSfield[i]/(spaceDim*pi*pi) - my_ResultField[i]) : - erreur_abs = abs(my_RHSfield[i]/(spaceDim*pi*pi) - my_ResultField[i]) - else: - for i in range(my_mesh.getNumberOfCells()) : - if erreur_abs < abs(my_RHSfield[i]/(spaceDim*pi*pi) - my_ResultField[i]) : - erreur_abs = abs(my_RHSfield[i]/(spaceDim*pi*pi) - my_ResultField[i]) + + for i in range(my_ResultField.getNumberOfElements()) : + if erreur_abs < abs(my_RHSfield[i]/(spaceDim*pi*pi) - my_ResultField[i]) : + erreur_abs = abs(my_RHSfield[i]/(spaceDim*pi*pi) - my_ResultField[i]) print("Absolute error = max(| exact solution - numerical solution |) = ",erreur_abs ) print("Relative error = max(| exact solution - numerical solution |)/max(| exact solution |) = ",erreur_abs/max_abs_sol_exacte) print("Maximum numerical solution = ", max_sol_num, " Minimum numerical solution = ", min_sol_num) -- 2.39.2