CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Initial conditions for uniform flow (http://www.cfd-online.com/Forums/openfoam/109218-initial-conditions-uniform-flow.html)

andreas November 12, 2012 16:07

Initial conditions for uniform flow
 
Hello,

I'm new in CFD and would like to know how to write the initial conditions for an incompressible fluid between two plane surfaces. I used channelFlow for the mesh, but have to change the 0 folder.

My initial conditions are:
p_inlet = p_outlet
V_initial = 5 m/s

As you imagine, the fluid will slow down untill it stops since there is no pressure gradient.

My initial pressure conditions are:

Code:

dimensions      [0 2 -2 0 0 0 0];

internalField  uniform 1;

boundaryField
{

    inlet
    {
        type            fixedValue;
    value        uniform 1;
    }

    outlet
    {
        type            fixedValue;
    value        uniform 1;
    }

    upAndDown
    {
        type            zeroGradient;
    }
    frontAndBack
    {
        type            empty;
    }
}

My initial speed conditions are:

Code:

dimensions      [0 1 -1 0 0 0 0];

internalField  uniform (5 0 0);

boundaryField
{
    inlet
    {
        type            cyclic;
    }

    outlet
    {
        type            cyclic; 
    }

    TopAndBottom
    {
        type            fixedValue;
        value          uniform (0 0 0);
    }

    frontAndBack
    {
        type            empty;
    }
}

But when I try to push the "apply" button on paraFoam, it automaticaly closes and I come back to the terminal window.

Thanks for your help,
Andreas

batta31 November 15, 2012 07:22

Maybe it's because you have called the same patches with 2 different names in the 2 files? :)

upAndDown & TopAndBottom

andreas November 15, 2012 14:05

It was not the problem, paraFoam still doesn't work.
And it still closes automaticaly when the "apply" button is pushed.

This is the response on the terminal when blockMesh is generated:

Code:

ubuntu@ubuntu-VirtualBox:~/OpenFOAM/Simu/U0$ blockMesh
/*---------------------------------------------------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.1.1                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
Build  : 2.1.1-221db2718bbb
Exec  : blockMesh
Date  : Nov 15 2012
Time  : 18:51:18
Host  : "ubuntu-VirtualBox"
PID    : 2587
Case  : /home/ubuntu/OpenFOAM/Simu/U0
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Creating block mesh from
    "/home/ubuntu/OpenFOAM/Simu/U0/constant/polyMesh/blockMeshDict"
Creating curved edges
Creating topology blocks
Creating topology patches

Creating block mesh topology

Check topology

    Basic statistics
        Number of internal faces : 0
        Number of boundary faces : 6
        Number of defined boundary faces : 6
        Number of undefined boundary faces : 0
    Checking patch -> block consistency

Creating block offsets
Creating merge list .

Creating polyMesh from blockMesh
Creating patches
Creating cells
Creating points with scale 0.1

Writing polyMesh
----------------
Mesh Information
----------------
  boundingBox: (0 0 0) (0.1 0.05 0.01)
  nPoints: 1722
  nCells: 800
  nFaces: 3260
  nInternalFaces: 1540
----------------
Patches
----------------
  patch 0 (start: 1540 size: 20) name: inlet
  patch 1 (start: 1560 size: 20) name: outlet
  patch 2 (start: 1580 size: 80) name: upAndDown
  patch 3 (start: 1660 size: 1600) name: frontAndBack

End

And when paraFoam is generated:
Code:

ubuntu@ubuntu-VirtualBox:~/OpenFOAM/Simu/U0$ paraFoam
created temporary 'U0.OpenFOAM'
OpenGL Warning: Failed to connect to host. Make sure 3D acceleration is enabled for this VM.


--> FOAM FATAL ERROR:
Attempt to cast type wall to type lduInterface

    From function refCast<To>(From&)
    in file /home/opencfd/OpenFOAM/OpenFOAM-2.1.1/src/OpenFOAM/lnInclude/typeInfo.H at line 114.

FOAM aborting

#0  Foam::error::printStack(Foam::Ostream&) in "/opt/openfoam211/platforms/linuxGccDPOpt/lib/libOpenFOAM.so"
#1  Foam::error::abort() addr2line failed
#2  Foam::lduInterface const& Foam::refCast<Foam::lduInterface const, Foam::fvPatch const>(Foam::fvPatch const&) addr2line failed
#3  Foam::cyclicFvPatchField<Foam::Vector<double> >::cyclicFvPatchField(Foam::fvPatch const&, Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) addr2line failed
#4  Foam::fvPatchField<Foam::Vector<double> >::adddictionaryConstructorToTable<Foam::cyclicFvPatchField<Foam::Vector<double> > >::New(Foam::fvPatch const&, Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) addr2line failed
#5  Foam::fvPatchField<Foam::Vector<double> >::New(Foam::fvPatch const&, Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) addr2line failed
#6  Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::GeometricBoundaryField::GeometricBoundaryField(Foam::fvBoundaryMesh const&, Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) in "/opt/openfoam211/platforms/linuxGccDPOpt/lib/libvtkPV3Foam.so"
#7  Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::readField(Foam::dictionary const&) addr2line failed
#8  Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::readField(Foam::Istream&) addr2line failed
#9  Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::GeometricField(Foam::IOobject const&, Foam::fvMesh const&) addr2line failed
#10  void Foam::vtkPV3Foam::convertVolFields<Foam::Vector<double> >(Foam::fvMesh const&, Foam::PtrList<Foam::PrimitivePatchInterpolation<Foam::PrimitivePatch<Foam::face, Foam::SubList, Foam::Field<Foam::Vector<double> > const&, Foam::Vector<double> > > > const&, Foam::IOobjectList const&, bool, vtkMultiBlockDataSet*) addr2line failed
#11  Foam::vtkPV3Foam::convertVolFields(vtkMultiBlockDataSet*) addr2line failed
#12  Foam::vtkPV3Foam::Update(vtkMultiBlockDataSet*, vtkMultiBlockDataSet*) addr2line failed
#13  vtkPV3FoamReader::RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) addr2line failed
#14  vtkMultiBlockDataSetAlgorithm::ProcessRequest(vtkInformation*, vtkInformationVector**, vtkInformationVector*) addr2line failed
#15  vtkExecutive::CallAlgorithm(vtkInformation*, int, vtkInformationVector**, vtkInformationVector*) addr2line failed
#16  vtkDemandDrivenPipeline::ExecuteData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) addr2line failed
#17  vtkCompositeDataPipeline::ExecuteData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) addr2line failed
#18  vtkDemandDrivenPipeline::ProcessRequest(vtkInformation*, vtkInformationVector**, vtkInformationVector*) addr2line failed
#19  vtkStreamingDemandDrivenPipeline::ProcessRequest(vtkInformation*, vtkInformationVector**, vtkInformationVector*) addr2line failed
#20  vtkCompositeDataPipeline::ProcessRequest(vtkInformation*, vtkInformationVector**, vtkInformationVector*) addr2line failed
#21  vtkCompositeDataPipeline::ForwardUpstream(vtkInformation*) addr2line failed
#22  vtkDemandDrivenPipeline::ProcessRequest(vtkInformation*, vtkInformationVector**, vtkInformationVector*) addr2line failed
#23  vtkStreamingDemandDrivenPipeline::ProcessRequest(vtkInformation*, vtkInformationVector**, vtkInformationVector*) addr2line failed
#24  vtkCompositeDataPipeline::ProcessRequest(vtkInformation*, vtkInformationVector**, vtkInformationVector*) addr2line failed
#25  vtkDemandDrivenPipeline::UpdateData(int) addr2line failed
#26  vtkStreamingDemandDrivenPipeline::Update(int) addr2line failed
#27  vtkSISourceProxy::UpdatePipeline(int, double, bool) addr2line failed
#28  vtkSISourceProxyCommand(vtkClientServerInterpreter*, vtkObjectBase*, char const*, vtkClientServerStream const&, vtkClientServerStream&) addr2line failed
#29  vtkClientServerInterpreter::ProcessCommandInvoke(vtkClientServerStream const&, int) addr2line failed
#30  vtkClientServerInterpreter::ProcessOneMessage(vtkClientServerStream const&, int) addr2line failed
#31  vtkClientServerInterpreter::ProcessStream(vtkClientServerStream const&) addr2line failed
#32  vtkPVSessionCore::ExecuteStreamInternal(vtkClientServerStream const&, bool) addr2line failed
#33  vtkPVSessionCore::ExecuteStream(unsigned int, vtkClientServerStream const&, bool) addr2line failed
#34  vtkPVSessionBase::ExecuteStream(unsigned int, vtkClientServerStream const&, bool) addr2line failed
#35  vtkSMProxy::ExecuteStream(vtkClientServerStream const&, bool, unsigned int) addr2line failed
#36  vtkSMOutputPort::UpdatePipelineInternal(double, bool) addr2line failed
#37  vtkSMOutputPort::UpdatePipeline(double) addr2line failed
#38  vtkSMSourceProxy::UpdatePipeline(double) addr2line failed
#39  pqPipelineSource::updatePipeline() addr2line failed
#40  pqDisplayPolicy::getPreferredViewType(pqOutputPort*, bool) const addr2line failed
#41  pqDisplayPolicy::getPreferredView(pqOutputPort*, pqView*) const addr2line failed
#42  pqDisplayPolicy::createPreferredRepresentation(pqOutputPort*, pqView*, bool) const addr2line failed
#43  pqObjectInspectorWidget::show(pqPipelineSource*) addr2line failed
#44  pqObjectInspectorWidget::accept() addr2line failed
#45  at moc_pqObjectInspectorWidget.cxx:0
#46  QMetaObject::activate(QObject*, QMetaObject const*, int, void**) addr2line failed
#47  QAbstractButton::clicked(bool) addr2line failed
#48  addr2line failed
#49  addr2line failed
#50  QAbstractButton::mouseReleaseEvent(QMouseEvent*) addr2line failed
#51  QWidget::event(QEvent*) addr2line failed
#52  QAbstractButton::event(QEvent*) addr2line failed
#53  QPushButton::event(QEvent*) addr2line failed
#54  QApplicationPrivate::notify_helper(QObject*, QEvent*) addr2line failed
#55  QApplication::notify(QObject*, QEvent*) addr2line failed
#56  QCoreApplication::notifyInternal(QObject*, QEvent*) addr2line failed
#57  QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) addr2line failed
#58  addr2line failed
#59  QApplication::x11ProcessEvent(_XEvent*) addr2line failed
#60  addr2line failed
#61  g_main_context_dispatch addr2line failed
#62  addr2line failed
#63  g_main_context_iteration addr2line failed
#64  QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) addr2line failed
#65  addr2line failed
#66  QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) addr2line failed
#67  QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) addr2line failed
#68  QCoreApplication::exec() addr2line failed
#69  QApplication::exec() addr2line failed
#70  main addr2line failed
#71  __libc_start_main addr2line failed
#72 
 addr2line failed
Aborted (core dumped)

Thank you for your help!

batta31 November 15, 2012 14:12

Maybe there's something wrong in the patch wall

Quote:

Attempt to cast type wall to type lduInterface

maddalena November 16, 2012 11:20

Hi,
you defined inlet and outlet as cyclic (as in U), but you give them a fixedValue. you should use cyclic instead.

mad

Lieven November 16, 2012 16:00

I'm somewhat confused why you would say

Quote:

As you imagine, the fluid will slow down untill it stops since there is no pressure gradient.
If you use channelFoam, you should set a mean flow rate Ubar in transportProperties. In the solver, a pressure gradient is calculated based on this flow rate and imposed as an external force (alternatively you can easily modify the solver to be able to impose a pressure gradient directly).

So your flow will certainly not stop. The fact that this pressure gradient is imposed independently from p means however, that on average this field will be equal to 0. But if you want to have the total pressure in the channel, you need to account for the pressure gradient in a post-processing step.

Regards,

L


All times are GMT -4. The time now is 10:22.