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

Question about scalar transport

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 26, 2006, 15:56
Default The problem is like this: a em
  #1
New Member
 
Simon Zhang
Join Date: Mar 2009
Posts: 18
Rep Power: 17
osimonsimon is on a distinguished road
The problem is like this: a empty room with one inlet and one outlet. I am using simpleFoam solver and I've added a scalar transport equation in the solver to calculate the concentration at the outlet. The transport scalar is released at the inlet. And it is working well.

Now I have a question: Since this model might be extended to solve more than 30 species (transport scalar), it might be a burden to solve all these transport equations every iteration. Can I solve the flow field first and then "freeze" it while solving the transport equation? How could I do it?

The other question is: how could I get the surface average concentration at the outlet? I tried to follow the "scalarTransport" example "pPrime2" and I could get all the cell face value at the outlet and then average them (since the grid is uniform). But I know it is quite a detour and there should be a much easy way to do it. Please give me some hint. A example will be even better for a C++ beginner like me.

Thank you very much!
osimonsimon is offline   Reply With Quote

Old   October 27, 2006, 13:44
Default Hi guys, The last question
  #2
New Member
 
Simon Zhang
Join Date: Mar 2009
Posts: 18
Rep Power: 17
osimonsimon is on a distinguished road
Hi guys,

The last question is already solved. I digged through all the threads and tried different things out. Finally I got what I want.

But for the first question, I still cannot get any hint through old threads. Can anyone help me with it? Again the question is:

How can I solve the flow field first and then, solve scalar transport equations using the known velocity field. My scalar(Y) transport equation looks like:
solve
(
fvm::div(phi,Y)-fvm::laplacian(DI,Y)
)
Any hint is appreciated!!
osimonsimon is offline   Reply With Quote

Old   October 28, 2006, 03:42
Default Hello Simon, Perhaps I miss
  #3
Member
 
anne dejoan
Join Date: Mar 2009
Location: madrid, spain
Posts: 66
Rep Power: 17
anne is on a distinguished road
Hello Simon,

Perhaps I miss something in your first question, but
I would answer to
just inplement the scalar transport equation you want to resolve after the velocity be computed.

For getting the surface average concentration at the oulet just inspire yu from the threat

"Calculation of integral boundary values" in the
forum (you can find it easily by search "sum(")
using sum and identification of BC patch.


Anne
anne is offline   Reply With Quote

Old   October 28, 2006, 14:22
Default Hi Anne, Thank you very mu
  #4
New Member
 
Simon Zhang
Join Date: Mar 2009
Posts: 18
Rep Power: 17
osimonsimon is on a distinguished road
Hi Anne,

Thank you very much for your reply. Now I can calculate the surface average concentration. But I am still not very clear about the first question.

Do you suggest that I run "simpleFoam mycase" and then run "scalarTransportFoam mycase"? If so, how should I adjust the createFields.H file so that the scalarTransportFoam solver could read in the solved flow field (U or Phi)?


Or do I just simplely add the scalar transportequation in a new solver based on simpleFoam with adding the line " solve (fvm::div(phi,Y)-fvm::laplacian(DI,Y)); ? If so, should I put it in a new loop (not in the runTime loop) so that it can be solved after the flow field is solved? It will save a lot of time if the flow field is solved. For example, if solve the flow field and the scalar transport together need 1000 iterations to converge. But solve the scalarTransport with flow field solved first (use 1000 iterations) might only need 100 iterations. It is obvious that it saves time if decouple the two solving process)

I know my questions might be stupid and I wish I had made myself clear. Please help me understand this! Thank you so much!

Simon
osimonsimon is offline   Reply With Quote

Old   October 28, 2006, 14:45
Default Well, take the simpleFoam solu
  #5
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,906
Rep Power: 33
hjasak will become famous soon enough
Well, take the simpleFoam solution you like (any time-step or iteration will do) and use the U and phi fields from that solution in the starting directory for your scalarTransportFoam application. I'm sure you've got the drift. :-)

Enjoy,

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   October 31, 2006, 12:51
Default Sorry for late response. Thank
  #6
New Member
 
Simon Zhang
Join Date: Mar 2009
Posts: 18
Rep Power: 17
osimonsimon is on a distinguished road
Sorry for late response. Thanks Hrv, it works with your idea. I also found another way to do it that is adding the line "solve (fvm::div(phi,Y)-fvm::laplacian(DI,Y));" at the end of the runTime loop and run it only once. Since all the variable in the equation is known by then except Y, it can be solved in only one iteration, right? (steady state problem) I've tried it and it seems right. Could anyone comment on this?

Thanks again for your help!
osimonsimon is offline   Reply With Quote

Old   October 31, 2006, 16:45
Default Ohh, I forgot to mention that
  #7
New Member
 
Simon Zhang
Join Date: Mar 2009
Posts: 18
Rep Power: 17
osimonsimon is on a distinguished road
Ohh, I forgot to mention that there still is a little trouble when I tried to add this line (solve...) to buoyantSimpleFoam. It seems that the "phi" is not what I expected as "U*rho". I added this line in the main after "#include pEqn.H". Any suggestions? Thanks a bunch!!
osimonsimon is offline   Reply With Quote

Old   January 30, 2007, 10:15
Default Hello, I want to simulate t
  #8
New Member
 
Jerome
Join Date: Mar 2009
Location: Germany
Posts: 8
Rep Power: 17
jerome is on a distinguished road
Hello,

I want to simulate the transport of a passive scalar in a periodic internal velocity field which is obtained by an icoFoam simulation.

I created a new solver based on icoFoam and scalarTransportFoam (I notably added the lines related to the scalar transport equation at the end of the runTime loop of icoFoam). This works but it is too slow for complicated geometry and when I want to compute the transport of the scalar during many periods.

It would be much quicker if I could use the results obtained with an unsteady icoFoam simulation for a single period (I would not have to calculate the same periodic internal velocity and pressure fields for each period).

Is it possible to change the scalarTransportFoam solver to read different internal velocity fields for each time step? Could you please give me some advice to do that?

Thank you very much

Jerome
jerome is offline   Reply With Quote

Old   January 30, 2007, 12:42
Default 1) Does your scalar diffuse? I
  #9
Senior Member
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26
mattijs is on a distinguished road
1) Does your scalar diffuse? If it is purely transport, there are some postprocessors that have transport built-in. ('streak lines'?)

2) Move the construction of e.g. phi or U (now in createFields.H ?) into the time loop

for (runTime++; !runTime.end(); runTime++)
{
Info<< "Time = " << runTime.timeName() << nl << endl;

surfaceScalarField phi
(
IOobject
(
"phi",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
)
);


The 'MUST_READ' argument makes sure it reads the field from file.
mattijs is offline   Reply With Quote

Old   January 30, 2007, 13:52
Default Also, if you want to reread pe
  #10
Senior Member
 
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 21
eugene is on a distinguished road
Also, if you want to reread periodic flow data from earlier times, you might want to modify the
runTime.timeName() entry in the constructor so that it reads from the correct old times and not the current time.

e.g
scalar readTime = runTime.value() - offset;
surfaceScalarField phi
(
IOobject
(
"phi",
runTime.timeName(readTime),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
)
);
eugene is offline   Reply With Quote

Old   January 31, 2007, 02:09
Default Thank you very much for your h
  #11
New Member
 
Jerome
Join Date: Mar 2009
Location: Germany
Posts: 8
Rep Power: 17
jerome is on a distinguished road
Thank you very much for your help.
Yes, my scalar diffuses. I will try what you proposed.

Jerome
jerome is offline   Reply With Quote

Old   February 20, 2007, 10:49
Default Hello, The scalar that is t
  #12
New Member
 
Jerome
Join Date: Mar 2009
Location: Germany
Posts: 8
Rep Power: 17
jerome is on a distinguished road
Hello,

The scalar that is transported is a mass. However, I noticed that sometimes, I obtain small negative values at some cell centres. Is there any way to avoid that? Would it be possible to inform the solver that only positive values are expected?

I tried to use other numerical schemes for that but it did not change anything. Is there any interpolation, laplacian or divergence schemes that I can use to obtain a positive and conservative scalar?

Thank you very much

Jerome
jerome is offline   Reply With Quote

Old   February 20, 2007, 10:58
Default Yup, upwing differencing on co
  #13
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,906
Rep Power: 33
hjasak will become famous soon enough
Yup, upwing differencing on convaction, Euler implicit in time and uncorrected laplacian guarantees the solution to be bounded and conservative on all meshes. Howeler, this is usually an overkill (you are throwing away quite a lot of accuracy), and a less aggressive discretisation is sufficient. For example:

- Gamma differencing scheme on convection (or Gamma01, if you are transporting a scalar bounded between 0 and 1, e.g. concentration).
- Euler implicit in time
- Gauss linear limited 1.0 on the laplacian.

Once this is in place, you just need to make sure that your sink terms are implicit for the lower limit and switch properly if the scalar is bounded above as well.

Enjoy,

Hrv
randolph likes this.
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   February 21, 2007, 08:54
Default Thank you very much for your a
  #14
New Member
 
Jerome
Join Date: Mar 2009
Location: Germany
Posts: 8
Rep Power: 17
jerome is on a distinguished road
Thank you very much for your answer.
I tried what you said and I can obtain only positive values now.

I still have some questions:

1. For the convection, I used a Gamma01 differencing scheme and I tried different values for the parameter. For "Gamma01 1" and "Gamma01 0.5", it is ok but for "Gamma01 0", I have some negative values. Do you advise me to use only "Gamma01 1"?

2. I would like to have a confirmation about the meaning of the scalar transport calculation.
As far as I understood, as I take the "phi" field from an icoFoam simulation, this is only the flux without taking the fluid density into account, so doing

solve
(
fvm::ddt(C)
+ fvm::div(phi, C)
- fvm::laplacian(DT, C)
);

is equivalent to solving the following passive scalar equation:

C/t + U • ÑC = DT Ñ2(C)

with for instance C the concentration in kg / m3, U the velocity field, and DT the diffusivity constant.
Thank you very much if you can confirm that,

Jerome
jerome is offline   Reply With Quote

Old   April 16, 2008, 08:02
Default hi, i want to add a scalar tr
  #15
Member
 
davey david
Join Date: Mar 2009
Posts: 54
Rep Power: 17
suredross is on a distinguished road
hi,
i want to add a scalar transport equation to the icoFoam solver.my eqn is :

fvm::ddt(C) == -fvc::grad (C,U)
is my equation correct and where do i implement it in my solver?

thanks in advance
davey
suredross is offline   Reply With Quote

Old   April 17, 2008, 07:24
Default hi Dragos i have tried what u
  #16
Member
 
davey david
Join Date: Mar 2009
Posts: 54
Rep Power: 17
suredross is on a distinguished road
hi Dragos
i have tried what u said(exactly as u wrote it).it seems to run fine but when i view it with paraview i cannot see the two different concentrations?do i need to modify the equation again?
kindly advise.

thanks
davey
suredross is offline   Reply With Quote

Old   April 18, 2008, 01:21
Default Hi Davey, I don't exactly und
  #17
Senior Member
 
dmoroian's Avatar
 
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20
dmoroian is on a distinguished road
Hi Davey,
I don't exactly understand your statement. If you wrote it as I posted above, than how do you expect to see two concentrations if you compute only one scalar?
Please, put a picture with the result that makes you unhappy.

Dragos
dmoroian is offline   Reply With Quote

Old   April 18, 2008, 05:33
Default Hi dragos, here are my source
  #18
Member
 
davey david
Join Date: Mar 2009
Posts: 54
Rep Power: 17
suredross is on a distinguished road
Hi dragos,
here are my source code and createfield files:
source code:
junctionFoam.C and
createFields.H
kindly have alook and see if my parameters and synthax are correct?and why should i neglect the U?

thanks
davey
suredross is offline   Reply With Quote

Old   April 18, 2008, 05:46
Default Hi Davey, Your sources look o
  #19
Senior Member
 
dmoroian's Avatar
 
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20
dmoroian is on a distinguished road
Hi Davey,
Your sources look ok to me. What is the problem? Do you have any results to show?

Dragos
dmoroian is offline   Reply With Quote

Old   April 18, 2008, 06:44
Default Hi Dragos, as u saw,i modifie
  #20
Member
 
davey david
Join Date: Mar 2009
Posts: 54
Rep Power: 17
suredross is on a distinguished road
Hi Dragos,
as u saw,i modified the conc into a vector knowing that i can imput two different values for my intlets.unfortunately,when i view it in paraFoam,it shows only one conc all through which should not be so.these are my results for the various parameters at time 0.3s
c.pvd
p.pvd
u.pvd

any ideas?
thanks
suredross is offline   Reply With Quote

Reply

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
Passive scalar transport novyno OpenFOAM Running, Solving & CFD 10 May 5, 2016 13:31
Scalar transport Sanchit CFX 0 September 29, 2008 07:46
Negative scalar transport diegon OpenFOAM Running, Solving & CFD 0 December 1, 2006 08:30
Steady scalar transport heather OpenFOAM Running, Solving & CFD 2 August 31, 2005 08:44
Scalar Transport Equations 123 Main CFD Forum 6 August 10, 1998 09:05


All times are GMT -4. The time now is 14:51.