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

Adding complex source term in momentum equation

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 24, 2019, 21:48
Default Adding complex source term in momentum equation
  #1
Member
 
Bidesh Sengupta
Join Date: Sep 2018
Location: Sngapore
Posts: 76
Rep Power: 7
BSengupta is on a distinguished road
Hi Foamers,


I wish to add some complex source term in the momentum equation, which is giving me a bit of trouble. If any one can help me, it shall be great.

I have attached the images of the equations that are used.
I have written the following code.


volScalarField ux = U.component(vector::X);
volScalarField uy = U.component(vector::Y);
volScalarField uz = U.component(vector::Z);
volScalarField u_airx = U_Air.component(vector::X);
volScalarField u_airy = U_Air.component(vector::Y);
volScalarField u_airz = U_Air.component(vector::Z);
volScalarField Re_u = (rho_Air*MVD/mu_Air)*mag(u_airx-ux);
volScalarField Re_v = (rho_Air*MVD/mu_Air)*mag(u_airy-uy);
volScalarField Re_w = (rho_Air*MVD/mu_Air)*mag(u_airz-uz);
volScalarField CD_u = (24/Re_u)*(1+0.0197*pow(Re_u,0.63)+2.6e-4*pow(Re_u,1.38));
volScalarField CD_v = (24/Re_v)*(1+0.0197*pow(Re_v,0.63)+2.6e-4*pow(Re_v,1.38));
volScalarField CD_w = (24/Re_w)*(1+0.0197*pow(Re_w,0.63)+2.6e-4*pow(Re_w,1.38));
volScalarField A_u = 0.75*rho_Air*CD_u*Re_u*mu_Air/(rho*pow(MVD,2));
volScalarField A_v = 0.75*rho_Air*CD_v*Re_v*mu_Air/(rho*pow(MVD,2));
volScalarField A_w = 0.75*rho_Air*CD_w*Re_w*mu_Air/(rho*pow(MVD,2));
volScalarField SD_x = A_u*(u_airx-ux);
volScalarField SD_y = A_v*(u_airy-uy);
volScalarField SD_z = A_w*(u_airz-uz);
volVectorField SD = SD_x*vector(1,0,0)+SD_y*vector(0,1,0)+SD_z*vector( 0,0,1);
volScalarField frac = (1-rho_Air/rho)*g_z;
volVectorField SG = -frac*rho*vector(0,0,1);
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
solve
(
1.0/beta[i]*fvm::ddt(rhoU)
+ fvc::div(dbnsFlux.rhoUFlux())
+ fvc::Sp(1, SD)
+ fvc::Sp(1, SG)
);


The compilation was successful but when I am trying to run the simulation it shows segmentation fault, core dumped. To test I ran the simulation putting off the 'SD' term, the simulation went well. I think I am making mistake in evaluating 'SD' term.



Kindly help me to overcome it. Thank you very much for your time.
Attached Images
File Type: png GoverningEquation.png (45.2 KB, 24 views)
File Type: png SourceTerms.png (43.8 KB, 19 views)
File Type: png OtherDefinitions.png (72.8 KB, 14 views)
BSengupta is offline   Reply With Quote

Old   September 5, 2019, 04:34
Default
  #2
Cyp
Senior Member
 
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 18
Cyp is on a distinguished road
Division by zero because MVD goes to zero?
Cyp is offline   Reply With Quote

Old   September 8, 2019, 01:57
Default
  #3
Member
 
Bidesh Sengupta
Join Date: Sep 2018
Location: Sngapore
Posts: 76
Rep Power: 7
BSengupta is on a distinguished road
Yes, Thank you.


You are right. I corrected it and it runs.
BSengupta 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
Adding of source term in momentum equation required any changes in PISO algorith shadabdyn OpenFOAM Programming & Development 2 January 15, 2017 01:16
[swak4Foam] swak4foam building problem GGerber OpenFOAM Community Contributions 54 April 24, 2015 16:02
OpenFOAM without MPI kokizzu OpenFOAM Installation 4 May 26, 2014 09:17
[swak4Foam] Error bulding swak4Foam sfigato OpenFOAM Community Contributions 18 August 22, 2013 12:41
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51


All times are GMT -4. The time now is 11:23.