Skip to content

Commit

Permalink
refactor python services; let leofea return rendered images
Browse files Browse the repository at this point in the history
  • Loading branch information
ghackenberg committed Jan 30, 2024
1 parent 9493396 commit d11074f
Show file tree
Hide file tree
Showing 43 changed files with 629 additions and 507 deletions.
32 changes: 32 additions & 0 deletions diagrams/services.mmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
classDiagram
class LeoFEA {
+port: int = 5000
+index(ldr: text, lib: text): image
+pre(ldr: text, lib: text): comm, mail
+post(resu: text, message: text): resultsMinMax
}
class CodeAster {
port: int = 5001
+index(comm: text, mail: text): resu, rmed, message
}
class OpenFOAM {
port: int = 5002
+index(TODO): TODO
}
class ParaView {
port: int = 5003
+index(rmed: text): image
}

<<service>> LeoFEA
<<service>> CodeAster
<<service>> OpenFOAM
<<service>> ParaView

LeoFEA ..> CodeAster: comm, mail
LeoFEA ..> OpenFOAM: TODO
LeoFEA ..> ParaView: rmed

CodeAster ..> LeoFEA: resu, rmed
OpenFOAM ..> LeoFEA: TODO
ParaView ..> LeoFEA: image
Binary file added diagrams/services.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions diagrams/services.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 19 additions & 27 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,34 @@
services:

fea-preprocessor:
build: ./services/fea-preprocessor
command: flask run --host=0.0.0.0 --debug
leofea:
build: ./services/leofea
command: python main.py --debug
volumes:
- ./services/fea-preprocessor:/app
- ./services/leofea:/app
ports:
- 5000:5000

fea-solver:
build: ./services/fea-solver
command: flask run --host=0.0.0.0 --debugger
codeaster:
build: ./services/codeaster
command: python main.py --debug
volumes:
- ./services/fea-solver:/app
- ./services/codeaster:/app
ports:
- 5001:5000

fea-postprocessor:
build: ./services/fea-postprocessor
command: flask run --host=0.0.0.0 --debug
volumes:
- ./services/fea-postprocessor:/app
ports:
- 5002:5000
# openfoam:
# build: ./services/openfoam
# command: python3 main.py --debug
# volumes:
# - ./services/openfoam:/root
# ports:
# - 5002:5000

fea-paraview:
build: ./services/fea-paraview
command: flask run --host=0.0.0.0
paraview:
build: ./services/paraview
command: python main.py
volumes:
- ./services/fea-paraview:/app
- ./services/paraview:/app
ports:
- 5003:5000

cfd-solver:
build: ./services/cfd-solver
command: flask run --host=0.0.0.0 --debugger
volumes:
- ./services/cfd-solver:/app
ports:
- 5004:5000

34 changes: 33 additions & 1 deletion services/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,39 @@
# CADdrive Services

This folder contains additional services required by the CADdrive platform such as **CodeAster** for finite element analysis (FEA), **OpenFOAM** for computational fluid dynamics (CFD), and **ParaView** for visualization of simulation results.

## Scripts

To run the services in development mode:

```sh
cd <CADdrive>

docker-compose up
```
```

## Services

The following diagram provides an overview of the services included in CADdrive.
For each service the port number and the HTTP route handlers are included.
Furthermore, the diagram shows the interactions between the different services.
Note that the interactions are implemented as HTTP requests and responses.

![Services](../diagrams/services.svg)

In the following, we provide some more information about the services and their functionality.

* [LeoFEA](./leofea/) for converting LDraw models to CodeAster models
* HTTP server listing on ``port 5000``
* ``HTTP POST /`` for full processing
* ``HTTP POST /preprocess`` for preprocessing
* ``HTTP POST /postprocess`` for postprocessing
* [CodeAster](./codeaster/) for producing CodeAster simulation results
* HTTP server listening on ``port 5001``
* ``HTTP POST /`` for simulating
* [OpenFOAM](./openfoam/) for producing OpenFOAM simulation results
* HTTP server listening on ``port 5002``
* ``HTTP POST /`` for simulating
* [ParaView](./paraview/) for rendering the CodeAster simulation results
* HTTP server listening on ``port 5003``
* ``HTTP POST /`` for rendering
12 changes: 3 additions & 9 deletions services/cfd-solver/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,10 @@ RUN apt-get update && apt-get install python3-pip -y
RUN pip3 install Flask
RUN pip3 install requests_toolbelt

RUN mkdir /app
COPY main.py /root

COPY main.py /app

WORKDIR /app
WORKDIR /root

EXPOSE 5000/tcp

ENV FLASK_APP=main.py
ENV FLASK_ENV=development

CMD flask run --host=0.0.0.0

CMD python3 main.py
2 changes: 1 addition & 1 deletion services/cfd-solver/Pipfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[[source]]
url = "https://github.com/ghackenberg/caddrive"
verify_ssl = true
name = "caddrive-cfd-solver"
name = "caddrive-openfoam"

[packages]
flask = "*"
Expand Down
Loading

0 comments on commit d11074f

Please sign in to comment.