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

How to use Spab function

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 20, 2008, 11:16
Default Hello everybody, i´m using
  #1
Member
 
Join Date: Mar 2009
Posts: 35
Rep Power: 17
booz is on a distinguished road
Hello everybody,

i´m using the following equation

tmp<fvvectormatrix> VEqn
(
fvm::div(-phi,V)
+ (gradU & V)
+ alpha & V // (*)
);

The problem is, that alpha and V are volVectorFields and (*) will be a scalar. Like in Programmers Guide for (*) i used

fvm::Sp(alpha&V, I) // I initialvector

In my createFields i use for I

dimensionedVector I
(
"I",
dimensionSet(0, 0, 0, 0, 0, 0, 0),
vector(1,1,1),
);

But i get the following error message:

createFields.H: In function 'int main(int char**)':
createFields.H:110: error: expected primary-expression before ')' token
AdjAlphaFoam_Vers2.C:81: error: no matching function for call to 'Sp(Foam::tmp<foam::geometricfield<double,> >, Foam::dimensionedVector&)'
make: *** [Make/linuxGccDPOpt/AdjAlphaFoam_Vers2.o] Error 1

Is the "Sp(a,b)" operator the right solution for to use (*) in OpenFoam?

For any answers i will be very happy!

Thanks a lot,
Khaled Totakhel
booz is offline   Reply With Quote

Old   October 22, 2008, 07:58
Default What is on like 110 in createF
  #2
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,905
Rep Power: 33
hjasak will become famous soon enough
What is on like 110 in createFields.H? Looks like you've got a syntax error. The operator fvm::Sp will take a scalar linearised field for the first argument and the field you are solving for as the second. Your second argument seems to be a dimensionedVector and not the thing you are solving for.

Hope this helps,

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   October 22, 2008, 08:08
Default first off, I have no idea what
  #3
Super Moderator
 
niklas's Avatar
 
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 29
niklas will become famous soon enoughniklas will become famous soon enough
first off, I have no idea what you are trying to do
so this will be an answer based purely on the visual inspection of your constructor...
there is a comma after vector(1,1,1) that shouldnt be there.
niklas is offline   Reply With Quote

Old   October 22, 2008, 08:46
Default Hello Niklas, i'll try the
  #4
Member
 
Join Date: Mar 2009
Posts: 35
Rep Power: 17
booz is on a distinguished road
Hello Niklas,

i'll try the Sp(a,b)-operator to solve (*) implicit.
In Programmers Guide "a" must be a scalar or volScalar -typ and "b" a vol<type>Field. I thought if i use an inititalvector I for b, i reach my goal!

Regards,
Khaled
booz is offline   Reply With Quote

Old   October 22, 2008, 08:51
Default Hello Hrvoje, thanks for yo
  #5
Member
 
Join Date: Mar 2009
Posts: 35
Rep Power: 17
booz is on a distinguished road
Hello Hrvoje,

thanks for your answer. But how can I use an initialvector (1,1,1) as volVectorField for the second argument of Sp(a,b) without:

volVectorField I
(
IOobject
(
"I",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh
);

in my createFields?

Regards,
Khaled
booz is offline   Reply With Quote

Reply


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
udf function!! shayej FLUENT 1 February 5, 2009 08:37
Cp as a function Mareike CFX 4 April 8, 2008 04:55
If function PANKAJ CFX 3 January 13, 2008 03:53
Stream Function - Potential Function coordinates harish Main CFD Forum 8 June 25, 2005 13:18
Max y+ as a function of Re Fred Uckfield Main CFD Forum 6 October 17, 2001 11:15


All times are GMT -4. The time now is 12:00.