From: michael Date: Mon, 5 Oct 2020 17:46:35 +0000 (+0200) Subject: Corrected error in all Poisson tests (indentation and mesh location) X-Git-Tag: V9_6_0~19 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=413e4bc5449cee0331977d46750f10219f01a06a;p=tools%2Fsolverlab.git Corrected error in all Poisson tests (indentation and mesh location) --- diff --git a/CDMATH/tests/examples/Poisson3DEF/CMakeLists.txt b/CDMATH/tests/examples/Poisson3DEF/CMakeLists.txt index b55c3ed..286cc1a 100755 --- a/CDMATH/tests/examples/Poisson3DEF/CMakeLists.txt +++ b/CDMATH/tests/examples/Poisson3DEF/CMakeLists.txt @@ -3,7 +3,7 @@ SET(MESH_MED ../../ressources/meshCube.med ) -file(COPY ${MESH_MED} DESTINATION ${CMAKE_BINARY_DIR}/tests/examples/Poisson3DEF) +file(COPY ${MESH_MED} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) install(FILES ${MESH_MED} DESTINATION share/examples/Poisson3DEF) if (CDMATH_WITH_PYTHON AND CDMATH_WITH_PETSC AND CDMATH_WITH_POSTPRO) diff --git a/CDMATH/tests/examples/Poisson3DEF/FiniteElements3DPoisson_CUBE.py b/CDMATH/tests/examples/Poisson3DEF/FiniteElements3DPoisson_CUBE.py index 3aed331..6317e94 100644 --- a/CDMATH/tests/examples/Poisson3DEF/FiniteElements3DPoisson_CUBE.py +++ b/CDMATH/tests/examples/Poisson3DEF/FiniteElements3DPoisson_CUBE.py @@ -121,7 +121,7 @@ for i in range(nbCells): #Ajout de la contribution de la cellule triangulaire i au second membre du noeud j RHS[j_int]=Ci.getMeasure()/4*my_RHSfield[j]+RHS[j_int] # intégrale dans le triangle du produit f x fonction de base #Contribution de la cellule tétraédrique i à la ligne j_int du système linéaire - for k in [nodeId0,nodeId1,nodeId2,nodeId3] : + for k in [nodeId0,nodeId1,nodeId2,nodeId3] : if boundaryNodes.count(k)==0 : #seuls les noeuds intérieurs contribuent à la matrice du système linéaire k_int=interiorNodes.index(k)#indice du noeud k en tant que noeud intérieur Rigidite.addValue(j_int,k_int,GradShapeFuncs[j]*GradShapeFuncs[k]/Ci.getMeasure()) diff --git a/CDMATH/tests/examples/Poisson3DEF_BALL/CMakeLists.txt b/CDMATH/tests/examples/Poisson3DEF_BALL/CMakeLists.txt index 7790282..1a05b09 100755 --- a/CDMATH/tests/examples/Poisson3DEF_BALL/CMakeLists.txt +++ b/CDMATH/tests/examples/Poisson3DEF_BALL/CMakeLists.txt @@ -3,7 +3,7 @@ SET(MESH_MED ../../ressources/ballWithTetrahedra.med ) -file(COPY ${MESH_MED} DESTINATION ${CMAKE_BINARY_DIR}/tests/examples/Poisson3DEF_BALL) +file(COPY ${MESH_MED} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) install(FILES ${MESH_MED} DESTINATION share/examples/Poisson3DEF_BALL) if (CDMATH_WITH_PYTHON AND CDMATH_WITH_PETSC AND CDMATH_WITH_POSTPRO) diff --git a/CDMATH/tests/examples/Poisson3DEF_BALL/FiniteElements3DPoisson_BALL.py b/CDMATH/tests/examples/Poisson3DEF_BALL/FiniteElements3DPoisson_BALL.py index b53f1e0..b9f0f14 100755 --- a/CDMATH/tests/examples/Poisson3DEF_BALL/FiniteElements3DPoisson_BALL.py +++ b/CDMATH/tests/examples/Poisson3DEF_BALL/FiniteElements3DPoisson_BALL.py @@ -119,7 +119,7 @@ for i in range(nbCells): #Ajout de la contribution de la cellule triangulaire i au second membre du noeud j RHS[j_int]=Ci.getMeasure()/4*my_RHSfield[j]+RHS[j_int] # intégrale dans le triangle du produit f x fonction de base #Contribution de la cellule triangulaire i à la ligne j_int du système linéaire - for k in [nodeId0,nodeId1,nodeId2,nodeId3] : + for k in [nodeId0,nodeId1,nodeId2,nodeId3] : if boundaryNodes.count(k)==0 : #seuls les noeuds intérieurs contribuent à la matrice du système linéaire k_int=interiorNodes.index(k)#indice du noeud k en tant que noeud intérieur Rigidite.addValue(j_int,k_int,GradShapeFuncs[j]*GradShapeFuncs[k]/Ci.getMeasure()) diff --git a/CDMATH/tests/examples/Poisson3DEF_RadiatorAndWindow/CMakeLists.txt b/CDMATH/tests/examples/Poisson3DEF_RadiatorAndWindow/CMakeLists.txt index 545bd5f..f628489 100755 --- a/CDMATH/tests/examples/Poisson3DEF_RadiatorAndWindow/CMakeLists.txt +++ b/CDMATH/tests/examples/Poisson3DEF_RadiatorAndWindow/CMakeLists.txt @@ -3,7 +3,7 @@ SET(MESH_MED ./Mesh_RadiatorAndWindow.med ) -file(COPY ${MESH_MED} DESTINATION ${CMAKE_BINARY_DIR}/tests/examples/Poisson3DEF_RadiatorAndWindow) +file(COPY ${MESH_MED} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) install(FILES ${MESH_MED} DESTINATION share/examples/Poisson3DEF_RadiatorAndWindow) if (CDMATH_WITH_PYTHON AND CDMATH_WITH_PETSC AND CDMATH_WITH_POSTPRO) diff --git a/CDMATH/tests/examples/Poisson3DEF_RadiatorAndWindow/FiniteElements3DPoisson_CUBE_RadiatorAndWindow.py b/CDMATH/tests/examples/Poisson3DEF_RadiatorAndWindow/FiniteElements3DPoisson_CUBE_RadiatorAndWindow.py index 3ec911c..f58010b 100755 --- a/CDMATH/tests/examples/Poisson3DEF_RadiatorAndWindow/FiniteElements3DPoisson_CUBE_RadiatorAndWindow.py +++ b/CDMATH/tests/examples/Poisson3DEF_RadiatorAndWindow/FiniteElements3DPoisson_CUBE_RadiatorAndWindow.py @@ -140,10 +140,10 @@ for i in range(nbCells): values2=[0,0,1,0] values3=[0,0,0,1] - GradShapeFunc0 = gradientNodal(M,values0)/6 - GradShapeFunc1 = gradientNodal(M,values1)/6 - GradShapeFunc2 = gradientNodal(M,values2)/6 - GradShapeFunc3 = gradientNodal(M,values3)/6 + GradShapeFunc0 = gradientNodal(M,values0)*(1./6) + GradShapeFunc1 = gradientNodal(M,values1)*(1./6) + GradShapeFunc2 = gradientNodal(M,values2)*(1./6) + GradShapeFunc3 = gradientNodal(M,values3)*(1./6) #Création d'un tableau (numéro du noeud, gradient de la fonction de forme) GradShapeFuncs={nodeId0 : GradShapeFunc0} @@ -168,7 +168,7 @@ for i in range(nbCells): T2 = boundaryValue(nodeId2) T3 = boundaryValue(nodeId3) boundaryContributionAdded=True#Contribution from the boundary to matrix line j is done in one step - GradGh = gradientNodal(M,[T0,T1,T2,T3])/6 + GradGh = gradientNodal(M,[T0,T1,T2,T3])*(1./6) RHS[j_int] += -(GradGh*GradShapeFuncs[j])/Ci.getMeasure() diff --git a/CDMATH/tests/examples/Poisson3DVF_BALL/FiniteVolumes3DPoisson_BALL.py b/CDMATH/tests/examples/Poisson3DVF_BALL/FiniteVolumes3DPoisson_BALL.py index 940eb2c..a09d3fd 100755 --- a/CDMATH/tests/examples/Poisson3DVF_BALL/FiniteVolumes3DPoisson_BALL.py +++ b/CDMATH/tests/examples/Poisson3DVF_BALL/FiniteVolumes3DPoisson_BALL.py @@ -78,7 +78,7 @@ for i in range(nbCells): Ck=my_mesh.getCell(k) distance=Ci.getBarryCenter().distance(Ck.getBarryCenter()) coeff=Fj.getMeasure()/Ci.getMeasure()/distance - Rigidite.setValue(i,k,-coeff) # terme extradiagonal + Rigidite.addValue(i,k,-coeff) # terme extradiagonal else: coeff=Fj.getMeasure()/Ci.getMeasure()/Ci.getBarryCenter().distance(Fj.getBarryCenter()) Rigidite.addValue(i,i,coeff) # terme diagonal diff --git a/CDMATH/tests/examples/SpectrumLaplace2DEF/SpectrumLaplace2DEF_SQUARE.py b/CDMATH/tests/examples/SpectrumLaplace2DEF/SpectrumLaplace2DEF_SQUARE.py index 5443f21..f34f58a 100755 --- a/CDMATH/tests/examples/SpectrumLaplace2DEF/SpectrumLaplace2DEF_SQUARE.py +++ b/CDMATH/tests/examples/SpectrumLaplace2DEF/SpectrumLaplace2DEF_SQUARE.py @@ -110,7 +110,7 @@ for i in range(nbCells): j_int=interiorNodes.index(j)#indice du noeud j en tant que noeud intérieur nodal_volumes[j_int]+=Ci.getMeasure()/3 #Contribution de la cellule triangulaire i à la ligne j_int du système linéaire - for k in [nodeId0,nodeId1,nodeId2] : + for k in [nodeId0,nodeId1,nodeId2] : if boundaryNodes.count(k)==0 : #seuls les noeuds intérieurs contribuent à la matrice du système linéaire k_int=interiorNodes.index(k)#indice du noeud k en tant que noeud intérieur Rigidite.addValue(j_int,k_int,GradShapeFuncs[j]*GradShapeFuncs[k]/Ci.getMeasure()) diff --git a/CDMATH/tests/examples/SpectrumLaplaceBeltrami3DEF/SpectrumFiniteElements3DLaplace-Beltrami.py b/CDMATH/tests/examples/SpectrumLaplaceBeltrami3DEF/SpectrumFiniteElements3DLaplace-Beltrami.py index 59439bb..a6b3f3e 100755 --- a/CDMATH/tests/examples/SpectrumLaplaceBeltrami3DEF/SpectrumFiniteElements3DLaplace-Beltrami.py +++ b/CDMATH/tests/examples/SpectrumLaplaceBeltrami3DEF/SpectrumFiniteElements3DLaplace-Beltrami.py @@ -66,7 +66,7 @@ for i in range(nbCells): normalFace1[2]=Ci.getNormalVector(1,2) normalCell = normalFace0.crossProduct(normalFace1) - normalCell = normalCell/normalCell.norm() + normalCell = normalCell*(1/normalCell.norm()) cellMat=cdmath.Matrix(4) cellMat[0,0]=N0.x() @@ -87,15 +87,15 @@ for i in range(nbCells): cellMat[3,3]=0 #Formule des gradients voir EF P1 -> calcul déterminants - GradShapeFunc0[0]= cellMat.partMatrix(0,0).determinant()/2 - GradShapeFunc0[1]=-cellMat.partMatrix(0,1).determinant()/2 - GradShapeFunc0[2]= cellMat.partMatrix(0,2).determinant()/2 - GradShapeFunc1[0]=-cellMat.partMatrix(1,0).determinant()/2 - GradShapeFunc1[1]= cellMat.partMatrix(1,1).determinant()/2 - GradShapeFunc1[2]=-cellMat.partMatrix(1,2).determinant()/2 - GradShapeFunc2[0]= cellMat.partMatrix(2,0).determinant()/2 - GradShapeFunc2[1]=-cellMat.partMatrix(2,1).determinant()/2 - GradShapeFunc2[2]= cellMat.partMatrix(2,2).determinant()/2 + GradShapeFunc0[0]= cellMat.partMatrix(0,0).determinant()*0.5 + GradShapeFunc0[1]=-cellMat.partMatrix(0,1).determinant()*0.5 + GradShapeFunc0[2]= cellMat.partMatrix(0,2).determinant()*0.5 + GradShapeFunc1[0]=-cellMat.partMatrix(1,0).determinant()*0.5 + GradShapeFunc1[1]= cellMat.partMatrix(1,1).determinant()*0.5 + GradShapeFunc1[2]=-cellMat.partMatrix(1,2).determinant()*0.5 + GradShapeFunc2[0]= cellMat.partMatrix(2,0).determinant()*0.5 + GradShapeFunc2[1]=-cellMat.partMatrix(2,1).determinant()*0.5 + GradShapeFunc2[2]= cellMat.partMatrix(2,2).determinant()*0.5 #Création d'un tableau (numéro du noeud, gradient de la fonction de forme GradShapeFuncs={nodeId0 : GradShapeFunc0}