|
[Sponsors] |
January 19, 2013, 03:57 |
define volscalarfield
|
#1 |
Member
v
Join Date: Nov 2011
Posts: 33
Rep Power: 15 |
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 |
|
January 19, 2013, 12:28 |
|
#2 |
Senior Member
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25 |
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()
__________________
My Personal Website (http://nimasamkhaniani.ir/) Telegram channel (https://t.me/cfd_foam) |
|
January 21, 2013, 02:23 |
|
#3 |
Member
v
Join Date: Nov 2011
Posts: 33
Rep Power: 15 |
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 |
|
January 21, 2013, 02:39 |
|
#4 |
Senior Member
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25 |
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) |
|
January 21, 2013, 05:14 |
|
#5 |
Member
v
Join Date: Nov 2011
Posts: 33
Rep Power: 15 |
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 |
|
January 21, 2013, 05:36 |
|
#6 |
Senior Member
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25 |
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) |
|
January 21, 2013, 07:35 |
|
#7 |
Member
v
Join Date: Nov 2011
Posts: 33
Rep Power: 15 |
thanks your reply
this problem was solved I hope it takes time to thank. |
|
|
|
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 |