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

Couldn't able to figure out the technique - NO problem with Compilation

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By Kummi
  • 1 Post By adhiraj
  • 1 Post By Kummi

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 13, 2020, 22:47
Default Couldn't able to find a way in Numerical Solution - NO problem with Compilation
  #1
Senior Member
 
Kumaresh
Join Date: Oct 2016
Posts: 348
Rep Power: 11
Kummi is on a distinguished road
Send a message via Yahoo to Kummi
Hello Foamers,
In my work, I need to resolve 2 variables - pressure (p) and velocity (V) based on Continuity and Ergun Equations shown below:
Quote:
Continuity::

\rho \bigtriangledown \cdot \vee =W_{sg}
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (Eq.1)

Ergun::

-\bigtriangledown p^{2}=2TR\left \{ (F_{1}+F_{2}\left |\rho U \right | )\rho \vee \right \} 
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (Eq.2)


*where \mathbf{{\vee}} = Velocity vector, U = Velocity magnitude,
T, Wsg - calculated non-uniform scalar data lists,
F1, F2, f1, f2 = constant values,
constant density - rho = 0.8
Based on Eqs. (1) and (2), we cant obtain the variables pressure (p) and velocity (V) directly. So, certain manipulations are done.
By applying the operator (\bigtriangledown \times) cross product on Eq. (2),

\bigtriangledown \times \vee -   \vee \times\bigtriangledown\left [ ln\left ( f_{1}+f_{2}\left | \rho U   \right | \right ) \right ] = 0
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (Eq.3)
  • taking (\bigtriangledown \times) on Eq. (2), the pressure term will be eliminated, since \mathbf{{\vee}} vector is the only dependent variable.
  • From Eq. (3), velocity can be computed.
Next By applying (\bigtriangledown) on both side of Eq. (2),

-\bigtriangledown^{2}p^{2}=2TR((f_{1}+f_{2})\left | \rho U \right |)(\rho \bigtriangledown \cdot \vee ) + \rho\left [ (\vee) \cdot ((f_{1}+f_{2})\left | \rho U \right |) \right ]
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (Eq.4)

-\bigtriangledown^{2}p^{2}=2TR((f_{1}+f_{2})\left  | \rho U \right |)(W_{sg}) + \rho\left [ (\vee) \cdot  ((f_{1}+f_{2})\left | \rho U \right |) \right ]
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (Eq.5) //Continuity (Eq.1) is substituted

After computing velocity from Eq. (3), the pressure can be computed from Eq. (5)
Expanding Eq. (3), we get,

\left [ \frac{\delta v_{y}}{\delta {x}}-\frac{\delta v_{x}}{\delta {y}} \right ] -
\left \{ v_{x} \left [ \frac{\delta}{\delta {y}}(ln(f_{1}+f_{2}\left | \rho v_{x} \right |) \right ] -v_{y} \left [ \frac{\delta}{\delta {x}}(ln(f_{1}+f_{2}\left | \rho v_{x} \right |) \right ]\right \}=0(Eq.3a)

\left [ \frac{\delta v_{y}}{\delta {x}}-\frac{\delta v_{x}}{\delta {y}} \right ] -
\left \{ v_{x} \left [ \frac{\delta}{\delta {y}}(ln(f_{1}+f_{2}\left |  \rho v_{y} \right |) \right ] -v_{y} \left [ \frac{\delta}{\delta  {x}}(ln(f_{1}+f_{2}\left | \rho v_{y} \right |) \right ]\right \}=0(Eq.3b)

Expanding Eq. (5), we get,

\frac{\delta^{2} p^{2}}{\delta x^{2}} =2TR\left \{ (f_{1}+f_{2}\left | \rho v_{x} \right |)W_{sg} +(\rho (v_{x}+v_{y})Lx) \right \}\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (Eq.5a)

\frac{\delta^{2} p^{2}}{\delta y^{2}} =2TR\left \{ (f_{1}+f_{2}\left | \rho v_{y} \right |)W_{sg} +(\rho (v_{x}+v_{y})Ly) \right \} 
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (Eq.5b)

where,

Lx= \frac{\delta }{\delta x}(f_{1}+f_{2}\left | \rho v_{x} \right |)
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (Eq.5c)

Ly= \frac{\delta }{\delta y}(f_{1}+f_{2}\left | \rho v_{y} \right |)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (Eq.5d)

  • Equs. (3a) and (3b) solves velocities vx and vy [2 equations, 2 unknowns]
  • From Equs. (5a and 5b) -- [2 equations, 1 unknown pressure] -- so either one of the equation is taken into account for solving pressure, because pressure is a scalar quantity
I defined the above equations in OpenFOAM. There is no problem with compilation. And the case runs good without error. During post-processing, I dont find change in velocity inside my domain. However, the pressure (p2) variable is changed. Quite confused here.

I guess my syntax is right. I feel there might be some problem with equations derived above ? I solved it to the best of my knowledge.
I'm hereby attaching my code and case files.
If anyone have some ideas, kindly do share it to proceed further.
Thank you


**The above equations are referred from the following reference:
https://aiche.onlinelibrary.wiley.co.../aic.690200519
Attached Images
File Type: png Velocity - no change.png (15.6 KB, 11 views)
File Type: png pressure.png (19.2 KB, 10 views)
Attached Files
File Type: gz ErgunFoam.tar.gz (110.7 KB, 7 views)
raj kumar saini likes this.

Last edited by Kummi; January 20, 2020 at 03:33.
Kummi is offline   Reply With Quote

Old   January 14, 2020, 12:10
Default
  #2
Senior Member
 
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 15
adhiraj is on a distinguished road
I took a quick look at the code you posted, and noticed that you are solving an equation for {p}^{2}, so {p}^{2} is getting updated.

You are not solving any equation for the velocity field, and neither are you updating the velocity explicitly. So your velocity field is not changing.

The line
Code:
(gradCurlUyx - gradCurlUxy) = ((Ux*gradUxy) - (Uy*gradUxx));
simply tries to assign the value of one temporary variable to another.
Kummi likes this.
adhiraj is offline   Reply With Quote

Old   January 15, 2020, 06:28
Default
  #3
Senior Member
 
Kumaresh
Join Date: Oct 2016
Posts: 348
Rep Power: 11
Kummi is on a distinguished road
Send a message via Yahoo to Kummi
Dear Adhiraj,
Thank you for your response.

I missed to add logarithm term in above velocity equations Equs. (3a and b). Since the logarithm expressions are used for only scalar variables in OpenFOAM, I used chain rule for gradient and resolved. The below expression shows how the second term in Equ. (3a) evaluated by eliminated logarithm term.

\left [ \frac{\delta}{\delta {y}}(ln(f_{1}+f_{2}\left | \rho v_{x} \right |) \right ]=\frac{1}{0.4343*(f_{1}+(f_{2}\left | \rho v_{x} \right |))}\left [ \frac{\delta}{\delta {y}}(f_{1}+f_{2}\left | \rho v_{x} \right |) \right ]
Issue with logarithm function in OpenFOAM

So, Equs. (3a and b) will be changed as,
Quote:
(gradCurlUyx - gradCurlUxy) = (1/0.4343*(f1+(f2*rho*Ux)))*((Ux*gradUxy)-(Uy*gradUxx)); // (Eq.3a)
(gradCurlUyx - gradCurlUxy) = (1/0.4343*(f1+(f2*rho*Uy)))*((Ux*gradUyy)-(Uy*gradUyx)); // (Eq.3b)
COMPILED WELL
As per your comment,
Quote:
You are not solving any equation for the velocity field, and neither are you updating the velocity explicitly. So your velocity field is not changing.
With your comment in mind, when I try to change the Equs. (3a and b) by evaluating to 0 (as shown below),
Quote:
(gradCurlUyx - gradCurlUxy) -((1/0.4343*(f1+(f2*rho*Ux)))*((Ux*gradUxy)-(Uy*gradUxx))) =0; //(Eq.3a)
(gradCurlUyx - gradCurlUxy) -((1/0.4343*(f1+(f2*rho*Uy)))*((Ux*gradUyy)-(Uy*gradUyx))) =0; //(Eq.3b)
COMPILATION FAILED //
The above equations (when equating to zero) it leads to error as,
Quote:
Making dependency list for source file ergunFoam.C
SOURCE=ergunFoam.C ; g++-4.7 -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-100 -I/home/kumaresh/OpenFOAM/OpenFOAM-2.1.1/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/kumaresh/OpenFOAM/OpenFOAM-2.1.1/src/OpenFOAM/lnInclude -I/home/kumaresh/OpenFOAM/OpenFOAM-2.1.1/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64Gcc47DPOpt/ergunFoam.o
ergunFoam.C: In function ‘int main(int, char**)’:
ergunFoam.C:59:92: error: no match for ‘operator=’ in ‘Foam:perator-(const Foam::tmp&, const Foam::tmp&) [with Type1 = double; Type2 = double; PatchField = Foam::fvPatchField; GeoMesh = Foam::volMesh; typename Foam::typeOfSum::type = double]((*(const Foam::tmp*)(& Foam:perator*(const Foam::tmp&, const Foam::tmp&) [with PatchField = Foam::fvPatchField; GeoMesh = Foam::volMesh]((*(const Foam::tmp*)(& Foam:perator-(const Foam::tmp&, const Foam::tmp&) [with Type1 = double; Type2 = double; PatchField = Foam::fvPatchField; GeoMesh = Foam::volMesh; typename Foam::typeOfSum::type = double]((*(const Foam::tmp*)(& Foam:perator*(const Foam::GeometricField&, const Foam::GeometricField&) [with PatchField = Foam::fvPatchField; GeoMesh = Foam::volMesh]((*(const Foam::GeometricField*)(& gradUxx)))))))))))) = 0’
ergunFoam.C:59:92: note: candidate is:
In file included from /home/kumaresh/OpenFOAM/OpenFOAM-2.1.1/src/OpenFOAM/lnInclude/tmp.H:140:0,
from /home/kumaresh/OpenFOAM/OpenFOAM-2.1.1/src/OpenFOAM/lnInclude/PtrListI.H:29,
from /home/kumaresh/OpenFOAM/OpenFOAM-2.1.1/src/OpenFOAM/lnInclude/PtrList.H:321,
from /home/kumaresh/OpenFOAM/OpenFOAM-2.1.1/src/OpenFOAM/lnInclude/List.C:30,
from /home/kumaresh/OpenFOAM/OpenFOAM-2.1.1/src/OpenFOAM/lnInclude/List.H:259,
from /home/kumaresh/OpenFOAM/OpenFOAM-2.1.1/src/OpenFOAM/lnInclude/labelList.H:48,
from /home/kumaresh/OpenFOAM/OpenFOAM-2.1.1/src/OpenFOAM/lnInclude/UPstream.H:43,
from /home/kumaresh/OpenFOAM/OpenFOAM-2.1.1/src/OpenFOAM/lnInclude/Pstream.H:42,
from /home/kumaresh/OpenFOAM/OpenFOAM-2.1.1/src/OpenFOAM/lnInclude/parRun.H:35,
from /home/kumaresh/OpenFOAM/OpenFOAM-2.1.1/src/finiteVolume/lnInclude/fvCFD.H:4,
from ergunFoam.C:32:
/home/kumaresh/OpenFOAM/OpenFOAM-2.1.1/src/OpenFOAM/lnInclude/tmpI.H:237:13: note: void Foam::tmp:perator=(const Foam::tmp&) [with T = Foam::GeometricField]
When equations equating to 0, it leads to compilation error, if not compiled well.
Could you please brief your above comments and share your thoughts please.
Thank you

Last edited by Kummi; January 15, 2020 at 07:31.
Kummi is offline   Reply With Quote

Old   January 15, 2020, 10:39
Default
  #4
Senior Member
 
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 15
adhiraj is on a distinguished road
Quote:
Originally Posted by Kummi View Post
I missed to add logarithm term in above velocity equations Equs. (3a and b).
It is very important to double and triple check your formulation, and initial implementation.

Quote:
Originally Posted by Kummi View Post
The above equations (when equating to zero) it leads to error
You are trying to use an assignment statement, that too incorrectly. You need to create and solve a transport equation using OpenFOAM syntax. Look at your equation for {p}^{2} to get a feel for the syntax.
adhiraj is offline   Reply With Quote

Old   January 15, 2020, 13:38
Default
  #5
Senior Member
 
Kumaresh
Join Date: Oct 2016
Posts: 348
Rep Power: 11
Kummi is on a distinguished road
Send a message via Yahoo to Kummi
Quote:
Originally Posted by adhiraj View Post
It is very important to double and triple check your formulation, and initial implementation.

You are trying to use an assignment statement, that too incorrectly. You need to create and solve a transport equation using OpenFOAM syntax. Look at your equation for {p}^{2} to get a feel for the syntax.
Thank you for your valuable comments. Hereafter, I will cross-check my formulation thoroughly.
In previous case using Darcy's law, I implemented the following equations to resolve velocity and pressure as follows,

Quote:
while (simple.correctNonOrthogonal())
{
solve
(
fvm::laplacian(k*rho/mu, p) == RRg // pressure field is solved (1)
);
}
U = -k/mu*fvc::grad(p); // velocity field ll be solved (2)
Here the equality operator (==) is overloaded with fvMatrix class. Later assignment operator (=) is defined outside the loop - used unless we need to override the fixedValue. On the basis of this approach, I tried implementing the current set of equations.

Quote:
solve
( fvm::laplacian(p2) == - (2*T*R)*(((f1+(f2*rho*Ux))*RRg) + (rho*(Ux+Uy)*gradUxx))
);
Here the pressure field is solved absolutely with no errors..
In order to calculate velocity, I defined the equations with assignment operator (=) outside the loop (as mentioned in previous thread), but it fails in compilation.

https://openfoamwiki.net/index.php/ScalarTransportFoam
Based on this link, when I try to define velocity equ as explicitly discretized terms, it fails in compilation too.
Quote:
solve
(
U == <your term here>
);
Kindly guide me and share if possible, any kind of references to check and resolve this velocity equation.

Thank you
Attached Files
File Type: gz ErgunFoam_6.tar.gz (6.1 KB, 4 views)
raj kumar saini likes this.

Last edited by Kummi; January 20, 2020 at 21:19.
Kummi is offline   Reply With Quote

Reply


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
UDF compilation problem on Linux System Nitin Pathak Fluent UDF and Scheme Programming 6 September 29, 2018 20:26
[OpenFOAM.org] OpenFOAM 2.4 ParaView 4.1 compilation problem tubois OpenFOAM Installation 2 October 23, 2015 06:56
code compilation problem with wmake bmikuz OpenFOAM Programming & Development 2 October 17, 2012 09:30
OpenFoam-1.5 on Solaris -- compilation problem calling octreeDataPoint(.) constructor cincaipatron OpenFOAM Installation 9 January 11, 2010 06:37
Compilation problem after modifying a solver. PetSul OpenFOAM Running, Solving & CFD 2 October 1, 2009 17:28


All times are GMT -4. The time now is 22:43.