|
[Sponsors] |
How to read freestream velocity vector in a new boundary condition? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 5, 2013, 11:49 |
How to read freestream velocity vector in a new boundary condition?
|
#1 |
Member
Roberto Pieri
Join Date: Feb 2012
Location: Milan
Posts: 57
Rep Power: 14 |
Hi to everyone,
I would like to build a new boundary condition for adjointShapeOptimizationFoam. I need to read the freestream velocity vector (which I named U_inf); my ideas to do this are:
Which of these ones is the best? How can I implement it? Attached below you find the file. Thank you Roberto |
|
April 5, 2013, 23:30 |
|
#2 |
Senior Member
Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 266
Blog Entries: 1
Rep Power: 19 |
Hi Roberto,
Are you addressing the drag coefficient minimization problems by the adjoint method? Personally, I think it is the most desirable approach to read a freestreamValue from U file, because we don't have to define another dictionary. Unfortunately, I don't know how to do that, but you can try the approach 1,2 by following the instructions: http://albertopassalacqua.com/?p=947 Hope this helps, Fumiya |
|
April 6, 2013, 19:29 |
|
#3 | |
Member
Roberto Pieri
Join Date: Feb 2012
Location: Milan
Posts: 57
Rep Power: 14 |
Thank you for the reply.
Quote:
I followed the instructions from the link you suggested to me, but, unfortunately, it doesn't work. The modified BC is attached below while this is the error: Code:
adjointCdWallVelocity/adjointCdWallVelocityFvPatchVectorField.C: In member function 'virtual void Foam::adjointCdWallVelocityFvPatchVectorField::updateCoeffs()': adjointCdWallVelocity/adjointCdWallVelocityFvPatchVectorField.C:113:44: error: no matching function for call to 'Foam::Field<double>::Field(Foam::dimensioned<double>)' adjointCdWallVelocity/adjointCdWallVelocityFvPatchVectorField.C:113:44: note: candidates are: /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:193:9: note: Foam::Field<Type>::Field(const Foam::word&, const Foam::dictionary&, Foam::label) [with Type = double, Foam::label = int] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:193:9: note: candidate expects 3 arguments, 1 provided /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:190:9: note: Foam::Field<Type>::Field(Foam::Istream&) [with Type = double] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:190:9: note: no known conversion for argument 1 from 'Foam::dimensioned<double>' to 'Foam::Istream&' /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:186:9: note: Foam::Field<Type>::Field(const Foam::tmp<Foam::Field<Type> >&) [with Type = double] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:186:9: note: no known conversion for argument 1 from 'Foam::dimensioned<double>' to 'const Foam::tmp<Foam::Field<double> >&' /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:177:9: note: Foam::Field<Type>::Field(const Foam::Xfer<Foam::Field<Type> >&) [with Type = double] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:177:9: note: no known conversion for argument 1 from 'Foam::dimensioned<double>' to 'const Foam::Xfer<Foam::Field<double> >&' /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:174:9: note: Foam::Field<Type>::Field(Foam::Field<Type>&, bool) [with Type = double] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:174:9: note: candidate expects 2 arguments, 1 provided /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:171:9: note: Foam::Field<Type>::Field(const Foam::Field<Type>&) [with Type = double] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:171:9: note: no known conversion for argument 1 from 'Foam::dimensioned<double>' to 'const Foam::Field<double>&' /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:164:9: note: Foam::Field<Type>::Field(const Foam::tmp<Foam::Field<Type> >&, const Foam::FieldMapper&) [with Type = double] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:164:9: note: candidate expects 2 arguments, 1 provided /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:157:9: note: Foam::Field<Type>::Field(const Foam::UList<T>&, const Foam::FieldMapper&) [with Type = double] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:157:9: note: candidate expects 2 arguments, 1 provided /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:149:9: note: Foam::Field<Type>::Field(const Foam::tmp<Foam::Field<Type> >&, const labelListList&, const scalarListList&) [with Type = double, Foam::labelListList = Foam::List<Foam::List<int> >, Foam::scalarListList = Foam::List<Foam::List<double> >] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:149:9: note: candidate expects 3 arguments, 1 provided /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:141:9: note: Foam::Field<Type>::Field(const Foam::UList<T>&, const labelListList&, const scalarListList&) [with Type = double, Foam::labelListList = Foam::List<Foam::List<int> >, Foam::scalarListList = Foam::List<Foam::List<double> >] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:141:9: note: candidate expects 3 arguments, 1 provided /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:134:9: note: Foam::Field<Type>::Field(const Foam::tmp<Foam::Field<Type> >&, const labelUList&) [with Type = double, Foam::labelUList = Foam::UList<int>] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:134:9: note: candidate expects 2 arguments, 1 provided /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:127:9: note: Foam::Field<Type>::Field(const Foam::UList<T>&, const labelUList&) [with Type = double, Foam::labelUList = Foam::UList<int>] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:127:9: note: candidate expects 2 arguments, 1 provided /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:124:18: note: Foam::Field<Type>::Field(const Foam::Xfer<Foam::List<T> >&) [with Type = double] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:124:18: note: no known conversion for argument 1 from 'Foam::dimensioned<double>' to 'const Foam::Xfer<Foam::List<double> >&' /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:121:18: note: Foam::Field<Type>::Field(const Foam::UList<T>&) [with Type = double] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:121:18: note: no known conversion for argument 1 from 'Foam::dimensioned<double>' to 'const Foam::UList<double>&' /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:118:9: note: Foam::Field<Type>::Field(Foam::label, const Type&) [with Type = double, Foam::label = int] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:118:9: note: candidate expects 2 arguments, 1 provided /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:115:18: note: Foam::Field<Type>::Field(Foam::label) [with Type = double, Foam::label = int] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:115:18: note: no known conversion for argument 1 from 'Foam::dimensioned<double>' to 'int' /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:111:9: note: Foam::Field<Type>::Field() [with Type = double] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.H:111:9: note: candidate expects 0 arguments, 1 provided adjointCdWallVelocity/adjointCdWallVelocityFvPatchVectorField.C:115:35: error: no matching function for call to 'Foam::Field<Foam::Vector<double> >::Field(Foam::dimensioned<Foam::Vector<double> >)' adjointCdWallVelocity/adjointCdWallVelocityFvPatchVectorField.C:115:35: note: candidates are: /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:205:1: note: Foam::Field<Type>::Field(const Foam::word&, const Foam::dictionary&, Foam::label) [with Type = Foam::Vector<double>, Foam::label = int] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:205:1: note: candidate expects 3 arguments, 1 provided /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:198:1: note: Foam::Field<Type>::Field(Foam::Istream&) [with Type = Foam::Vector<double>] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:198:1: note: no known conversion for argument 1 from 'Foam::dimensioned<Foam::Vector<double> >' to 'Foam::Istream&' /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:188:1: note: Foam::Field<Type>::Field(const Foam::tmp<Foam::Field<Type> >&) [with Type = Foam::Vector<double>] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:188:1: note: no known conversion for argument 1 from 'Foam::dimensioned<Foam::Vector<double> >' to 'const Foam::tmp<Foam::Field<Foam::Vector<double> > >&' /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:163:1: note: Foam::Field<Type>::Field(const Foam::Xfer<Foam::Field<Type> >&) [with Type = Foam::Vector<double>] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:163:1: note: no known conversion for argument 1 from 'Foam::dimensioned<Foam::Vector<double> >' to 'const Foam::Xfer<Foam::Field<Foam::Vector<double> > >&' /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:149:1: note: Foam::Field<Type>::Field(Foam::Field<Type>&, bool) [with Type = Foam::Vector<double>] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:149:1: note: candidate expects 2 arguments, 1 provided /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:141:1: note: Foam::Field<Type>::Field(const Foam::Field<Type>&) [with Type = Foam::Vector<double>] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:141:1: note: no known conversion for argument 1 from 'Foam::dimensioned<Foam::Vector<double> >' to 'const Foam::Field<Foam::Vector<double> >&' /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:128:1: note: Foam::Field<Type>::Field(const Foam::tmp<Foam::Field<Type> >&, const Foam::FieldMapper&) [with Type = Foam::Vector<double>] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:128:1: note: candidate expects 2 arguments, 1 provided /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:115:1: note: Foam::Field<Type>::Field(const Foam::UList<T>&, const Foam::FieldMapper&) [with Type = Foam::Vector<double>] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:115:1: note: candidate expects 2 arguments, 1 provided /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:101:1: note: Foam::Field<Type>::Field(const Foam::tmp<Foam::Field<Type> >&, const labelListList&, const scalarListList&) [with Type = Foam::Vector<double>, Foam::labelListList = Foam::List<Foam::List<int> >, Foam::scalarListList = Foam::List<Foam::List<double> >] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:101:1: note: candidate expects 3 arguments, 1 provided /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:87:1: note: Foam::Field<Type>::Field(const Foam::UList<T>&, const labelListList&, const scalarListList&) [with Type = Foam::Vector<double>, Foam::labelListList = Foam::List<Foam::List<int> >, Foam::scalarListList = Foam::List<Foam::List<double> >] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:87:1: note: candidate expects 3 arguments, 1 provided /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:74:1: note: Foam::Field<Type>::Field(const Foam::tmp<Foam::Field<Type> >&, const labelUList&) [with Type = Foam::Vector<double>, Foam::labelUList = Foam::UList<int>] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:74:1: note: candidate expects 2 arguments, 1 provided /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:61:1: note: Foam::Field<Type>::Field(const Foam::UList<T>&, const labelUList&) [with Type = Foam::Vector<double>, Foam::labelUList = Foam::UList<int>] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:61:1: note: candidate expects 2 arguments, 1 provided /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:156:1: note: Foam::Field<Type>::Field(const Foam::Xfer<Foam::List<T> >&) [with Type = Foam::Vector<double>] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:156:1: note: no known conversion for argument 1 from 'Foam::dimensioned<Foam::Vector<double> >' to 'const Foam::Xfer<Foam::List<Foam::Vector<double> > >&' /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:179:1: note: Foam::Field<Type>::Field(const Foam::UList<T>&) [with Type = Foam::Vector<double>] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:179:1: note: no known conversion for argument 1 from 'Foam::dimensioned<Foam::Vector<double> >' to 'const Foam::UList<Foam::Vector<double> >&' /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:54:1: note: Foam::Field<Type>::Field(Foam::label, const Type&) [with Type = Foam::Vector<double>, Foam::label = int] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:54:1: note: candidate expects 2 arguments, 1 provided /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:47:1: note: Foam::Field<Type>::Field(Foam::label) [with Type = Foam::Vector<double>, Foam::label = int] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:47:1: note: no known conversion for argument 1 from 'Foam::dimensioned<Foam::Vector<double> >' to 'int' /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:40:1: note: Foam::Field<Type>::Field() [with Type = Foam::Vector<double>] /Users/roberto/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/Field.C:40:1: note: candidate expects 0 arguments, 1 provided make: *** [Make/darwinIntel64Gcc46DPOpt/adjointCdWallVelocityFvPatchVectorField.o] Error 1 make: *** Waiting for unfinished jobs.... Roberto |
||
April 6, 2013, 21:00 |
|
#4 |
Senior Member
Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 266
Blog Entries: 1
Rep Power: 19 |
There is no problem with the descriptions in the link.
The errors you encountered are related to how to use your variable U_inf. You might want to try Code:
scalar C_inf(.5*pow(mag(U_inf.value()), 2)); vector d(U_inf.value()/mag(U_inf.value())); Code:
scalarField C_inf(.5*pow(mag(U_inf), 2)); vectorField d(U_inf/mag(U_inf)); Fumiya |
|
April 7, 2013, 17:37 |
|
#5 |
Member
Roberto Pieri
Join Date: Feb 2012
Location: Milan
Posts: 57
Rep Power: 14 |
Thank you very much Fumiya, your help was precise and useful; now it compiles without errors.
I have two other questions:
Unfortunately I built my mesh with only FARFIELD patch and it isn't so easy to divide in Inlet and Outlet. Best regards, Roberto |
|
April 24, 2013, 10:43 |
|
#6 |
Member
Roberto Pieri
Join Date: Feb 2012
Location: Milan
Posts: 57
Rep Power: 14 |
Any idea about question number 2 of previous post?
Roberto |
|
Tags |
adjointshapeoptimization, boundary condition |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Freestream boundary condition | YJ Lee | OpenFOAM Running, Solving & CFD | 14 | June 5, 2020 03:54 |
Difficulty in calculating angular velocity of Savonius turbine simulation | alfaruk | CFX | 14 | March 17, 2017 07:08 |
Massflow or average velocity boundary condition | Sideshore | OpenFOAM Pre-Processing | 6 | September 27, 2016 16:09 |
[Commercial meshers] fluentMeshToFoam multidomain mesh conversion problem | Attesz | OpenFOAM Meshing & Mesh Conversion | 12 | May 2, 2013 11:52 |
velocity boundary condition | Logan Page | OpenFOAM | 0 | November 19, 2010 18:59 |