Skip to content

Commit 4d4e761

Browse files
Merge pull request #926 from KratosMultiphysics/use-gids-python
Use gids python
2 parents 11ff6aa + 85365c2 commit 4d4e761

20 files changed

Lines changed: 303 additions & 86 deletions

.github/workflows/tester.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131

3232
- name: Install bins
3333
run: |
34-
pip install --upgrade --force-reinstall --no-cache-dir KratosMultiphysics-all==9.2
34+
pip install --upgrade --force-reinstall --no-cache-dir KratosMultiphysics-all==9.3.2
3535
3636
# Copy problemtype to gid and copy exec
3737
- name: Move kratos where it should be

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ kratos.gid/exec/Kratos*
88
*.orig
99
.vscode/
1010

11-
custom_tools/*
11+
dist
1212
.DS_Store
1313

1414
*.zip
1515
*.tgz
16+
null

README.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/36d3d305c87e4bb398bc87ea2e3b890e)](https://www.codacy.com/gh/KratosMultiphysics/GiDInterface/dashboard?utm_source=github.com&utm_medium=referral&utm_content=KratosMultiphysics/GiDInterface&utm_campaign=Badge_Grade)
44
[![Tester](https://github.com/KratosMultiphysics/GiDInterface/actions/workflows/tester.yml/badge.svg)](https://github.com/KratosMultiphysics/GiDInterface/actions/workflows/tester.yml)
55

6-
The user interface of Kratos with [GiD](http://www.gidhome.com).
6+
The user interface of Kratos with [GiD](http://www.gidsimulation.com).
77

88
If you need the latest stable release, launch your GiD, navigate to Data > Problemtype > Internet retrieve and download Kratos there.
99
Available for Linux. Windows, and macOS.
@@ -12,35 +12,41 @@ If you need the developer version, you are on the right place.
1212

1313
## First steps
1414
* 1- Clone this repository, or install a stable [release](https://github.com/KratosMultiphysics/GiDInterface/releases)
15-
* 2- Install the latest GiD developer version -> [Developer version](http://www.gidhome.com/download/developer-versions)
15+
* 2- Install the latest GiD developer version **(minimum 16.1.4d)** -> [Developer version](https://www.gidsimulation.com/gid-for-science/downloads/)
1616
* 3- Navigate to GiD's problemtype folder and delete any previous kratos.gid
1717
* Create there a link to our [kratos.gid](./kratos.gid/) downloaded in step 1
1818
* Windows: Simple shortcut to kratos.gid folder
1919
* 4- Choose your execution mode:
20+
* 4.1- **Default execution mode.** Use GiD's python:
21+
* You don't need to install python. The program will detect if you have any pending package to install.
22+
* If there's any missing package, use the GiD command line and execute:
23+
24+
`-np- W [GiD_Python_PipInstallMissingPackages [list $Kratos::pip_packages_required ] ]`
2025
* 4.1- To execute Kratos using the standard pip packages:
21-
* Python version recommended: 3.9
26+
* Python version recommended: 3.8, 3.9, 3.10, 3.11
2227
* Open a terminal and run
23-
- Linux: `python3 -m pip install --upgrade --force-reinstall --no-cache-dir KratosMultiphysics-all==9.2`
24-
- Windows: `python -m pip install --upgrade --force-reinstall --no-cache-dir KratosMultiphysics-all==9.2`
28+
- Linux: `python3 -m pip install --upgrade --force-reinstall --no-cache-dir KratosMultiphysics-all==9.3.2`
29+
- Windows: `python -m pip install --upgrade --force-reinstall --no-cache-dir KratosMultiphysics-all==9.3.2`
2530
* 4.2- To execute Kratos using your compiled binaries:
26-
* Navigate to kratos.gid/exec/
27-
* Create there a symbolic link to the kratos installation folder (where runkratos is located)
28-
* Unix : `ln -s ~/Kratos Kratos` or maybe `ln -s ~/Kratos/bin/Release Kratos` if that's the destination folder
29-
* Windows : `mklink /J Kratos C:\kratos\bin\Release` (choose actual Kratos installation folder)
31+
* Fill the Kratos preferences windows with
32+
- Path to the python folder
33+
- Path to the kratos build folder
3034
* Step by step video: https://www.youtube.com/watch?v=zZq7ypDdudo
31-
* 4.3- To execute Kratos using docker, just install docker
35+
* 4.3- To execute Kratos using docker, just install docker.
36+
* Note: This is the ONLY option if you are a **macOS** user at this moment
3237

3338
### Launch modes
3439
In Kratos preferences, select the execution mode:
40+
* GiD's python: Use the GiD internal python to run. It will help you install the pip packages
3541
* Pip packages: Kratos will be installed via `pip install`
3642
* local compiled: If you are a developer and build your applications, use this one
3743
* docker: If you do not want to install any dependency, just run via docker!
3844
* The default image is [fjgarate/kratos-run](https://hub.docker.com/repository/docker/fjgarate/kratos-run)
3945

4046
### Usage
4147
* Run GiD
42-
* Go to: Data / Problem type / kratos
43-
* kratos top menu / Developer mode (recommended)
48+
* Go to top menu: Data / Problem type / kratos
49+
* Go to top menu: kratos / Preferences / Developer mode (recommended)
4450

4551
### Examples
4652
* [Fluid dynamics example](https://github.com/KratosMultiphysics/Kratos/wiki/Running-an-example-from-GiD#3-set-a-fluid-dynamics-problem)

dockers/.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*
2+
!./*
3+
!dist/*
4+
!../dist/

dockers/create-release.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
# Change directory to the specified directory
4+
cd /tmp/dist/kratos-9.3.2/
5+
find . -type f -name "*.unix.bat" -print0 | xargs -0 dos2unix
6+
7+
# Add execute permission to all .bat files in the directory
8+
# chmod 755 *.bat
9+
10+
# Create a tgz file from the directory
11+
tar -czf ../kratos-9.3.2-linux-64.tgz *
12+

dockers/deploy.bat

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
2-
set krversion=9.3
3-
set pyversion=3.11.2-alpine3.17
1+
set krversion=9.3.2
2+
set pyversion=3.10.5
3+
@REM 3.10.10-alpine3.17
44
echo "Building kratos %krversion% on python %pyversion%"
5-
docker build --build-arg version=%krversion% --build-arg pyversion=%pyversion% -t kratos-run:%krversion%-py%pyversion% .
5+
docker build --build-arg krversion=%krversion% --build-arg pyversion=%pyversion% -t kratos-run:%krversion% -t kratos-run:latest .
6+
67
docker tag kratos-run:%krversion% fjgarate/kratos-run:%krversion%
7-
@REM docker push fjgarate/kratos-run:%krversion%
8+
docker push fjgarate/kratos-run:%krversion%
89

9-
@REM docker build -t -t kratos-run:latest .
10-
@REM docker tag kratos-run:latest fjgarate/kratos-run:latest
11-
@REM docker push fjgarate/kratos-run:latest
10+
docker tag kratos-run:latest fjgarate/kratos-run:latest
11+
docker push fjgarate/kratos-run:latest

dockers/dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# Default values. Use --build-arg on build to change
2-
ARG pyversion=3.10
2+
ARG pyversion=3.10.8
33

44
# Base pyton image
5-
FROM python:3.10.10-alpine3.17
6-
7-
ARG krversion=9.3
8-
ENV krversion=9.3
5+
FROM python:$pyversion
6+
# FROM python:3.10.10-alpine3.17
97

108
# Update pip
119
RUN pip install --upgrade pip
1210

11+
ARG krversion=9.3.2
12+
1313
# Install Kratos and dependencies
1414
RUN python3 -m pip install KratosMultiphysics-all==$krversion numpy
1515

dockers/linux-releaser.dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM ubuntu
2+
3+
RUN apt-get update && \
4+
apt-get install -y dos2unix && \
5+
apt-get clean
6+
7+
WORKDIR /tmp
8+
COPY create-release.sh create-release.sh
9+
RUN dos2unix create-release.sh
10+
RUN chmod 755 /tmp/create-release.sh
11+
12+
CMD /tmp/create-release.sh
13+
# docker build -t linux_releaser -f linux-releaser.dockerfile .
14+
# docker run --rm -v ${PWD}/dist:/tmp/dist linux_releaser

kratos.gid/exec/compiled.unix.bat

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ rm -f "$2/$1*.post.msh"
88
rm -f "$2/$1.info"
99
rm -f "$2/$1.err"
1010
rm -f "$2/$1.flavia.dat"
11+
rm -fr "$2/gid_output"
12+
rm -fr "$2/vtk_output"
1113

1214
# include .bashrc if it exists
1315
if [ -f "$HOME/.bashrc" ]; then
@@ -18,28 +20,18 @@ fi
1820
# and maintains OLD_LD_LIBRARY_PATH with previous settings
1921
# therefore, we use the OLD_LD_LIBRARY_PATH and prepend the path to the kratos libs
2022
if [ "$OLD_LD_LIBRARY_PATH" != "" ]; then
21-
export LD_LIBRARY_PATH="$3/exec/Kratos":"$3/exec/Kratos/libs":$OLD_LD_LIBRARY_PATH
23+
export LD_LIBRARY_PATH="$kratos_bin_path/libs":$OLD_LD_LIBRARY_PATH
2224
else
2325
# do not add the ':'
24-
export LD_LIBRARY_PATH="$3/exec/Kratos":"$3/exec/Kratos/libs"
26+
export LD_LIBRARY_PATH="$kratos_bin_path/libs"
2527
fi
2628

2729
# Prevents the PYTHONHOME error from happening and isolate possible python repacks present
2830
# in the system and interfeering with runkratos
29-
export PYTHONPATH="$3/exec/Kratos":$PYTHONPATH
31+
export PYTHONPATH=$kratos_bin_path:$PYTHONPATH
3032

33+
KERNEL_NAME="linux"
3134

32-
# if mac
33-
KERNEL=`uname -s`
34-
if [ $KERNEL = "Darwin" ]; then
35-
KERNEL_NAME="macosx"
36-
export DYLD_LIBRARY_PATH="$3/exec/Kratos":"$3/exec/Kratos/libs":$DYLD_LIBRARY_PATH
37-
export DYLD_FALLBACK_LIBRARY_PATH="$3/exec/Kratos":"$3/exec/Kratos/libs":$DYLD_FALLBACK_LIBRARY_PATH
38-
export PYTHONPATH="$3/exec/Kratos/Lib":"$3/exec/Kratos/Lib/lib-dynload/":$PYTHONPATH
39-
export PYTHONHOME="$3/exec/Kratos"
40-
else
41-
KERNEL_NAME="linux"
42-
fi
4335

4436
# Run Python using the script MainKratos.py
45-
"$3/exec/Kratos/runkratos" MainKratos.py > "$2/$1.info" 2> "$2/$1.err"
37+
$python_path/python3 MainKratos.py > "$2/$1.info" 2> "$2/$1.err"

kratos.gid/exec/compiled.win.bat

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,19 @@ REM ErrorFile: "%2\%1.err"
99

1010
DEL "%2\%1.info"
1111
DEL "%2\%1.err"
12+
DEL "%2\%1*.post.bin"
13+
DEL "%2\%1*.post.res"
14+
DEL "%2\%1*.post.msh"
15+
DEL "%2\%1.info"
16+
DEL "%2\%1.err"
17+
DEL "%2\%1.flavia.dat"
18+
DEL "%2\gid_output"
19+
DEL "%2\vtk_output"
20+
21+
@REM echo "Launching on Compiled for windows -> %kratos_bin_path%" > .run
1222

13-
set PATH=%3\\exec\\kratos;%3\\exec\\kratos\\libs;%PATH%
23+
set PATH=%kratos_bin_path%\libs;%PATH%
24+
set PYTHONPATH=%kratos_bin_path%
1425

1526
REM Run Python using the script MainKratos.py
16-
"%3\\exec\\kratos\\runkratos" MainKratos.py > "%2\\%1.info" 2> "%2\\%1.err"
27+
%python_path%/python MainKratos.py > "%2\\%1.info" 2> "%2\\%1.err"

0 commit comments

Comments
 (0)