groovyBC
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? |
oh i found my mistake!
I didn't add the library to controlDict file |
groovyBC applied after first iteration?
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. |
Dear Camille
after some iteration, save time directory and look the results in paraview by choosing appropriate patch |
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.... |
did you look at patch in other time steps than 0 ?
|
Yes indeed, I am up to two time steps later...
|
Quote:
|
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. |
Quote:
|
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 Code:
velocities { // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 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 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::printStack(Foam::Ostream&) at ??:? #1 Foam::error::abort() at ??:? #2 Foam::Istream& Foam::operator>><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::DimensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) at ??:? #5 Foam::fvPatchField<Foam::Vector<double> >::New(Foam::fvPatch const&, Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) at ??:? #6 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::GeometricBoundaryField::readField( Foam::DimensionedField<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::processEvents(QFlags<QEventL oop::ProcessEventsFlag>) in "/usr/lib64/libQtCore.so.4" #55 in "/usr/lib64/libQtGui.so.4" #56 QEventLoop::processEvents(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 |
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. |
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. |
Quote:
- 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) |
Thank you so much for your valuable help and immediate response!I will proceed as you suggested.
|
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. |
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. |
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. |
Quote:
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) |
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.
|
All times are GMT -4. The time now is 07:28. |