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

Conservatively Smoothing a Source Term

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 2, 2022, 16:18
Default Conservatively Smoothing a Source Term
  #1
Member
 
Kellis
Join Date: Mar 2017
Posts: 38
Rep Power: 9
Kellis is on a distinguished road
Hello all,

I am attempting to solve a conjugate heat transfer problem where viscous heating plays an important role in the overall process. I am solving the energy equation as follows:

\rho c_p \frac{\partial T}{\partial t} + \rho c_p \textbf{U} \cdot \nabla T = \nabla \cdot (k \nabla T) + \mu \Phi

Due to the nature of the problem, the viscous heating term varies many orders of magnitude over the width of a few cells, and causes some instabilities / oscillations when solving for the temperature. To combat this, I am hoping to implement some sort of smoothing algorithm which conserves the overall amount of viscous heating, but distributes it within a wider area to make the computation more stable. For instance in 1D, assuming a uniform grid spacing, this smoothing algorithm might turn a field that looks like this:

[ 1 1 1 10 1 1 1 ]

Into one which looks like this:

[ 1 2 3 4 3 2 1 ]

Ideally, the "width" of the spread would be controllable by the user. I am sure such an algorithm exists already, but I am not sure what the correct search terms would be, and my initial efforts to find such a method have not yielded any good leads.

If anyone has a suggestion for a method I might try, I would be grateful. Additionally, any other strategies I might try to increase the stability of the problem would be appreciated.

Thanks,
Kellis
Kellis is offline   Reply With Quote

Old   March 3, 2022, 04:44
Default
  #2
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15
mAlletto will become famous soon enough
Hello,

You can try to first interpolate to the faces and then avarage over the faces of the cell. The code would look like this:

Code:
volScalarField smoothedSoure (fvc::average(fvc::interpolate(source)));
This will smooth the source a bit
mAlletto is offline   Reply With Quote

Old   March 3, 2022, 05:14
Default
  #3
Senior Member
 
mkraposhin's Avatar
 
Matvey Kraposhin
Join Date: Mar 2009
Location: Moscow, Russian Federation
Posts: 355
Rep Power: 21
mkraposhin is on a distinguished road
You can solve diffusion equation in pseudo-time, like that:




dimensionedScalar pseudoDeltaT ("dT", dimTime, 1.0);
dimensionedScalar Dphi ("Dphi", dimLength*dimLength/dimTime, 1.0);



solve
(
fvm::Sp(1.0/pseudoDeltaT, Phi)
- fvc::Sp(1.0/pseudoDeltaT, Phi)
- fvm::laplacian(Dphi, Phi)



);
mkraposhin is offline   Reply With Quote

Old   March 3, 2022, 05:59
Default
  #4
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15
mAlletto will become famous soon enough
What's the purpose of

fvm::Sp(1.0/pseudoDeltaT, Phi)
- fvc::Sp(1.0/pseudoDeltaT, Phi)

Numerical stability of the equations?
mAlletto is offline   Reply With Quote

Old   March 3, 2022, 06:15
Default
  #5
Senior Member
 
mkraposhin's Avatar
 
Matvey Kraposhin
Join Date: Mar 2009
Location: Moscow, Russian Federation
Posts: 355
Rep Power: 21
mkraposhin is on a distinguished road
Quote:
Originally Posted by mAlletto View Post
What's the purpose of

fvm::Sp(1.0/pseudoDeltaT, Phi)
- fvc::Sp(1.0/pseudoDeltaT, Phi)

Numerical stability of the equations?

If you use diffusion equation w/o temporal term, then your Phi distribution will be smoothed across a whole domain. But with adjustment of ratio between "pseudoDeltaT" and Dphi you can tune how many cells around initial field will be affected during one pseudo iteration.
mkraposhin is offline   Reply With Quote

Old   March 3, 2022, 06:25
Default
  #6
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15
mAlletto will become famous soon enough
That's interesting. Can you recommend someone regarding about the method?
mAlletto is offline   Reply With Quote

Old   March 3, 2022, 06:28
Default
  #7
Senior Member
 
mkraposhin's Avatar
 
Matvey Kraposhin
Join Date: Mar 2009
Location: Moscow, Russian Federation
Posts: 355
Rep Power: 21
mkraposhin is on a distinguished road
This is a simple idea, which arises from the concept of numerical diffusion of convection equation.


http://www.mathematik.tu-dortmund.de.../Transport.pdf


Or just walk around this personal page: http://www.mathematik.tu-dortmund.de/~kuzmin/

Last edited by mkraposhin; March 3, 2022 at 06:38. Reason: grammar correction
mkraposhin is offline   Reply With Quote

Old   March 5, 2022, 14:12
Default
  #8
Senior Member
 
Josh Williams
Join Date: Feb 2021
Location: Scotland
Posts: 112
Rep Power: 5
joshwilliams is on a distinguished road
Quote:
Originally Posted by mAlletto View Post
That's interesting. Can you recommend someone regarding about the method?

I used code from the CFDEMcoupling library to do something similar. You can copy the function from this GitHub repository. There are some user-defined lengths and lower/upper limits you can use to tune the diffusion.
joshwilliams 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
[openSmoke] LaminarSMOKE compilation error mdhfiz OpenFOAM Community Contributions 7 October 4, 2022 13:57
[Other] Tabulated thermophysicalProperties library chriss85 OpenFOAM Community Contributions 62 October 2, 2022 03:50
polynomial BC srv537 OpenFOAM Pre-Processing 4 December 3, 2016 09:07
"parabolicVelocity" in OpenFoam 2.1.0 ? sawyer86 OpenFOAM Running, Solving & CFD 21 February 7, 2012 11:44
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 01:24


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