CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   How to get access to a certain boundary? (https://www.cfd-online.com/Forums/openfoam-programming-development/125665-how-get-access-certain-boundary.html)

TankTinyPig October 28, 2013 21:09

How to get access to a certain boundary?
 
Hello!
Good day to everyone!

I'm a beginner of operating OpenFOAM codes, I have some trouble in searching a certain class instance and accessing its memberfunctions. Details are listed below:

I'm going to simulate two solid body in fluid fields. One can move freely and the other must move according to the movement of the first one. So I use two boundary field type to abtain this goal. One is "sixDofSolidMotionDisplacement" named "wing" and the other is "angularOscillatingDisplacment" named "plate", and they are set in file "0/pointDisplacement".

Now, in order to make the forced move object rotate according to the movement of the first one, I have to modify the "angularOscillatingDisplacment" class to make "plate" be able to get information of the class instance "wing". Now it's time to ask the question:

I know the name is "wing", how can I find this class instance?

Thank you all!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

mkraposhin October 31, 2013 05:03

Quote:

Originally Posted by TankTinyPig (Post 459534)
Hello!
Good day to everyone!

I'm a beginner of operating OpenFOAM codes, I have some trouble in searching a certain class instance and accessing its memberfunctions. Details are listed below:

I'm going to simulate two solid body in fluid fields. One can move freely and the other must move according to the movement of the first one. So I use two boundary field type to abtain this goal. One is "sixDofSolidMotionDisplacement" named "wing" and the other is "angularOscillatingDisplacment" named "plate", and they are set in file "0/pointDisplacement".

Now, in order to make the forced move object rotate according to the movement of the first one, I have to modify the "angularOscillatingDisplacment" class to make "plate" be able to get information of the class instance "wing". Now it's time to ask the question:

I know the name is "wing", how can I find this class instance?

Thank you all!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Code:


 label wingPatchID = mesh.boundary().findPatchID("wing");
 
 //for any field S of type T:
 fvPatchField<T>& pwing = S.boundaryField()[wingPatchID];

Have a look at the OpenFOAM source code documentation:

http://foam.sourceforge.net/docs/cpp/a00741.html

http://foam.sourceforge.net/docs/cpp/a01665.html

TankTinyPig October 31, 2013 20:43

oh! It works out! Thank you very much!!!!!!


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