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

volPointInterpolation on boundaryField only?

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

Reply
 
LinkBack Thread Tools Display Modes
Old   October 11, 2011, 06:01
Default volPointInterpolation on boundaryField only?
  #1
Senior Member
 
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 8
Arnoldinho is on a distinguished road
Hi all,

I want to make an interpolation from (boundary) cell faces to cell points.

I know that an interpolation for the (whole) internalField of a mesh can be done using volPointInterpolation :

Quote:
volPointInterpolation interpolateHbVolPoints (mesh);
hbVolPoints = interpolateHbVolPoints.interpolate(hbVol);
whereas hbVolPoints is a pointScalarField and hbVol is a volScalarField previously declared.
hbVol does only have values on the boundaryField patches, which where previously mapped using vsm.mapToVolume (FAM->FVM).

When I do the above interpolation, hbVol boundaryField values are interpolated to the hbVolPoints internalField. Thats not exactly what I need... I need an interpolation from the boundary cell faces to the boundary cell points, both stored in the boundaryField! Is this possible?

I guess I could make a mapping back from the internalField to the boundaryField, but I guess this could be done directly and without loosing accuracy. Furthermore, I do not need the interpolation for the whole mesh (which is done using above function), but only for the boundaryFields.

Any suggestions?

Arne

Last edited by Arnoldinho; October 11, 2011 at 07:13. Reason: Changed content structure
Arnoldinho is offline   Reply With Quote

Old   October 11, 2011, 13:18
Default
  #2
Senior Member
 
Join Date: Nov 2009
Location: Michigan
Posts: 135
Rep Power: 7
doubtsincfd is on a distinguished road
Have a look at sampleDict. you can sample data on patches and there are few interpolation schemes available.www.openfoam.com/docs/user/sample.php
doubtsincfd is offline   Reply With Quote

Old   October 11, 2011, 15:00
Default
  #3
Senior Member
 
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 8
Arnoldinho is on a distinguished road
Thanks doubstincfd. I guess I forgot to say that I need the interpolation during runtime, within th solver directly.
sampleDict seems to be working in postprocessing only. But I will have a look at the source code of it.

Arne
Arnoldinho is offline   Reply With Quote

Old   October 11, 2011, 16:15
Default
  #4
Senior Member
 
Join Date: Nov 2009
Location: Michigan
Posts: 135
Rep Power: 7
doubtsincfd is on a distinguished road
you are welcome. Let me know if it works. Else I will dig in more
doubtsincfd is offline   Reply With Quote

Old   October 11, 2011, 16:16
Default
  #5
Senior Member
 
Join Date: Nov 2009
Location: Michigan
Posts: 135
Rep Power: 7
doubtsincfd is on a distinguished road
Meanwhile:


psip_(volPointInterpolation::New(psi.mesh()).inter polate(psi))

in

http://foam.sourceforge.net/docs/cpp/a04429_source.html
doubtsincfd is offline   Reply With Quote

Old   October 12, 2011, 04:47
Default
  #6
Senior Member
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin,Ireland
Posts: 568
Rep Power: 19
bigphil will become famous soon enoughbigphil will become famous soon enough
Hi Arne,


You could use primitivePatchInterpolation to interpolate from boundary faces to boundary points (and vice versa).

i.e.
Code:
//- set-up interpolator
primitivePatchInterpolation patchInterpolator
	(
         mesh.boundaryMesh()[patchOfInterestIndex]
         );

//- perform interpolation
vectorField faceValues =
            patchInterpolator.pointToFaceInterpolate<vector>
            (
             pointValues
             );

Philip
bigphil is offline   Reply With Quote

Old   October 12, 2011, 10:23
Default
  #7
Senior Member
 
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 8
Arnoldinho is on a distinguished road
Bigphil, thanks for the hint. This is exactly what I was looking for and seems to be doing what it should.

1. Now I have another problem, mainly in the syntax of OF: I want to store the interpolated boundary points values in a previously declared pointScalarField hbVolPoints.

Quote:
scalarField hbVolPatch = hbVol.boundaryField()[patchi];
scalarField hbVolPointsPatch = patchInterpolateHbVolPoints.faceToPointInterpolate (hbVolPatch);
gives the scalarField of interpolated point values, originally coming from the hbVol boundaryField patch. Storing/Overwriting this scalarField in the pointScalarField hbVolPoints using

Quote:
hbVolPoints.boundaryField()[patchi] = hbVolPointsPatch;
does not compile. I guess I have to cast this somehow, but am not sure how to...

2. Another one: I'm also missing the correct syntax for storing the values of a pointScalarField hbVolPoints into components of a pointVectorField hbVolPoints2.

Quote:
hbVolPoints2.component(2) = hbVolPoints.component(0);
does not have any effect on hbVolPoints2.


Any clue?
Arnoldinho is offline   Reply With Quote

Old   October 12, 2011, 10:35
Default
  #8
Senior Member
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin,Ireland
Posts: 568
Rep Power: 19
bigphil will become famous soon enoughbigphil will become famous soon enough
Arne,


Good to hear that it is starting to work.

Hmnnn you could always use a forAll loop to set each value:
Code:
forAll(hbVolPoints.boundaryField()[patchi], pointi)
{
hbVolPoints.boundaryField()[patchi][pointi] = hbVolPointsPatch[pointi];
}
And do the same for the components.

I am not sure why your current method does not work, maybe the "=" operator is not defined for this.


Philip
bigphil is offline   Reply With Quote

Old   October 12, 2011, 11:29
Default
  #9
Senior Member
 
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 8
Arnoldinho is on a distinguished road
Quote:
forAll(hbVolPoints.boundaryField()[patchi], pointi) { hbVolPoints.boundaryField()[patchi][pointi] = hbVolPointsPatch[pointi]; }
Hmm, thats what I already tried. It gives an error during compilation:

Quote:
sedTrans.C:329: error: no match for ‘operator[]’ in ‘((Foam::GeometricField<double, Foam:ointPatchField, Foam:ointMesh>::GeometricBoundaryField*)hbVolPoi nts.Foam::GeometricField<Type, PatchField, GeoMesh>::boundaryField [with Type = double, PatchField = Foam:ointPatchField, GeoMesh = Foam:ointMesh]())->Foam::GeometricField<double, Foam:ointPatchField, Foam:ointMesh>::GeometricBoundaryField::<anonymo us>.Foam::FieldField<Foam:ointPatchField, double>::<anonymous>.Foam::PtrList<T>:perator[] [with T = Foam:ointPatchField<double>](patchi)[pointi]’
Could it have to do with the initialization of hbVolPoints?

Quote:
pointMesh pMesh(mesh);

pointScalarField hbVolPoints
(
IOobject
(
"hbVolPoints",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
pMesh,
dimensionedScalar("hbVolPoints", dimensionSet(0, 1, 0, 0, 0, 0, 0), 0.0),
"zeroGradient"
);
Any hints are welcome!
Arnoldinho is offline   Reply With Quote

Old   October 12, 2011, 11:46
Default
  #10
Senior Member
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin,Ireland
Posts: 568
Rep Power: 19
bigphil will become famous soon enoughbigphil will become famous soon enough
Hmnnn I am not sure, maybe someone else has an idea.
I am not very familiar with pointScalarFields.

What happens when you:
Info << hbVolPoints.boundaryField()[patchi] << endl;
Does it just print out a scalarfield?

Philip
bigphil is offline   Reply With Quote

Old   October 12, 2011, 12:00
Default
  #11
Senior Member
 
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 8
Arnoldinho is on a distinguished road
Quote:
Info << "hbVolPoints.boundaryField()[patchi]: " << hbVolPoints.boundaryField()[patchi] << endl;
Info << "hbVolPointsPatch: " << hbVolPointsPatch << endl;
gives

Quote:
hbVolPoints.boundaryField()[patchi]: type zeroGradient;

hbVolPointsPatch:
525
(
-5.4949228e-07
-1.7257233e-07
1.686064e-07
1.0247966e-07
...
)
where patchi has been declared as const label patchi = mesh.boundaryMesh().findPatchID("name"); before.
hbVolPoints.boundaryField()[patchi] has not been initialized with any values before.

Arne
Arnoldinho is offline   Reply With Quote

Old   October 12, 2011, 13:00
Default
  #12
Senior Member
 
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 8
Arnoldinho is on a distinguished road
Hi,

Quote:
hbVolPoints.internalField() = hbVolPointsPatch;
compiles and writes it as internalField values into hbVolPoints, which is wrong in the sense of the mesh nodes/numbers. hbVolPointsPatch values are boundary patch node values!

Quote:
hbVolPoints.boundaryField()[patchi] = hbVolPointsPatch;
which should be right in the sense of the mesh nodes/numbers gives the compilation error

Quote:
sedTrans.C:330: error: no match for ‘operator=’ in ‘((Foam::GeometricField<double, Foam:ointPatchField, Foam:ointMesh>::GeometricBoundaryField*)hbVolPoi nts.Foam::GeometricField<Type, PatchField, GeoMesh>::boundaryField [with Type = double, PatchField = Foam:ointPatchField, GeoMesh = Foam:ointMesh]())->Foam::GeometricField<double, Foam:ointPatchField, Foam:ointMesh>::GeometricBoundaryField::<anonymo us>.Foam::FieldField<Foam:ointPatchField, double>::<anonymous>.Foam::PtrList<T>:perator[] [with T = Foam:ointPatchField<double>](patchi) = hbVolPointsPatch’
So is there no function to write boundaryField() patch values directly?
Arnoldinho is offline   Reply With Quote

Old   March 11, 2013, 10:55
Default
  #13
Senior Member
 
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 236
Rep Power: 8
fredo490 is on a distinguished road
Hello,
I know this topic is a bit old, but did you find a solution to your problem ?
Can you provide the final version of your technique ?

Thx
fredo490 is offline   Reply With Quote

Old   October 27, 2014, 09:37
Default
  #14
Member
 
Fei Fan
Join Date: Jun 2013
Location: NanJing, China
Posts: 44
Rep Power: 4
Fanfei is on a distinguished road
Quote:
Originally Posted by Arnoldinho View Post
Hi all,

I want to make an interpolation from (boundary) cell faces to cell points.

I know that an interpolation for the (whole) internalField of a mesh can be done using volPointInterpolation :

whereas hbVolPoints is a pointScalarField and hbVol is a volScalarField previously declared.
hbVol does only have values on the boundaryField patches, which where previously mapped using vsm.mapToVolume (FAM->FVM).

When I do the above interpolation, hbVol boundaryField values are interpolated to the hbVolPoints internalField. Thats not exactly what I need... I need an interpolation from the boundary cell faces to the boundary cell points, both stored in the boundaryField! Is this possible?

I guess I could make a mapping back from the internalField to the boundaryField, but I guess this could be done directly and without loosing accuracy. Furthermore, I do not need the interpolation for the whole mesh (which is done using above function), but only for the boundaryFields.

Any suggestions?

Arne
Hi Arne:
I'm the student of Yuchuan Bai of Tianjin University, I get my master degree on Ocean Univerity of China. my master tutor is Bingchen Liang. Both of them attend the China-Germany seminar on september. They saied you do a good job on local scour. so I want to following with you. the problem you mentioned above make me confused.
You mapped the internalField of FAM to the boundayField of FVM, which was stored in the centre of volume. And you want to get the displacement of boundary point. so you need a interpolated. what confused me is that, why you interpoated from the cell face to cell point. On my understood, the variables are stored on Vol centre, so, the interpolated should be from vol to point. could you make me clear about this?
In your paper, 3D sand slide model is used. I have understood the 2D sand slide model, but for 3D ,I have some problem. could you give me some hints about how does is work? Thanks .

Best Regards

Fan Fei
Fanfei is offline   Reply With Quote

Old   October 31, 2014, 03:52
Default
  #15
Senior Member
 
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 8
Arnoldinho is on a distinguished road
Hei Fanfei,

yes you are right, we talked about OF scour modeling at CGJoint Sysposium here in Hanover.

Coming to your questions:
1. If I'm not totally wrong now - I wrote the source code almost two years ago and do not have easy access to it right now - the interpolation FAM (after solving the Exner equation) to FVM is carried out to the FVM boundary faces, not the volume! So from FAM volume (which is actually 2D) center to FVM boundary face center. In order to calculate the mesh motion, which I in my case did for the mesh points and not the volumes, the boundary face center values where then calculated to the boundary points, serving as 'boundary condition' for the inner point motion of the entire 3D domain.

2. For the sand slide routine, I did this using the bed load calculation procedure I implemented. If you give qb from the bed load calculation an 'artificial' high and meaningful calculated value with limiter function in the direction of the steepest slope of the boundary face, this can serve as a sliding procedure. In a first step, you of cource have to calculate the direction of steepest slope, which is however quite simple, as you can easily get all boundary face angles from the boundary (boundary faces/points) domain.

Greetings,
Arne
Arnoldinho is offline   Reply With Quote

Old   November 3, 2014, 06:50
Default
  #16
Member
 
Fei Fan
Join Date: Jun 2013
Location: NanJing, China
Posts: 44
Rep Power: 4
Fanfei is on a distinguished road
Quote:
Originally Posted by Arnoldinho View Post
Hei Fanfei,

yes you are right, we talked about OF scour modeling at CGJoint Sysposium here in Hanover.

Coming to your questions:
1. If I'm not totally wrong now - I wrote the source code almost two years ago and do not have easy access to it right now - the interpolation FAM (after solving the Exner equation) to FVM is carried out to the FVM boundary faces, not the volume! So from FAM volume (which is actually 2D) center to FVM boundary face center. In order to calculate the mesh motion, which I in my case did for the mesh points and not the volumes, the boundary face center values where then calculated to the boundary points, serving as 'boundary condition' for the inner point motion of the entire 3D domain.

2. For the sand slide routine, I did this using the bed load calculation procedure I implemented. If you give qb from the bed load calculation an 'artificial' high and meaningful calculated value with limiter function in the direction of the steepest slope of the boundary face, this can serve as a sliding procedure. In a first step, you of cource have to calculate the direction of steepest slope, which is however quite simple, as you can easily get all boundary face angles from the boundary (boundary faces/points) domain.

Greetings,
Arne

Hi Arne:
Thank you very much. I'm clear to those now.
Greetings,
Fan fei
Fanfei is offline   Reply With Quote

Old   November 3, 2014, 22:50
Default
  #17
Member
 
Fei Fan
Join Date: Jun 2013
Location: NanJing, China
Posts: 44
Rep Power: 4
Fanfei is on a distinguished road
Quote:
Originally Posted by Fanfei View Post
Hi Arne:
Thank you very much. I'm clear to those now.
Greetings,
Fan fei
[SIZE="5"]Hi Arne:
[SIZE="5"] I'm so sorry to trouble you again. I have some question about your sand slid model.
From what I understood. First, the bed level change was calculated with bed load model, and stored in face centre. Then, the displacement of point was interploated, and mesh was update. And then, the steepest slope angle of boundary face was calcuted. If the steepest angle of a face exceed the repose angle, the face should be adjusted. However,due to the mass conservation, the centroid of face shouldn't move , in order to statisfy the need of angle, the face should rotate around the centroid of face. And the displacement of point of this face are solve. Is that right?

Best regards
Fan Fei
Fanfei is offline   Reply With Quote

Reply

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
Difference between 'internalField' and 'boundaryField'? Rusty Velo OpenFOAM 20 May 4, 2014 23:36
Need help with boundary conditions: open to atmosphere Wolle OpenFOAM 2 April 11, 2011 07:32
boundaryField vs. internalField sebonator OpenFOAM 10 January 24, 2011 17:43
pipe flow with heat transfer Fabian OpenFOAM 2 December 12, 2009 05:53
changing the names and types of a boundaryField gerado OpenFOAM Running, Solving & CFD 0 March 24, 2009 09:55


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