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

Function using exp() not being calculated properly

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 27, 2022, 12:51
Default Function using exp() not being calculated properly
  #1
Member
 
Venkat Ganesh
Join Date: May 2020
Location: Cincinnati, Ohio
Posts: 49
Rep Power: 5
Venky_94 is on a distinguished road
I'm trying to change the linear property estimation in interFoam solver to an exponential averaging by modifying the existing equation
Code:
 𝜇 = 𝛾𝜇𝑙 + (1 − 𝛾)𝜇𝑔
to the equation in the attached image, where C is a constant of 25.

I've modified the lines of code impacting the property estimation in three separate files (incompressibleTwoPhaseMixture.C, createFields.H, and alphaEqnSubCycle.H). I've attached the files here. The syntax I've used in alphaEqnSubCycle.H is shown below.

Code:
Original Code which has been commented out:
//rho == alpha1*rho1 + alpha2*rho2;
Custom code:
rho == rho2 + (rho1 - rho2)*(Foam::exp(scalar(25)*limitedAlpha1)-scalar(1))/Foam::exp(scalar(25));
Now the issue I'm facing is while post processing is that I'm finding the variation of the property along the interface is not linear and somewhat exponential, but the values at the points are not as expected if I directly apply my equation using the computed alpha values. Can someone please shed some light on this?

Note: I used plot over line function on paraview and saved the data in csv format and removed the multiple entries for 0 & 1 volume fraction, to get below table.

HTML Code:
Output from Openfoam		Expected rho Values Based on Function
		
alpha.water	rho	
0.24673	15.789	1.225006846
0.48029	37.635	1.227355937
0.69946	249.01	1.789643492
0.91413	519.61	122.15227
0.9696	772.34	485.154527
0.99854	1022.1	998.9116916
0.99996	1035	1034.965742
1	1036	1036
Attached Images
File Type: jpg Equation.JPG (10.8 KB, 4 views)
File Type: png Property variation.png (8.4 KB, 3 views)
Attached Files
File Type: c incompressibleTwoPhaseMixture.C (6.8 KB, 0 views)
File Type: h alphaEqnSubCycle.H (1.1 KB, 1 views)
File Type: h createFields.H (2.7 KB, 0 views)
Venky_94 is offline   Reply With Quote

Reply

Tags
interfoam, programing, property estimation, vof

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
[Other] mesh airfoil NACA0012 anand_30 OpenFOAM Meshing & Mesh Conversion 13 March 7, 2022 17:22
[snappyHexMesh] How to define to right point for locationInMesh Mirage12 OpenFOAM Meshing & Mesh Conversion 7 March 13, 2016 14:07
using METIS functions in fortran dokeun Main CFD Forum 7 January 29, 2013 04:06
channelFoam for a 3D pipe AlmostSurelyRob OpenFOAM 3 June 24, 2011 13:06
latest OpenFOAM-1.6.x from git failed to compile phsieh2005 OpenFOAM Bugs 25 February 9, 2010 04:37


All times are GMT -4. The time now is 04:15.