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 Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By somesh

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 25, 2018, 18: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 25, 2018, 23:39
Default
  #2
Senior Member
 
zhangyan's Avatar
 
Yan Zhang
Join Date: May 2014
Posts: 120
Rep Power: 11
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, 08: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

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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


All times are GMT -4. The time now is 05:22.