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

define volscalarfield

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By nimasam

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 19, 2013, 03:57
Default define volscalarfield
  #1
Member
 
v
Join Date: Nov 2011
Posts: 33
Rep Power: 15
vahidzanganeh is on a distinguished road
hi foamers
i have to want a volumetric heat transfer coefficient defined in my new solver.
i have the following:
volScalarField Hv
(
IOobject
(
"Hv",
runTime.timeName(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar
(
"Hv",
dimensionSet(1, -1, -3, -1, 0, 0, 0),
10000.0
)
);
forAll(mesh.C(),i)
{
Hv[i] = ((Nuseltv[i]*thermo.alpha()[i] * thermo.Cp())/pow(porousdim,2));
}
__________________________
comment:
alpha is volscalarfield
Cp is volscalarfield
porousdim is dimeter: defined in constant folder
porousdim porousdim [0 1 0 0 0 0 0] 0.00083;
---------------------------------------------------
The following error is generated executable file
*************************
parameter.H: In function ‘int main(int, char**)’:
parameter.H:98: error: cannot convert ‘Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >’ to ‘double’ in assignment
**************************************
line 98 is : Hv[i] = ((Nuseltv[i]*thermo.alpha()[i] * thermo.Cp())/pow(porousdim,2));
******************************
who can help me?
best regards
vahidzanganeh is offline   Reply With Quote

Old   January 19, 2013, 12:28
Default
  #2
Senior Member
 
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25
nimasam is on a distinguished road
is Cp volscalarField or dimensionedScalar ?
however
if it is volScalarField, i guess it should be
thermo.Cp()[i]
also
porousdim is a dimensionedScalar, here you need just its value, so it should be
porousdim.value()
vahidzanganeh likes this.
__________________
My Personal Website (http://nimasamkhaniani.ir/)
Telegram channel (https://t.me/cfd_foam)
nimasam is offline   Reply With Quote

Old   January 21, 2013, 02:23
Default
  #3
Member
 
v
Join Date: Nov 2011
Posts: 33
Rep Power: 15
vahidzanganeh is on a distinguished road
dear nima
thanks your reply
Cp is volscalarfield in basicThermo.H file
I have changed the formula of volumetric heat transfer coefficient but the error is
***********
parameter.H: In function ‘int main(int, char**)’:
parameter.H:101: error: no match for ‘operator[]’ in ‘Foam::basicThermo::Cp()[i]
****************************
comment:
Hv[i] = ((Nuseltv[i] * thermo.alpha()[i] * thermo.Cp()[i])/pow(porousdim.value(),2));
********************
and
error is
parameter.H: In function ‘int main(int, char**)’:
parameter.H:101: error: cannot convert ‘Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >’ to ‘double’ in assignment
***********************************
comment:
Hv[i] = ((Nuseltv[i] * thermo.alpha()[i] * thermo.Cp())/pow(porousdim.value(),2));
**********************************

best regards
vahidzanganeh is offline   Reply With Quote

Old   January 21, 2013, 02:39
Default
  #4
Senior Member
 
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25
nimasam is on a distinguished road
you can use this setting:
volScalarField Cp1=thermo.Cp();
then use
Cp1[i]
__________________
My Personal Website (http://nimasamkhaniani.ir/)
Telegram channel (https://t.me/cfd_foam)
nimasam is offline   Reply With Quote

Old   January 21, 2013, 05:14
Unhappy
  #5
Member
 
v
Join Date: Nov 2011
Posts: 33
Rep Power: 15
vahidzanganeh is on a distinguished road
thanks your reply
this problem was solved.
but with Info Cp and Cp1 in log file
***************
cp=dimensions [0 2 -2 -1 0 0 0];
internalField uniform 1009.12;
boundaryField
{
.........
}
*******************
cp1=dimensions [0 0 1.49095e-264 1.51456e-264 0 0 0];
internalField nonuniform 0();
boundaryField
{
}
****************************
why??
best regards
vahidzanganeh is offline   Reply With Quote

Old   January 21, 2013, 05:36
Default
  #6
Senior Member
 
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25
nimasam is on a distinguished road
Dear vahid
thats strange error, i've never seen this before
may its better you define Cp first as:
volScalarField Cp
(
IOobject
(
"Cp",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
thermo.Cp()
);

then use
Cp[i]
__________________
My Personal Website (http://nimasamkhaniani.ir/)
Telegram channel (https://t.me/cfd_foam)
nimasam is offline   Reply With Quote

Old   January 21, 2013, 07:35
Default
  #7
Member
 
v
Join Date: Nov 2011
Posts: 33
Rep Power: 15
vahidzanganeh is on a distinguished road
thanks your reply
this problem was solved
I hope it takes time to thank.
vahidzanganeh 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
HELP----Surface Reaction UDF Ashi Fluent UDF and Scheme Programming 1 May 19, 2020 22:13
Installing OF 1.6 on Mac OS X gschaider OpenFOAM Installation 129 June 19, 2010 10:23
Missing math.h header Travis FLUENT 4 January 15, 2009 12:48
Free surface boudary conditions with SOLA-VOF Fan Main CFD Forum 10 September 9, 2006 13:24
UDF FOR UNSTEADY TIME STEP mayur FLUENT 3 August 9, 2006 11:19


All times are GMT -4. The time now is 01:15.