CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   BC coefficients evaluation functions (https://www.cfd-online.com/Forums/openfoam-solving/59985-bc-coefficients-evaluation-functions.html)

 shrina October 9, 2006 04:55

Hi all, I'm trying to solve

Hi all,

I'm trying to solve a model with different populations of particles, each solved on its relative mesh ,representing its space state (every number density function is an object of the GeometricField class relative to a particular mesh object). So in the solver I solve different fields, each relative to a particular mesh.
In some of these meshes there is the V coordinate axis (V=4/3*pi*r^3) that gives the position of the particle in the physical space (I have a spherical simmetry and the position of the particle at coordinate r is expressed by coordinate V=4/3*pi*r^3, that is the enclosed volume that corresponds to that radial position).
I expressed all the equations in function of the new spatial variable V, but they all give a punctual, not averaged information: a number density function at position V, that's to say at its relative r position.
I used that coordinate because the integration along the V axis of the number density function corresponds to its integration in the physical space.

Along the physical axis V I have to represent 2 interfaces.
As a matter of fact I have to represent 3 regions along the spatial axis, region 1, 2, 3 (region 2 is between region 1 and 3).
So I decided to spilt each mesh with the V axis in three meshes and impose the interface conditions on the patches that connect these regions.
On these boundaries belonging to region 1 and 3 I express the gradients as a function of the gradients found for the patches of region 2 (using the condition of same fluxes of region 2 at the interfaces).
For region 2 I have to determine the gradients at these boundaries by the calculs, but at the same time I have to impose BCs.
So I decided to impose that the gradient on each of these boundaries is equal to the gradient on its nearer internal face (that's to say a linear profile of the field in the two last cells, on each side of region 2 ). So, for every patch of these, I need to express the value on the border as a function of the nodal values of the field in the cell near the patch and in the neighbour cell.

I wrote the evaluation functions for the class I created for that kind of BC, but I have problems with the coefficients evaluation functions.
Now not only the source and diagonal coefficients are to be returned, but also the one relative to the value of the field in the neighbour cell.

What should that function be like?
How can I see which is the position of that coefficient in the relative fvMatrix?
Are the equations (in the system) ordered in the same manner as the List of cell centres?

Thanks a lot in andvance

Miriam

 hjasak October 9, 2006 05:02

Well, to be gentle, I need to

Well, to be gentle, I need to start by saying that you are trying to do pretty advanced stuff: if you want to write the b.c. form basic principles you will need to study the way the coefficients are handled in the fvMatrix (with delayed addition to diagonal and rhs).

Fortunately, in most cases, this is not necessary: you can derive your b.c. from a fixedGradient or mixed condition, adjust the value or the gradient based on the reasoning you have given and rely on the base type to do the rest for you.

Hrv

 All times are GMT -4. The time now is 13:24.