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

Constructing Surface Interpolation Scheme from Divergence Scheme Information

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By ngj

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 5, 2013, 04:20
Default Constructing Surface Interpolation Scheme from Divergence Scheme Information
  #1
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,903
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Good morning,

I have a small problem, which I have not been able to solve so far.

Background:
I am going to perform different operations on a small grid (say 1400 cells):

1. Evaluating the divergence of some field, i.e fvc::div(phi,T)
2. Building the fvScalarMatrix for the same, i.e. fvm::div(phi,T)

The thing is that I am going to perform these two operations approximately 90,000 times per time step/iteration, so there is room for thinking in optimising and utilising prior knowledge of the system.
The prior knowledge is that half of the faces (fixed in time and identical for all grids) have a zero flux, why the construction of fvm::div and fvc::div can probably be reduced by a factor of 2.
This reduction approximately corresponds to 15% of the execution time, so it is worthwhile to spend some time on it.

Problem:
I would still like to utilise the numerical scheme selection in fvSchemes, i.e. the user should merely give e.g.
Code:
div(phi,T) Gauss upwind phi;
From this I need to extract the information on the surface interpolation scheme and construct it, such that I can obtain the weights.
So far I have managed to get the divergence scheme information from the fvSchemes by using
Code:
ITstream& ss = mesh.divScheme("div(phi,T)");
This is were I am stranded, because I have not been able to transform this information into anything useful for the surfaceInterpolationScheme, which must be constructed as
Code:
tmp<surfaceInterpolationScheme<scalar> > surfaceInterpolationScheme::New(const fvMesh& mesh, Istream& schemeData);
The problem is specifically to transform the
Code:
ITstream ss
into the correctly formatted
Code:
Istream schemeData
Any help is greatly appreaciated.

Kind regards,

Niels
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   December 9, 2013, 12:19
Default
  #2
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,903
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Good evening all,

I have found the solution, and it is rather simple:

Code:
Istream& is = mesh.divSchemes("div(phi,T)");
word ss(is);
tmp<surfaceInterpolationScheme<scalar> > sis(Foam::surfaceInterpolationScheme<scalar>::New(mesh, is));
The important part is to construct the word 'ss', because this makes Istream go one word forward in the stream, i.e. once I am constructing the surface interpolation scheme, it is not aware of the existence of the 'Gauss' part in front.

Kind regards

Niels
Jun_93 likes this.
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   June 17, 2022, 10:12
Default
  #3
New Member
 
Jun Liu
Join Date: Jan 2020
Posts: 3
Rep Power: 6
Jun_93 is on a distinguished road
Hi Niels,


I have the same problem to construct limitedSurfaceInterpolationScheme class and have already been stuck to it for two three days. The Gauss token in the itstream drives me nuts. Your solution works finally! Many thanks!!!!

best regards
Jun
Jun_93 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
[snappyHexMesh] Layers don't fully surround surface EVBUCF OpenFOAM Meshing & Mesh Conversion 14 August 20, 2012 05:31
[snappyHexMesh] Add additional boundary layers to complex stl surface tobijingles OpenFOAM Meshing & Mesh Conversion 1 October 26, 2011 11:45
reconstructParMesh not working with an axisymetric case francesco OpenFOAM Bugs 4 May 8, 2009 06:49
information from a surface, not made from GAMBIT rr123 FLUENT 7 March 25, 2009 17:20
output surface grid information Adam FLUENT 0 May 17, 2004 22:17


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