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

how to define a vector5(5 primitive variables) in Block matrix?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 2, 2014, 23:15
Default how to define a vector5(5 primitive variables) in Block matrix?
  #1
Member
 
hua1015's Avatar
 
Hua
Join Date: May 2012
Posts: 31
Rep Power: 14
hua1015 is on a distinguished road
Dear Foamers,
Recently, I want to define a vector5(5 primitive variables,u,v,w,p,T) in block matrix. vector2,3,4,6,8 have been defined in OpenFOAM. So I added some codes to define vector5.
follow is my codes
//vector5 and some relative variables***************************************** ******************************** //
#include "ExpandTensorN.H"
#define nGroups 5

typedef Foam::VectorN<scalar, nGroups> vector5;
typedef Foam::TensorN<scalar, nGroups> tensor5;
typedef Foam:iagTensorN<scalar, nGroups> diagTensor5;
typedef Foam::SphericalTensorN<scalar, nGroups> sphericalTensor5;

typedef dimensioned<vector5> dimensionedVector5;
typedef dimensioned<tensor5> dimensionedTensor5;
typedef dimensioned<diagTensor5> dimensionedDiagTensor5;
typedef dimensioned<sphericalTensor5> dimensionedSphericalTensor5;

typedef GeometricField<vector5, fvPatchField, volMesh> volVector5Field;
typedef GeometricField<tensor5, fvPatchField, volMesh> volTensor5Field;
typedef GeometricField<diagTensor5, fvPatchField, volMesh> voldiagTensor5Field;
typedef GeometricField<sphericalTensor5, fvPatchField, volMesh> volsphericalTensor5Field;
// ************************************************** *********************** //

Unlucky, compilation is error.
Could anyone can help me?
hua1015 is offline   Reply With Quote

Old   June 3, 2014, 04:13
Default
  #2
Member
 
hua1015's Avatar
 
Hua
Join Date: May 2012
Posts: 31
Rep Power: 14
hua1015 is on a distinguished road
My openFoam is openfoam-extend-3.0.
hua1015 is offline   Reply With Quote

Old   June 4, 2014, 01:18
Default
  #3
Member
 
hua1015's Avatar
 
Hua
Join Date: May 2012
Posts: 31
Rep Power: 14
hua1015 is on a distinguished road
I had solved this problem.Thanks
hua1015 is offline   Reply With Quote

Old   May 14, 2015, 13:58
Default
  #4
New Member
 
Anant Grewal
Join Date: Mar 2009
Posts: 9
Rep Power: 17
agrewal is on a distinguished road
Could you please post how you did this? I have the same requirement for a vector of 5 scalars.
Thanks
Anant
agrewal is offline   Reply With Quote

Old   May 15, 2015, 11:46
Default
  #5
Member
 
hua1015's Avatar
 
Hua
Join Date: May 2012
Posts: 31
Rep Power: 14
hua1015 is on a distinguished road
Hi,Anant,
I remembered there some change should be done in source codes in OF-ext3,0.
Since vector2,3,4,6,8 have been defined in OpenFOAM. So I added some codes to define vector5 just like vector2,3,4,6,8 in source codes.
follow is my codes
//vector5 and some relative variables***************************************** ******************************** //
#include "ExpandTensorN.H"
#define nGroups 5

typedef Foam::VectorN<scalar, nGroups> vector5;
typedef Foam::TensorN<scalar, nGroups> tensor5;
typedef Foam:iagTensorN<scalar, nGroups> diagTensor5;
typedef Foam::SphericalTensorN<scalar, nGroups> sphericalTensor5;

typedef dimensioned<vector5> dimensionedVector5;
typedef dimensioned<tensor5> dimensionedTensor5;
typedef dimensioned<diagTensor5> dimensionedDiagTensor5;
typedef dimensioned<sphericalTensor5> dimensionedSphericalTensor5;

typedef GeometricField<vector5, fvPatchField, volMesh> volVector5Field;
typedef GeometricField<tensor5, fvPatchField, volMesh> volTensor5Field;
typedef GeometricField<diagTensor5, fvPatchField, volMesh> voldiagTensor5Field;
typedef GeometricField<sphericalTensor5, fvPatchField, volMesh> volsphericalTensor5Field;
// ************************************************** *********************** //
Good luck.
There some more change may be needed. Try it and follow the error to find something needed.
hua1015 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
Force can not converge colopolo CFX 13 October 4, 2011 23:03
UDF to define variables orlik FLUENT 0 March 11, 2010 12:15
REAL GAS UDF brian FLUENT 6 September 11, 2006 09:23
PHI file structure Eugene Phoenics 9 November 2, 2001 23:00
writing a 3d NS solver in the primitive variables! lostsoul Main CFD Forum 4 October 20, 2000 03:52


All times are GMT -4. The time now is 03:59.