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

fvm::div("phi", U) always requires registered phi?

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

Like Tree1Likes
  • 1 Post By dlahaye

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 23, 2025, 16:25
Default fvm::div("phi", U) always requires registered phi?
  #1
New Member
 
Jim Park
Join Date: Nov 2020
Posts: 5
Rep Power: 6
bmb333 is on a distinguished road
I am modifying simpleFoam such that I can operate with two fluids, which do not mix but shares the same mesh.

I have prepared new fields which are U1, U2, p1, p2, phi1, and phi2. So, I no longer have the original U,p,phi, and such.

Now, when I try to run the following piece of code (which is itself a part of original UEqn.H in simpleFoam):

fvVectorMatrix tU1Eqn
(
fvm::div(phi1, U1)
);

I get an error saying

failed lookup of phi (objectRegistry region0)
available objects of type surfaceScalarField:
2(phi2 phi1).

Obviously, there is no phi since I intend to work with phi1 and phi2.

But, it is quite surprising that even if the input arguments to fvm::div were phi1 and U1, it still tries to find phi.


When compiling, I did not have any error.

Do you have any suggestion on how to work this out?
bmb333 is offline   Reply With Quote

Old   January 24, 2025, 04:28
Default
  #2
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 820
Blog Entries: 1
Rep Power: 19
dlahaye is on a distinguished road
Not sure. Is your pressure solve (pEqn) looking for the original phi? Should you try modifying scalarTrsansportFoam first?
bmb333 likes this.
dlahaye is offline   Reply With Quote

Old   January 25, 2025, 01:43
Default Modified scalarTransportFoam works fine!
  #3
New Member
 
Jim Park
Join Date: Nov 2020
Posts: 5
Rep Power: 6
bmb333 is on a distinguished road
Quote:
Originally Posted by dlahaye View Post
Not sure. Is your pressure solve (pEqn) looking for the original phi? Should you try modifying scalarTrsansportFoam first?
Hi, I appreciate your suggestion.

I tried modifying the scalarTransportFoam so that all the variables like T, U, phi are converted to T1, U1, phi1.

I ran the pitzDaily in the tutorials/basic/scalarTransportFoam, and there is no complaint. What a surprise.

I am suspecting whether this has more to do with the case directory settings than the solver itself.

Answering the other part of your comment, if my solver (which tries to adapt the simpleFoam) did use phi somewhere, then I would be getting an error during compilation of the solver because I do not declare phi at all. However, during compilation, there is no error. It only spits out an error during the execution of the case with the solver.

I will keep digging and try to experiment with the modified scalarTransportFoam with different initial/boundary conditions...
bmb333 is offline   Reply With Quote

Old   January 25, 2025, 17:18
Default Happens with fvVectorMatrix
  #4
New Member
 
Jim Park
Join Date: Nov 2020
Posts: 5
Rep Power: 6
bmb333 is on a distinguished road
I found that it might have to do with whether you are working with fvScalarMatrix or fvVectorMatrix.

For example,

fvScalarMatrix TEqn
(
fvm::div(phi1, T1)
==
fvOptions(T1)
);

This works without errors.

But,

fvVectorMatrix tUEqn
(
fvm::div(phi1, U1)
==
fvOptions(U1)
);

This will try to search for phi during execution and throw error if phi is not there as a registered object.

I am not sure whether there is some dynamic referencing that is happening to actively search for phi when you run fvVectorMatrix..?
bmb333 is offline   Reply With Quote

Reply

Tags
divergence, flux

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
Windkessel boundary implementation Filippo70 OpenFOAM Programming & Development 0 November 7, 2024 12:04
[General] Extracting ParaView Data into Python Arrays Jeffzda ParaView 30 November 6, 2023 22:00
Correction procedure on a non-orthogonal skewed Mesh me.ouda OpenFOAM Programming & Development 0 January 18, 2017 10:05
mixerVesselAMI2D's mass is not balancing sharonyue OpenFOAM Running, Solving & CFD 6 June 10, 2013 10:34


All times are GMT -4. The time now is 17:35.