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

Momentum source containing div(tensor) using fvOptions

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 2, 2022, 08:46
Post Momentum source containing div(tensor) using fvOptions
  #1
New Member
 
Sreehari Perumanath
Join Date: Jun 2022
Posts: 28
Rep Power: 4
sreehahaha is on a distinguished road
Hi Foamers,

I'm fairly new to OpenFOAM and I'm using v6. In my momentum equations, I have a source term that contains a divergence of a random symmetric stress tensor. Is it possible to define this term using fvOptions? If yes, please let me know how.

Many thanks in advance!
sreehahaha
sreehahaha is offline   Reply With Quote

Old   August 2, 2022, 10:50
Default
  #2
Senior Member
 
Agustín Villa
Join Date: Apr 2013
Location: Alcorcón
Posts: 314
Rep Power: 15
agustinvo is on a distinguished road
How is that tensor defined? If it is already defined in your solver you could add the term directly there.
Otherwise you could try with a codeStream fvOption
agustinvo is offline   Reply With Quote

Old   August 2, 2022, 11:25
Default
  #3
New Member
 
Sreehari Perumanath
Join Date: Jun 2022
Posts: 28
Rep Power: 4
sreehahaha is on a distinguished road
Thanks for the reply agustinvo.

I already tried adding this term directly into the UEqn definition within a new solver (myIcoFoam). However, it looks like it has some issues. That is why I thought to use fvOptions instead. But, I'm confused how to define div(tensor) in fvOptions. If possible, could you please elaborate your suggestion on using codeStream? Many thanks!
sreehahaha is offline   Reply With Quote

Old   August 3, 2022, 19:21
Default
  #4
Senior Member
 
Agustín Villa
Join Date: Apr 2013
Location: Alcorcón
Posts: 314
Rep Power: 15
agustinvo is on a distinguished road
What are these issues? Can you show your equations?

I am not an expert in codeStream, however I think it could be easy to add it in your solver if the tensor is already created there.
agustinvo is offline   Reply With Quote

Old   August 4, 2022, 07:37
Default
  #5
New Member
 
Sreehari Perumanath
Join Date: Jun 2022
Posts: 28
Rep Power: 4
sreehahaha is on a distinguished road
Hi agustinvo,

Sorry for the slight delay in replying. So my UEqn goes like:

Code:
        fvVectorMatrix UEqn
        (
            fvm::ddt(U)
          + fvm::div(phi, U)
          - fvm::laplacian(nu, U)
  	== 
  	    fvc::div(stochTau)/rho
        );
The stochastic stress tensor is defined already in a separate header file as:

Code:
       forAll(stochTau,i)
{
	Tcell=T.internalField()[i]; // local temperature
	rhocell=rho.internalField()[i]; local density
	visc=nu.value()*rhocell; // viscosity=kinematic_viscosity*density
	dv=mesh.V()[i]; //cell volume
	dt=runTime.deltaTValue();

	dummy=vector(rnumxx.scalarNormal(),rnumyy.scalarNormal(),rnumzz.scalarNormal()); //random vector; uncorrleated elements
	diag=dummy&chol; //correlated elements with sum=0. [chol is predefined and this step is correct]
	stochTau[i]=Foam::sqrt(2*visc*kb*Tcell/dv/dt)*symmTensor(diag.x(),rnumxy.scalarNormal(),rnumxz.scalarNormal(),diag.y(),rnumyz.scalarNormal(),diag.z());

}
Looking at its definition, everything seems fine. The issue that I face is that when I look at the variance of the resulting velocity normalised with 3*kb*T/rho/dV, I get 0.25 instead of 1. The normalising factor comes from equipartition theorem. What I noted is that if I multiply the RHS with 2, I get the expected result of 1. I don't understand where I'm missing this factor. Any help is much appreciated.

Last edited by sreehahaha; August 4, 2022 at 09:04.
sreehahaha is offline   Reply With Quote

Old   August 4, 2022, 10:20
Default
  #6
Senior Member
 
Agustín Villa
Join Date: Apr 2013
Location: Alcorcón
Posts: 314
Rep Power: 15
agustinvo is on a distinguished road
I would need to see the reference model to check what can be missing. Do you have a test case? Which OpenFOAM version are you using?
agustinvo is offline   Reply With Quote

Reply

Tags
divergence, fvoptions momentum source, stress tensor


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] Tabulated thermophysicalProperties library chriss85 OpenFOAM Community Contributions 62 October 2, 2022 04:50
[snappyHexMesh] Invalid Normals for source face to target face while making AMI? Sorabh OpenFOAM Meshing & Mesh Conversion 1 August 3, 2021 07:35
[swak4Foam] funkyDoCalc with OF2.3 massflow NiFl OpenFOAM Community Contributions 14 November 25, 2020 04:30
polynomial BC srv537 OpenFOAM Pre-Processing 4 December 3, 2016 10:07
[swak4Foam] build problem swak4Foam OF 2.2.0 mcathela OpenFOAM Community Contributions 14 April 23, 2013 14:59


All times are GMT -4. The time now is 14:31.