CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Programming & Development

Calculation of gradient only for subset of cells to improve performance

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

LinkBack Thread Tools Display Modes
Old   July 11, 2016, 09:35
Default Calculation of gradient only for subset of cells to improve performance
New Member
Join Date: Feb 2016
Posts: 22
Rep Power: 3
elmo555 is on a distinguished road
Hello Foamers,

is there a way to calculate the gradient (or any other OF tensor operation) for only a subset of cells that fulfill a given condition? In my case, I need a concentration gradient Xv only near the phase interphase, that is where eps < alpha1 < 1-eps.

Since most of the cells in the domain are not close to the interface, calculating the gradient in them is a waste of computational time.

I can easily limit normal calculations to the required cells using:
forAll(alpha1, celli) {
    if(alpha1[celli] > eps && alpha1[celli] < 1-eps) {
        // ... calculation ...
Is there a similar way for the gradient (without manually computing it - I would like to stick with the OF-implementation fvc::grad)?
elmo555 is offline   Reply With Quote


conditional, conditional computation, gradient, limit

Thread Tools
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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Periodic flow using Cyclic - comparison with Fluent nusivares OpenFOAM Running, Solving & CFD 29 November 3, 2015 06:33
No layers in a small gap bobburnquist OpenFOAM Native Meshers: snappyHexMesh and Others 6 August 26, 2015 09:38
[ICEM] error analysis despaired student ANSYS Meshing & Geometry 7 June 27, 2012 11:57
snappyHexMesh aborting Tobi OpenFOAM Native Meshers: snappyHexMesh and Others 0 November 10, 2010 04:23
Gradient calculation in CFD apurva shukla Main CFD Forum 1 August 21, 1998 07:05

All times are GMT -4. The time now is 06:36.