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

why CPtr_ defined as SlicedGeometricField, whereas magSfPtr_ as GeometricField?

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Jerryfan

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 6, 2016, 03:14
Default why CPtr_ defined as SlicedGeometricField, whereas magSfPtr_ as GeometricField?
  #1
Member
 
Jerry
Join Date: Oct 2013
Location: Salt Lake City, UT, USA
Posts: 52
Rep Power: 12
Jerryfan is on a distinguished road
Hi,

I read the code of fvMesh recently. I got confused about one thing. I realized that its class data attributes like CPtr_ (cell centers), CfPtr_ (face centers) and SfPtr_ (face area vectors) are all defined as slicedGeometricField pointers, but magSfPtr_ (cell surface area magnitude) is defined as a GeometricField pointer.
Quote:
//- Face area vectors
mutable slicedSurfaceVectorField* SfPtr_;

//- Mag face area vectors
mutable surfaceScalarField* magSfPtr_;

//- Cell centres
mutable slicedVolVectorField* CPtr_;

//- Face centres
mutable slicedSurfaceVectorField* CfPtr_;
My point is that since SfPtr_ includes the surface centers of all the cell surfaces (both the internal cell surfaces and boundary cell surfaces), why it is still defined as a slicedGeometricField variable? whereas, magSfPtr_ is defined as a GeometricField variable as expected as it includes all the cell surface areas. In my opinion, slicedGeometricField after all, it's a sliced part of a whole field. Since SfPtr_ already covers all the cell surfaces, what's the purpose of defining it as a slicedGeometricField variable? And it would be a sliced part of what field since it includes the content of the whole field? Then what's the essence of defining it as a sliced GeometricField? The same thing applies also to CPtr_ and CfPtr_. Can anyone explains why?
Jerryfan is offline   Reply With Quote

Old   July 6, 2016, 21:02
Default
  #2
Member
 
Jerry
Join Date: Oct 2013
Location: Salt Lake City, UT, USA
Posts: 52
Rep Power: 12
Jerryfan is on a distinguished road
It seems that I got the answer. It is all because of the way how it handles the slicing for the boundary fields. Below is what I got from the source code.

The complete field is the surface area vector field. The slicing for the boundary is achieved by using the slicedBoundaryField function in the slicedGeometricField constructor. As for why they do it this way, I think it might because the GeometricField class doesn't have a proper constructor so that we can just use a complete field as an argument to generator a GeoemtricField. Though GeometricField class does have a constructor that can take a Field type variable argument, the problem is the field variable used in this constructor must contain the internal field only, the boundary filed should not be included. I think this is the main reason, they have to use slicedGeometricField class here. While for magSfPtr_, it just simply use the magnitude of SfPtr_, which is already a kind of GeometricField. That's why magSfPtr_ is defined as a GeometricField pointer. Any comment is welcomed towards this discussion. Thanks.


Quote:
SfPtr_ = new slicedSurfaceVectorField
(
IOobject
(
"S",
pointsInstance(),
meshSubDir,
*this,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
*this,
dimArea,
faceAreas()
);
slicedGeometricField constructor:
Quote:
Foam::SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>::
SlicedGeometricField
(
const IOobject& io,
const Mesh& mesh,
const dimensionSet& ds,
const Field<Type>& completeField,
const bool preserveCouples
)
:
GeometricField<Type, PatchField, GeoMesh>
(
io,
mesh,
ds,
Field<Type>(),
slicedBoundaryField(mesh, completeField, preserveCouples)
)
{
// Set the internalField to the slice of the complete field
UList<Type>:perator=
(
typename Field<Type>::subField(completeField, GeoMesh::size(mesh))
);
correctBoundaryConditions();
}
In the makemagSf function of fvMesh class:
Quote:
magSfPtr_ = new surfaceScalarField
(
IOobject
(
"magSf",
pointsInstance(),
meshSubDir,
*this,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mag(Sf()) + dimensionedScalar("vs", dimArea, VSMALL)
);
mnajafi likes this.
Jerryfan is offline   Reply With Quote

Reply

Tags
geometricfield, slicedgeometricfield


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
[ICEM] How can I define different zones in ICEM? llrr ANSYS Meshing & Geometry 14 February 12, 2017 13:44
UDF link fortran source yorelchr Fluent UDF and Scheme Programming 0 February 7, 2013 03:44
using METIS functions in fortran dokeun Main CFD Forum 7 January 29, 2013 04:06
GeometricField of a user defined class! Hisham OpenFOAM Programming & Development 7 October 13, 2011 07:13
OpenFOAM static build on Cray XT5 asaijo OpenFOAM Installation 9 April 6, 2011 12:21


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