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

Configuration of boundary conditions and fvOptions file

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By LuckyTran

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 26, 2019, 05:13
Default Configuration of boundary conditions and fvOptions file
  #1
Senior Member
 
Raza Javed
Join Date: Apr 2019
Location: Germany
Posts: 183
Rep Power: 7
Raza Javed is on a distinguished road
Hello everyone,


I am implementing the chtMultiRegionSimpleFoam. My geometry consists of three solid regions (Hot, Cold and Pipe). Hot box and Cold box are connected using pipe between them.


I am making one box hot by generating the heat source using fvOptions file. My fvOptions file is given below:


Code:
heatSource
{
    type            scalarSemiImplicitSource;
    active          true;
 
    scalarSemiImplicitSourceCoeffs
    {
        selectionMode   all; // all, cellSet, cellZone, points
       // cellZone        heatSrc;
        //cellSet         hotFace;
        volumeMode      absolute; // specific;
        injectionRateSuSp
        {
            h     (1000 0);
        }
    }
}
When I run the simulation, I can see the temperature change from hot box to cold box through the pipe between them.


According to my understanding the power that I am putting in the fvOptions file (h (1000 0)) is related to the temperature change by the formula below:


Q = k*A*(delta T)/L


where A is the area of the pipe, k is thermal conductivity and L is the length of the pipe, and delta-T is the temperature gradient.


when I put the power as Q in the above relation, it doesn't give me the same temperature gradient as I got in simulation.


I don't know where is the mistake OR what I am doing wrong?


I have checked various threads on this forum about using fvOptions, and most of them are saying that you can put directly your power in fvOptions like I did above.


After checking all the possibilities I deduced that there might be a problem with my boundary conditions.



I am giving my changeDictionaryDict file of all the three regions below:


Cold box



Code:
T
{
    internalField   uniform 300;
    defaultFaces
    {
        type            patch;

    }
    boundaryField
    {
        "defaultFaces"
        {
            type            zeroGradient;

        }
        "Cold_to_.*"
        {
            type            compressible::turbulentTemperatureCoupledBaffleMixed;
            Tnbr            T;
            kappaMethod     solidThermo;
            kappaName       none;
            value           uniform 300;
        }
    }
}

Pipe


Code:
T
{
    internalField   uniform 300;
    defaultFaces
    {
        type            patch;

    }
    boundaryField
    {
        "defaultFaces"
        {
            type            zeroGradient;

        }
        "pipe_to_.*"
        {
            type            compressible::turbulentTemperatureCoupledBaffleMixed;
            Tnbr            T;
            kappaMethod     solidThermo;
            kappaName       none;
            value           uniform 300;
        }
    }
}
Hot Box
Code:
T
{
    internalField   uniform 300;
    defaultFaces
    {
        type            patch;

    }
    boundaryField
    {
        "defaultFaces"
        {
            type            zeroGradient;

        }
        "Hot_to_.*"
        {
            type            compressible::turbulentTemperatureCoupledBaffleMixed;
            Tnbr            T;
            kappaMethod     solidThermo;
            kappaName       none;
            value           uniform 300;
        }
    }
 }

Do I have any problem with the boundary conditions? OR fvOptions file? I would be really thankful if someone can figure out where is the mistake. I would be glad to give any further information if required.


Thank you
Raza Javed is offline   Reply With Quote

Old   April 26, 2019, 09:45
Default
  #2
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,674
Rep Power: 65
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
h(1000 0) with volumeMode absolute means there is a h (energy) source of 1000 W in every cell. That means you have to add up 1000 W times the number of cells affected. You also used selectionMode all which means every single cell in your domain has this heat source (including the cold box).

How do you calculate Q from h (1000 0)? You are specifying Power per cell, not total power. And are you sure you want to apply the source to all cells?
LuckyTran is offline   Reply With Quote

Old   April 26, 2019, 10:05
Default
  #3
Senior Member
 
Raza Javed
Join Date: Apr 2019
Location: Germany
Posts: 183
Rep Power: 7
Raza Javed is on a distinguished road
Thank you so much for your reply.


I am sorry I am new to openfoam... I want to make only my hot box a heat source (Does it mean that all the cells of hot box will have a separate heat source?). and I have a power of 1000W but I exactly don't know that how to introduce that power into fvOptions file (or how to configure fvOption) file for it, so that I can be sure that my temperature gradient in the pipe is relating to the power I have given...


I didn't calculate the power from Q, I just want to create a heat source that takes this power (1000W) as input and gives temperature as output, and that temperature will be transferred to cold box through pipe.


But exactly don't know how to achieve it.
Raza Javed is offline   Reply With Quote

Old   April 26, 2019, 10:12
Default
  #4
Senior Member
 
Raza Javed
Join Date: Apr 2019
Location: Germany
Posts: 183
Rep Power: 7
Raza Javed is on a distinguished road
Here is the result of the simulation, when I run my case.
Attached Images
File Type: jpg power.jpg (30.4 KB, 49 views)
Raza Javed is offline   Reply With Quote

Old   April 26, 2019, 10:29
Default
  #5
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,674
Rep Power: 65
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
You want a total power of 1000 W, but right now you are specifying 1000 W per cell.


You are using selectionMode all; Use selectionMode cellSet; or selectionMode cellZone; and then specify the proper cellSet or cellZone representing the hot region.


volumeMode absolute; specifies the raw heat source in W.
volumeMode specific; specifies the volumetric source in W/m^3. Probably volumeMode specific is closer to what you want. You need to know the total volume of the hot region to figure out what number to specify.
LuckyTran is offline   Reply With Quote

Old   April 26, 2019, 10:40
Default
  #6
Senior Member
 
Raza Javed
Join Date: Apr 2019
Location: Germany
Posts: 183
Rep Power: 7
Raza Javed is on a distinguished road
I have edited my fvoptions file like this:


Code:
heatSource
{
    type            scalarSemiImplicitSource;
    active          true;
 
    scalarSemiImplicitSourceCoeffs
    {
        selectionMode   cellZone; // all, cellSet, cellZone, points
        cellZone        Hot;
        //cellSet         c1;
        volumeMode      specific; // specific;
        injectionRateSuSp
        {
            h     (1000 0);
        }
    }
}
And my log file looks like this;


Code:
    Adding fvOptions

Creating finite volume options from "constant/fvOptions"

Selecting finite volume options model type scalarSemiImplicitSource
    Source: heatSource
    - selecting cells using cellZone Hot
    - selected 4478 cell(s) with volume 900000
And my definitions of the cell zones are as follows:
Code:
0: Hot is cellZone
1: Cold is cellZone
2: pipe is cellZone

Constructing mesh with non-default patches of size:

--> FOAM Warning : 
    From function Foam::polyMesh::polyMesh(const Foam::IOobject&, const Foam::Xfer<Foam::Field<Foam::Vector<double> > >&, const cellShapeList&, const faceListList&, const wordList&, const wordList&, const Foam::word&, const Foam::word&, const wordList&, bool)
    in file meshes/polyMesh/polyMeshFromShapeMesh.C at line 595
    Found 7280 undefined faces in mesh; adding to default patch.
Adding cell and face zones
 Cell Zone Hot     4478
 Cell Zone Cold     4287
 Cell Zone pipe     5524

End
Now based on this configuration, Can I use this 1000W of power as total power (Q in the formula of first post) to find out the temperature change?



Quote:
Q = k*A*(delta T)/L
Also to add to your notice, my temperature has shifted to 303.1053K which was 300.2 before the changes you mentioned.

Code:
Solving for solid region Cold
DICPCG:  Solving for h, Initial residual = 0.002070642, Final residual = 2.278098e-05, No Iterations 2
Min/max T:300.008 303.1053
ExecutionTime = 13.88 s  ClockTime = 14 s

End

Now I just want to verify this temperature change by hand calculation.
Raza Javed is offline   Reply With Quote

Old   April 26, 2019, 10:54
Default
  #7
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,674
Rep Power: 65
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
You've specified 1000 W/m^3 over a volume of 900 000 m^3. That's not a Q of 1000W but 900 MW!


Also, does 900000 m^3 sound like the right volume for your hot box? Maybe you forgot to scale the mesh at some point?
LuckyTran is offline   Reply With Quote

Old   April 26, 2019, 11:16
Default
  #8
Senior Member
 
Raza Javed
Join Date: Apr 2019
Location: Germany
Posts: 183
Rep Power: 7
Raza Javed is on a distinguished road
Thank you so much.


Quote:
You've specified 1000 W/m^3 over a volume of 900 000 m^3. That's not a Q of 1000W but 900 MW!
So, it means that to get the power of 1000W I need to put value (h (0.001 0)) in fvOption file?


And if I put the value of "h" as (0.001 0) then the simulation looks like in the attached image.


Quote:
Also, does 900000 m^3 sound like the right volume for your hot box? Maybe you forgot to scale the mesh at some point?

My volume is so high because my hot box dimensions are 300m*300m*10m.
Attached Images
File Type: jpg new.jpg (34.2 KB, 13 views)
Raza Javed is offline   Reply With Quote

Old   May 2, 2019, 11:32
Default
  #9
Senior Member
 
Raza Javed
Join Date: Apr 2019
Location: Germany
Posts: 183
Rep Power: 7
Raza Javed is on a distinguished road
Hello LuckyTran,


My version of OpenFoam is 4.1.


I have one question.


I have searched alot on this forum and almost everywhere else. No one even encountered this error. Probably, I am doing a very stupid mistake.



I am using topoSetDict to make a faceSet from a patch, and then I want to make cellSet using that faceSet.


My topoSetDict file is given below:


Code:
actions
(
    {
        name    hot1;
        type    faceSet;
        action  new;
        source  patchToFace;
        sourceInfo
        {
            name "hotFace";
        }
    }
     
// Select based on faceSet
    {
        name    hotcell;
        type    cellSet;
        action  new;
        source  faceToCell;
        sourceInfo
        {
            set hot1;             // Name of faceSet

            //option neighbour; // cell with neighbour in faceSet
            //option owner;     //  ,,       owner
            option any;         // cell with any face in faceSet
            //option all;       // cell with all faces in faceSet
        } 
    }
the log file shows that it has created faceSet and cellSet,


Code:
Create time

Create polyMesh for time = 0

Reading topoSetDict

Time = 0
    mesh not changed.
Created faceSet hot1
    Applying source patchToFace
    Adding all faces of patch hotFace ...
    Found matching patch hotFace with 253 faces.
    faceSet hot1 now size 253
Created cellSet hotcell
    Applying source faceToCell
    Adding cells according to faceSet hot1 ...
    cellSet hotcell now size 253
End
but I am getting the following error:


Code:
--> FOAM FATAL ERROR: 
Illegal content 8200 of set:hotcell of type cellSet
Value should be between 0 and 6396

    From function void Foam::topoSet::check(Foam::label)
    in file sets/topoSets/topoSet.C at line 189.

FOAM aborting

#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::error::abort() at ??:?
#2  Foam::topoSet::check(int) at ??:?
#3  Foam::cellSet::cellSet(Foam::polyMesh const&, Foam::word  const&, Foam::IOobject::readOption, Foam::IOobject::writeOption) at  ??:?
#4  Foam::fv::cellSetOption::setCellSet() at ??:?
#5  Foam::fv::cellSetOption::cellSetOption(Foam::word const&,  Foam::word const&, Foam::dictionary const&, Foam::fvMesh  const&) at ??:?
#6   Foam::fv::option::adddictionaryConstructorToTable<Foam::fv::SemiImplicitSource<double>  >::New(Foam::word const&, Foam::word const&,  Foam::dictionary const&, Foam::fvMesh const&) at ??:?
#7  Foam::fv::option::New(Foam::word const&, Foam::dictionary const&, Foam::fvMesh const&) at ??:?
#8  Foam::fv::optionList::reset(Foam::dictionary const&) at ??:?
#9  Foam::fv::optionList::optionList(Foam::fvMesh const&, Foam::dictionary const&) at ??:?
#10  Foam::fv::options::options(Foam::fvMesh const&) at ??:?
#11  ? at ??:?
#12  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#13  ? at ??:?
Aborted (core dumped)
I don't know where I did mistake. I would be highly thankful if you can help me out in this.


Thank you
Raza Javed is offline   Reply With Quote

Old   May 3, 2019, 10:47
Default
  #10
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,674
Rep Power: 65
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
If you're only applying the heat source to the cells that are adjacent to a patch anyway... why not just use a heat flux boundary condition instead of trying to jack the volumetric heat source?


Maybe post what you did to get to the error. Some context would help.... I see that the error is complaining you're trying to assign cell number 8200 to the set hotcell and it can't because there are only 6396 cells and cell 8200 doesn't exist. I have no idea under what circumstances this can happen without some clues.
LuckyTran is offline   Reply With Quote

Old   May 3, 2019, 10:57
Default
  #11
Member
 
Priyanka P
Join Date: Apr 2019
Location: Germany
Posts: 40
Rep Power: 7
priyankap is on a distinguished road
Hi..


Thank you so much for your reply.


Actually I am making heat source using fvOptions, and I am putting power in fvOptions to generate heat source.



Now I want to have a heat source on one face. For that I created a faceSet. as you can see below in the figure (red face)


Then I made cellSet from that faceSet. But that is something different. it is the red face with some triangular cells with it. you can see in the figure also.


My problem is that I just want one face of a solid to be a heat source using fvOptions, and fvOptions should take power as a parameter.
Attached Images
File Type: jpg faceSet.jpg (85.1 KB, 13 views)
File Type: jpg cellSet.jpg (79.5 KB, 17 views)

Last edited by priyankap; May 3, 2019 at 11:13. Reason: I am Raza Javed's colleague, we are working on the same project, so I am replying instead of him, as he is currently not here
priyankap is offline   Reply With Quote

Old   May 3, 2019, 11:10
Default
  #12
Member
 
Priyanka P
Join Date: Apr 2019
Location: Germany
Posts: 40
Rep Power: 7
priyankap is on a distinguished road
Hi,


I am attaching dropbox link to my case also, If you can find time to have a look, I would be highly thankful.


Thank you so much.




https://www.dropbox.com/sh/3fy3k575f...MLiNQ-WOa?dl=0
priyankap is offline   Reply With Quote

Old   May 3, 2019, 11:24
Default
  #13
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,674
Rep Power: 65
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
Quote:
Originally Posted by priyankap View Post
Hi..


Thank you so much for your reply.

Actually I am making heat source using fvOptions, and I am putting power in fvOptions to generate heat source.

Now I want to have a heat source on one face. For that I created a faceSet. as you can see below in the figure (red face)

My problem is that I just want one face of a solid to be a heat source using fvOptions, and fvOptions should take power as a parameter.

Yes I understand that, hence my complaint. A heat source on a face is just a heat flux. The heat flux BC is wayyy easier to do. Why not just do that?


You need to stop trying to make up your own language because that makes it really hard for anyone trying to help you because they don't know your language. Cells are not faces and faces are not cells! Let me tell you what you are doing...


You marked the faces on your patch.
You then marked the cells that are adjacent to this patch.
You created a cellSet of the cells adjacent to the patch. These are cells, with volumes, not faces.


You are now generating a heat source in this cellSet... which is not the same adding heat through faces. You can never apply a volumetric heat flux through a face.


I'm not going to open your files. If you can't find the time to explain what you did, I am unwilling to spend the time to look at them. More importantly, I have no freakin clue what commands you type into the terminal to encounter the errors.
altinel likes this.
LuckyTran is offline   Reply With Quote

Old   May 3, 2019, 11:29
Default
  #14
Member
 
Priyanka P
Join Date: Apr 2019
Location: Germany
Posts: 40
Rep Power: 7
priyankap is on a distinguished road
Thank you for your reply.


I am sorry I am asking you this. but I don't have so much experience in Openfoam.


Can you please guide me a little about how can I use heatflux BC on one face? Can I use the power of 65 W to give heat flux boundary condition on one face?




Thank you
priyankap is offline   Reply With Quote

Old   May 3, 2019, 12:16
Default
  #15
Member
 
Priyanka P
Join Date: Apr 2019
Location: Germany
Posts: 40
Rep Power: 7
priyankap is on a distinguished road
I am sorry to annoy you with wrong language here. I am new to OpenFoam and hence not very familiar with the names.



Also, I realized that it was a wrong way to make a cellSet from the faceSet.


I sent you my files because I felt I was unable to explain my problem correctly.


I will try to explain you as good as I can.


1. I created a geomerty with 3 regions: i) hot , ii) cold and iii) pipe in salome.

2. In region "hot" , I defined a face called hotFace.
3. Now I import this geometry as unv file in openfoam. and ran
Code:
ideasUnvToFoam heatTransfer_new.unv
4. Then I used

Code:
topoSet
5. my topoSetDict file is:
Code:
actions
(
    {
        name    hot1;
        type    faceSet;
        action  new;
        source  patchToFace;
        sourceInfo
        {
            name "hotFace";
        }
    }



//cellSet

    {

        name    hotcell;
        type    cellSet;
        action  new;
        source  faceToCell;
        sourceInfo
        {
            set hot1;     
            option  any;    
        }
    }
6. Then, I used

Code:
splitMeshRegions -cellZones -overwrite | tee log.splitMeshRegions
7. This command created the three regions which I mentioned above (hot, cold, pipe).

8. Based on the boundary file inside constant/region_name/polyMesh folder, I changed the changeDictionaryDict file.
9. I added fvOptions file in region "hot" which is given below:
Code:
heatSource
{
    type            scalarSemiImplicitSource;
    active          true;
 
    scalarSemiImplicitSourceCoeffs
    {
        selectionMode   cellSet; // all, cellSet, cellZone, points
        //cellZone        hot;        
        cellSet         hotcell;
        volumeMode      specific; // absolute;
        injectionRateSuSp
        {
            h     (2600 0);
        }
    }
}
10. After doing all these 9 steps I run my case from the begining using ./Allrun command in terminal. My Allrun file is given below:
Code:
#!/bin/sh
cd ${0%/*} || exit 1    # run from this directory


# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions


#runApplication blockMesh

ideasUnvToFoam heatTransfer_new.unv | tee log.ideasUnvToFoam
runApplication topoSet | tee log.topoSet
splitMeshRegions -cellZones -overwrite | tee log.splitMeshRegions
mv /home/openfoam/run/heatTransfer_new/constant/polyMesh/sets /home/openfoam/run/heatTransfer_new/constant/hot/polyMesh



# remove fluid fields from solid regions (important for post-processing)
for i in cold hot pipe
do
   rm -f 0*/$i/{mut,alphat,epsilon,k,U,p_rgh}
done

for i in cold hot pipe
do
   changeDictionary -region $i > log.changeDictionary.$i 2>&1
done


#-- Run on single processor
#runApplication `getApplication`
chtMultiRegionSimpleFoam | tee log.chtMultiRegionSimpleFoam
## Decompose
#runApplication decomposePar -allRegions
#
## Run
#runParallel `getApplication` 4
#
## Reconstruct
#runApplication reconstructPar -allRegions


echo
echo "creating files for paraview post-processing"
echo
paraFoam -touchAll

# ----------------------------------------------------------------- end-of-file
11. Now, I get the error that I have posted before in my earlier post.


I tried my best to explain my problem here. Please let me know if you can't understand something.


Thanks a lot for taking out time for this.
priyankap is offline   Reply With Quote

Old   May 3, 2019, 15:37
Default
  #16
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,674
Rep Power: 65
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
Ok but at which point do you get the error.... You actually gave me an all run script and are asking me to find it?
LuckyTran is offline   Reply With Quote

Old   May 3, 2019, 16:35
Default
  #17
Member
 
Priyanka P
Join Date: Apr 2019
Location: Germany
Posts: 40
Rep Power: 7
priyankap is on a distinguished road
Thank you for your reply.


I am getting this error when fvOption tries to select finite volume options. But if I am unable to explain it, I am attaching the error log below:




Code:
 Adding fvOptions

Creating finite volume options from "system/fvOptions"

Selecting finite volume options model type scalarSemiImplicitSource
    Source: heatSource
    - selecting cells using cellSet hotcell


--> FOAM FATAL ERROR: 
Illegal content 8200 of set:hotcell of type cellSet
Value should be between 0 and 6396

    From function void Foam::topoSet::check(Foam::label)
    in file sets/topoSets/topoSet.C at line 189.

FOAM aborting

Thank you
priyankap is offline   Reply With Quote

Reply

Tags
boundary conditions, fvoption, openfoam, power, temperature


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
Issues on the simulation of high-speed compressible flow within turbomachinery dowlee OpenFOAM Running, Solving & CFD 11 August 6, 2021 06:40
Appropriate boundary conditions using buoyantBoussenesqPimpleFoam sturgeon OpenFOAM Running, Solving & CFD 5 August 7, 2020 04:06
Interface boundary conditions in chtMultiRegionFoam bibin.sme OpenFOAM Running, Solving & CFD 8 April 27, 2020 10:12
Divergence while using cyclic boundary conditions in twoPhaseEulerFoam shanvach OpenFOAM Running, Solving & CFD 0 April 25, 2019 13:01
[mesh manipulation] patch splitting for different boundary conditions vaina74 OpenFOAM Meshing & Mesh Conversion 12 April 3, 2019 14:45


All times are GMT -4. The time now is 06:35.