CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

How to use genericFvPatchField

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

Reply
 
LinkBack Thread Tools Display Modes
Old   August 17, 2008, 10:59
Default Hello again! My next questi
  #1
maddhi
Guest
 
Posts: n/a
Hello again!

My next question while learning about BC implementation...:

It seems that the genericFvPatchField (derived from calculatedFvPatchField) somehow interprets it's arguments into field names. Does this mean that for example in the dictionary file I could have a patch like follows?

boundaryField{
//...
mypatch{
type generic;
value "p-rho*sqr(U)/2";
}...

Probably I'm getting this completely wrong, so can I find any explanations in existing documentation how the genericFvPatchField or calculatedFvPatchField are supposed to be used?

Thanks
Maddhi
  Reply With Quote

Old   August 18, 2008, 05:55
Default Seems to me that generic is ju
  #2
Senior Member
 
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 12
eugene is on a distinguished road
Seems to me that generic is just a renaming of the old default boundary type. In which case, you cant really use it for anything.
eugene is offline   Reply With Quote

Old   August 18, 2008, 07:23
Default Hello Eugene! You are right
  #3
maddhi
Guest
 
Posts: n/a
Hello Eugene!

You are right, comparing the directories under finiteVolume/fields/fvPatchFields/basic/ shows that apparently "default" has been "replaced" by generic.

I want to implement a class that performs calculations on the dependent variables and applies the result as boundary condition on certain patches.

To give an example, I calculate the flux F_A=sum(c*<u,n>) of a concentration c across patch A, and on patch B the boundary condition should be c=k*F_A for some constant k.

This is just an example, the actual BCs are more involved, but if you could give some hints how to achieve the example above, I will probably know how to continue.

a) Which base class is best used to implement a BC like c=k*F_A where F_A depends on U and c?
b) How would I get access to the fields U and c in my implementation? Does the fvPatchField have a reference to a registry where I can find the required fields?
c) What steps are required to make my new fvPatchField available for use like

patch B{
type myNewBC;
constant_k 3.14;
}

more specifically how does OpenFOAM know for example that a fixedValueFvPatchField is requested if "type fixedValue" is given in the dictionary?

Thanks
Maddhi
  Reply With Quote

Old   August 18, 2008, 10:01
Default a) Probably something like sur
  #4
Senior Member
 
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 12
eugene is on a distinguished road
a) Probably something like surfaceNormalFixedValue

b) Yes, you do a database lookup: mesh().lookupObject<volvectorfield>("U") for instance. (the mesh has access to the database)

c) Depends on where you compiled it, but you can generally add the new library containing the BC using the "libs" keyword in the controlDict. Check documentation for details.

d) The class declaration has a macro called TypeName that adds the specified name to a run time type information table.

Your best bet to learn more about this stuff is to learn to read the code. There are examples of everything you need here: src/finiteVolume/fvPatchFields/
eugene 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



All times are GMT -4. The time now is 00:03.