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 OpenFoam stores variable values (https://www.cfd-online.com/Forums/openfoam-programming-development/78557-how-openfoam-stores-variable-values.html)

titio July 26, 2010 05:13

How OpenFoam stores variable values
 
Hi Foamers.

I am having difficulties in understanding how OpenFoam stores variables, in particular dependent variables like for example velocity vector and stress tensor field, in the elements, and how it uses them when performing calculations, especially those associated with div schemes for convection and convective related derivatives.

Information in the literature, including Jasak thesis, are not very user friendly in this regard.

The problem is that my boss wants to know every little detail concerning OpenFoam, and he is having doubts that OpenFoam is any good.

Regards,

António Martins

olesen July 28, 2010 05:33

Quote:

Originally Posted by titio (Post 268865)
Hi Foamers.

I am having difficulties in understanding how OpenFoam stores variables, in particular dependent variables like for example velocity vector and stress tensor field, in the elements, and how it uses them when performing calculations, especially those associated with div schemes for convection and convective related derivatives.

Information in the literature, including Jasak thesis, are not very user friendly in this regard.

The problem is that my boss wants to know every little detail concerning OpenFoam, and he is having doubts that OpenFoam is any good.

If you really wish to understand it, you'll have to wade your way through the source documentation. For example, starting with a volScalarField
http://foam.sourceforge.net/doc/Doxy...ca1069e5ec8d15
you can work back to the GeometricField http://foam.sourceforge.net/doc/Doxy...tricField.html
which gets you to a DimensionedField.html
http://foam.sourceforge.net/doc/Doxy...onedField.html

which has a dimensionSet http://foam.sourceforge.net/doc/Doxygen/html/classFoam_1_1dimensionSet.html for managing consistence in the operations and then there are the various bits of the field (internal, boundary..)

BTW: what happens when your boss can't get the same implementation information for a commercial code? I guess he wouldn't use a commercial code then.

marupio August 4, 2010 09:25

VectorSpace has the actual data members for the tensor and vector components, which it stores as arrays. OpenFOAM defines its own lists, which I doubt are much different from STL lists. Fields are lists with algebra defined (for instance, using operator overloads). GeometricFields are fields with boundaries defined.

The indexing of the lists varies by what is defined. For instance, the diagonal coefficients are scalarFields, indexed by cell number; the owner and neighbour coefficients are also scalarFields, but these are indexed by cell faces.

My boss also had concerns about OpenFOAM. It seems the open source can scare some people... but try and find a commercial code that tells you where its TensorFields are stored.

Luise August 5, 2010 14:58

You can find information about the basic principles in

Weller, Tabor, Jasak, Fureby; A tensorial approach to computational continuum mechanics using object-oriented techniques, 1998
http://powerlab.fsb.hr/ped/kturbo/op...apers/Foam.pdf.

Luise

santiagomarquezd September 2, 2010 22:07

Quoting David:

Quote:

VectorSpace has the actual data members for the tensor and vector components, which it stores as arrays. OpenFOAM defines its own lists, which I doubt are much different from STL lists.
I agree with you in the STL part, FOAM's List has an interface similar to STL one, but there is a very important difference, in FOAM, Lists are raw memory, from List.C we have:

Code:

00041 // Construct with length specified
00042 template<class T>
00043 Foam::List<T>::List(const label s)
00044 :
00045    UList<T>(NULL, s)
00046 {
00047    if (this->size_ < 0)
00048    {
00049        FatalErrorIn("List<T>::List(const label size)")
00050            << "bad size " << this->size_
00051            << abort(FatalError);
00052    }
00053
00054    if (this->size_)
00055    {
00056        this->v_ = new T[this->size_];
00057    }
00058 }

and has ramdom access capabilities. STL ones are based in linked lists.

Regards.

santiagomarquezd September 2, 2010 22:33

1 Attachment(s)
Titio, you said:

Quote:

Originally Posted by titio (Post 268865)
Hi Foamers.
I am having difficulties in understanding how OpenFoam stores variables, in particular dependent variables like for example velocity vector and stress tensor field, in the elements, and how it uses them when performing calculations, especially those associated with div schemes for convection and convective related derivatives.

maybe you can give some other info about your concerns. If I understand, much of you want to know is related with lists as people said. In Figure 2.5 from FOAM's Programmer's Guide, one can see that values of fields are stored in GeometricFields, they have a lot info but essentially the values of the field and its positions. To do so it is necessary to have pointers to a fvMesh and a Field, finally Field class has a List of type T, where List and T are classes too.

Respect of div schemes for convection and convective related derivatives, it depends on the kind of operations you want to do, if these are implicit operations (fvm) or explicit (fvc) ones.

Regards.

T.D. October 14, 2010 10:56

Hi
 
Hi
i have something like this and i don't know if it is implemented in openfoam


it is:


fvc::div(nusEff * T)

where nusEff is a scalar spacial varying viscosity law to be defined and T is a tensor

so if i do fvc::div(nusEff *T), will it be ok in openFoam? or it should be done another way?
How to define a new nusEff , lets for example in simpleFoam different from the existing nuEff()?

thanks


All times are GMT -4. The time now is 14:43.