CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   adjoint solver in OpenFOAM (https://www.cfd-online.com/Forums/openfoam-programming-development/135386-adjoint-solver-openfoam.html)

samiam1000 May 13, 2014 04:40

adjoint solver in OpenFOAM
 
Dear All,

I am trying to implement an adjoint solver for external flow.

I have implemented the sensitivity. Now I would need to implement the normals to a certain patch, but - while coding - I get an error. My idea is to write something like

Code:

        forAll(mesh.boundary(), patchi)
        {
            if(mesh.boundary()[patchi].name() == "ciao")
            {
                normal.setSize(mesh.boundary()[patchi].size());
       
                forAll(normal, i)
                {
                    normal[i] = mesh.boundary()[patchi].nf();
                }
            }
        }

What's wrong with this code?

Thanks for help,
Samuele

ngj May 13, 2014 15:08

Hallo,

It is more difficult, when you are not telling, what the compiler complains about. But, the problem at least lies in line 9, where you assign a vector field to a single element in a vector field.

Cheers,

Niels


All times are GMT -4. The time now is 19:58.