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

Writing scalarField values into a pointScalarField

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

Reply
 
LinkBack Thread Tools Display Modes
Old   October 13, 2011, 07:06
Default Writing scalarField values into a pointScalarField
  #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 write values of a scalarField sF to the patch boundaryField values of a pointScalarField pSF. The pointScalarField pSF has been created as

pointScalarField pSF
(
IOobject
(
"pSF",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
pMesh,
dimensionedScalar("pSF", dimensionSet(0, 1, 0, 0, 0, 0, 0), 0.0),
"zeroGradient"
);

These are the errors I get:

1. pSF.boundaryField()[patchi] = sF; results in
Quote:
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’
If pSF was a volScalarField instead of a pointScalarField, it would compile and run (except wrong patch sizes) but thats not what I want.

2. pSF.boundaryField()[patchi].patchInternalField() = sF; compiles but results in
Quote:
--> FOAM FATAL ERROR:
attempted to assign to a const reference to constant object
during runtime. Also, I'm not sure if .patchInternalField() assigns the points on patchi of the boundaryField!?

Do you have any idea?

Arne
Arnoldinho is offline   Reply With Quote

Old   October 13, 2011, 07:52
Default
  #2
Senior Member
 
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 8
Arnoldinho is on a distinguished road
Sorry, patchInternalField() is of course a function to write internalField values to the corresponding boundaryFields. I mixed that.

Last edited by Arnoldinho; October 13, 2011 at 07:58. Reason: typo
Arnoldinho is offline   Reply With Quote

Old   October 13, 2011, 08:58
Default
  #3
Senior Member
 
Hisham's Avatar
 
Hisham El Safti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 247
Blog Entries: 10
Rep Power: 8
Hisham is on a distinguished road
Hi Arne,

I hope it helps to recall that a geometricField (e.g. a volScalarField) is defined at cell centroid, whereas pointField values are defined at cell vertices. Refer to figure 2.4 of the programmer's guide.

Best regards,
Hisham
Hisham is offline   Reply With Quote

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

Quote:
I hope it helps to recall that a geometricField (e.g. a volScalarField) is defined at cell centroid, whereas pointField values are defined at cell vertices.
Thanks, I got that. I'm just wondering why a volScalarField has a boundaryField() option, while a pointScalarField does not seems to have.

Do you have a hint on howto access/replace the points on the specific boundary patch of the pointScalarField? I'm stuck right now...

Arne

Last edited by Arnoldinho; October 13, 2011 at 09:26.
Arnoldinho is offline   Reply With Quote

Old   October 13, 2011, 09:26
Default
  #5
Senior Member
 
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 8
Arnoldinho is on a distinguished road
Ok, regarding Figure 2.4, I'm a bit confused. boundaryField values of a volField are on the edes (in 2D), what is the same for a pointField.

So now I'm not sure which points I need: I want to modify a pointDisplacement file as boundary condition for e.g. interDyMFoam during runTime. Modifications in the pointDisplacement file are done in the boundaryField (e.g. SnakeRiverCanyon tutorial). Regarding fig. 2.4, are these now the vertices of the internalField lying on the patch, or the face mid-points of the bundaryField lying on the patch?

Arne
Arnoldinho is offline   Reply With Quote

Old   October 13, 2011, 12:21
Default
  #6
Senior Member
 
Hisham's Avatar
 
Hisham El Safti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 247
Blog Entries: 10
Rep Power: 8
Hisham is on a distinguished road
The following is only my understanding (not to be taken without checking)

The fvMesh is the mesh on which all FV calculations are done and stored. Therefore, it is logically found that a geometricBoundaryField exists, which is a geometricField defined over the patchField.

Checking moveDynamicMesh, what is manipulated is the dynamicFvMesh, which is an fvMesh (again centroid).

Checking the code (I have no experience with moving mesh but interested), the dynamicFvMesh type set, in the dynamicMeshDict dictionary, is the responsible for the mesh.update() function.

Checking this dynamicMotionSolverFvMesh.C for example, it seems that the code does the update of the fvMesh.

In displacementSBRStressFvMotionSolver.C, it seems that there is an interpolation from pre-defined face displacements to cell centroid. Then, the motion solver solves for cellDisplacement, which I believe is at the centroid (as the Doxygen makes it explicitly clear that all FV calculations are at the fvMesh)

I am interested in this topic, would you kindly keep me informed?

Best regards,
Hisham
Hisham 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
It would be wonderful if a tool for FoamToTecplot is available luckyluke OpenFOAM Post-Processing 165 November 27, 2012 07:54
max node values exceed max element values in contour plot jason_t FLUENT 0 August 19, 2009 11:32
exact face values RubenG Main CFD Forum 0 June 22, 2009 11:09
Writing yPlusRAS Values velan OpenFOAM Running, Solving & CFD 0 December 30, 2008 07:09
strange node values @ solid/fluid interface - help JB FLUENT 2 November 1, 2008 13:04


All times are GMT -4. The time now is 02:04.