|
[Sponsors] |
writeEntry while using codeStream(OFv1906 v.s. OF7) |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 13, 2020, 02:48 |
writeEntry while using codeStream(OFv1906)
|
#1 |
New Member
Join Date: May 2016
Posts: 11
Rep Power: 9 |
Hi all,
I followed the tutorial, https://wiki.openfoam.com/Programming2 http://www.wolfdynamics.com/wiki/pro...streamINIT.pdf and tried to learn using codeStream in Dictionary to set B.C. And I found that OFv1906 has a different definition of writeEntry. with the original line, writeEntry(os, "", alpha); this error pop up error: ‘Foam::scalarField {aka class Foam::Field<double>}’ has no member named ‘writeEntry ’ then I follow the instruction in src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.H and change the line to alpha.writeEntry("",os); this error pop up /home/sam/OpenFOAM/sam-v1906/run/codeStream_INIT/fillBox_BCIC/0/alpha.water.#codeStream:59:15: error: ‘Foam::scalarField {aka class Foam::Field<double>}’ has no member named ‘writeEntry ’ What's happening.? Last edited by samwong; March 13, 2020 at 05:15. Reason: misunderstand the situation |
|
March 13, 2020, 04:22 |
|
#2 |
New Member
Join Date: May 2016
Posts: 11
Rep Power: 9 |
Anyone? please help
|
|
March 13, 2020, 11:39 |
|
#3 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,684
Rep Power: 40 |
Quote:
The second one with Code:
field.writeEntry(keyword, os); must work. Need to check if there is something else wrong. https://develop.openfoam.com/Develop...d/Field.H#L361 |
||
February 2, 2022, 08:55 |
codestream for Taylor-Green Vortex initial conditions
|
#4 |
New Member
Konstantinos Missios
Join Date: Mar 2017
Location: Copenhagen, Denmark.
Posts: 12
Rep Power: 9 |
I just wanted to add a small implementation based on the above discussion. It is not the same field but the procedure remains sort of similar.
So, scope of the folowing code stream is the generation of Taylor-Green Vortex initial conditions in order to simulate some canonical DNS case. The files that codestream needs to be used is the velocity file U under the 0 directory as well as the pressure file p under the same directory. Here are attached the code snippets of those files First is given the U file Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: v2006 | | \\ / A nd | Website: www.openfoam.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volVectorField; object U; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 1 -1 0 0 0 0]; //internalField uniform (0 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 U_0(mesh.nCells(), Foam::Vector<double>(0.,0.,0.)); forAll(U_0, i) { const scalar x = mesh.C()[i][0]; const scalar y = mesh.C()[i][1]; const scalar z = mesh.C()[i][2]; U_0[i] = Foam::Vector<double>(-Foam::cos(x) *Foam::sin(y), Foam::sin(x) *Foam::cos(y), 0.); } U_0.writeEntry("",os) ; #}; }; boundaryField { upperBoundary { type cyclic; } lowerBoundary { type cyclic; } leftBoundary { type cyclic; } rightBoundary { type cyclic; } frontAndBack { type empty; } } // ************************************************************************* // Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: v2006 | | \\ / A nd | Website: www.openfoam.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; object p; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 2 -2 0 0 0 0]; //internalField uniform 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()); scalarField p_0(mesh.nCells(), 0.); forAll(p_0, i) { const scalar x = mesh.C()[i][0]; const scalar y = mesh.C()[i][1]; const scalar z = mesh.C()[i][2]; p_0[i]=-0.25*(Foam::cos(2*x) + Foam::cos(2*y)); } p_0.writeEntry("",os) ; #}; }; boundaryField { upperBoundary { type cyclic; } lowerBoundary { type cyclic; } leftBoundary { type cyclic; } rightBoundary { type cyclic; } frontAndBack { type empty; } } // ************************************************************************* // Best K |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[OpenFOAM.org] OpenFOAM installation problem (of7 not working) | tenichols19 | OpenFOAM Installation | 3 | September 20, 2019 02:24 |