CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Adding Sensitivity Adjoint Problem

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By verboomj
  • 1 Post By FlyBob91

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   November 10, 2016, 07:21
Lightbulb Adding Sensitivity Adjoint Problem
  #1
Senior Member
 
FlyBob91's Avatar
 
Join Date: Mar 2016
Location: Bergamo
Posts: 157
Rep Power: 10
FlyBob91 is on a distinguished road
Hello to all,
I'm going to add the sensitivity equation to my createFields.H

the equation is

Code:
-A*nu*(n*nabla)u*(n*nabla)u
I know how define all the terms because i included them in the outlet boundary files, however i think i missed some header line to be included.

At the end of the file i added

Code:
 
    scalar nu = readScalar(db().lookupObject<IOdictionary>("transportProperties").lookup  
    ("nu"));

volScalarField sens
(
    IOobject 
    (
        "sensitivity"
        "alpha",
        runTime.timeName(),
        mesh,
        IOobject::READ_IF_PRESENT,
        IOobject::AUTO_WRITE
    ),
    -magSf()*nu*snGrad(Ua)*snGrad(U)
);
and this is the error

Code:
In file included from /home/roby/OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/postProcess.H:129:0,
                 from myAdjointShapeOptimizationFoam.C:72:
./createFields.H: In function ‘int main(int, char**)’:
./createFields.H:112:34: error: ‘patch’ was not declared in this scope
     vectorField U_n = (U & patch().nf())*patch().nf();  // Normale
                                  ^
./createFields.H:118:31: error: ‘db’ was not declared in this scope
     scalar nu = readScalar(db().lookupObject<IOdictionary>("transportProperties
                               ^
./createFields.H:118:58: error: expected primary-expression before ‘>’ token
     scalar nu = readScalar(db().lookupObject<IOdictionary>("transportProperties
                                                          ^
./createFields.H:118:83: error: request for member ‘lookup’ in ‘("transportProperties")’, which is of non-class type ‘const char [20]’
 nu = readScalar(db().lookupObject<IOdictionary>("transportProperties").lookup  
                                                                        ^
./createFields.H:132:12: error: ‘magSf’ was not declared in this scope
     -magSf()*nu*snGrad(Ua_t)*snGrad(U_t)
            ^
./createFields.H:132:28: error: ‘snGrad’ was not declared in this scope
     -magSf()*nu*snGrad(Ua_t)*snGrad(U_t)
                            ^
./createFields.H:132:28: note: suggested alternative:
In file included from /home/roby/OpenFOAM/OpenFOAM-4.1/src/finiteVolume/lnInclude/fvcSnGrad.H:88:0,
                 from /home/roby/OpenFOAM/OpenFOAM-4.1/src/finiteVolume/lnInclude/fvc.H:51,
                 from /home/roby/OpenFOAM/OpenFOAM-4.1/src/finiteVolume/lnInclude/fvCFD.H:8,
                 from myAdjointShapeOptimizationFoam.C:48:
/home/roby/OpenFOAM/OpenFOAM-4.1/src/finiteVolume/lnInclude/fvcSnGrad.C:88:1: note:   ‘Foam::fvc::snGrad’
 snGrad
 ^
In file included from myAdjointShapeOptimizationFoam.C:78:0:
createFields.H:112:34: error: ‘patch’ was not declared in this scope
     vectorField U_n = (U & patch().nf())*patch().nf();  // Normale
                                  ^
createFields.H:118:31: error: ‘db’ was not declared in this scope
     scalar nu = readScalar(db().lookupObject<IOdictionary>("transportProperties
                               ^
createFields.H:118:58: error: expected primary-expression before ‘>’ token
     scalar nu = readScalar(db().lookupObject<IOdictionary>("transportProperties
                                                          ^
createFields.H:118:83: error: request for member ‘lookup’ in ‘("transportProperties")’, which is of non-class type ‘const char [20]’
 nu = readScalar(db().lookupObject<IOdictionary>("transportProperties").lookup  
                                                                        ^
createFields.H:132:12: error: ‘magSf’ was not declared in this scope
     -magSf()*nu*snGrad(Ua_t)*snGrad(U_t)
            ^
createFields.H:132:28: error: ‘snGrad’ was not declared in this scope
     -magSf()*nu*snGrad(Ua_t)*snGrad(U_t)
                            ^
createFields.H:132:28: note: suggested alternative:
In file included from /home/roby/OpenFOAM/OpenFOAM-4.1/src/finiteVolume/lnInclude/fvcSnGrad.H:88:0,
                 from /home/roby/OpenFOAM/OpenFOAM-4.1/src/finiteVolume/lnInclude/fvc.H:51,
                 from /home/roby/OpenFOAM/OpenFOAM-4.1/src/finiteVolume/lnInclude/fvCFD.H:8,
                 from myAdjointShapeOptimizationFoam.C:48:
/home/roby/OpenFOAM/OpenFOAM-4.1/src/finiteVolume/lnInclude/fvcSnGrad.C:88:1: note:   ‘Foam::fvc::snGrad’
 snGrad
 ^
/home/roby/OpenFOAM/OpenFOAM-4.1/wmake/rules/General/transform:8: set di istruzioni per l'obiettivo "Make/linux64GccDPInt32Opt/myAdjointShapeOptimizationFoam.o" non riuscito
make: *** [Make/linux64GccDPInt32Opt/myAdjointShapeOptimizationFoam.o] Errore 1

Last edited by FlyBob91; November 16, 2016 at 04:54.
FlyBob91 is offline   Reply With Quote

 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
conjugateHeatFoam + interFoam farhagim OpenFOAM Programming & Development 15 July 19, 2016 07:55
chtMultiRegionSimpleFoam samiam1000 OpenFOAM Running, Solving & CFD 39 March 31, 2016 08:43
chtMultiRegionSimpleFoam: strange error samiam1000 OpenFOAM Running, Solving & CFD 26 December 29, 2015 22:14
Adjoint sensitivity on specified surface robyTKD OpenFOAM Programming & Development 0 April 29, 2013 05:05
Help with chtMultiRegionFoam jbvw96 OpenFOAM Running, Solving & CFD 2 December 26, 2010 17:16


All times are GMT -4. The time now is 16:51.