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

scalarTransportFoam for arbitrary number of transported scalars

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 4, 2011, 08:49
Question scalarTransportFoam for arbitrary number of transported scalars
  #1
New Member
 
Andreas P
Join Date: Sep 2010
Posts: 26
Rep Power: 16
andreasp is on a distinguished road
Hi,

I am just taking my first steps programming OF, so please pardon my awkwardly foolish question. The only thing I want to do is extend scalarTransportFoam so that it can solve for an arbitrary number of transported (and independent) scalars. That means, T should not be a volScalarField, but a field of vectors of length N, and accordingly the user should provide the diffusivities also as a vector of length N.

Of course it would be possible to solve the different transport equations one after another. But I don't want to do that, since I might need coupling between the different scalars some time later.

So how could I achieve that? I tried to define T as a volVectorField, but that seems to always expect a vector of length 3. Is that true?

I'd appreciate any help to get me on the right track.

Thanks in advance!
Andreas
andreasp is offline   Reply With Quote

Old   June 4, 2011, 12:52
Default
  #2
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 22
marupio is on a distinguished road
I don't think it would work as you hope. First of all, the vector idea is not suitable: vectors have direction, and the X vector of T will coincide with the X direction of velocity.

What you are suggesting would require defining a new Type for fvScalarMatrix<Type>, which would be an involved process (a nightmare, actually... you'd have to add to all the fvc, fvm namespaces, and create all the field operators for starters...). Furthermore, I suspect that the algorithm would ultimately need to solve each component individually, so I don't think you'd be saving any computation time by defining this new Type.

I wrote a scalarTransportFoam version that solves for an arbitirary number of scalars (individually), listed in a dictionary file. Let me know if you want more details about that.
marupio is offline   Reply With Quote

Old   June 4, 2011, 13:35
Default
  #3
New Member
 
Andreas P
Join Date: Sep 2010
Posts: 26
Rep Power: 16
andreasp is on a distinguished road
Thanks for your quick reply.

Quote:
Originally Posted by marupio View Post
I don't think it would work as you hope. First of all, the vector idea is not suitable: vectors have direction, and the X vector of T will coincide with the X direction of velocity.
OK, I kind of suspected that.

Quote:
Originally Posted by marupio View Post
I wrote a scalarTransportFoam version that solves for an arbitirary number of scalars (individually), listed in a dictionary file. Let me know if you want more details about that.
Yes, I would definitely like to have more details about your implementation!

Thanks!
Andreas
andreasp is offline   Reply With Quote

Old   June 4, 2011, 13:51
Default
  #4
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 22
marupio is on a distinguished road
Here's some of the code. I wrote it before I was very comfortable with OF, so it's a little awkward in places. It uses a custom class called "admScalar", which I can't seem to find anymore, but it was just a container - I'm sure you can guess what it was supposed to do.

Also, I grouped all the scalars together to use the same fvSchemes - this simplifies the fvSchemes file, but you don't have to do that. (This is what all that admConvection, admLaplacian, etc.. stuff is all about.)

This should at least give you an idea of what to do - especially the part about reading the variables in from a dictionary, and creating a pointer list of the volScalarFields.
Attached Files
File Type: gz scalarTransportBits.tar.gz (794 Bytes, 47 views)
marupio is offline   Reply With Quote

Old   June 4, 2011, 17:36
Default
  #5
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
Quote:
Originally Posted by andreasp View Post

Yes, I would definitely like to have more details about your implementation!
You could also take a look at the "diesel" or "reacting" solvers. Species are solved in a sequence, and their number is arbitrary (related to components).

Best,
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   June 4, 2011, 19:34
Default
  #6
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 22
marupio is on a distinguished road
Now that you mention that, Alberto, I think that's what I used for inspiration when I wrote that code.
marupio is offline   Reply With Quote

Old   June 5, 2011, 16:58
Default
  #7
New Member
 
Andreas P
Join Date: Sep 2010
Posts: 26
Rep Power: 16
andreasp is on a distinguished road
Thanks for your code snippets!
I'll take a look at them and at the other foam solvers mentioned, and I'll come back if I run into problems...
andreasp is offline   Reply With Quote

Reply

Tags
extend, multiple scalars, scalartransportfoam


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
[mesh manipulation] Mesh Refinement Luiz Eduardo Bittencourt Sampaio (Sampaio) OpenFOAM Meshing & Mesh Conversion 42 January 8, 2017 13:55
DecomposePar unequal number of shared faces maka OpenFOAM Pre-Processing 6 August 12, 2010 10:01
[blockMesh] BlockMeshmergePatchPairs hjasak OpenFOAM Meshing & Mesh Conversion 11 August 15, 2008 08:36
Unaligned accesses on IA64 andre OpenFOAM 5 June 23, 2008 11:37
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Meshing & Mesh Conversion 2 July 15, 2005 05:15


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