|
[Sponsors] |
How to create the internalField with #codeStream |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
November 3, 2016, 12:48 |
How to create the internalField with #codeStream
|
#1 |
New Member
Join Date: Jun 2014
Posts: 22
Rep Power: 12 |
Dear all,
I tried to use #codeStream to create the internalField in OpenFoam 4.1. The code is at the following: Code:
internalField #codeStream { code #{ scalar x0=-0.6; scalar y0=0; const IOdictionary& d = static_cast<const IOdictionary&>(dict); const fvMesh& mesh = refCast<const fvMesh>(d.db()); scalarField newField(mesh.nCells(), 0);// fld(mesh.nCells(), 1.2) or fld(mesh.nCells()) // to set a position-dependent value forAll(mesh.C(), i) { scalar x = mesh.C()[i].x(); scalar y = mesh.C()[i].y(); scalar rSqr = magSqr(x-x0) + magSqr(y-y0); scalar r = sqrt(rSqr); newField[i] =exp(- pow(r,1)); } newField.writeEntry("", os); // now return the value of fld as the internal field value #}; codeInclude #{ #include "fvCFD.H" #}; codeOptions #{ -I$(LIB_SRC)/finiteVolume/lnInclude #}; }; The error code in OF4.1 is the following: Code:
Using #codeStream at line 19 in file "/u/user/OpenFOAM/user-4.1/case1/0/T" Using #codeStream with "/u/user/OpenFOAM/user-4.1/case1/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libcodeStream_5fb0fb15ace670c74f854b9267f149e18da51df6.so" Creating new library in "dynamicCode/_5fb0fb15ace670c74f854b9267f149e18da51df6/platforms/linux64GccDPInt32Opt/lib/libcodeStream_5fb0fb15ace670c74f854b9267f149e18da51df6.so" Invoking "wmake -s libso /u/user/OpenFOAM/user-4.1/case1/dynamicCode/_5fb0fb15ace670c74f854b9267f149e18da51df6" wmakeLnInclude: linking include files to ./lnInclude Making dependency list for source file codeStreamTemplate.C could not open file cyclicAMILduInterface.H for source file codeStreamTemplate.C due to No such file or directory could not open file cyclicAMIPolyPatch.H for source file codeStreamTemplate.C due to No such file or directory In file included from /opt/openfoam4/src/finiteVolume/lnInclude/ddtScheme.C:30:0, from /opt/openfoam4/src/finiteVolume/lnInclude/ddtScheme.H:337, from /opt/openfoam4/src/finiteVolume/lnInclude/fvcDdt.C:28, from /opt/openfoam4/src/finiteVolume/lnInclude/fvcDdt.H:199, from /opt/openfoam4/src/finiteVolume/lnInclude/fvc.H:44, from /opt/openfoam4/src/finiteVolume/lnInclude/fvCFD.H:8, from /u/user/OpenFOAM/user-4.1/case1/0/T.#codeStream:36: /opt/openfoam4/src/finiteVolume/lnInclude/cyclicAMIFvPatch.H:39:35: fatal error: cyclicAMILduInterface.H: No such file or directory compilation terminated. /opt/openfoam4/wmake/rules/General/transform:8: recipe for target 'Make/linux64GccDPInt32Opt/codeStreamTemplate.o' failed make: *** [Make/linux64GccDPInt32Opt/codeStreamTemplate.o] Error 1 --> FOAM FATAL IO ERROR: Failed wmake "dynamicCode/_5fb0fb15ace670c74f854b9267f149e18da51df6/platforms/linux64GccDPInt32Opt/lib/libcodeStream_5fb0fb15ace670c74f854b9267f149e18da51df6.so" |
|
November 5, 2016, 05:42 |
|
#2 |
Senior Member
|
Hi,
Code:
$ pwd $HOME/OpenFOAM/OpenFOAM-4.1/src $ find . -name 'cyclicAMILduInterface.H' ./meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H ./meshTools/lnInclude/cyclicAMIPolyPatch.H |
|
April 25, 2017, 11:25 |
|
#3 |
New Member
Yu Cheng
Join Date: Aug 2014
Posts: 15
Rep Power: 12 |
The answer given by Alexey is exact solution for OF version >2.4.0. Thank you
Yu |
|
May 6, 2017, 11:35 |
|
#4 |
Member
Di Cheng
Join Date: May 2010
Location: Beijing, China
Posts: 47
Rep Power: 16 |
Hi, Alexey
Your solution works for OpenFOAM 201612+, however, when it comes to post-process using paraFOAM ( rather than paraview only). It shows some error like this: --------------------------------------------------------------------- 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_f72d8df02b71ca83b7c6dc9d8f194b2d2d74 8bbd.so" Invoking wmake libso /home/di/OpenFOAM/di-v1612+/run/forwardStepMod3/dynamicCode/_f72d8df02b71ca83b7c6dc9d8f194b2d2d748bbd wmake libso /home/di/OpenFOAM/di-v1612+/run/forwardStepMod3/dynamicCode/_f72d8df02b71ca83b7c6dc9d8f194b2d2d748bbd --> FOAM FATAL IO ERROR: Failed loading library "/home/di/OpenFOAM/di-v1612+/run/forwardStepMod3/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libcodeStream_f72d8df02b71ca83b7c6dc9d8f194b2d2d74 8bbd.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(con st Foam::dictionary&, const Foam::dictionary&))(Foam::Ostream&, const Foam::dictionary&) in file db/dictionary/functionEntries/codeStream/codeStream.C at line 309. FOAM exiting --------------------------------------------------------------------- Do you have any idea to load the library correctly? |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
internalField condition | mchehab2 | OpenFOAM Running, Solving & CFD | 14 | November 10, 2022 14:28 |
create the file *.foam | phongstar | OpenFOAM | 12 | October 14, 2018 19:06 |
[GAMBIT] How to plot S pipe | mariam.sara | ANSYS Meshing & Geometry | 36 | November 7, 2013 16:22 |
[ANSYS Meshing] is it possible to create virtual edges on the blades | er_ijaz | ANSYS Meshing & Geometry | 0 | November 3, 2013 06:15 |
[DesignModeler] Design Modeller create surface | papis | ANSYS Meshing & Geometry | 0 | October 31, 2013 14:52 |