FabianGabriel / Active_flow_control_past_cylinder_using_DRL

GNU General Public License v3.0
9 stars 10 forks source link

Test and copy Darshan's instructions #4

Closed AndreWeiner closed 3 years ago

AndreWeiner commented 3 years ago

Hi Fabian,

Darshan has now taken the time to clean up his repository nicely. I would like you to have a look at his instructions in the README file and to see if those instructions also work for you. If you encounter any trouble or if there are missing links, which is likely going to happen, please open an issue in Darshan's repository such that the two of you can find a solution together (or the three of us if needed). Once you can reproduce Darshan's DRL workflow, I would like you to copy the DRL-specific parts of the repo, code and instructions, to your repository. Of course, you should add a reference to the origin in the header of each source file. So, in summary, there are two top-level tasks:

This issue is going to take some time to complete, but it is extremely important. Take your time to check things carefully :-)

Best, Andre

FabianGabriel commented 3 years ago

Hi Andre,

I've run into a bit of a problem getting it to work on the new openFOAM version. After our meeting on Friday I've tried to run the training on both the old mesh by Darshan and my newly created one. On both tries I got the same error: --> FOAM FATAL IO ERROR: (openfoam-2012) Entry 'logStdMax' not found in dictionary "/home/y0095063/DRL_py/env/sample_0/trajectory_1/0/U.boundaryField.cylinder"

That happens right at the start and I have not yet found a solution for it. I have noo real idea what could cause this as this "U.boundaryField.cylinder" file has never existed and to my knowledge is also not mentioned in the code, so I have no idea why it now demands that this file exists. I've uploaded the current state of tthe DRL_py directory and also 1 example trajectory where you can see the error.

I hope you can help me on this.

Best Regards Fabian

AndreWeiner commented 3 years ago

Hi Fabian, the error is raised by OpenFOAM when reading the entries in the 0/U file. Within the definition of agentRotatingWallVelocity, an entry logStdMax is expected (a value for clipping the log of the standard deviation output of the policy network). This entry is missing in the documentation and also in Darshan's base case. To fix this issue, add logStdMax 2.0; to the boundary condition, e.g.:

cylinder
    {
        type            agentRotatingWallVelocity;
        // center of cylinder
        origin          (0.2 0.2 0.0);
        // axis of rotation; normal to 2D domain
        axis            (0 0 1);
        // name of the policy network; must be a torchscript file
        policy          "policy.pt";
        // when to start controlling
        startTime       0.01;
        // how often to evaluate policy
        interval        20;
        // if true, the angular velocity is sampled from a Gaussian distribution
        // if false, the mean value predicted by the policy is used
        train           true;
        // currently ignored
        absOmegaMax     0.05;
        // limit log of standard deviation
        logStdMax 2.0;
    }

Best, Andre

FabianGabriel commented 3 years ago

Hi Andre,

thank you! That did work and it is now running as it should.

Best Regards Fabian