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

Usage of DataEntry

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 4, 2016, 14:54
Default Usage of DataEntry
  #1
Senior Member
 
Join Date: Sep 2013
Posts: 353
Rep Power: 20
Bloerb will become famous soon enough
I have programmed a simple mesh Motion Solver. It currently moves a patch with constant velocity "vel". I now want to extend this velocity to be a function of time. The DataEntry class seems to be the way to go. I want to supply a table with time and velocity inside my dynamicMeshDict and use those for interpolation.

My first attempt is adding
Code:
#include "DataEntry.H"
and the following entry for my dataEntry
Code:
    const DataEntry<vector> vel
    (
        motionDict_.lookup("vel")
    );
And finally changing the old vector vel to the dataEntry vel.value which should give me the interpolated value
Code:
    
forAll(patchPoints, ppI)
    {
        np[patchPoints[ppI]] += vel.value(time().value())*time().deltaTValue();
    }
Since my c++ is at best rusty I was surprised it compiled without error messages but when starting the solver i got the following message:
Code:
--> FOAM FATAL ERROR: 
Not implemented

    From function Type Foam::DataEntry<Type>::value(const scalar) const
    in file /opt/openfoam30/src/OpenFOAM/lnInclude/DataEntry.C at line 73.

FOAM aborting
Has anyone an idea on how to fix this / do this correctly?
Bloerb is offline   Reply With Quote

Old   February 5, 2016, 02:31
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

value method is implemented only in children of DataEntry class (CSV, Constant, Table, etc.).

You can find example of usage in $FOAM_SRC/mesh/extrudeModel/radial.
alexeym is offline   Reply With Quote

Old   February 6, 2016, 13:19
Default
  #3
Senior Member
 
Join Date: Sep 2013
Posts: 353
Rep Power: 20
Bloerb will become famous soon enough
Thank you for the quick reply alexeym. Because of your input I now include InterpolationTable.H instead of DataEntry.H, which then itself includes it. I also had to make minor adjustments to the rest of the code. With this i can now provide a file with tabulated values. The problem is therefore solved.

I would nevertheless like to have the flexability boundary conditions have. Like choosing between table polynom etc. Is this not possible in this scope?
Bloerb is offline   Reply With Quote

Old   February 6, 2016, 16:50
Default
  #4
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Well, if radial example is not quite convincing, you can take a look at $FOAM_SRC/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue boundary condition.

Since you would like user to select between CSV, Polynomial, etc. you need:

1. Include DataEntry.H
2. Declare property as autoPtr<DataEntry<vector> > vel_
3. Use DataEntry::New(...) (http://foam.sourceforge.net/docs/cpp...be2ac84884862f) to create vel_ property.

You can find example of DataEntry construction on line 87 of uniformFixedValueFvPatchField.C. And you can find variants of uniformFixedValue usage (i.e. dictionary describing DataEntry) in

Code:
$ cd $FOAM_TUTORIALS
$ grep -lr uniformFixedValue *
incompressible/pimpleDyMFoam/movingCone/0/pointMotionUx
incompressible/simpleFoam/turbineSiting/0.org/U
incompressible/simpleFoam/turbineSiting/0.org/p
lagrangian/reactingParcelFilmFoam/hotBoxes/0.org/U
multiphase/interDyMFoam/ras/damBreakWithObstacle/0.org/U
multiphase/interPhaseChangeDyMFoam/propeller/0.org/U
multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/0.org/pointDisplacement
The most informative would be multiphase/interPhaseChangeDyMFoam/propeller/0.org/U, as others use Constant variant of DataEntry. Or you can refer http://www.openfoam.org/version2.1.0...conditions.php. Or concrete classes header for dictionary syntax.
alexeym 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
New workstation for different usage scenarios - CPU and RAM natem Hardware 6 August 7, 2013 02:47
Boosting CPU usage earlybird FLUENT 2 November 2, 2012 10:32
DataEntry class implementation calim_cfd OpenFOAM Programming & Development 0 March 2, 2012 05:11
BoF-Group: interFoam - documentation and usage unnikrsn OpenFOAM Running, Solving & CFD 0 November 12, 2011 22:39
OpenFOAM Solver/BC usage description murrayjc OpenFOAM 3 August 25, 2009 04:48


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