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

 October 26, 2006, 16:56 The problem is like this: a em #1 New Member   Simon Zhang Join Date: Mar 2009 Posts: 18 Rep Power: 12 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!

 October 27, 2006, 14:44 Hi guys, The last question #2 New Member   Simon Zhang Join Date: Mar 2009 Posts: 18 Rep Power: 12 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!!

 October 28, 2006, 04:42 Hello Simon, Perhaps I miss #3 Member   anne dejoan Join Date: Mar 2009 Location: madrid, spain Posts: 66 Rep Power: 12 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

 October 28, 2006, 15:45 Well, take the simpleFoam solu #5 Senior Member   Hrvoje Jasak Join Date: Mar 2009 Location: London, England Posts: 1,849 Rep Power: 28 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

 October 31, 2006, 13:51 Sorry for late response. Thank #6 New Member   Simon Zhang Join Date: Mar 2009 Posts: 18 Rep Power: 12 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!

 October 31, 2006, 17:45 Ohh, I forgot to mention that #7 New Member   Simon Zhang Join Date: Mar 2009 Posts: 18 Rep Power: 12 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!!

 January 30, 2007, 11:15 Hello, I want to simulate t #8 New Member   Jerome Join Date: Mar 2009 Location: Germany Posts: 8 Rep Power: 12 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

 January 30, 2007, 13:42 1) Does your scalar diffuse? I #9 Senior Member   Mattijs Janssens Join Date: Mar 2009 Posts: 1,419 Rep Power: 20 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.

 January 30, 2007, 14:52 Also, if you want to reread pe #10 Senior Member   Eugene de Villiers Join Date: Mar 2009 Posts: 726 Rep Power: 16 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 ) );

 January 31, 2007, 03:09 Thank you very much for your h #11 New Member   Jerome Join Date: Mar 2009 Location: Germany Posts: 8 Rep Power: 12 Thank you very much for your help. Yes, my scalar diffuses. I will try what you proposed. Jerome

 February 20, 2007, 11:49 Hello, The scalar that is t #12 New Member   Jerome Join Date: Mar 2009 Location: Germany Posts: 8 Rep Power: 12 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

 February 20, 2007, 11:58 Yup, upwing differencing on co #13 Senior Member   Hrvoje Jasak Join Date: Mar 2009 Location: London, England Posts: 1,849 Rep Power: 28 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

 February 21, 2007, 09:54 Thank you very much for your a #14 New Member   Jerome Join Date: Mar 2009 Location: Germany Posts: 8 Rep Power: 12 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

 April 16, 2008, 09:02 hi, i want to add a scalar tr #15 Member   davey david Join Date: Mar 2009 Posts: 54 Rep Power: 12 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

 April 17, 2008, 08:24 hi Dragos i have tried what u #16 Member   davey david Join Date: Mar 2009 Posts: 54 Rep Power: 12 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

 April 18, 2008, 02:21 Hi Davey, I don't exactly und #17 Senior Member     Dragos Join Date: Mar 2009 Posts: 648 Rep Power: 15 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

 April 18, 2008, 06:33 Hi dragos, here are my source #18 Member   davey david Join Date: Mar 2009 Posts: 54 Rep Power: 12 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

 April 18, 2008, 06:46 Hi Davey, Your sources look o #19 Senior Member     Dragos Join Date: Mar 2009 Posts: 648 Rep Power: 15 Hi Davey, Your sources look ok to me. What is the problem? Do you have any results to show? Dragos

 April 18, 2008, 07:44 Hi Dragos, as u saw,i modifie #20 Member   davey david Join Date: Mar 2009 Posts: 54 Rep Power: 12 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