darshan315 / flow_past_cylinder_by_DRL

code for active flow control of flow around cynder using Deep Reinforcement Learning
MIT License
44 stars 19 forks source link

oscillatory_boundary_condition case not working #39

Closed chandukec closed 10 months ago

chandukec commented 2 years ago

Hi, I was excited to see your recent work related to CFD + ML, even followed you on 16th OpenFOAM workshop posted on Youtube. For the last couple of days, I was trying to run this case. I installed all the prerequisites: docker, singularity etc and it took me a while to get it done. I was able to produce the file of2112-py1.10.2-cpu.sif using sudo singularity build of2112-py1.10.2-cpu.sif docker://andreweiner/of_pytorch:of2112-py1.10.2-cpu. I placed this file inside the case folder of oscillatory_boundary_condition and tried to run this using singularity run of2112-py1.10.2-cpu.sif ./Allrun it is throwing me an error which says: /home/csp/of_pytorch_docker/flow_past_cylinder_by_DRL-master/test_cases/oscillatory_boundary_condition/Allrun: 227: blockMesh: not found when I tried to run this case without singularity: just by using ./Allrun then it sends an error: --> FOAM FATAL IO ERROR: [0] Unknown patchField type exprFixedValue for patch type patch. I am not sure what I am missing in this process, any guidance/comment/suggestion will be a great help. May be if you have some other case of CFD + ML which could be executed using these dependencies then also help me a lot to start with, many thanks in advance.

AndreWeiner commented 2 years ago

Hi @chandukec, great that you already managed to build the Singularity container; the image is usually expected to be located at the top-level of the repository folder structure. To execute the test case with oscillatory boundary condition on your local workstation, the following should do the trick:

# log into the container
singularity shell of2112-py1.10.2-cpu.sif
# now you are inside the container
# navigate to the test case
singularity> cd test_cases/oscillatory_boundary_condition/
singularity> ./Allrun

Best, Andre

chandukec commented 2 years ago

Hello @AndreWeiner Many thanks for your help, it worked for me. Meanwhile, initially, I was not been able to source the OpenFOAM 2112, then I realized that I forgot the line for linking it (already given in your steps): ./usr/lib/openfoam/openfoam2112/etc/bashrc

AndreWeiner commented 2 years ago

Sure, the OpenFOAM variables have to be sourced at the beginning; sorry I forgot that. Great that you made it work. Best, Andre

chandukec commented 2 years ago

Hi again, After the successful execution of the command: singularity> ./Allrun. Nothing really works: neither ./mesh_study nor ./bash_LHS_sampling. The errors from ./mesh_study are:

cp: cannot create directory 'test_cases/run/mesh_convergence_study/refinement_100': No such file or directory
./mesh_study.sh: line 10: cd: ./test_cases/run/mesh_convergence_study/refinement_100/: No such file or directory
******************************************************************

Mesh size = 100

******************************************************************
./mesh_study.sh: line 14: ./Allclean: No such file or directory
./mesh_study.sh: line 15: ./mesh: No such file or directory
./mesh_study.sh: line 16: ./solveronly: No such file or directory
cp: cannot stat 'test_cases/run/mesh_convergence_study/refinement_100/system': No such file or directory
cp: cannot stat 'test_cases/run/mesh_convergence_study/refinement_100/postProcessing': No such file or directory
cp: cannot stat 'test_cases/cylinder2D_base': No such file or directory
mkdir: cannot create directory 'notebooks': Read-only file system
./mesh_study.sh: line 10: cd: ./test_cases/run/mesh_convergence_study/refinement_200/: No such file or directory

From running ./bash_LHS_sampling getting the following errors:

./bash_LHS_sampling.sh: line 14: bc: command not found
./bash_LHS_sampling.sh: line 14: bc: command not found
./bash_LHS_sampling.sh: line 15: bc: command not found
./bash_LHS_sampling.sh: line 16: bc: command not found
./bash_LHS_sampling.sh: line 14: bc: command not found
./bash_LHS_sampling.sh: line 14: bc: command not found
./bash_LHS_sampling.sh: line 15: bc: command not found
./bash_LHS_sampling.sh: line 16: bc: command not found
cp: cannot stat '/home/csp/of_pytorch_docker/test_cases/run/oscillatory_parameter_study/base_pre-mesh/0': No such file or directory
cp: cannot stat '/home/csp/of_pytorch_docker/test_cases/run/oscillatory_parameter_study/base_pre-mesh/change_param': No such file or directory
Amplitude = 0.557834  frequency = 2.00048

I guess either some directories are missing or I am not in the correct folder, however to be more specific when I do pwd the output is: /home/csp/of_pytorch_docker and when I use ls I got the following:

DRL_py             LICENSE          bash_LHS_sampling.sh          execute_jobs.sh           of2112-py1.10.2-cpu.sif      start_notebooks.sh    test
Dockerfile         README.md        create_jupyter_container.sh   flow_past_cylinder_by_DRL-master  oscillatory_U_pramater_study.sh  start_openfoam.sh     test_cases
Dockerfile.abi_source  Singularity.def      create_openfoam_container.sh  mesh_study.sh         py_LHS_sampling.py       study_dir_setting.sh
Dockerfile.no_abi      base_mesh_osci_param.sh  data_LHS.csv              notebooks             py_plots             symbolic_link.sh
AndreWeiner commented 2 years ago

Hi @chandukec, I think these issues should be easy to fix. 1) the first error message tells you that the copy operation was not successful; the reason is probably that the path test_cases/run/mesh_convergence_study/ does not exist; to fix this, run

mkdir -p test_cases/run/mesh_convergence_study/

before executing the mesh_study.sh script. To install bc, run:

sudo apt install bc

The parameter study with oscillatory boundary condition requires some additional setup, which is currently not documented properly, but @darshan315 has to provide these details. Moreover, it appears that these scripts are meant to be executed using the SLURM scheduler, so they were run on a cluster.

Best, Andre

chandukec commented 2 years ago

Many thanks, @AndreWeiner for your help. Using your help, I managed to execute and produce results until ./mesh_study.sh but after that ./bash_LHS_sampling.sh is not working at all. Any further help?

chandukec commented 2 years ago

@AndreWeiner Maybe if you think this case is not very well documented, could you suggest some other (simple) case where I could easily run CFD + ML case. I simply want to use the application case of whatever I have installed: Docker, Go, singularity, etc. As I mentioned earlier that I was motivated and really impressed by the 16th OpenFOAM workshop posted on Youtube, thus just wanted to actually run and understand the case. I hope this makes sense, thanks in advance.

AndreWeiner commented 2 years ago

I see. In that case, here are two suggestions:

Best, Andre

chandukec commented 2 years ago

Thanks a lot, @AndreWeiner for your prompt help. But going through the online link lecture repository, I am interested in the 2Dcylinder problem, particularly # 10 and 11(Controlling the flow past a cylinder I and Controlling the flow past a cylinder II) if I click link then I am directed to your home page of GitHub. If I click the view online then it redirects me to Github page with (I assume) nothing. I am not sure, if I am missing something terribly. Sorry for being so naive.

AndreWeiner commented 2 years ago

If you are only interested in the DRL cylinder problem, you find the instructions here (closed-loop active flow control). You can simply copy and paste the code snippets; there is nothing left to complete.