CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   write nut fields in simpleFoam (http://www.cfd-online.com/Forums/openfoam-solving/62867-write-nut-fields-simplefoam.html)

maurice March 22, 2009 15:29

write nut fields in simpleFoam
 
Hi All,
Sorry if this question sounds stupid but how can I write out the nut field from simpleFoam? I copied the simpleFoam code to my application directory and then add the following in createFields:

Info << "Creating nut" << endl;
volScalarField nut
(
IOobject
(
"nut",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
turbulence().nut()()
);

It compiles and runs ok but it seems that the output field is uniform and does not chage as iterations go on...

Any suggestions?

Q.

jurich March 22, 2009 21:41

Hello Qi,

You need to add a line into simpleFoam.c:

nut=turbulence->nut();

Your code in createFields.H creates nut as a volScalarField and initializes it with the starting values for turbulent viscosity. The line above is what's necessary to update it during each iteration.

Regards,

J. Urich

maurice March 22, 2009 22:26

Hi jruich,
Thanks a lot. Works now.
Qi

Cynthia Poon March 22, 2009 22:36

Hi all,

I am making a boundary conditon using FvPatchFields, I need to correct the U boundary using another field like nut. I use the normal code find from this forum to get nut in the fvpatchfields, but it fails to run saying that no nut field is detected.

Therefore, I use the same way as the above (creating and copying the nut field in my own solver) by using also this:
kco == turbulence->nut();
This time, the fvPatchField class can detect nut.

The solver together with the boundary condition run successfully, but I cannot use the decomposePar and paraFoam since then, the following is the error message that I got:

[cynthia@atmospheric-turbulence cavity_upbound]$ paraFoam


request for volScalarField kco from objectRegistry region0 failed
available objects of type volScalarField are
0
(
)
#0 Foam::error::printStack(Foam::Ostream&) in "/home/cynthia/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so"
#1 Foam::error::abort() in "/home/cynthia/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so"
#2 Foam::Ostream& Foam::operator<< <Foam::error>(Foam::Ostream&, Foam::errorManip<Foam::error>) in "/home/cynthia/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so"
#3 Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const& Foam::objectRegistry::lookupObject<Foam::Geometric Field<double, Foam::fvPatchField, Foam::volMesh> >(Foam::word const&) const in "/home/cynthia/OpenFOAM/cynthia-1.5/lib/linux64GccDPOpt/libbccondtion.so"
#4 Foam::wallSlipFvPatchVectorField::evaluate(Foam::P stream::commsTypes) in "/home/cynthia/OpenFOAM/cynthia-1.5/lib/linux64GccDPOpt/libbccondtion.so"
#5 Foam::wallSlipFvPatchVectorField::wallSlipFvPatchV ectorField(Foam::fvPatch const&, Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) in "/home/cynthia/OpenFOAM/cynthia-1.5/lib/linux64GccDPOpt/libbccondtion.so"
#6 Foam::fvPatchField<Foam::Vector<double> >::adddictionaryConstructorToTable<Foam::wallSlipF vPatchVectorField>::New(Foam::fvPatch const&, Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) in "/home/cynthia/OpenFOAM/cynthia-1.5/lib/linux64GccDPOpt/libbccondtion.so"
#7 Foam::fvPatchField<Foam::Vector<double> >::New(Foam::fvPatch const&, Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) in "/home/cynthia/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libfiniteVolume.so"
#8 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::GeometricBoundaryField::GeometricB oundaryField(Foam::fvBoundaryMesh const&, Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) in "/home/cynthia/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libfiniteVolume.so"
#9 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::readField(Foam::Istream&) in "/home/cynthia/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libfiniteVolume.so"
#10 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::GeometricField(Foam::IOobject const&, Foam::fvMesh const&) in "/home/cynthia/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libfiniteVolume.so"
#11 void Foam::vtkPV3Foam::convertVolFields<Foam::Vector<do uble> >(Foam::fvMesh const&, Foam::volPointInterpolation const&, Foam::IOobjectList const&, vtkDataArraySelection*, vtkMultiBlockDataSet*) in "/home/cynthia/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libvtkPV3Foam.so"
#12 Foam::vtkPV3Foam::updateVolFields(vtkMultiBlockDat aSet*) in "/home/cynthia/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libvtkPV3Foam.so"
#13 Foam::vtkPV3Foam::Update(vtkMultiBlockDataSet*) in "/home/cynthia/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libvtkPV3Foam.so"
#14 vtkPV3FoamReader::RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) in "/home/cynthia/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libPV3FoamReader_SM.so"
#15 vtkExecutive::CallAlgorithm(vtkInformation*, int, vtkInformationVector**, vtkInformationVector*) in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libvtkFiltering.so.pv3.3"
#16 vtkDemandDrivenPipeline::ExecuteData(vtkInformatio n*, vtkInformationVector**, vtkInformationVector*) in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libvtkFiltering.so.pv3.3"
#17 vtkCompositeDataPipeline::ExecuteData(vtkInformati on*, vtkInformationVector**, vtkInformationVector*) in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libvtkFiltering.so.pv3.3"
#18 vtkDemandDrivenPipeline::ProcessRequest(vtkInforma tion*, vtkInformationVector**, vtkInformationVector*) in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libvtkFiltering.so.pv3.3"
#19 vtkStreamingDemandDrivenPipeline::ProcessRequest(v tkInformation*, vtkInformationVector**, vtkInformationVector*) in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libvtkFiltering.so.pv3.3"
#20 vtkCompositeDataPipeline::ProcessRequest(vtkInform ation*, vtkInformationVector**, vtkInformationVector*) in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libvtkFiltering.so.pv3.3"
#21 vtkDemandDrivenPipeline::UpdateData(int) in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libvtkFiltering.so.pv3.3"
#22 vtkStreamingDemandDrivenPipeline::Update(int) in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libvtkFiltering.so.pv3.3"
#23 vtkAlgorithmCommand(vtkClientServerInterpreter*, vtkObjectBase*, char const*, vtkClientServerStream const&, vtkClientServerStream&) in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libvtkFilteringCS.so"
#24 vtkMultiBlockDataSetAlgorithmCommand(vtkClientServ erInterpreter*, vtkObjectBase*, char const*, vtkClientServerStream const&, vtkClientServerStream&) in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libvtkFilteringCS.so"
#25 vtkPV3FoamReaderCommand(vtkClientServerInterpreter *, vtkObjectBase*, char const*, vtkClientServerStream const&, vtkClientServerStream&) in "/home/cynthia/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libPV3FoamReader_SM.so"
#26 vtkClientServerInterpreter::ProcessCommandInvoke(v tkClientServerStream const&, int) in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libvtkClientServer.so"
#27 vtkClientServerInterpreter::ProcessOneMessage(vtkC lientServerStream const&, int) in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libvtkClientServer.so"
#28 vtkClientServerInterpreter::ProcessStream(vtkClien tServerStream const&) in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libvtkClientServer.so"
#29 vtkSelfConnection::ProcessStreamLocally(vtkClientS erverStream&) in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libvtkPVServerCommon.so"
#30 vtkProcessModuleConnection::SendStream(unsigned int, vtkClientServerStream&) in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libvtkPVServerCommon.so"
#31 vtkProcessModuleConnectionManager::SendStream(long long, unsigned int, vtkClientServerStream&, int) in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libvtkPVServerCommon.so"
#32 vtkProcessModule::SendStream(long long, unsigned int, vtkClientServerStream&, int) in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libvtkPVServerCommon.so"
#33 vtkSMOutputPort::UpdatePipeline(double) in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libvtkPVServerManager.so"
#34 vtkSMSourceProxy::UpdatePipeline(double) in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libvtkPVServerManager.so"
#35 pqOutputPort::getDataInformation(bool) const in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libpqCore.so"
#36 pqDisplayPolicy::getPreferredViewType(pqOutputPort *, bool) const in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libpqCore.so"
#37 pqDisplayPolicy::getPreferredView(pqOutputPort*, pqView*) const in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libpqCore.so"
#38 pqDisplayPolicy::createPreferredRepresentation(pqO utputPort*, pqView*, bool) const in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libpqCore.so"
#39 pqPendingDisplayManager::createPendingDisplays(pqV iew*) in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libpqCore.so"
#40 pqMainWindowCore::qt_metacall(QMetaObject::Call, int, void**) in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libpqComponents.so"
#41 QMetaObject::activate(QObject*, int, int, void**) in "/usr/local/Trolltech/Qt-4.3.5/lib/libQtCore.so.4"
#42 pqObjectInspectorWidget::accept() in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libpqComponents.so"
#43 pqObjectInspectorWidget::qt_metacall(QMetaObject:: Call, int, void**) in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libpqComponents.so"
#44 QMetaObject::activate(QObject*, int, int, void**) in "/usr/local/Trolltech/Qt-4.3.5/lib/libQtCore.so.4"
#45 QAbstractButton::clicked(bool) in "/usr/local/Trolltech/Qt-4.3.5/lib/libQtGui.so.4"
#46 ?? in "/usr/local/Trolltech/Qt-4.3.5/lib/libQtGui.so.4"
#47 ?? in "/usr/local/Trolltech/Qt-4.3.5/lib/libQtGui.so.4"
#48 QAbstractButton::mouseReleaseEvent(QMouseEvent*) in "/usr/local/Trolltech/Qt-4.3.5/lib/libQtGui.so.4"
#49 QWidget::event(QEvent*) in "/usr/local/Trolltech/Qt-4.3.5/lib/libQtGui.so.4"
#50 QApplicationPrivate::notify_helper(QObject*, QEvent*) in "/usr/local/Trolltech/Qt-4.3.5/lib/libQtGui.so.4"
#51 QApplication::notify(QObject*, QEvent*) in "/usr/local/Trolltech/Qt-4.3.5/lib/libQtGui.so.4"
#52 QCoreApplication::notifyInternal(QObject*, QEvent*) in "/usr/local/Trolltech/Qt-4.3.5/lib/libQtCore.so.4"
#53 ?? in "/usr/local/Trolltech/Qt-4.3.5/lib/libQtGui.so.4"
#54 QApplication::x11ProcessEvent(_XEvent*) in "/usr/local/Trolltech/Qt-4.3.5/lib/libQtGui.so.4"
#55 ?? in "/usr/local/Trolltech/Qt-4.3.5/lib/libQtGui.so.4"
#56 g_main_context_dispatch in "/lib64/libglib-2.0.so.0"
#57 g_main_context_prepare in "/lib64/libglib-2.0.so.0"
#58 g_main_context_iteration in "/lib64/libglib-2.0.so.0"
#59 QEventDispatcherGlib::processEvents(QFlags<QEventL oop::ProcessEventsFlag>) in "/usr/local/Trolltech/Qt-4.3.5/lib/libQtCore.so.4"
#60 ?? in "/usr/local/Trolltech/Qt-4.3.5/lib/libQtGui.so.4"
#61 QEventLoop::processEvents(QFlags<QEventLoop::Proce ssEventsFlag>) in "/usr/local/Trolltech/Qt-4.3.5/lib/libQtCore.so.4"
#62 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsF lag>) in "/usr/local/Trolltech/Qt-4.3.5/lib/libQtCore.so.4"
#63 QCoreApplication::exec() in "/usr/local/Trolltech/Qt-4.3.5/lib/libQtCore.so.4"
#64 pqProcessModuleGUIHelper::RunGUIStart(int, char**, int, int) in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libpqCore.so"
#65 vtkProcessModule::StartClient(int, char**) in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libvtkPVServerCommon.so"
#66 vtkProcessModule::Start(int, char**) in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libvtkPVServerCommon.so"
#67 vtkProcessModuleGUIHelper::Run(vtkPVOptions*) in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libvtkPVServerCommon.so"
#68 pqMain::Run(QApplication&, pqProcessModuleGUIHelper*) in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/libpqCore.so"
#69 main in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/paraview"
#70 __libc_start_main in "/lib64/libc.so.6"
#71 _start in "/home/cynthia/OpenFOAM/ThirdParty/ParaView3.3-cvs/platforms/linux64Gcc/bin/paraview"

From function objectRegistry::lookupObject<Type>(const word&) const
in file /home/cynthia/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/objectRegistryTemplates.C at line 142.
FOAM aborting
/home/cynthia/OpenFOAM/OpenFOAM-1.5/bin/paraFoam: line 83: 16607 Aborted paraview --data=$caseFile

I am sorry if my message is too long, but I really don't get an idea why I got the above error message.

Can anybody offer me some help?

Regards,
Cynthia

maurice March 23, 2009 00:19

Hi Cynthia,
Have you tried to convert to VTK and run paraview directly?
Qi

Cynthia Poon March 23, 2009 02:57

Hi Qi and all,

I have try foamToVTK, but the same error message appeared. It cannot detect the user-defined kco field. May I ask where do you define your field? in createField.H and after where turbulence pointer is defined?

Thanks.
Regards,
Cynthia


All times are GMT -4. The time now is 16:01.