|
[Sponsors] |
using codestream to initialize internal velocity |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 21, 2020, 13:35 |
using codestream to initialize internal velocity
|
#1 |
New Member
Yanxuan Shao
Join Date: Sep 2019
Posts: 5
Rep Power: 7 |
Hi Everyone,
I am trying to use codestream to initialize internal velocity and here is my 0/U file Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 4.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volVectorField; object U; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 1 -1 0 0 0 0]; //internalField uniform (2 0 0); internalField #codeStream { codeInclude #{ #include "fvCFD.H" #}; codeOptions #{ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude #}; codeLibs #{ -lmeshTools \ -lfiniteVolume #}; code #{ const IOdictionary& d = static_cast<const IOdictionary&>(dict); const fvMesh& mesh = refCast<const fvMesh>(d.db()); vectorField T(mesh.nCells()); const vectorField& CC = mesh.C(); //cell center forAll(CC,cellI) { scalar x = CC[cellI].x(); scalar y = CC[cellI].y(); T[cellI] = vector(1-pow(y,2),-sin(x),0); } T.writeEntry("", os); #}; }; boundaryField { frontAndBack { type empty; } walls { type noSlip; } outlet { type inletOutlet; value $internalField; inletValue uniform (0 0 0); } inlet { type groovyBC; variables "yp=pts().y;para=1-pow(yp,2);"; // variables "yp=pts().y;minY=min(yp);maxY=max(yp);para=-(maxY-pos().y)*(pos().y-minY)/(pow(maxY-minY,2))*normal();"; valueExpression "para"; value uniform (0 0 0); } } // ************************************************************************* // Code:
--> FOAM FATAL IO ERROR: compound has already been transfered from token on line 0 the empty compound of type List<vector> file: /home/yanxuan/OpenFOAM/yanxuan-5.0/run/2d_poi/0/U.boundaryField.outlet.value at line 0. From function Foam::token::compound& Foam::token::transferCompoundToken(const Foam::Istream&) in file lnInclude/token.C at line 99. FOAM aborting #0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::IOerror::abort() at ??:? #2 Foam::token::transferCompoundToken(Foam::Istream const&) at ??:? #3 Foam::Istream& Foam::operator>><Foam::Vector<double> >(Foam::Istream&, Foam::List<Foam::Vector<double> >&) in "/opt/openfoam5/platforms/linux64GccDPInt32Opt/bin/simpleFoam" #4 Foam::Field<Foam::Vector<double> >::Field(Foam::word const&, Foam::dictionary const&, int) in "/opt/openfoam5/platforms/linux64GccDPInt32Opt/bin/simpleFoam" #5 Foam::inletOutletFvPatchField<Foam::Vector<double> >::inletOutletFvPatchField(Foam::fvPatch const&, Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) at ??:? #6 Foam::fvPatchField<Foam::Vector<double> >::adddictionaryConstructorToTable<Foam::inletOutletFvPatchField<Foam::Vector<double> > >::New(Foam::fvPatch const&, Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) at ??:? #7 Foam::fvPatchField<Foam::Vector<double> >::New(Foam::fvPatch const&, Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) in "/opt/openfoam5/platforms/linux64GccDPInt32Opt/bin/simpleFoam" #8 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::Boundary::readField(Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) in "/opt/openfoam5/platforms/linux64GccDPInt32Opt/bin/simpleFoam" #9 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::readFields(Foam::dictionary const&) in "/opt/openfoam5/platforms/linux64GccDPInt32Opt/bin/simpleFoam" #10 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::readFields() in "/opt/openfoam5/platforms/linux64GccDPInt32Opt/bin/simpleFoam" #11 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::GeometricField(Foam::IOobject const&, Foam::fvMesh const&) in "/opt/openfoam5/platforms/linux64GccDPInt32Opt/bin/simpleFoam" #12 ? in "/opt/openfoam5/platforms/linux64GccDPInt32Opt/bin/simpleFoam" #13 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6" #14 ? in "/opt/openfoam5/platforms/linux64GccDPInt32Opt/bin/simpleFoam" Aborted (core dumped) Charlotte |
|
February 25, 2020, 06:20 |
|
#2 |
Senior Member
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14 |
Hi!
The outlet value is your problem as you can see from the error. Instead of "$internalField;" set to "uniform (0 0 0);" for example. The code will correct this based on the inletOutlet BC. |
|
February 25, 2020, 18:23 |
|
#3 |
New Member
Yanxuan Shao
Join Date: Sep 2019
Posts: 5
Rep Power: 7 |
Thanks for your reply! It is working well now!
|
|
Tags |
codestream, initial velocity field |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF comilation error. urgent help please | m zubair | Fluent UDF and Scheme Programming | 4 | February 10, 2019 12:19 |
How does CFX initialize velocity fluctuations in LES? | dtmith | CFX | 3 | June 4, 2017 04:09 |
[swak4Foam] how to initialize a random velocity field with funkySetFields | Andrea1984 | OpenFOAM Community Contributions | 18 | August 2, 2016 07:02 |
Velocity in Porous medium : HELP! HELP! HELP! | Kali Sanjay | Phoenics | 0 | November 6, 2006 07:10 |
what the result is negatif pressure at inlet | chong chee nan | FLUENT | 0 | December 29, 2001 06:13 |