Topology optimization software with the discrete adjoint method from DAFoam.
Need to build datofoam_base docker image before.
- Clone DATOFOam_base:
git clone https://github.com/ckiyono/datofoam_base.git
- cd into folder:
cd datofoam-base
- Generate docker image of DATOFoam_base:
sudo docker build -t datofoam:base .
- Leave folder:
cd ..
- Clone this repository:
git clone https://github.com/ckiyono/datofoam.git
- cd into folder:
cd datofoam
- Generate docker image of DATOFoam:
sudo docker build -t datofoam .
If any modification is made to the DATOFoam code, just build the image again.
- cd into an example folder:
cd /path/to/example/folder
- Run a container with datofoam image:
docker run -it --rm -u dafoamuser --mount "type=bind,src=$(pwd),target=/home/dafoamuser/mount" -w /home/dafoamuser/mount datofoam bash
Inside the container, scripts may not have persmission to run. In this case:
- Leave mount folder:
cd ..
- Change permissions:
chmod -R 777 mount
- cd to mount folder
cd mount
Now, to run the optimization:
- Run the preProcessing.sh script to generate the mesh:
./preProcessing.sh
- Change runScript_v2.py file by adding the following code at task options
elif args.task == "runAdjVector":
optFuncs.runAdjVector()
- Then, use the following command to run the optimization with 4 CPU cores:
mpirun -np 4 python runScript_v2.py --task="runPrimal" 2>&1 | tee logOpt.txt
The option '--task=' can be used after 'runScript_v2.py' to choose the task:
- "opt" (default)
- "runPrimal"
- "runAdjoint"
- "runAdjVector"