-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IBM] prepareIBMData: check if for t_in cartesian=True or cartesian=F…
…alse.
- Loading branch information
Showing
6 changed files
with
335 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# - check if mesh is cartesian - | ||
import Transform.PyTree as T | ||
import KCore.test as test | ||
import Converter.PyTree as C | ||
import Converter.Internal as Internal | ||
import Generator.PyTree as G | ||
import Generator.IBM as G_IBM | ||
import Distributor2.PyTree as D2 | ||
import Converter.Mpi as Cmpi | ||
import random | ||
|
||
if Cmpi.rank==0: | ||
a = G.cart((0.,0.,0.), (0.1,0.1,1), (40,40,40)) | ||
t = C.newPyTree(['CARTESIAN', a]) | ||
C._addState(t, 'EquationDimension', 3) | ||
|
||
t = T.splitNParts(t, 10) | ||
t,stats = D2.distribute(t, 2) | ||
C.convertPyTree2File(t,'t_TMP.cgns') | ||
t=Cmpi.convertFile2PyTree('t_TMP.cgns',proc=Cmpi.rank) | ||
|
||
##Test 1 - Cartesian | ||
cartesian=G_IBM.checkCartesian(t) | ||
isCartesian=0 | ||
if cartesian:isCartesian=1 | ||
Internal._createUniqueChild(t, 'TMP_Node', 'UserDefinedData_t') | ||
Internal._createUniqueChild(Internal.getNodeFromName1(t, 'TMP_Node'), 'Cartesian', 'DataArray_t', value=isCartesian) | ||
if Cmpi.rank==0: | ||
test.testT(t,1) | ||
print('Is Cartesian::',cartesian,isCartesian) | ||
tsave = Internal.copyTree(t) | ||
#C.convertPyTree2File(t,'t_test1.cgns') | ||
|
||
## Test 2 - Z direction is non homogenous --> non Cartesian mesh | ||
Internal._rmNode(t, Internal.getNodeFromName(t, 'TMP_Node')) | ||
coord = Internal.getNodeFromName(Internal.getZones(t)[0],'CoordinateZ')[1] | ||
for i in range(6): coord[:,:,i]=coord[:,:,i]*i/10+coord[:,:,i] | ||
cartesian=G_IBM.checkCartesian(t) | ||
|
||
isCartesian=0 | ||
if cartesian:isCartesian=1 | ||
Internal._createUniqueChild(t, 'TMP_Node', 'UserDefinedData_t') | ||
Internal._createUniqueChild(Internal.getNodeFromName1(t, 'TMP_Node'), 'Cartesian', 'DataArray_t', value=isCartesian) | ||
if Cmpi.rank==0: | ||
test.testT(t,2) | ||
print('Is Cartesian::',cartesian,isCartesian) | ||
#C.convertPyTree2File(t,'t_test2.cgns') | ||
|
||
## Test 3 - Y direction is non homogenous --> non Cartesian mesh | ||
t = Internal.copyTree(tsave) | ||
Internal._rmNode(t, Internal.getNodeFromName(t, 'TMP_Node')) | ||
coord = Internal.getNodeFromName(Internal.getZones(t)[0],'CoordinateY')[1] | ||
for i in range(6): coord[:,i,:]=coord[:,i,:]*i/10+coord[:,i,:] | ||
cartesian=G_IBM.checkCartesian(t) | ||
|
||
isCartesian=0 | ||
if cartesian:isCartesian=1 | ||
Internal._createUniqueChild(t, 'TMP_Node', 'UserDefinedData_t') | ||
Internal._createUniqueChild(Internal.getNodeFromName1(t, 'TMP_Node'), 'Cartesian', 'DataArray_t', value=isCartesian) | ||
if Cmpi.rank==0: | ||
test.testT(t,3) | ||
print('Is Cartesian::',cartesian,isCartesian) | ||
#C.convertPyTree2File(t,'t_test3.cgns') | ||
|
||
## Test 4 - Z direction is non homogenous --> non Cartesian mesh | ||
t = Internal.copyTree(tsave) | ||
Internal._rmNode(t, Internal.getNodeFromName(t, 'TMP_Node')) | ||
coord = Internal.getNodeFromName(Internal.getZones(t)[0],'CoordinateX')[1] | ||
for i in range(6): coord[i,:,:]=coord[i,:,:]*i/10+coord[i,:,:] | ||
cartesian=G_IBM.checkCartesian(t) | ||
|
||
isCartesian=0 | ||
if cartesian:isCartesian=1 | ||
Internal._createUniqueChild(t, 'TMP_Node', 'UserDefinedData_t') | ||
Internal._createUniqueChild(Internal.getNodeFromName1(t, 'TMP_Node'), 'Cartesian', 'DataArray_t', value=isCartesian) | ||
if Cmpi.rank==0: | ||
test.testT(t,4) | ||
print('Is Cartesian::',cartesian,isCartesian) | ||
#C.convertPyTree2File(t,'t_test4.cgns') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# - check if mesh is cartesian - | ||
import Transform.PyTree as T | ||
import KCore.test as test | ||
import Converter.PyTree as C | ||
import Converter.Internal as Internal | ||
import Generator.PyTree as G | ||
import Generator.IBM as G_IBM | ||
import random | ||
|
||
a = G.cart((0.,0.,0.), (0.1,0.1,1), (20,20,20)) | ||
t = C.newPyTree(['CARTESIAN', a]) | ||
C._addState(t, 'EquationDimension', 3) | ||
|
||
##Test 1 - Cartesian | ||
cartesian=G_IBM.checkCartesian(t) | ||
isCartesian=0 | ||
if cartesian:isCartesian=1 | ||
Internal._createUniqueChild(t, 'TMP_Node', 'UserDefinedData_t') | ||
Internal._createUniqueChild(Internal.getNodeFromName1(t, 'TMP_Node'), 'Cartesian', 'DataArray_t', value=isCartesian) | ||
test.testT(t,1) | ||
tsave = Internal.copyTree(t) | ||
print('Is Cartesian::',cartesian,isCartesian) | ||
#C.convertPyTree2File(t,'t_test1.cgns') | ||
|
||
## Test 2 - Z direction is non homogenous --> non Cartesian mesh | ||
Internal._rmNode(t, Internal.getNodeFromName(t, 'TMP_Node')) | ||
coord = Internal.getNodeFromName(t,'CoordinateZ')[1] | ||
for i in range(6): coord[:,:,i]=coord[:,:,i]*i/10+coord[:,:,i] | ||
cartesian=G_IBM.checkCartesian(t) | ||
|
||
isCartesian=0 | ||
if cartesian:isCartesian=1 | ||
Internal._createUniqueChild(t, 'TMP_Node', 'UserDefinedData_t') | ||
Internal._createUniqueChild(Internal.getNodeFromName1(t, 'TMP_Node'), 'Cartesian', 'DataArray_t', value=isCartesian) | ||
test.testT(t,2) | ||
print('Is Cartesian::',cartesian,isCartesian) | ||
#C.convertPyTree2File(t,'t_test2.cgns') | ||
|
||
## Test 3 - Y direction is non homogenous --> non Cartesian mesh | ||
t = Internal.copyTree(tsave) | ||
Internal._rmNode(t, Internal.getNodeFromName(t, 'TMP_Node')) | ||
coord = Internal.getNodeFromName(t,'CoordinateY')[1] | ||
for i in range(6): coord[:,i,:]=coord[:,i,:]*i/10+coord[:,i,:] | ||
cartesian=G_IBM.checkCartesian(t) | ||
|
||
isCartesian=0 | ||
if cartesian:isCartesian=1 | ||
Internal._createUniqueChild(t, 'TMP_Node', 'UserDefinedData_t') | ||
Internal._createUniqueChild(Internal.getNodeFromName1(t, 'TMP_Node'), 'Cartesian', 'DataArray_t', value=isCartesian) | ||
test.testT(t,3) | ||
print('Is Cartesian::',cartesian,isCartesian) | ||
#C.convertPyTree2File(t,'t_test3.cgns') | ||
|
||
## Test 4 - Z direction is non homogenous --> non Cartesian mesh | ||
t = Internal.copyTree(tsave) | ||
Internal._rmNode(t, Internal.getNodeFromName(t, 'TMP_Node')) | ||
coord = Internal.getNodeFromName(t,'CoordinateX')[1] | ||
for i in range(6): coord[i,:,:]=coord[i,:,:]*i/10+coord[i,:,:] | ||
cartesian=G_IBM.checkCartesian(t) | ||
|
||
isCartesian=0 | ||
if cartesian:isCartesian=1 | ||
Internal._createUniqueChild(t, 'TMP_Node', 'UserDefinedData_t') | ||
Internal._createUniqueChild(Internal.getNodeFromName1(t, 'TMP_Node'), 'Cartesian', 'DataArray_t', value=isCartesian) | ||
test.testT(t,4) | ||
print('Is Cartesian::',cartesian,isCartesian) | ||
#C.convertPyTree2File(t,'t_test4.cgns') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# - check if mesh is cartesian - | ||
import Transform.PyTree as T | ||
import KCore.test as test | ||
import Converter.PyTree as C | ||
import Converter.Internal as Internal | ||
import Generator.PyTree as G | ||
import Generator.IBM as G_IBM | ||
import random | ||
|
||
a = G.cart((0.,0.,0.), (0.1,0.1,1), (20,20,2)) | ||
t = C.newPyTree(['CARTESIAN', a]) | ||
C._addState(t, 'EquationDimension', 2) | ||
|
||
##Test 1 - Cartesian | ||
cartesian=G_IBM.checkCartesian(t) | ||
isCartesian=0 | ||
if cartesian:isCartesian=1 | ||
Internal._createUniqueChild(t, 'TMP_Node', 'UserDefinedData_t') | ||
Internal._createUniqueChild(Internal.getNodeFromName1(t, 'TMP_Node'), 'Cartesian', 'DataArray_t', value=isCartesian) | ||
test.testT(t,1) | ||
tsave = Internal.copyTree(t) | ||
print('Is Cartesian::',cartesian,isCartesian) | ||
#C.convertPyTree2File(t,'t_test1.cgns') | ||
|
||
## Test 2 - Y direction is non homogenous --> non Cartesian mesh | ||
t = Internal.copyTree(tsave) | ||
Internal._rmNode(t, Internal.getNodeFromName(t, 'TMP_Node')) | ||
coord = Internal.getNodeFromName(t,'CoordinateY')[1] | ||
for i in range(6): coord[:,i,:]=coord[:,i,:]*i/10+coord[:,i,:] | ||
cartesian=G_IBM.checkCartesian(t) | ||
|
||
isCartesian=0 | ||
if cartesian:isCartesian=1 | ||
Internal._createUniqueChild(t, 'TMP_Node', 'UserDefinedData_t') | ||
Internal._createUniqueChild(Internal.getNodeFromName1(t, 'TMP_Node'), 'Cartesian', 'DataArray_t', value=isCartesian) | ||
test.testT(t,2) | ||
print('Is Cartesian::',cartesian,isCartesian) | ||
#C.convertPyTree2File(t,'t_test2.cgns') | ||
|
||
## Test 3 - Z direction is non homogenous --> non Cartesian mesh | ||
t = Internal.copyTree(tsave) | ||
Internal._rmNode(t, Internal.getNodeFromName(t, 'TMP_Node')) | ||
coord = Internal.getNodeFromName(t,'CoordinateX')[1] | ||
for i in range(6): coord[i,:,:]=coord[i,:,:]*i/10+coord[i,:,:] | ||
cartesian=G_IBM.checkCartesian(t) | ||
|
||
isCartesian=0 | ||
if cartesian:isCartesian=1 | ||
Internal._createUniqueChild(t, 'TMP_Node', 'UserDefinedData_t') | ||
Internal._createUniqueChild(Internal.getNodeFromName1(t, 'TMP_Node'), 'Cartesian', 'DataArray_t', value=isCartesian) | ||
test.testT(t,3) | ||
print('Is Cartesian::',cartesian,isCartesian) | ||
#C.convertPyTree2File(t,'t_test3.cgns') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# - check if mesh is cartesian - | ||
import Transform.PyTree as T | ||
import KCore.test as test | ||
import Converter.PyTree as C | ||
import Converter.Internal as Internal | ||
import Generator.PyTree as G | ||
import Generator.IBM as G_IBM | ||
import random | ||
|
||
a = G.cart((0.,0.,0.), (0.1,0.1,1), (40,40,40)) | ||
t = C.newPyTree(['CARTESIAN', a]) | ||
C._addState(t, 'EquationDimension', 3) | ||
|
||
t = T.splitNParts(t, 10) | ||
|
||
##Test 1 - Cartesian | ||
cartesian=G_IBM.checkCartesian(t) | ||
isCartesian=0 | ||
if cartesian:isCartesian=1 | ||
Internal._createUniqueChild(t, 'TMP_Node', 'UserDefinedData_t') | ||
Internal._createUniqueChild(Internal.getNodeFromName1(t, 'TMP_Node'), 'Cartesian', 'DataArray_t', value=isCartesian) | ||
test.testT(t,1) | ||
tsave = Internal.copyTree(t) | ||
print('Is Cartesian::',cartesian,isCartesian) | ||
#C.convertPyTree2File(t,'t_test1.cgns') | ||
|
||
## Test 2 - Z direction is non homogenous --> non Cartesian mesh | ||
Internal._rmNode(t, Internal.getNodeFromName(t, 'TMP_Node')) | ||
coord = Internal.getNodeFromName(Internal.getZones(t)[0],'CoordinateZ')[1] | ||
for i in range(6): coord[:,:,i]=coord[:,:,i]*i/10+coord[:,:,i] | ||
cartesian=G_IBM.checkCartesian(t) | ||
|
||
isCartesian=0 | ||
if cartesian:isCartesian=1 | ||
Internal._createUniqueChild(t, 'TMP_Node', 'UserDefinedData_t') | ||
Internal._createUniqueChild(Internal.getNodeFromName1(t, 'TMP_Node'), 'Cartesian', 'DataArray_t', value=isCartesian) | ||
test.testT(t,2) | ||
print('Is Cartesian::',cartesian,isCartesian) | ||
#C.convertPyTree2File(t,'t_test2.cgns') | ||
|
||
## Test 3 - Y direction is non homogenous --> non Cartesian mesh | ||
t = Internal.copyTree(tsave) | ||
Internal._rmNode(t, Internal.getNodeFromName(t, 'TMP_Node')) | ||
coord = Internal.getNodeFromName(Internal.getZones(t)[0],'CoordinateY')[1] | ||
for i in range(6): coord[:,i,:]=coord[:,i,:]*i/10+coord[:,i,:] | ||
cartesian=G_IBM.checkCartesian(t) | ||
|
||
isCartesian=0 | ||
if cartesian:isCartesian=1 | ||
Internal._createUniqueChild(t, 'TMP_Node', 'UserDefinedData_t') | ||
Internal._createUniqueChild(Internal.getNodeFromName1(t, 'TMP_Node'), 'Cartesian', 'DataArray_t', value=isCartesian) | ||
test.testT(t,3) | ||
print('Is Cartesian::',cartesian,isCartesian) | ||
#C.convertPyTree2File(t,'t_test3.cgns') | ||
|
||
## Test 4 - Z direction is non homogenous --> non Cartesian mesh | ||
t = Internal.copyTree(tsave) | ||
Internal._rmNode(t, Internal.getNodeFromName(t, 'TMP_Node')) | ||
coord = Internal.getNodeFromName(Internal.getZones(t)[0],'CoordinateX')[1] | ||
for i in range(6): coord[i,:,:]=coord[i,:,:]*i/10+coord[i,:,:] | ||
cartesian=G_IBM.checkCartesian(t) | ||
|
||
isCartesian=0 | ||
if cartesian:isCartesian=1 | ||
Internal._createUniqueChild(t, 'TMP_Node', 'UserDefinedData_t') | ||
Internal._createUniqueChild(Internal.getNodeFromName1(t, 'TMP_Node'), 'Cartesian', 'DataArray_t', value=isCartesian) | ||
test.testT(t,4) | ||
print('Is Cartesian::',cartesian,isCartesian) | ||
#C.convertPyTree2File(t,'t_test4.cgns') |