cfl-minds / drl_shape_optimization

Deep reinforcement learning to perform shape optimization
MIT License
58 stars 15 forks source link

Negative Drag #3

Closed Aaryansh7 closed 2 years ago

Aaryansh7 commented 2 years ago

Hi The numerical values of drag being computed over shapes are coming out to be negative(which cannot be possible). Although the mathematical equations seem to be correct in the code. Also in the "compute_reward" function, it has been commented that drag is always less than zero. I am not able to figure out why this is happening.

Can you please enlighten me on this? Thanks

jviquerat commented 2 years ago

Hi,

Thanks for showing interest in this work. The sign of the drag depends on how you consider it (the force of the fluid acting on the obstacle, or the force of the obstacle acting on the fluid), so this is purely conventional.

This repository is already pretty old, and the optimization method used in it has been largely improved. The new implementation can be found here, although it does not consider shape optimization.

Best,

Aaryansh7 commented 2 years ago

Thanks for the response.

So in the repo code, the forceX(Drag) and the forceY(Lift), are being calculated on the fluid itself, right?

# Compute drag and lift
    def compute_drag_lift(u, p, mu, normal, gamma):
        eps      = 0.5*(nabla_grad(u) + nabla_grad(u).T)
        sigma    = 2.0*mu*eps - p*Identity(len(u))
        traction = dot(sigma, normal)

        forceX   = traction[0]*gamma
        forceY   = traction[1]*gamma
        fX       = assemble(forceX)
        fY       = assemble(forceY)

        return (fX, fY)
jviquerat commented 2 years ago

I honestly don't really remember the convention, but if the drag force is negative it should mean that it is oriented along -x, so it should be the force exerted by the solid on the fluid.

Aaryansh7 commented 2 years ago

Okay Thank You