From fce844bbe1ac3f55c8da1c4d57b163161005db58 Mon Sep 17 00:00:00 2001 From: benoit128 Date: Thu, 11 Jul 2024 14:36:23 +0200 Subject: [PATCH 1/2] docs: update git and install doc --- .../Converter/test/getPathsFromValuePT_t1.py | 1 - Cassiopee/Envs/env_Cassiopee_local | 7 +- Cassiopee/Envs/sh_Cassiopee_local | 8 ++- docs/developers/Git/UsingGit.md | 62 ++++++++++++++++++ docs/developers/Install/msys2.md | 65 ++++++++++--------- docs/developers/Install/ubuntu.md | 43 ++++++++---- 6 files changed, 137 insertions(+), 49 deletions(-) create mode 100644 docs/developers/Git/UsingGit.md diff --git a/Cassiopee/Converter/test/getPathsFromValuePT_t1.py b/Cassiopee/Converter/test/getPathsFromValuePT_t1.py index f869a17f4..98b584bc5 100644 --- a/Cassiopee/Converter/test/getPathsFromValuePT_t1.py +++ b/Cassiopee/Converter/test/getPathsFromValuePT_t1.py @@ -6,7 +6,6 @@ a = G.cart((0,0,0), (1,1,1), (10,10,10)) t = C.newPyTree(['Base', a]) -C.convertPyTree2File(t, 'out.cgns') # Return nodes with given value paths = Internal.getPathsFromValue(t, 'Structured') diff --git a/Cassiopee/Envs/env_Cassiopee_local b/Cassiopee/Envs/env_Cassiopee_local index d90e8faf9..5bf76f772 100644 --- a/Cassiopee/Envs/env_Cassiopee_local +++ b/Cassiopee/Envs/env_Cassiopee_local @@ -205,9 +205,12 @@ else if ($MAC == "macosx") then else if ($MAC == "ubuntu") then #-------------------------------- ubuntu ------------------------------------ - setenv ELSAPROD ub_r8 + setenv ELSAPROD ubuntu setenv ELSAPROD "$ELSAPROD$INTTYPE" - setenv OMP_NUM_THREADS 2 + setenv OMP_NUM_THREADS 4 + setenv PYTHONEXE=python3 + setenv PRODMODE=1 + setenv PIP_DISABLE_PIP_VERSION_CHECK=1 else if ($MAC == "fulvio") then #------------------------------- fulvio --------------------------------------- diff --git a/Cassiopee/Envs/sh_Cassiopee_local b/Cassiopee/Envs/sh_Cassiopee_local index 2ba2f6366..19e6aaf52 100644 --- a/Cassiopee/Envs/sh_Cassiopee_local +++ b/Cassiopee/Envs/sh_Cassiopee_local @@ -124,9 +124,12 @@ elif [ "$MAC" = "macosx" ]; then elif [ "$MAC" = "ubuntu" ]; then #-------------------------------- ubuntu -------------------------------------- - export ELSAPROD=ub_r8 + export ELSAPROD=ubuntu export ELSAPROD=$ELSAPROD$INTTYPE - export OMP_NUM_THREADS=2 + export OMP_NUM_THREADS=4 + export PYTHONEXE=python3 + export PRODMODE=1 + export PIP_DISABLE_PIP_VERSION_CHECK=1 elif [ "$MAC" = "visio" ]; then #----------------------------- visio ----------------------------------------- @@ -191,7 +194,6 @@ elif [ "$MAC" = "visung_el8" ]; then export PYTHONEXE=python3 export OMP_NUM_THREADS=72 #export PRODMODE=1 - #export PIP_DISABLE_PIP_VERSION_CHECK=1 unset I_MPI_PMI_LIBRARY elif [ "$MAC" = "austri" ]; then diff --git a/docs/developers/Git/UsingGit.md b/docs/developers/Git/UsingGit.md new file mode 100644 index 000000000..e902739c7 --- /dev/null +++ b/docs/developers/Git/UsingGit.md @@ -0,0 +1,62 @@ +# Using git + +## Forks +To help developping Cassiopee, you have to first fork the +Cassiopee repository. + +Regularly, you will have to "sync" your fork using the "sync" button +on the web site of your fork. +When syncing, your fork is updated from the main repository. + +## Pulling +Pulling is updating your sources from your fork (after syncing): +```sh +git pull +``` +If you have modified the same sources as the one that has been touched on the main repository, this operation will fail. You then have to move your modification aside by doing: +```sh +git stash +git pull +``` +The pull will be ok, since no local modification exists. You now have to put back your modifications with: +```sh +git stash apply +``` +You local modifications will be merged. Merge problem may occur and you will have to edit some files to choose the right code. + +## Commiting +Commiting will commit your modifications locally. Nothing is sent. +To check the files you have modified: +```sh +git status +``` +To see the differences: +```sh +git diff +``` + +Before commiting, you must first tag files for commit using: +```sh +git add +``` +or tag all modified files: +```sh +git add -u +``` + +You can then commit: +```sh +git commit -m "message" +``` + +## Pushing to your fork +Pushing is submitting your modifications to your fork. +```sh +git push +``` + +## Merging to main repository + +Finally, to send your modifications to the main repository, you have to +submit a merge request. Go to your fork web site and click on "submit merge request". Add some comments about what you have down and click ok. + diff --git a/docs/developers/Install/msys2.md b/docs/developers/Install/msys2.md index d579ba759..0798e6bc6 100644 --- a/docs/developers/Install/msys2.md +++ b/docs/developers/Install/msys2.md @@ -1,50 +1,57 @@ -# Installation sous msys2 (windows) +# Installation on msys2 (windows) ## Install msys2 Download msys2 (https://www.msys2.org) -Install it +and install it. ## Install dependencies In an msys2 mingw64 terminal: - - pacman -S mingw64/mingw-w64-x86_64-gcc - pacman -S mingw64/mingw-w64-x86_64-gcc-fortran - pacman -S mingw64/mingw-w64-x86_64-python - pacman -S mingw64/mingw-w64-x86_64-python-numpy - pacman -S mingw64/mingw-w64-x86_64-scons - pacman -S mingw64/mingw-w64-x86_64-python-pip - pacman -S mingw64/mingw-w64-x86_64-python-pip-tools - pacman -S mingw64/mingw-w64-x86_64-hdf5 - pacman -S mingw64/mingw-w64-x86_64-msmpi - pacman -S mingw64/mingw-w64-x86_64-oce +```shell +pacman -S mingw64/mingw-w64-x86_64-gcc +pacman -S mingw64/mingw-w64-x86_64-gcc-fortran +pacman -S mingw64/mingw-w64-x86_64-python +pacman -S mingw64/mingw-w64-x86_64-python-numpy +pacman -S mingw64/mingw-w64-x86_64-scons +pacman -S mingw64/mingw-w64-x86_64-python-pip +pacman -S mingw64/mingw-w64-x86_64-python-pip-tools +pacman -S mingw64/mingw-w64-x86_64-hdf5 +pacman -S mingw64/mingw-w64-x86_64-msmpi +pacman -S mingw64/mingw-w64-x86_64-oce +``` ## Install Cassiopee - - export CASSIOPEE=/d/johndo/Cassiopee - export MACHINE=win64 +```shell +export CASSIOPEE=/d/johndo/Cassiopee +export MACHINE=win64 - source $CASSIOPEE/Cassiopee/Envs/sh_Cassiopee_r8 - cd $CASSIOPEE/Cassiopee - ./install +source $CASSIOPEE/Cassiopee/Envs/sh_Cassiopee_r8 +cd $CASSIOPEE/Cassiopee +./install +``` ## Some usefull pacman commands Update system: - - pacman -Syu +```shell +pacman -Syu +``` Find package matching keyword: - - pacman -Ss +```shell +pacman -Ss +``` Install package: - - pacman -S +```shell +pacman -S +``` List installed packages: +```shell +pacman -Qe +``` - pacman -Qe - Remove package: - - pacman -Rs +```shell +pacman -Rs +``` \ No newline at end of file diff --git a/docs/developers/Install/ubuntu.md b/docs/developers/Install/ubuntu.md index fd5de4818..26ce9e950 100644 --- a/docs/developers/Install/ubuntu.md +++ b/docs/developers/Install/ubuntu.md @@ -1,19 +1,34 @@ -# Installation sous ubuntu (linux) +# Installation on ubuntu (linux) ## Install dependencies - - sudo apt-get install python-dev - sudo apt-get install python-numpy - sudo apt-get install scons - sudo apt-get install gcc - sudo apt-get install gfortran - sudo apt-get install xorg-dev +```shell +sudo apt-get install python3-dev +sudo apt-get install python-numpy +sudo apt-get install scons +sudo apt-get install gcc +sudo apt-get install gfortran +sudo apt-get install hdf5 +sudo apt-get install xorg-dev +``` ## Install Cassiopee - - export CASSIOPEE=/d/johndo/Cassiopee - export MACHINE=ubuntu +```shell +export CASSIOPEE=/d/johndo/Cassiopee +export MACHINE=ubuntu - source $CASSIOPEE/Cassiopee/Envs/sh_Cassiopee_r8 - cd $CASSIOPEE/Cassiopee - ./install \ No newline at end of file +source $CASSIOPEE/Cassiopee/Envs/sh_Cassiopee_r8 +cd $CASSIOPEE/Cassiopee +./install +``` + +## Using apt_get + +Find package from keyword: +```shell +apt-cache search +``` + +Install package: +```shell +sudo apt-get install +``` \ No newline at end of file From 0a1a8644a55f5a7043f01f3fca0745915c4e9cc7 Mon Sep 17 00:00:00 2001 From: BconstantMMK Date: Thu, 11 Jul 2024 14:54:20 +0200 Subject: [PATCH 2/2] G_IBM: bug corr. and check=False by default / P_IBM: add extra security check --- Cassiopee/Apps/test/IBMrotation_t1.py | 2 -- Cassiopee/Generator/Generator/IBM.py | 15 +++++++-------- Cassiopee/Post/Post/IBM.py | 1 + 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Cassiopee/Apps/test/IBMrotation_t1.py b/Cassiopee/Apps/test/IBMrotation_t1.py index c84a98e1f..da956a42e 100644 --- a/Cassiopee/Apps/test/IBMrotation_t1.py +++ b/Cassiopee/Apps/test/IBMrotation_t1.py @@ -174,8 +174,6 @@ R._copyGrid2GridInit(tc) C.convertPyTree2File(tc, LOCAL+'/tc.cgns') -os.remove(LOCAL+'/octree.cgns') - Internal._rmNodesByName(t, '.Solver#Param') Internal._rmNodesByName(t, '.Solver#ownData') Internal._rmNodesByName(tc, '.Solver#Param') diff --git a/Cassiopee/Generator/Generator/IBM.py b/Cassiopee/Generator/Generator/IBM.py index cfba0c364..19add998b 100644 --- a/Cassiopee/Generator/Generator/IBM.py +++ b/Cassiopee/Generator/Generator/IBM.py @@ -7,19 +7,18 @@ import Transform.PyTree as T import Converter.Internal as Internal import Connector.IBM as X_IBM -import Geom.IBM as D_IBM import Geom.PyTree as D import Post.PyTree as P import Converter -import Transform import Converter.GhostCells as CGC import Connector.PyTree as X import Converter.Mpi as Cmpi +import Converter.Filter as Filter import numpy EPSCART = 1.e-6 -def generateCartMesh__(o, parento=None, dimPb=3, vmin=11, DEPTH=2, sizeMax=4000000, check=True, +def generateCartMesh__(o, parento=None, dimPb=3, vmin=11, DEPTH=2, sizeMax=4000000, check=False, externalBCType='BCFarfield', bbox=None): # Estimation du nb de pts engendres @@ -47,7 +46,7 @@ def generateCartMesh__(o, parento=None, dimPb=3, vmin=11, DEPTH=2, sizeMax=40000 if bbox is None: bbox = G.bbox(o) del o - X_IBM._addExternalBCs(t, bbox, DEPTH, externalBCType, dimPb) + _addExternalBCs(t, bbox, DEPTH, externalBCType, dimPb) nptsTot = 0 for zp in Internal.getZones(t): @@ -60,7 +59,7 @@ def generateCartMesh__(o, parento=None, dimPb=3, vmin=11, DEPTH=2, sizeMax=40000 def adaptIBMMesh(t, tb, vmin, sensor, factor=1.2, DEPTH=2, sizeMax=4000000, variables=None, refineFinestLevel=False, refineNearBodies=False, - check=True, externalBCType='BCFarfield', fileo='octree.cgns', + check=False, externalBCType='BCFarfield', fileo='octree.cgns', isAMR=False,valMin=0,valMax=1): if fileo is None: raise ValueError("adaptIBMMesh: Octree mesh must be specified by a file.") try: to = C.convertFile2PyTree(fileo) @@ -117,7 +116,7 @@ def adaptIBMMesh(t, tb, vmin, sensor, factor=1.2, DEPTH=2, sizeMax=4000000, def generateIBMMesh(tb, vmin=15, snears=None, dfar=10., dfarList=[], DEPTH=2, tbox=None, - snearsf=None, check=True, sizeMax=4000000, + snearsf=None, check=False, sizeMax=4000000, externalBCType='BCFarfield', to=None, fileo=None, expand=2, dfarDir=0, mode=0): dimPb = Internal.getNodeFromName(tb, 'EquationDimension') @@ -362,7 +361,7 @@ def _addBCsForSymmetry(t, bbox=None, dimPb=3, dir_sym=0, X_SYM=0., depth=2): def generateIBMMeshPara(tb, vmin=15, snears=None, dimPb=3, dfar=10., dfarList=[], tbox=None, - snearsf=None, check=True, to=None, ext=2, + snearsf=None, check=False, to=None, ext=2, expand=3, dfarDir=0, check_snear=False, mode=0, tbOneOver=None, listF1save=[], fileoutpre=['./','template.cgns']): import KCore.test as test @@ -1000,7 +999,7 @@ def octree2StructLoc__(o, parento=None, vmin=21, ext=0, optimized=0, sizeMax=4e6 return zones else: bbox0 = G.bbox(o) - X_IBM._addBCOverlaps(zones, bbox0) + _addBCOverlaps(zones, bbox0) return zones # only in octree2StructLoc__ diff --git a/Cassiopee/Post/Post/IBM.py b/Cassiopee/Post/Post/IBM.py index a63ea1f33..a2c539363 100644 --- a/Cassiopee/Post/Post/IBM.py +++ b/Cassiopee/Post/Post/IBM.py @@ -791,6 +791,7 @@ def createCloudIBM__(tc, ibctypes=[]): XW = Internal.getNodeFromName(IBCD,'CoordinateX_PW')[1] YW = Internal.getNodeFromName(IBCD,'CoordinateY_PW')[1] ZW = Internal.getNodeFromName(IBCD,'CoordinateZ_PW')[1] + if len(XW) < 2: continue zsize = numpy.empty((1,3), Internal.E_NpyInt, order='F') zsize[0,0] = XW.shape[0]; zsize[0,1] = 0; zsize[0,2] = 0 newName = 'IBW_%sX%d'%(cpt_name, Cmpi.rank)