CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   About adjointShapeOptimizationFoam (https://www.cfd-online.com/Forums/openfoam/110118-about-adjointshapeoptimizationfoam.html)

samiam1000 December 4, 2012 05:13

About adjointShapeOptimizationFoam
 
Dear Foamers,

I am trying to figure out how adjointShapeOptimizationFoam works. The first attempt I did was to run the tutorial. Everything goes well - tough I don't completely und the results - except for a detail: if I change the inlet name (e.g. from inlet to inlet1) I get this error:

Code:

phd@lab-laptop:~/Scrivania/pitzDaily$ blockMesh
/*---------------------------------------------------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.1.0                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
Build  : 2.1.0-0bc225064152
Exec  : blockMesh
Date  : Dec 04 2012
Time  : 10:58:58
Host  : "lab-laptop"
PID    : 3302
Case  : /home/phd/Scrivania/pitzDaily
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Creating block mesh from
    "/home/phd/Scrivania/pitzDaily/constant/polyMesh/blockMeshDict"
Creating curved edges
Creating topology blocks
Creating topology patches

Creating block mesh topology

Check topology

        Basic statistics
                Number of internal faces : 18
                Number of boundary faces : 42
                Number of defined boundary faces : 42
                Number of undefined boundary faces : 0
        Checking patch -> block consistency

Creating block offsets
Creating merge list .

Creating polyMesh from blockMesh
Creating patches
Creating cells
Creating points with scale 0.001

Writing polyMesh
----------------
Mesh Information
----------------
  boundingBox: (-0.0206 -0.0254 -0.0005) (0.29 0.0254 0.0005)
  nPoints: 25012
  nCells: 12225
  nFaces: 49180
  nInternalFaces: 24170
----------------
Patches
----------------
  patch 0 (start: 24170 size: 30) name: inlet1
  patch 1 (start: 24200 size: 57) name: outlet
  patch 2 (start: 24257 size: 223) name: upperWall
  patch 3 (start: 24480 size: 250) name: lowerWall
  patch 4 (start: 24730 size: 24450) name: frontAndBack

End

[2]+  Done                    gedit constant/polyMesh/blockMeshDict
phd@lab-laptop:~/Scrivania/pitzDaily$ adjointShapeOptimizationFoam
/*---------------------------------------------------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.1.0                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
Build  : 2.1.0-0bc225064152
Exec  : adjointShapeOptimizationFoam
Date  : Dec 04 2012
Time  : 10:59:01
Host  : "lab-laptop"
PID    : 3303
Case  : /home/phd/Scrivania/pitzDaily
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Reading field p

Reading field U

Reading/calculating face flux field phi

Reading field pa

Reading field Ua

Reading/calculating face flux field phia

Selecting incompressible transport model Newtonian
Selecting RAS turbulence model kEpsilon
kEpsilonCoeffs
{
    Cmu            0.09;
    C1              1.44;
    C2              1.92;
    sigmaEps        1.3;
}



--> FOAM FATAL ERROR:
Patch named inlet not found.


    From function fvBoundaryMesh::operator[](const word&) const
    in file fvMesh/fvBoundaryMesh/fvBoundaryMesh.C at line 145.

FOAM aborting

#0  Foam::error::printStack(Foam::Ostream&) in "/opt/openfoam210/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#1  Foam::error::abort() in "/opt/openfoam210/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#2  Foam::fvBoundaryMesh::operator[](Foam::word const&) const in "/opt/openfoam210/platforms/linux64GccDPOpt/lib/libfiniteVolume.so"
#3 
 in "/opt/openfoam210/platforms/linux64GccDPOpt/bin/adjointShapeOptimizationFoam"
#4  __libc_start_main in "/lib/libc.so.6"
#5 
 in "/opt/openfoam210/platforms/linux64GccDPOpt/bin/adjointShapeOptimizationFoam"
Aborted

What does this mean?

Thanks for help.

Samuele

fumiya December 4, 2012 06:54

Hi Samuele,

In createFields.H of this solver, there is a line

const labelList& inletCells = mesh.boundary()["inlet"].faceCells();

so you got the error message.

Hope that helps,
Fumiya

samiam1000 December 4, 2012 07:01

So,

isn't it possible to have more than one inlet?

If so, what should I do? Should I edit the solver?

Also, always about that solver, could it solve 3D flows?

Thanks a lot,

Samuele

fumiya December 4, 2012 07:26

Hi,

I think you have to edit the solver to use with the geometry that has
the multiple inlets. In the original solver, the inletCells defined in the
code is used to keep alpha=0 at cells adjacent to the "inlet". If you
have another inlet, I think you need to the same for it.

This solver can solve both 2d and 3d flows.

Hope that helps,
fumiya

samiam1000 December 4, 2012 07:31

Thanks again. So, it seems feasible and pretty easy. Let's see. If I have problems, I'll post them here.

Also, just one more question: I don't want to modify alpha, but I'd rather change mass flow or something like that to optimize my flow (in a fixed geometry). Do you think it is possible?

Thanks a lot,

Samuele

batta31 December 5, 2012 03:05

Hi Samuele,
adjointShapeOptimizationFoam performs a "topological" optimization of the flow, i.e. it modifies the porosity of each cell; so at the end of the cycle you will know where you have to modify the geometry wrt the distribution of alpha.

What you ask to perform ( change mass flow for example) I think it's not feasible with this kind of optimization and, by the way, with a fixed geometry.

Hope this help
Simone

samiam1000 December 5, 2012 03:07

I am gonna try to edit the source. In this case I should be able to he the optimization I like best. Right?

batta31 December 6, 2012 02:37

That's for sure the best solution! :)

j-avdeev July 26, 2013 11:20

2 Attachment(s)
Something wrong in my case (see attached pictures).

Maybe it's wrong BC in U, Ua?

Places, where I'm not sure:

in 0/U
Code:

    inlet
    {
        type            surfaceNormalFixedValue;
        refValue          uniform -26;
    }

in 0/Ua
Code:

    inlet
    {
        type                surfaceNormalFixedValue;
        refValue                uniform -1;
//        type            fixedValue;
//        value          uniform (-1 -1 -1);
    }

Can this situation be the after-effect of wrong alpha range? Here alphaMax = 200.0.

sylvester August 2, 2013 08:12

Hi Avdeev,

The adjoint velocity direction is opposite to the primal. See the tutorial files.

I hope this helps.

Best regards,
Sylvester

j-avdeev August 3, 2013 05:45

Thanks, Sylvester.
0/U was ok.
Problem was in Ua - now it's work fine:
Code:

    inlet
    {
        type            fixedValue;
        value          uniform (-1 0 0);
    }


fumiya January 3, 2016 00:47

adjointShapeOptimizationFoam/pitzDaily tutorial
 
Hi,

Judging from the direction of the adjoint velocity on the inlet of the pitzDaily tutorial,
I think it converts a minimization problem of total pressure loss(=I) to the maximization problem of -I.
If this is the case, the adjoint boundary conditions on the outlet boundary do not correctly correspond to the reference.

I think lambda should be set to an negative value in constant/transportProperties file when solving minimization problems.
In this case, you have to change the boundary condition of the adjoint velocity Ua:

Code:

    // For pitzDaily tutorial
    inlet
    {
        type            fixedValue;
        value          uniform (1 0 0);
    }

Best regards,
Fumiya


All times are GMT -4. The time now is 13:20.