|
[Sponsors] |
[OpenFOAM] How to correctly show the result of #codeStream# internalField? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 7, 2017, 06:38 |
How to correctly show the result of #codeStream# internalField?
|
#1 |
Member
Di Cheng
Join Date: May 2010
Location: Beijing, China
Posts: 47
Rep Power: 16 |
Hi, everyone
I just used codeStream to generate some initial condtion and codedFixedValue to generate some boundary condtion. The codedFixedValue BC can be correctly executed and loaded using paraFoam (I am using OF1612+ in docker), however, the codeStream initial condition can be correctly interpreted and executed but cannot be loaded in paraFoam. I was running the forwardStep with following "0/U" file Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: plus | | \\ / A nd | Web: 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 (3 0 0); internalField #codeStream { 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) { //spatial coordinates, type: scalar scalar x = CC[cellI].x(); scalar y = CC[cellI].y(); scalar z = CC[cellI].z(); T[cellI] = vector(3+0.2*sin(10*x),0,0); } //void Foam::Field<Type>::writeEntry(const word& keyword, Ostream& os) const T.writeEntry("", os); #}; //! Optional: codeInclude #{ #include "fvCFD.H" #}; //! Optional: codeOptions #{ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude #}; //! libs: codeLibs #{ -lmeshTools #}; }; boundaryField { inlet { type codedMixed; refValue uniform (3 0 0); //default value refGradient uniform (0 0 0); //default value valueFraction uniform 1; redirectType linearOscillatingBC; //name of new BC type code #{ const vectorField& Cf = patch().Cf(); // get face center coordinate; scalar ymax = max(Cf&vector(0,1,0)); // `&` is dot product scalar ymin = min(Cf&vector(0,1,0)); // Info<<"ymax="<<ymax<<",ymin="<<ymin<<nl; vectorField& rvf = this->refValue(); vectorField& rgf = this->refGrad(); scalarField& vf = this->valueFraction(); //temporal coordinate, type: scalar scalar t =this->db().time().value(); // get time //Oscillating parameters scalar omega = 5; scalar A = 0.2; scalar tt = (1+A*sin(omega*t)); // temporal term, separated forAll(Cf,faceI) { //spatial coordinates, type: scalar //scalar x = Cf[faceI].x(); scalar y = Cf[faceI].y(); //scalar z = Cf[faceI].z(); rvf[faceI] = vector(((y-ymin)/(ymax-ymin)+2.5)*tt,0.0,0.0); rgf[faceI] = Zero; vf[faceI] = 1.0; } #}; //I do not know why I need to add those things //codeInclude //#{ // #include "fvCFD.H" //#}; //codeOptions //#{ // -I$(LIB_SRC)/finiteVolume/lnInclude //#}; } outlet { type inletOutlet; inletValue uniform (3 0 0); value uniform (3 0 0); } bottom { type symmetryPlane; } top { type symmetryPlane; } obstacle { type slip; } defaultFaces { type empty; } } // ************************************************************************* // Code:
Created temporary 'forwardStepMod3.OpenFOAM' Using #codeStream at line 21 in file "/home/di/OpenFOAM/di-v1612+/run/forwardStepMod3/0/U" Using #codeStream with "/home/di/OpenFOAM/di-v1612+/run/forwardStepMod3/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libcodeStream_ba5ce8457724532859ca03bd0612f92a5665a90f.so" Invoking wmake libso /home/di/OpenFOAM/di-v1612+/run/forwardStepMod3/dynamicCode/_ba5ce8457724532859ca03bd0612f92a5665a90f wmake libso /home/di/OpenFOAM/di-v1612+/run/forwardStepMod3/dynamicCode/_ba5ce8457724532859ca03bd0612f92a5665a90f --> FOAM FATAL IO ERROR: Failed loading library "/home/di/OpenFOAM/di-v1612+/run/forwardStepMod3/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libcodeStream_ba5ce8457724532859ca03bd0612f92a5665a90f.so" Did you add all libraries to the 'libs' entry in system/controlDict? file: /home/di/OpenFOAM/di-v1612+/run/forwardStepMod3/0/U from line 17 to line 17. From function static void (* Foam::functionEntries::codeStream::getFunction(const Foam::dictionary&, const Foam::dictionary&))(Foam::Ostream&, const Foam::dictionary&) in file db/dictionary/functionEntries/codeStream/codeStream.C at line 309. FOAM exiting Code:
Created temporary 'forwardStepMod3.OpenFOAM' --> FOAM Warning : From function void* Foam::dlOpen(const Foam::fileName&, bool) in file POSIX.C at line 1244 dlopen error : /home/di/OpenFOAM/di-v1612+/run/forwardStepMod3/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libcodeStream_ba5ce8457724532859ca03bd0612f92a5665a90f.so: undefined symbol: _ZTIN4Foam6fvMeshE --> FOAM Warning : From function bool Foam::dlLibraryTable::open(const Foam::fileName&, bool) in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 101 could not load "/home/di/OpenFOAM/di-v1612+/run/forwardStepMod3/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libcodeStream_ba5ce8457724532859ca03bd0612f92a5665a90f.so" Using #codeStream at line 21 in file "/home/di/OpenFOAM/di-v1612+/run/forwardStepMod3/0/U" Using #codeStream with "/home/di/OpenFOAM/di-v1612+/run/forwardStepMod3/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libcodeStream_ba5ce8457724532859ca03bd0612f92a5665a90f.so" Invoking wmake libso /home/di/OpenFOAM/di-v1612+/run/forwardStepMod3/dynamicCode/_ba5ce8457724532859ca03bd0612f92a5665a90f wmake libso /home/di/OpenFOAM/di-v1612+/run/forwardStepMod3/dynamicCode/_ba5ce8457724532859ca03bd0612f92a5665a90f --> FOAM FATAL IO ERROR: Failed loading library "/home/di/OpenFOAM/di-v1612+/run/forwardStepMod3/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libcodeStream_ba5ce8457724532859ca03bd0612f92a5665a90f.so" Did you add all libraries to the 'libs' entry in system/controlDict? file: /home/di/OpenFOAM/di-v1612+/run/forwardStepMod3/0/U from line 17 to line 17. From function static void (* Foam::functionEntries::codeStream::getFunction(const Foam::dictionary&, const Foam::dictionary&))(Foam::Ostream&, const Foam::dictionary&) in file db/dictionary/functionEntries/codeStream/codeStream.C at line 309. FOAM exiting |
|
Tags |
codestream, openfoam, parafoam |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Difference of the max function result with full field, internalField and boundaryFiel | cyss38 | OpenFOAM Programming & Development | 1 | October 2, 2018 05:39 |
CFD post cannot load results-Error appeared? | mariam.sara | ANSYS | 9 | September 17, 2018 15:23 |
[Workbench] Current result file may not contain requested result data | zhizhuo | ANSYS Meshing & Geometry | 0 | December 13, 2017 04:18 |
Simulation won't show turbulence | pete_87 | OpenFOAM Running, Solving & CFD | 4 | June 25, 2014 11:35 |
Geometry show in Result Display | ShFlow | FLOW-3D | 3 | January 11, 2009 20:51 |