CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Help with codeStream in chtMultiregionFoam case

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 14, 2023, 08:18
Question Help with codeStream in chtMultiregionFoam case
  #1
New Member
 
Chris
Join Date: Jan 2022
Posts: 22
Rep Power: 4
Chris T is on a distinguished road
I'm trying to use codeStream to implement a very simple initial condition for a region that contains air in my case. I'm trying to solve the case in parallel with the chtMultiregionFoam solver.
The condition I need to impose is to to have 3 different temperature regions. One at T_out another one at T_max and another region between the previous two to gradually vary the temperature.


My T file for that specific region is the following

Code:
dimensions      [ 0 0 0 1 0 0 0 ];

internalField   #codeStream//uniform 400;
{
   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());
      
      scalar T_out = 320;
      scalar T_max = 450;
      scalar y_o = 0;
      scalar y_d= 0.1;
      
      scalarField T(mesh.nCells(), T_out);
      
      forAll(T, i)
      {
         //const scalar x = mesh.C()[i][0];
         const scalar y = mesh.C()[i][1];
         //const scalar z = mesh.C()[i][2];
         if ( ( y > y_o) && (y < y_d)  ) 
         {
            T[i] = T_out + (T_max-T_out)*y/y_d;
         }
         if ( y > y_d)
         {
            T[i] = T_max;
         }
       }
       writeEntry(os, "", T);
   #}; 
}

boundaryField
{    
    free_air
    {
        type        zeroGradient;//fixedValue;
        value           uniform 300;
    }
    "air_to_receiver_(hot|mid)"
    {
        type            compressible::turbulentTemperatureRadCoupledMixed;
        value           $internalField;
        Tnbr            T;
        kappaMethod     fluidThermo;
        kappa           none;
    }
    air_to_receiver_out
    {
        type            compressible::turbulentTemperatureCoupledBaffleMixed;
        value           $internalField;
        Tnbr            T;
        kappaMethod     fluidThermo;
        kappa           none;
    }
}
The error I get while running decomposePar is

Code:
Time = 0
Using #codeStream at line 19 in file "/home/ct/OpenFOAM/ct-9/run/iSTORE/iSTORE_conical_radiation_2/0/air/T"
Using #codeStream with "/home/ct/OpenFOAM/ct-9/run/iSTORE/iSTORE_conical_radiation_2/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libcodeStream_71df4e2699f44fe883e845da37e52226fb0ad032.so"
Creating new library in "dynamicCode/_71df4e2699f44fe883e845da37e52226fb0ad032/platforms/linux64GccDPInt32Opt/lib/libcodeStream_71df4e2699f44fe883e845da37e52226fb0ad032.so"
"/opt/openfoam9/etc/codeTemplates/dynamicCode/codeStreamTemplate.C" "/home/ct/OpenFOAM/ct-9/run/iSTORE/iSTORE_conical_radiation_2/dynamicCode/_71df4e2699f44fe883e845da37e52226fb0ad032/codeStreamTemplate.C"
Invoking "wmake -s libso /home/ct/OpenFOAM/ct-9/run/iSTORE/iSTORE_conical_radiation_2/dynamicCode/_71df4e2699f44fe883e845da37e52226fb0ad032"
wmake libso /home/ct/OpenFOAM/ct-9/run/iSTORE/iSTORE_conical_radiation_2/dynamicCode/_71df4e2699f44fe883e845da37e52226fb0ad032
    ln: ./lnInclude
    wmkdep: codeStreamTemplate.C
    Ctoo: codeStreamTemplate.C
    ld: /home/ct/OpenFOAM/ct-9/run/iSTORE/iSTORE_conical_radiation_2/dynamicCode/_71df4e2699f44fe883e845da37e52226fb0ad032/../platforms/linux64GccDPInt32Opt/lib/libcodeStream_71df4e2699f44fe883e845da37e52226fb0ad032.so
codeStream : dictionary:"/home/ct/OpenFOAM/ct-9/run/iSTORE/iSTORE_conical_radiation_2/0/air/T" master-only-reading:0

on processor 0 have masterSize:827336 and localSize:827336

on processor 0 after waiting: have masterSize:827336 and localSize:827336
Opening cached dictionary:"/home/ct/OpenFOAM/ct-9/run/iSTORE/iSTORE_conical_radiation_2/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libcodeStream_71df4e2699f44fe883e845da37e52226fb0ad032.so"
codeStream : dictionary:"/home/ct/OpenFOAM/ct-9/run/iSTORE/iSTORE_conical_radiation_2/0/air/T" master-only-reading:0


--> FOAM FATAL IO ERROR: 
Illegal dictionary entry or environment variable name "internalField"
Valid dictionary entries are 1(dimensions)

file: /home/ct/OpenFOAM/ct-9/run/iSTORE/iSTORE_conical_radiation_2/0/air/T from line 17 to line 17.

    From function bool Foam::primitiveEntry::expandVariable(const Foam::variable&, const Foam::dictionary&)
    in file db/dictionary/primitiveEntry/primitiveEntry.C at line 92.

FOAM exiting

Completed in 9 seconds
I tried to follow the instruction in the slides from : https://wiki.openfoam.com/Programming2

I'm running OpenFoam v9.

I also tried to find example in the tutorial folder but I didn't find anything similar to the think I try to do.


Does anybody know where my mistake is or alternatively how else I could implement my initial condition?
Chris T is offline   Reply With Quote

Old   February 20, 2024, 14:59
Lightbulb
  #2
Member
 
Thiago Parente Lima
Join Date: Sep 2011
Location: Diamantina, Brazil.
Posts: 62
Rep Power: 14
thiagopl is on a distinguished road
Hi Chris,

Have you tried first to run a case analogous to the tutorial slides, setting a different value for T in an elliptical region?
I am asking you because in my case not even this case compiles... If you are succesfull on it , please let us know.

Regards.

P.s.: sorry, the post from February 14, 2023 and not 2024 :#
__________________
Fields of interest: buoyantFoam, chtMultRegionFoam.

Last edited by thiagopl; February 20, 2024 at 15:07. Reason: Didn't notice it is an old question.
thiagopl is offline   Reply With Quote

Reply

Tags
codestream, parallel


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[OpenFOAM] post-processing chtMultiRegionFoam case in paraview? phsieh2005 ParaView 2 July 15, 2016 15:05
Is Playstation 3 cluster suitable for CFD work hsieh OpenFOAM 9 August 16, 2015 14:53
Multiregion Heat Transfer + natural convection (water) with chtMultiRegionFoam fattychickenrun OpenFOAM 5 October 31, 2011 16:53
Error reading new case montag dp FLUENT 5 September 15, 2011 06:00
Transient case running with a super computer microfin FLUENT 0 March 31, 2009 11:20


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