CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions

[swak4Foam] groovyBC

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 26, 2013, 15:11
Default groovyBC
  #1
New Member
 
ahmad taheri
Join Date: Oct 2013
Posts: 4
Rep Power: 12
taheri.atp is on a distinguished road
hi to all
I'm using groovyBC for simulating wave in OpenFOAM
I've installed swak4foam before and i have this folder in my home folder
but when i want to run my model, I receive this error:

--> FOAM FATAL IO ERROR:
Unknown patchField type groovyBC for patch type patch

Valid patchField types are :

73
(
advective
alphaFixedPressure
atmBoundaryLayerInletEpsilon
buoyantPressure
calculated
codedFixedValue
codedMixed
constantAlphaContactAngle
cyclic
cyclicAMI
cyclicSlip
directionMixed
dynamicAlphaContactAngle
empty
epsilonWallFunction
.
.
.


is there any one can help me solving this problem?
taheri.atp is offline   Reply With Quote

Old   December 26, 2013, 15:48
Default
  #2
New Member
 
ahmad taheri
Join Date: Oct 2013
Posts: 4
Rep Power: 12
taheri.atp is on a distinguished road
oh i found my mistake!
I didn't add the library to controlDict file
taheri.atp is offline   Reply With Quote

Old   May 12, 2014, 12:54
Default groovyBC applied after first iteration?
  #3
Member
 
Camille Bilger
Join Date: Jul 2013
Posts: 43
Rep Power: 12
kmou is on a distinguished road
Hello Foamers,

I am using interFoam in OpenFOAM2.3.0 and swak4Foam/groovyBC.
I am simulating the entrance of a liquid flowing over a solid plate, on top of the liquid stream, there is an airstream entering at the same time.
I want to apply a groovyBC inlet velocity to both the liquid and air.

For now though, to keep it simple, I am keeping the airstream velocity uniform and I want to apply a parabolic profile on the fuel entrance.

I added:
inlet-liquid
{
type groovyBC;
value uniform (0.75 0 0);
variables
(
"veltry= 0.75*pos().y*(2-(pos().y/0.05));"
);
valueExpression "vector (veltry, 0, 0)";
}
I have understood on the wikipedia/groovyBC page that the value uniform (0.75 0 0) will be used only for the first iteration?
I also read that before the interFoam solver starts, Paraview cannot "understand" the groovyBC condition and therefore I am not seeing a parabolic profile in Paraview then.

My question might be weird but I would like to know when is groovyBC being applied exactly when interFoam starts solving the case, if not at t=0?
I want to make sure that the parabolic profile is applied straight away when liquid and air enter the domain, as this is the whole point of my exercise, to get this sharp entrance.


Thank you very much for your time.
kmou is offline   Reply With Quote

Old   May 13, 2014, 09:35
Default
  #4
Senior Member
 
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,266
Blog Entries: 1
Rep Power: 24
nimasam is on a distinguished road
Dear Camille

after some iteration, save time directory and look the results in paraview by choosing appropriate patch
__________________
My Personal Website (http://nimasamkhaniani.ir/)
Telegram channel (https://t.me/cfd_foam)
nimasam is offline   Reply With Quote

Old   May 13, 2014, 09:48
Default
  #5
Member
 
Camille Bilger
Join Date: Jul 2013
Posts: 43
Rep Power: 12
kmou is on a distinguished road
Hi Nima,

I did (Paraview, isolated inlet patch, velocity vectors) but the inlet patch is exhibiting a uniform block profile, due to the
value uniform (0.75 0 0)
I had given it.
It seems that the inlet patch is not taking in the specific profile I want it to have....
kmou is offline   Reply With Quote

Old   May 13, 2014, 09:55
Default
  #6
Senior Member
 
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,266
Blog Entries: 1
Rep Power: 24
nimasam is on a distinguished road
did you look at patch in other time steps than 0 ?
__________________
My Personal Website (http://nimasamkhaniani.ir/)
Telegram channel (https://t.me/cfd_foam)
nimasam is offline   Reply With Quote

Old   May 13, 2014, 10:10
Default
  #7
Member
 
Camille Bilger
Join Date: Jul 2013
Posts: 43
Rep Power: 12
kmou is on a distinguished road
Yes indeed, I am up to two time steps later...
kmou is offline   Reply With Quote

Old   May 13, 2014, 19:41
Default
  #8
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by kmou View Post
Hello Foamers,

I am using interFoam in OpenFOAM2.3.0 and swak4Foam/groovyBC.
I am simulating the entrance of a liquid flowing over a solid plate, on top of the liquid stream, there is an airstream entering at the same time.
I want to apply a groovyBC inlet velocity to both the liquid and air.

For now though, to keep it simple, I am keeping the airstream velocity uniform and I want to apply a parabolic profile on the fuel entrance.

I added:
inlet-liquid
{
type groovyBC;
value uniform (0.75 0 0);
variables
(
"veltry= 0.75*pos().y*(2-(pos().y/0.05));"
);
valueExpression "vector (veltry, 0, 0)";
}
I have understood on the wikipedia/groovyBC page that the value uniform (0.75 0 0) will be used only for the first iteration?
I also read that before the interFoam solver starts, Paraview cannot "understand" the groovyBC condition and therefore I am not seeing a parabolic profile in Paraview then.

My question might be weird but I would like to know when is groovyBC being applied exactly when interFoam starts solving the case, if not at t=0?
I want to make sure that the parabolic profile is applied straight away when liquid and air enter the domain, as this is the whole point of my exercise, to get this sharp entrance.


Thank you very much for your time.
What you can try is set "evaluateDuringConstruction true;" in the BC (this is undocumented). But this won't be visible to Paraview only to the solver. The alternative is setting the value with funkySetBoundaryField (that would set the value to a non-uniform value)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   May 14, 2014, 08:07
Default
  #9
Member
 
Camille Bilger
Join Date: Jul 2013
Posts: 43
Rep Power: 12
kmou is on a distinguished road
Hello Bernhard,
Thank you for your message. I will try now the evaluateDuringConstruction solution.
Should this help to set up the profile right at t=0?
Does this mean that I cannot check in Paraview if the profile is present or not at the inlet patch? At t=0 or at later times?

If this does not work I will try the other tool with funkySetBC.
kmou is offline   Reply With Quote

Old   May 14, 2014, 10:09
Default
  #10
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by kmou View Post
Hello Bernhard,
Thank you for your message. I will try now the evaluateDuringConstruction solution.
Should this help to set up the profile right at t=0?
Does this mean that I cannot check in Paraview if the profile is present or not at the inlet patch? At t=0 or at later times?

If this does not work I will try the other tool with funkySetBC.
It sets the profile at the time of reading. Usually this is not done because if a field that is used in the expression is not yet in memory it will break the evaluation. But you will hardly see a difference in the solution and NO difference for t=0 in paraview. For that you've got to use FSBF
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   May 20, 2014, 10:02
Default
  #11
Member
 
Camille Bilger
Join Date: Jul 2013
Posts: 43
Rep Power: 12
kmou is on a distinguished road
Hello Bernhard,
Thank you for your response. I am trying to use FSBC instead.
I encountering a problem.

My /0/U file contains:
Code:
    inlet-top
    {
        type            fixedValue;
        value           uniform (60 0 0);
    }
    inlet-liquid
    {
        type            fixedValue;
        value           uniform (0.75 0 0); //fixed value non-uniform BC
    }
and my funkySetBoundaryDIct looks like
Code:
velocities {
    field U;
    expressions
    (
         {
             target value;
             patchName inlet-top;
            variables "d=0.0011;gradP=-17142;K=-0.0011;eta=27777.8;";
                        expression "(eta*((pos().y*pos().y)-(d*d))+K*eta*(pos().y-d))*gradP";
         }
             {
                    target value;
                    patchName inlet-liquid;
            variables "d=0.0011;gradP=-69000;K=-0.0011;eta=217.4;";
                        expression "(eta*(pos().y*pos().y)+K*eta*pos().y)*gradP";
            }

           
    );
}
funkySetBoundaryField -time 0 works:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
swakVersion: 0.3.1 (Release date: Next release)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Time = 0


Part: velocities working on field U
Setting value on inlet-top the expression "(eta*((pos().y*pos().y)-(d*d))+K*eta*(pos().y-d))*gradP"
Setting value on inlet-liquid the expression "(eta*(pos().y*pos().y)+K*eta*pos().y)*gradP"
End



and my /0/U file changes accordingly:
Code:
 inlet-top
    {
        type            fixedValue;
        valueOld        uniform ( 60 0 0 );
        value           nonuniform List<scalar> 
10000
(
51.85459148
60.0446647
67.85380428
....
   inlet-liquid
    {
        type            fixedValue;
        valueOld        uniform ( 0.75 0 0 );
        value           nonuniform List<scalar> 
1000
(
0.16350654
0.48151926
0.7875315
....

but when I open paraFoam to check that my inlet patch contains the correct velocity vectors, ParaView crashes and I am wondering if you have an idea regarding this. Thank you!

--> FOAM FATAL ERROR:
Attempt to cast type N4Foam5token8CompoundINS_4ListIdEEEE to type N4Foam5token8CompoundINS_4ListINS_6VectorIdEEEEEE

From function dynamicCast<To>(From&)
in file lnInclude/typeInfo.H at line 93.

FOAM aborting

#0 Foam::error:rintStack(Foam::Ostream&) at ??:?
#1 Foam::error::abort() at ??:?
#2 Foam::Istream& Foam:perator>><Foam::Vector<double> >(Foam::Istream&, Foam::List<Foam::Vector<double> >&) at ??:?
#3 Foam::Field<Foam::Vector<double> >::Field(Foam::word const&, Foam::dictionary const&, int) at ??:?
#4 Foam::fvPatchField<Foam::Vector<double> >::adddictionaryConstructorToTable<Foam::fixedValu eFvPatchField<Foam::Vector<double> > >::New(Foam::fvPatch const&, Foam:imensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) at ??:?
#5 Foam::fvPatchField<Foam::Vector<double> >::New(Foam::fvPatch const&, Foam:imensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) at ??:?
#6 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::GeometricBoundaryField::readField( Foam:imensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) at ??:?
#7 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::readFields(Foam::dictionary const&) at ??:?
#8 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::readFields() at ??:?
#9 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::GeometricField(Foam::IOobject const&, Foam::fvMesh const&) at ??:?
#10 void Foam::vtkPV4Foam::convertVolFields<Foam::Vector<do uble> >(Foam::fvMesh const&, Foam::PtrList<Foam::PrimitivePatchInterpolation<Fo am::PrimitivePatch<Foam::face, Foam::SubList, Foam::Field<Foam::Vector<double> > const&, Foam::Vector<double> > > > const&, Foam::IOobjectList const&, bool, vtkMultiBlockDataSet*) at ??:?
#11 Foam::vtkPV4Foam::convertVolFields(vtkMultiBlockDa taSet*) at ??:?
#12 Foam::vtkPV4Foam::Update(vtkMultiBlockDataSet*, vtkMultiBlockDataSet*) at ??:?
#13 vtkPV4FoamReader::RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) at ??:?
#14 vtkExecutive::CallAlgorithm(vtkInformation*, int, vtkInformationVector**, vtkInformationVector*) in "/home/cb757/OpenFOAM/ThirdParty-2.3.0/platforms/linux64Gcc/ParaView-4.1.0/lib/paraview-4.1/libvtkCommonExecutionModel-pv4.1.so.1"
#15 vtkDemandDrivenPipeline::ExecuteData(vtkInformatio n*, vtkInformationVector**, vtkInformationVector*) in "/home/cb757/OpenFOAM/ThirdParty-2.3.0/platforms/linux64Gcc/ParaView-4.1.0/lib/paraview-4.1/libvtkCommonExecutionModel-pv4.1.so.1"
#16 vtkCompositeDataPipeline::ExecuteData(vtkInformati on*, vtkInformationVector**, vtkInformationVector*) in "/home/cb757/OpenFOAM/ThirdParty-2.3.0/platforms/linux64Gcc/ParaView-4.1.0/lib/paraview-4.1/libvtkCommonExecutionModel-pv4.1.so.1"
#17 vtkDemandDrivenPipeline::ProcessRequest(vtkInforma tion*, vtkInformationVector**, vtkInformationVector*) in "/home/cb757/OpenFOAM/ThirdParty-2.3.0/platforms/linux64Gcc/ParaView-4.1.0/lib/paraview-4.1/libvtkCommonExecutionModel-pv4.1.so.1"
#18 vtkStreamingDemandDrivenPipeline::ProcessRequest(v tkInformation*, vtkInformationVector**, vtkInformationVector*) in "/home/cb757/OpenFOAM/ThirdParty-2.3.0/platforms/linux64Gcc/ParaView-4.1.0/lib/paraview-4.1/libvtkCommonExecutionModel-pv4.1.so.1"
#19 vtkCompositeDataPipeline::ForwardUpstream(vtkInfor mation*) in "/home/cb757/OpenFOAM/ThirdParty-2.3.0/platforms/linux64Gcc/ParaView-4.1.0/lib/paraview-4.1/libvtkCommonExecutionModel-pv4.1.so.1"
#20 vtkDemandDrivenPipeline::ProcessRequest(vtkInforma tion*, vtkInformationVector**, vtkInformationVector*) in "/home/cb757/OpenFOAM/ThirdParty-2.3.0/platforms/linux64Gcc/ParaView-4.1.0/lib/paraview-4.1/libvtkCommonExecutionModel-pv4.1.so.1"
#21 vtkStreamingDemandDrivenPipeline::ProcessRequest(v tkInformation*, vtkInformationVector**, vtkInformationVector*) in "/home/cb757/OpenFOAM/ThirdParty-2.3.0/platforms/linux64Gcc/ParaView-4.1.0/lib/paraview-4.1/libvtkCommonExecutionModel-pv4.1.so.1"
#22 vtkDemandDrivenPipeline::UpdateData(int) in "/home/cb757/OpenFOAM/ThirdParty-2.3.0/platforms/linux64Gcc/ParaView-4.1.0/lib/paraview-4.1/libvtkCommonExecutionModel-pv4.1.so.1"
#23 vtkStreamingDemandDrivenPipeline::Update(int) in "/home/cb757/OpenFOAM/ThirdParty-2.3.0/platforms/linux64Gcc/ParaView-4.1.0/lib/paraview-4.1/libvtkCommonExecutionModel-pv4.1.so.1"
#24 vtkSISourceProxyCommand(vtkClientServerInterpreter *, vtkObjectBase*, char const*, vtkClientServerStream const&, vtkClientServerStream&, void*) in "/home/cb757/OpenFOAM/ThirdParty-2.3.0/platforms/linux64Gcc/ParaView-4.1.0/lib/paraview-4.1/libvtkPVServerManagerApplication-pv4.1.so.1"
#25 vtkClientServerInterpreter::CallCommandFunction(ch ar const*, vtkObjectBase*, char const*, vtkClientServerStream const&, vtkClientServerStream&) in "/home/cb757/OpenFOAM/ThirdParty-2.3.0/platforms/linux64Gcc/ParaView-4.1.0/lib/paraview-4.1/libvtkClientServer-pv4.1.so.1"
#26 vtkClientServerInterpreter::ProcessCommandInvoke(v tkClientServerStream const&, int) in "/home/cb757/OpenFOAM/ThirdParty-2.3.0/platforms/linux64Gcc/ParaView-4.1.0/lib/paraview-4.1/libvtkClientServer-pv4.1.so.1"
#27 vtkClientServerInterpreter::ProcessOneMessage(vtkC lientServerStream const&, int) in "/home/cb757/OpenFOAM/ThirdParty-2.3.0/platforms/linux64Gcc/ParaView-4.1.0/lib/paraview-4.1/libvtkClientServer-pv4.1.so.1"
#28 vtkClientServerInterpreter::ProcessStream(vtkClien tServerStream const&) in "/home/cb757/OpenFOAM/ThirdParty-2.3.0/platforms/linux64Gcc/ParaView-4.1.0/lib/paraview-4.1/libvtkClientServer-pv4.1.so.1"
#29 vtkPVSessionCore::ExecuteStreamInternal(vtkClientS erverStream const&, bool) in "/home/cb757/OpenFOAM/ThirdParty-2.3.0/platforms/linux64Gcc/ParaView-4.1.0/lib/paraview-4.1/libvtkPVServerImplementationCore-pv4.1.so.1"
#30 vtkPVSessionCore::ExecuteStream(unsigned int, vtkClientServerStream const&, bool) in "/home/cb757/OpenFOAM/ThirdParty-2.3.0/platforms/linux64Gcc/ParaView-4.1.0/lib/paraview-4.1/libvtkPVServerImplementationCore-pv4.1.so.1"
#31 vtkPVSessionBase::ExecuteStream(unsigned int, vtkClientServerStream const&, bool) in "/home/cb757/OpenFOAM/ThirdParty-2.3.0/platforms/linux64Gcc/ParaView-4.1.0/lib/paraview-4.1/libvtkPVServerImplementationCore-pv4.1.so.1"
#32 vtkSMOutputPort::UpdatePipelineInternal(double, bool) in "/home/cb757/OpenFOAM/ThirdParty-2.3.0/platforms/linux64Gcc/ParaView-4.1.0/lib/paraview-4.1/libvtkPVServerManagerCore-pv4.1.so.1"
#33 vtkSMSourceProxy::UpdatePipeline(double) in "/home/cb757/OpenFOAM/ThirdParty-2.3.0/platforms/linux64Gcc/ParaView-4.1.0/lib/paraview-4.1/libvtkPVServerManagerCore-pv4.1.so.1"
#34 pqDisplayPolicy::getPreferredViewType(pqOutputPort *, bool) const in "/home/cb757/OpenFOAM/ThirdParty-2.3.0/platforms/linux64Gcc/ParaView-4.1.0/lib/paraview-4.1/libvtkpqCore-pv4.1.so.1"
#35 pqDisplayPolicy::getPreferredView(pqOutputPort*, pqView*) const in "/home/cb757/OpenFOAM/ThirdParty-2.3.0/platforms/linux64Gcc/ParaView-4.1.0/lib/paraview-4.1/libvtkpqCore-pv4.1.so.1"
#36 pqDisplayPolicy::createPreferredRepresentation(pqO utputPort*, pqView*, bool) const in "/home/cb757/OpenFOAM/ThirdParty-2.3.0/platforms/linux64Gcc/ParaView-4.1.0/lib/paraview-4.1/libvtkpqCore-pv4.1.so.1"
#37 pqPropertiesPanel::apply() in "/home/cb757/OpenFOAM/ThirdParty-2.3.0/platforms/linux64Gcc/ParaView-4.1.0/lib/paraview-4.1/libvtkpqComponents-pv4.1.so.1"
#38 QMetaObject::activate(QObject*, QMetaObject const*, int, void**) in "/usr/lib64/libQtCore.so.4"
#39 QAbstractButton::clicked(bool) in "/usr/lib64/libQtGui.so.4"
#40 in "/usr/lib64/libQtGui.so.4"
#41 in "/usr/lib64/libQtGui.so.4"
#42 QAbstractButton::mouseReleaseEvent(QMouseEvent*) in "/usr/lib64/libQtGui.so.4"
#43 QWidget::event(QEvent*) in "/usr/lib64/libQtGui.so.4"
#44 QApplicationPrivate::notify_helper(QObject*, QEvent*) in "/usr/lib64/libQtGui.so.4"
#45 QApplication::notify(QObject*, QEvent*) in "/usr/lib64/libQtGui.so.4"
#46 QCoreApplication::notifyInternal(QObject*, QEvent*) in "/usr/lib64/libQtCore.so.4"
#47 QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) in "/usr/lib64/libQtGui.so.4"
#48 in "/usr/lib64/libQtGui.so.4"
#49 QApplication::x11ProcessEvent(_XEvent*) in "/usr/lib64/libQtGui.so.4"
#50 in "/usr/lib64/libQtGui.so.4"
#51 g_main_context_dispatch in "/usr/lib64/libglib-2.0.so.0"
#52 in "/usr/lib64/libglib-2.0.so.0"
#53 g_main_context_iteration in "/usr/lib64/libglib-2.0.so.0"
#54 QEventDispatcherGlib:rocessEvents(QFlags<QEventL oop::ProcessEventsFlag>) in "/usr/lib64/libQtCore.so.4"
#55 in "/usr/lib64/libQtGui.so.4"
#56 QEventLoop:rocessEvents(QFlags<QEventLoop::Proce ssEventsFlag>) in "/usr/lib64/libQtCore.so.4"
#57 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsF lag>) in "/usr/lib64/libQtCore.so.4"
#58 QCoreApplication::exec() in "/usr/lib64/libQtCore.so.4"
#59 main at ??:?
#60 __libc_start_main in "/lib64/libc.so.6"
#61
at /home/abuild/rpmbuild/BUILD/glibc-2.18/csu/../sysdeps/x86_64/start.S:125
kmou is offline   Reply With Quote

Old   May 20, 2014, 10:21
Default
  #12
Member
 
Camille Bilger
Join Date: Jul 2013
Posts: 43
Rep Power: 12
kmou is on a distinguished road
Sorry I did solve this problem, velocity is a vector I needed something like:
expression "vector(profile,0,0)";


The inlet-liquid profile does not seem to be apparent in ParaView, I will work on that.
kmou is offline   Reply With Quote

Old   June 3, 2014, 15:29
Default
  #13
New Member
 
Join Date: Jun 2014
Posts: 8
Rep Power: 0
vasepan is on a distinguished road
I am new user to OpenFOAM and I want to simulate a flow over a cylinder. I have generated the mesh and use icoFoam solver. The results I obtained are satisfactory. However, I want to alter my boundary conditions. I want to obtain a measurement at some point of the field for the velocity and feedback that measurement back at a specific patch (BC). I have searched and found that GroovyBC has the option for "lookuptables" but this implies that I have already created a data file. I know that the data file can be generated using the "probe utility". The problem is that the values obtained are from a simulation that has already been completed.

I look to calculate the velocity at a specific point in a single time step and then using that data alter a boundary condition. In the next time step obtain the new measurement which was caused by the modified BC and implement the new measurement again...until end of simulation.

I want to thank you in advance for any help.
vasepan is offline   Reply With Quote

Old   June 3, 2014, 16:58
Default
  #14
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by vasepan View Post
I am new user to OpenFOAM and I want to simulate a flow over a cylinder. I have generated the mesh and use icoFoam solver. The results I obtained are satisfactory. However, I want to alter my boundary conditions. I want to obtain a measurement at some point of the field for the velocity and feedback that measurement back at a specific patch (BC). I have searched and found that GroovyBC has the option for "lookuptables" but this implies that I have already created a data file. I know that the data file can be generated using the "probe utility". The problem is that the values obtained are from a simulation that has already been completed.

I look to calculate the velocity at a specific point in a single time step and then using that data alter a boundary condition. In the next time step obtain the new measurement which was caused by the modified BC and implement the new measurement again...until end of simulation.

I want to thank you in advance for any help.
Lookup tables are only good for static data. The kind of feedback you're describing is possible for a long time in OF. Currently don't have got time to go into details: you've got to define a sampledSet in the controlDict. That can be accessed via variables of the form "var{set'name}= ..." and "var" could then be used in your boundary conditions. For examples have a look at:

- Examples/groovyBC/fillingTheDam in the swak distribution
- my presentation from the Workshop 2011 at PennState (linked from the swak-page)
- my presentation at the OSCFD in London 2012 (linked from the swak-page)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   June 3, 2014, 17:31
Default
  #15
New Member
 
Join Date: Jun 2014
Posts: 8
Rep Power: 0
vasepan is on a distinguished road
Thank you so much for your valuable help and immediate response!I will proceed as you suggested.
vasepan is offline   Reply With Quote

Old   June 6, 2014, 06:22
Default
  #16
New Member
 
Join Date: Jun 2014
Posts: 8
Rep Power: 0
vasepan is on a distinguished road
Thank you again for your help. Your presentations were very helpful and the code seems to run smoothly. I would like to ask one more thing. Using a "swakExpression" , besides reading values from a point I can also write this values. For the problem previously discussed:

-Is there an expression that would allow me to obtain the maximum of the value from all previous time steps at the measurement point? What I try to implement is the following ratio:

v(x,t)/max(v(x,t)),

where
v(x,t) is the value calculated at each time step and using SampledSet I can obtain it.
max(v(x,t)) is the maximum value of all previous time steps.
Again I want to implement this dynamically to the boundary condition.


-Is there an expression for absolute value, like 'abs' or do I have to develop a code?

Thank you in advance for your help.
vasepan is offline   Reply With Quote

Old   June 6, 2014, 09:19
Default
  #17
New Member
 
Join Date: Jun 2014
Posts: 8
Rep Power: 0
vasepan is on a distinguished road
I think I figured out something...with the help of your presentations, instead of looking every step for maximum value, one can create a sample set that would store the maximum value at each time step, if it exceeds a specific threshold else it would use the previously assigned value. Similar as the "maxfillHeight".

And for the absolute value, one can develop a statement that would check if the value is negative and then multiply it with -1.
vasepan is offline   Reply With Quote

Old   June 6, 2014, 13:03
Default
  #18
New Member
 
Join Date: Jun 2014
Posts: 8
Rep Power: 0
vasepan is on a distinguished road
Regarding the simulations using SampledSet, I noticed something strange. I set my line of measurements as follows:

functions
{
velocitymeasure
{
type swakExpression;
valueType set;
verbose true;
outputControlMode timeStep;
outputInterval 1;
setName vel;

set
{
type uniform;
axis x;
start ( 0.15 0 0 );
end ( 0.16 0 0 );
nPoints 6;
}

expression "U";
accumulations (average);

interpolate true;
interpolationType cellPoint ;
}



}
}


Additionally, in order to obtain measurements in the boundary condition, I have used the following on the U file:

blow
{
type groovyBC;
valueExpression "vOutlet";
variables
(
"vOutlet{set'vel}=average(U);"
);

value uniform (0 0 0);

}

However, when I run the simulation I obtain different results between the values of U and the post processed values from the "velocitymeasure". Shouldn't they be the same. I attach the results from "velocitymeasure":

# Time average
0.002 (0.898128 0.00275221 -9.37472e-20)
0.004 (0.923306 7.3051e-05 3.10228e-21)
0.006 (0.931091 -0.00123558 -6.50806e-22)
0.008 (0.929597 0.000356499 3.16473e-22)
0.01 (0.930994 0.000461478 -1.25708e-22)

and the results from the folders of U for the first two timesteps:

0.002
blow
{
type groovyBC;
refValue uniform (0.900424 0.0211944 -2.44489e-18);
refGradient uniform (0 0 0);
valueFraction uniform 1;
value uniform (0.900424 0.0211944 -2.44489e-18);
valueExpression "vOutlet";
gradientExpression "vector(0,0,0)";
fractionExpression "1";
evaluateDuringConstruction 0;
variables "vOutlet{set'vel}=average(U);";
timelines (
);
lookuptables (
);
}

0.004

blow
{
type groovyBC;
refValue uniform (0.924193 -0.00445294 7.44098e-20);
refGradient uniform (0 0 0);
valueFraction uniform 1;
value uniform (0.924193 -0.00445294 7.44098e-20);
valueExpression "vOutlet";
gradientExpression "vector(0,0,0)";
fractionExpression "1";
evaluateDuringConstruction 0;
variables "vOutlet{set'vel}=average(U);";
timelines (
);
lookuptables (
);
}
As you can see they are totally different especially for the v-component!!Do I make any mistake?

Any help would be deeply appreciated.
vasepan is offline   Reply With Quote

Old   June 7, 2014, 07:21
Default
  #19
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by vasepan View Post
Regarding the simulations using SampledSet, I noticed something strange. I set my line of measurements as follows:

functions
{
velocitymeasure
{
type swakExpression;
valueType set;
verbose true;
outputControlMode timeStep;
outputInterval 1;
setName vel;

set
{
type uniform;
axis x;
start ( 0.15 0 0 );
end ( 0.16 0 0 );
nPoints 6;
}

expression "U";
accumulations (average);

interpolate true;
interpolationType cellPoint ;
}



}
}


Additionally, in order to obtain measurements in the boundary condition, I have used the following on the U file:

blow
{
type groovyBC;
valueExpression "vOutlet";
variables
(
"vOutlet{set'vel}=average(U);"
);

value uniform (0 0 0);

}

However, when I run the simulation I obtain different results between the values of U and the post processed values from the "velocitymeasure". Shouldn't they be the same. I attach the results from "velocitymeasure":

# Time average
0.002 (0.898128 0.00275221 -9.37472e-20)
0.004 (0.923306 7.3051e-05 3.10228e-21)
0.006 (0.931091 -0.00123558 -6.50806e-22)
0.008 (0.929597 0.000356499 3.16473e-22)
0.01 (0.930994 0.000461478 -1.25708e-22)

and the results from the folders of U for the first two timesteps:

0.002
blow
{
type groovyBC;
refValue uniform (0.900424 0.0211944 -2.44489e-18);
refGradient uniform (0 0 0);
valueFraction uniform 1;
value uniform (0.900424 0.0211944 -2.44489e-18);
valueExpression "vOutlet";
gradientExpression "vector(0,0,0)";
fractionExpression "1";
evaluateDuringConstruction 0;
variables "vOutlet{set'vel}=average(U);";
timelines (
);
lookuptables (
);
}

0.004

blow
{
type groovyBC;
refValue uniform (0.924193 -0.00445294 7.44098e-20);
refGradient uniform (0 0 0);
valueFraction uniform 1;
value uniform (0.924193 -0.00445294 7.44098e-20);
valueExpression "vOutlet";
gradientExpression "vector(0,0,0)";
fractionExpression "1";
evaluateDuringConstruction 0;
variables "vOutlet{set'vel}=average(U);";
timelines (
);
lookuptables (
);
}
As you can see they are totally different especially for the v-component!!Do I make any mistake?

Any help would be deeply appreciated.
At first: PLEASE. Use the CODE-tag for excerpts from case files. It preserves indentation and makes it much easier to read stuff

To your question: they are not completely different, but slightly. The reason is probably the order in which things are evaluated:

1. Variable for groovyBC is read from the set
2. Sets reference value on the boundary
3. Equation is solved according to the boundary condition you set. This changes the values at the set
4. function-object is evaluated and picks up the new values

Of course then the BC should be the same with the FO from the previous time-step. That it isn't lets me assume that your solver solves U more than once per time-step (thus 1-3 is done more than once)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   June 7, 2014, 13:40
Default
  #20
New Member
 
Join Date: Jun 2014
Posts: 8
Rep Power: 0
vasepan is on a distinguished road
My apologies for the text. It is indeed very difficult to read. However, once more I would like to thank you again for your valuable help and immediate response.
vasepan is offline   Reply With Quote

Reply

Tags
groovybc, swak4foam


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
[swak4Foam] groovyBC for oscillatory flow liybzd OpenFOAM Community Contributions 5 November 12, 2018 07:53
[swak4Foam] reactingMultiPhaseEulerFoam problems with groovyBC zanilu70 OpenFOAM Community Contributions 4 December 13, 2016 06:46
[swak4Foam] Change in alpha and U with groovyBC in twoPhaseEulerFoam dani2702 OpenFOAM Community Contributions 0 November 17, 2016 03:30
[swak4Foam] groovyBC issue - k and epsilon sagnikmazumdar OpenFOAM Community Contributions 24 March 1, 2015 07:16
[swak4Foam] groovyBC and Eqn.setReference() benk OpenFOAM Community Contributions 3 June 2, 2011 08:49


All times are GMT -4. The time now is 08:04.