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

Object of type GeometricBoundaryField

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By epi_c

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 7, 2016, 11:01
Default Object of type GeometricBoundaryField
  #1
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Dear all,

I want to change the boundary types of a special pointScalarField.
As I can figure out with doxygen, I need the GeometricBoundaryField for my further manipulations. Sofar so good, done:

Code:
pointScalarField::GeometricBoundaryField& gBF = pointMotionU_.boundaryField();
I also can get the types of the BC via .types(). But now the problem is that I don't be successful to assign a new type to the corresponding patch. With doxygen I can figure out that there is the assignment operator=() but till now I failed.

Any suggestions are appreciated.
Thanks in advance.


PS: To explain the problem more precisely. I want to use ACMI with moving meshes (not solidBodyMotion). Hence we create a pointScalarField called pointMotionU_. The problem now is that the patch types in that field for ACMI boundaries are of type ACMI. The problem is that these patches should become zeroGradient.
__________________
Keep foaming,
Tobias Holzmann

Last edited by Tobi; June 7, 2016 at 12:24.
Tobi is offline   Reply With Quote

Old   June 7, 2016, 13:40
Default
  #2
New Member
 
Jianzhi Li
Join Date: Jul 2013
Location: Shanghai, China
Posts: 27
Rep Power: 13
epi_c is on a distinguished road
Send a message via Skype™ to epi_c
Hi Tobias,

When you say operator=() did you mean:

//- Assignment to FieldField<PatchField, Type>
void operator=(const FieldField<PatchField, Type>&);

To change an individual patch's type, I think this is the best choice.

B.R.
epi_c is offline   Reply With Quote

Old   June 7, 2016, 18:37
Default Doxygen
  #3
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hey,

thanks for the replay. I made a beautiful mistake. I always checked out Doxygen for 2.3.1 but I use 3.0+. I checked the online version and could not get the same classes that I have in 2.3.1. Tomorrow I will compile Doxygen for 3.0+ and recheck the stuff.

I will check your funtion and give a replay. Thanks in advance.
Tobi
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   June 8, 2016, 09:13
Default
  #4
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Dear Bryan (?), B.R.

The problem at the moment (may be I am too focused on the patch type change) is how to do exactly what you have. Here the code that I already have (nothing special):

Code:
    Info<< "Manipulating patch fields for ACMI\n" << endl;

    pointScalarField::GeometricBoundaryField& gBF =
        pointMotionU_.boundaryField();

    const wordList& typeNames = gBF.types();
    Info<< gBF << endl;
    
    forAll(typeNames, n)
    {
        if (typeNames[n] == "cyclicACMI")
        {
            //- Get patchField
            //patchField& pF = gBF[](n);

            //- Set new patchField with new patch type
            //gBF[](n)=
        }
    }
The problem that I have up to know. To get the patch field is not working because patchField is not defined. I already included the fvPatch.H but still it is not defined. Furthermore I can not figure out how to change the patch type of a given patch field.

Any suggestions are appreciated.

Thanks in advance,
Tobi
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   June 8, 2016, 11:53
Default
  #5
New Member
 
Jianzhi Li
Join Date: Jul 2013
Location: Shanghai, China
Posts: 27
Rep Power: 13
epi_c is on a distinguished road
Send a message via Skype™ to epi_c
Hi Tobias,

As far as I know:
Code:
typedef GeometricField<scalar, pointPatchField, pointMesh> pointScalarField;
So you need to include pointPatchFields.H (pointPatchField.H) rather than fvPatch.H.

Can you try this:
Code:
Info<< "Manipulating patch fields for ACMI\n" << endl;

pointScalarField::GeometricBoundaryField& gBF = pointMotionU_.boundaryField();
Info<< gBF << endl;

const wordList& typeNames = gBF.types();
forAll(typeNames, i)
{
	if (typeNames[i] == "cyclicACMI")
	{
		FieldField<pointPatchField, scalar>& xxx = gBF;
		PtrList<pointPatchField<scalar> >& yyy = xxx;
		const pointPatch& pp = yyy[i].patch();
		const DimensionedField<scalar, pointMesh>& pif = yyy[i].dimensionedInternalField();
		yyy.set(i, new zeroGradientPointPatchField<scalar>(pp, pif);
	}
}
I'm not familiar with pointMotion, so It's hard for me to test it.

Best Regard
epi_c is offline   Reply With Quote

Old   June 8, 2016, 14:04
Default
  #6
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi,

thanks for the replay. I also tested out something different:

Code:
pointScalarField tmp
(
    IOobject
    (
        "tmp",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::NO_WRITE
    ),
    point::New(mesh),
    dimensionedScalar("tmp", dimensionSet(0,1,-1,0,0,0,0), scalar(0)),
    newTypeNames,
    oldTypeNames
);

Info<< tmp.boundaryField() << endl;

pointMotionU_ = tmp;

Info<< pointMotionU_.boundaryField() << endl;
This I based on the constructor:
Code:
GeometricField (const IOobject &, const Mesh &, const dimensioned< Type > &, const wordList &wantedPatchTypes, const wordList &actualPatchTypes=wordList())  
Constructor given IOobject, mesh, dimensioned<Type> and patch types.
For the tmp field it was working. But the copy was not successful. I will check out your solution tomorrow. Thanks in advance. Tobi
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   June 10, 2016, 05:15
Default
  #7
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Dear all,

first, thank you for the replay. The code you mentioned is working and I get the modified patch types for the ACMI. The solution looks better but still I get interpolation somehow. Hence I did the same for the volMotionU_ field. After that the stuff looked even better but I still get interpolations in between the point field of the ACMI patches (if they get connected). I do not know why but it is based on the ACMI type. See the pictures. Therefore, I need more investigations how to manipulate the ACMI patch values. If this is done, I think the ACMI will also work fine with dynamic meshes motion (not zone motion). Maybe I will focus on the manipulation on the pointScalarFields but there is only less time doing this. I thought after changing the ACMI patch types it is done, but not as I saw, not really (I was too enthusiastic) . Maybe it would be even better to manipulate the ACMI patch class somehow to forbid interpolation for the motion fields. Thanks epi_c for the kind help. Again I learned more about programming in FOAM.

Up to now, I think I got a good insight into what we have to manipulated but it is not finished . if I get any progress I will let you know.
Attached Images
File Type: jpg test,.jpg (195.8 KB, 40 views)
File Type: jpg test2.jpg (183.9 KB, 40 views)
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   June 10, 2016, 05:46
Default
  #8
New Member
 
Jianzhi Li
Join Date: Jul 2013
Location: Shanghai, China
Posts: 27
Rep Power: 13
epi_c is on a distinguished road
Send a message via Skype™ to epi_c
Hi Tobias,

I'm glad the code is working and the result improved.

Best Regards
Tobi likes this.
epi_c 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
second order schemes marine OpenFOAM 67 April 11, 2022 19:19
[OpenFOAM.org] compile error in dynamicMesh and thermophysicalModels libraries NickG OpenFOAM Installation 3 December 30, 2019 01:21
Time continuity error & FAN patch Zephiro88 OpenFOAM Running, Solving & CFD 4 April 22, 2015 13:39
[GAMBIT] periodic faces not matching Aadhavan ANSYS Meshing & Geometry 6 August 31, 2013 12:25
Flow Around a Cylinder ronaldo OpenFOAM 5 September 18, 2009 09:13


All times are GMT -4. The time now is 15:23.