|
[Sponsors] |
June 20, 2020, 21:51 |
Calculating phi from U read from file
|
#1 |
New Member
Kaushik
Join Date: Jun 2019
Posts: 14
Rep Power: 7 |
Hi,
I have used the incompressible navier stokes equations to compute the velocity field for my domain using a third part solver, and I need to use this velocity to implement a scalar transport solver in openfoam. How should I calculate phi for this application? I have my velocity field in the format required by openfoam on file. |
|
June 21, 2020, 06:04 |
|
#2 |
Senior Member
Carlos Rubio Abujas
Join Date: Jan 2018
Location: Spain
Posts: 127
Rep Power: 11 |
When you mention you need to implement a scalar transport solver you mean to write the code? Have you tried scalarTransportFoam? You can check in the tutorials how to define the case and it do just that (inside the basic folder).
Basically you define a U Boundary condition with a non-uniform internal with the velocity field you have, and also set the boundary condition properly. The scalar has to be named T for this case, and a diffusion term is defined in constant/transportProperties as DT. With that information it will calculate phi and solve the scalar transport. It sounds pretty much to want you want. However, if you want to modify the behavior, adding additional scalarFields, renamed or whatever you may check the code of scalarTransient. There are plenty of tutorials out there explaining how to do that. (i.e https://openfoamwiki.net/index.php/H...ure_to_icoFoam). |
|
June 21, 2020, 06:29 |
|
#3 |
New Member
Kaushik
Join Date: Jun 2019
Posts: 14
Rep Power: 7 |
Thanks for your reply crubio.abujas! Yes, I have implemented what you have pointed out using scalarTransportFoam. However, I am having trouble in obtaining the phi field. It seems to be always be set to 0 throughout my domain. I guess my question is: how do I obtain the right phi field from U which I know.
|
|
June 21, 2020, 06:54 |
|
#4 | |
Senior Member
Carlos Rubio Abujas
Join Date: Jan 2018
Location: Spain
Posts: 127
Rep Power: 11 |
Quote:
It's hard to tell without knowing how your settings file look like. What is 0? the U field? the scalar (lets name it T) T field? or the phi field? When you define the BC you have to tell two pieces of information, one is the value field inside the domain and other is the treatment on the boundaries. Typically you set the scalar value in a boundary and then let the solver calculate the distribution. Maybe you defined de velocity in that particular patch to be 0, or to point outwards the domain and that is why the scalar is not distributing. I'm only guessing here, please share more information about the setting of the case for more insight. |
||
June 21, 2020, 16:10 |
|
#5 |
New Member
Kaushik
Join Date: Jun 2019
Posts: 14
Rep Power: 7 |
The phi field is always zero.
I read the internal field for U from a file, and compute U on the boundary using correctBoundaryConditions. I use zeroGradient boundary conditions for U for my inlet and outlet, and no slip conditions on the walls. I find that even if U is updated, phi does not get updated. How do I tell the solver to update the values of phi based on U? |
|
June 22, 2020, 03:16 |
|
#6 | |
Senior Member
Carlos Rubio Abujas
Join Date: Jan 2018
Location: Spain
Posts: 127
Rep Power: 11 |
So you are coding your own solver, right? In that case it would be useful if you share the code, so it is clearer where something may be wrong instead of me having to guess what you have done.
If you're getting a phi field to visualize means that, at least, you're initiating the field. You probably have created this field using Code:
#include "createPhi.H" Quote:
If that is your case, you can just call createPhi after U is properly set. Or call Code:
phi = fvc::flux(U); Again, it's hard to forecast the details and implementation of your solver without seeing the code itself. If the problems persist please share the important bits of the code. It's also important to know your OF version, as the code may be different. Regars |
||
June 22, 2020, 07:22 |
|
#7 |
New Member
Kaushik
Join Date: Jun 2019
Posts: 14
Rep Power: 7 |
That worked, thanks a lot! Yes, phi was not getting updated because I read U after creating phi.
|
|
June 22, 2020, 07:43 |
|
#8 |
Senior Member
Carlos Rubio Abujas
Join Date: Jan 2018
Location: Spain
Posts: 127
Rep Power: 11 |
||
Tags |
phi field |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] Installation Problem with OF 6 version | Aurel | OpenFOAM Community Contributions | 14 | November 18, 2020 17:18 |
[foam-extend.org] Problems installing foam-extend-4.0 on openSUSE 42.2 and Ubuntu 16.04 | ordinary | OpenFOAM Installation | 19 | September 3, 2019 19:13 |
what is swap4foam ?? | AB08 | OpenFOAM | 28 | February 2, 2016 02:22 |
SparceImage v1.7.x Issue on MAC OS X | rcarmi | OpenFOAM Installation | 4 | August 14, 2014 07:42 |
DxFoam reader update | hjasak | OpenFOAM Post-Processing | 69 | April 24, 2008 02:24 |