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

Access molecular weight from basicMultiComponentMixture

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By somesh

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 25, 2018, 19:54
Default Access molecular weight from basicMultiComponentMixture
  #1
New Member
 
Somesh
Join Date: Mar 2013
Posts: 2
Rep Power: 0
somesh is on a distinguished road
Hello,

I am trying to convert an old custom library from OpenFOAM-2.3.x to OpenFOAM-4.x

The library uses molecular weights of different species in calculations. Earlier in OF-2.3.x the library had routines such as:
Code:
void Foam::custom::computeCustom
(
...
    basicMultiComponentMixture& mixture
...
)
{
...
    mixture.W(spIndex); // spIndex is an already-defined label
...
}
In OF-4.x, it seems W() is not part of basicMultiComponentMixture and can only be accessed from basicSpecieMixture.

Does anyone have any suggestion on how to access molecular weight of species from basicMultiComponentMixture?
somesh is offline   Reply With Quote

Old   April 26, 2018, 00:39
Default
  #2
Senior Member
 
zhangyan's Avatar
 
Yan Zhang
Join Date: May 2014
Posts: 120
Rep Power: 12
zhangyan is on a distinguished road
Can it be replaced by
Code:
this->getLocalThermo(speciei).W()
?
zhangyan is offline   Reply With Quote

Old   April 26, 2018, 09:45
Default
  #3
New Member
 
Somesh
Join Date: Mar 2013
Posts: 2
Rep Power: 0
somesh is on a distinguished road
Thanks zhangyan for the quick reply.

I did not try your method, but I think I have figured it out (my C/C++ skills are rusty at best!)

I used

Code:
void Foam::custom::computeCustom
(
...
    basicMultiComponentMixture& mixture
...
)
{
...
const basicSpecieMixture& spMixture =
          dynamic_cast<const basicSpecieMixture&>(mixture);

    spMixture.W(spIndex); // spIndex is an already-defined label
...
}
and now I have access to member functions inside basicSpecieMixture as:
zhangyan likes this.
somesh is offline   Reply With Quote

Reply

Tags
4.x, molecular weight


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
How to access species molecular weight in UDFs Ellen FLUENT 3 June 2, 2019 20:55
polymerization molecular weight distribution Tleja FLUENT 0 August 1, 2014 18:03
How to change molecular weight of a species in pdf-mixture Jenny_W FLUENT 0 November 3, 2012 17:49
Pressure and molecular weight ? Jane FLUENT 0 January 2, 2009 05:17
Molecular weight of the solid phase? imburse CFX 3 May 9, 2002 19:28


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