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

Adding Energy Equation for porousSimpleFoam

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 31, 2014, 21:04
Default Adding Energy Equation for porousSimpleFoam
  #1
New Member
 
Yesaswi
Join Date: Jan 2014
Posts: 26
Rep Power: 12
yesaswi92 is on a distinguished road
Hi,

I am new to openFOAM. I am trying to add energy equation for simplePorousFoam. I initially attempted the same for simpleFoam solver by
  • adding TEqn.H,
  • including this header file in <solver>.C,
  • editing createFields.H
  • making necessary changes in the make folder
.

This ran successfully.

I repeated the same for porousSimpleFoam. Practically, this doesn't work as the energy equations are different for different domains (porous and non porous). OpenFOAM deals with this my making modifications in the equation based on the inout porosity parameters. It used member functions like
  • addResistance()
.

Could anyone help me to implement the similar approach for energy equation too??
yesaswi92 is offline   Reply With Quote

Old   April 3, 2014, 14:34
Default porousSimpleFoam
  #2
New Member
 
Yesaswi
Join Date: Jan 2014
Posts: 26
Rep Power: 12
yesaswi92 is on a distinguished road
Hi all,

Can someone explain me how the porous simple foam works? All I know is it modifies the original momentum equation just for the porous zone

I want to add a temperature equation in the same way. It should have basic energy equation for fluid zone and porous temperature equation for porous zone.

So, can someone help me out with this?

Thank You,
Yesaswi
yesaswi92 is offline   Reply With Quote

Old   July 27, 2015, 00:44
Default
  #3
New Member
 
Ipos
Join Date: Feb 2015
Posts: 7
Rep Power: 11
Kittipos is on a distinguished road
Hi Yesaswi

I have a problem same as you.

If you know about that. Could you describe to me pls.

Thx
Kittipos is offline   Reply With Quote

Old   July 28, 2015, 12:33
Default
  #4
Member
 
Kapa Lilla
Join Date: Mar 2009
Location: Bruxelles, Belgium
Posts: 57
Rep Power: 17
klilla is on a distinguished road
porousSimpleFoam add an additional force term in the region where porosity is defined, do not solve a different equation there.

So, if you want temperature equation everywhere and just add a source/sink in the porous regions that is fine, you can use fvOptions for simple sources or swak SourceExpression for more elaborated ones.

If you want to solve two distinct equations depending on the region, you need something like multiregion handling, like in conjugate heat transfer, because there you will have boundary conditions in the interface to keep the problem well-posed. That is difficult, I think and I cannot help with that.

Could you describe a bit better your problem?
Kittipos and svramana like this.
klilla is offline   Reply With Quote

Old   July 29, 2015, 07:04
Default
  #5
New Member
 
Ipos
Join Date: Feb 2015
Posts: 7
Rep Power: 11
Kittipos is on a distinguished road
Hi klilla

I use fvOptions for source but it has error.

Can you explain me about that pls.

Code:
#0  Foam::error::printStack(Foam::Ostream&) in "/opt/openfoam221/platforms/linuxGccDPOpt/lib/libOpenFOAM.so"
#1  Foam::sigFpe::sigHandler(int) in "/opt/openfoam221/platforms/linuxGccDPOpt/lib/libOpenFOAM.so"
#2  Uninterpreted: 
#3   Foam::heRhoThermo<Foam::rhoThermo,  Foam::pureMixture<Foam::sutherlandTransport<Foam::species::thermo<Foam::hConstThermo<Foam::perfectGas<Foam::specie>  >, Foam::sensibleInternalEnergy> > > >::calculate() in  "/opt/openfoam221/platforms/linuxGccDPOpt/lib/libfluidThermophysicalModels.so"
#4   Foam::heRhoThermo<Foam::rhoThermo,  Foam::pureMixture<Foam::sutherlandTransport<Foam::species::thermo<Foam::hConstThermo<Foam::perfectGas<Foam::specie>  >, Foam::sensibleInternalEnergy> > > >::correct() in  "/opt/openfoam221/platforms/linuxGccDPOpt/lib/libfluidThermophysicalModels.so"
#5  
 in "/opt/openfoam221/platforms/linuxGccDPOpt/bin/rhoPorousSimpleFoam"
#6  __libc_start_main in "/lib/i386-linux-gnu/libc.so.6"
#7  
 in "/opt/openfoam221/platforms/linuxGccDPOpt/bin/rhoPorousSimpleFoam"
Floating point exception (core dumped)
regards

Kittipos

Last edited by Kittipos; August 4, 2015 at 00:03.
Kittipos is offline   Reply With Quote

Old   January 25, 2018, 05:42
Default porousSimpleFoam
  #6
Member
 
Ramana
Join Date: Jul 2017
Location: India
Posts: 58
Rep Power: 9
svramana is on a distinguished road
Hi,
I am new to openFOAM. I am trying to simulate Heat transfer from a porous square cylinder maintained at constant temeperature to a flowing wind.I want to add temperature equation and Brinkmann term for PorousSimpleFoam.

initially I added TEqn.H similar to procedure explained for icofoam solver and made necessary changes in header file ,create fields and make file

here are my observations for which i need some clarifications

TEqn:fvScalarMatrix TEqn
(
//fvm::ddt(T) // <--- steady state simulation, so ddt disabled...
//+
fvm::div(phi, T)
- fvm::laplacian(DT, T)
==
fvOptions(T) // porouszone is maintained at const. temperature
);
TEqn.relax();
fvOptions.constrain(TEqn);
TEqn.solve();
fvOptions.correct(T);

UEqn:
tmp<fvVectorMatrix> tUEqn
(
fvm::div(phi, U)
//- fvm::laplacian(nu, U) //<<------ here i added brinkmann term
+ MRF.DDt(U)
+ turbulence->divDevReff(U)
==
fvOptions(U)
);
fvVectorMatrix& UEqn = tUEqn.ref();

UEqn.relax();

header file modifications

// Pressure-velocity SIMPLE corrector
{
#include "UEqn.H"
#include "TEqn.H" // TEqn included here
#include "pEqn.H"
}

laminarTransport.correct();
turbulence->correct();
Make file modifications:

my_porousSimpleFoam.C

EXE = $(FOAM_USER_APPBIN)/my_porousSimpleFoam

fvOptions Dict:
s1
{
type scalarFixedValueConstraint;
active true;


scalarFixedValueConstraintCoeffs
{
selectionMode cellZone;
cellZone porousBlockage;
volumeMode uniform;
fieldValues
{
T 303;
}
}
}

incoming flow is at const temp. 283

following are the flow and heat transfer parameters considered
Re 40
Darcy no (Da ): 10e-6,10e-4 ,10e-2
porosity values: 0..629,0.8,0.993
Pr :0.71
when i run the simulation the Cd and Nusselt number values are not matching with the case which i want to validate

So, can someone help me out with this?

Thank You,
Svramana
Attached Images
File Type: png cfd domain.png (28.3 KB, 69 views)

Last edited by svramana; January 25, 2018 at 05:53. Reason: to add simulation domain
svramana is offline   Reply With Quote

Old   February 7, 2018, 17:10
Post multiRegionReactingPorousSimpleFoam
  #7
Senior Member
 
Lasse Brams Vinther
Join Date: Oct 2015
Posts: 118
Rep Power: 11
Swagga5aur is on a distinguished road
Hello Ramana,

Seems like you got the hang of things, creating your own solver, feel free to link your case and I may be able to look into it in the upcoming weekend.

In the mean time, I have been working on a chemical catalyst model expanding upon the usermade solver called multiRegionSimpleReactingFoam (originally by TonkomoLLC https://github.com/TonkomoLLC/multiRegionReactingFoam).
I have added a thermal model to the solid domain inside of the fluid domain, which may be a reacting mixture or not.

This solver is not validated or tested enough but builds in OF4 (I'll soon update it to OF5), but it may give you a hint at what may the be next move.

The solver does not include a heat transfer model between the porous media and the fluid, however, it may be included using fvoptions.

Hope its of any help.

https://www.dropbox.com/s/vgtl1o1be5...am.tar.gz?dl=0

Regards Lasse
Swagga5aur is offline   Reply With Quote

Old   February 10, 2018, 14:07
Default
  #8
Member
 
Ramana
Join Date: Jul 2017
Location: India
Posts: 58
Rep Power: 9
svramana is on a distinguished road
Quote:
Originally Posted by Swagga5aur View Post
Hello Ramana,

Seems like you got the hang of things, creating your own solver, feel free to link your case and I may be able to look into it in the upcoming weekend.

In the mean time, I have been working on a chemical catalyst model expanding upon the usermade solver called multiRegionSimpleReactingFoam (originally by TonkomoLLC https://github.com/TonkomoLLC/multiRegionReactingFoam).
I have added a thermal model to the solid domain inside of the fluid domain, which may be a reacting mixture or not.

This solver is not validated or tested enough but builds in OF4 (I'll soon update it to OF5), but it may give you a hint at what may the be next move.

The solver does not include a heat transfer model between the porous media and the fluid, however, it may be included using fvoptions.

Hope its of any help.

https://www.dropbox.com/s/vgtl1o1be5...am.tar.gz?dl=0

Regards Lasse

Dear Lasse,
Thank you so much for your replay and please find the case folder (solver ,case and ref. paper) for your reference .
I will definitely go through the reference link and will update you . https://www.dropbox.com/s/e3i9wxifcg...e1.tar.gz?dl=0


Reagards,
S.V.Ramana
svramana is offline   Reply With Quote

Old   February 12, 2018, 15:44
Default
  #9
Senior Member
 
Lasse Brams Vinther
Join Date: Oct 2015
Posts: 118
Rep Power: 11
Swagga5aur is on a distinguished road
Hello Ramana,

I implemented your case in the following:

https://www.dropbox.com/s/eesdzhxa6x...er.tar.gz?dl=0

I chose to solve it with chtMultiRegionSimpleFoam, a transient version also exists, however, you may not agree with the implementation.

The main issue is the porosity model inside the porous domain, it is just solved as normal fluid problem. To improve it either implement a porousity model in fvoption applying it only in the porous domain or divide the domain into a non porous domain or a porous domain, and then implement a custom boundary condition from the fluid - fluid inside porous domain.

I would due the prior as its much simpler compared to the custom boundary conditions.

Let me know if you have any questions, it was just a quick setup and the case is ready for the chtMultiRegionSimpleFoam call, if you wish to recreate it just create your mesh as usual and use the topodict on only the solid (porous) domain, by copying the polymesh into the porous folder and running the Allporos.

Additionally, note that I build the case based upon the heatTransfer tutorial chtMultiRegionSimpleFoam called heatExchanger, and that the AoE and htcConst should be determined from the heat transfer rate between the solid porous domain and the fluid.

Regards Lasse.
Swagga5aur is offline   Reply With Quote

Old   February 14, 2018, 04:36
Default
  #10
Member
 
Ramana
Join Date: Jul 2017
Location: India
Posts: 58
Rep Power: 9
svramana is on a distinguished road
Quote:
Originally Posted by Swagga5aur View Post
Hello Ramana,

I implemented your case in the following:

https://www.dropbox.com/s/eesdzhxa6x...er.tar.gz?dl=0

I chose to solve it with chtMultiRegionSimpleFoam, a transient version also exists, however, you may not agree with the implementation.

The main issue is the porosity model inside the porous domain, it is just solved as normal fluid problem. To improve it either implement a porousity model in fvoption applying it only in the porous domain or divide the domain into a non porous domain or a porous domain, and then implement a custom boundary condition from the fluid - fluid inside porous domain.

I would due the prior as its much simpler compared to the custom boundary conditions.

Let me know if you have any questions, it was just a quick setup and the case is ready for the chtMultiRegionSimpleFoam call, if you wish to recreate it just create your mesh as usual and use the topodict on only the solid (porous) domain, by copying the polymesh into the porous folder and running the Allporos.

Additionally, note that I build the case based upon the heatTransfer tutorial chtMultiRegionSimpleFoam called heatExchanger, and that the AoE and htcConst should be determined from the heat transfer rate between the solid porous domain and the fluid.

Regards Lasse.
Hi Lassi,
I am using single domain approach ,i don't have the thermo physical properties.All i have is Reynold number(nu),Pr No:0.71(for air),permiability K and porosity.
svramana is offline   Reply With Quote

Old   February 14, 2018, 12:48
Default
  #11
Senior Member
 
Lasse Brams Vinther
Join Date: Oct 2015
Posts: 118
Rep Power: 11
Swagga5aur is on a distinguished road
Hello Ramana,

My bad, however, as the tempererature is fixed any of the solid properties don't matter.
The reason for the implementation is due to the enthalpy setup in chtMultiregionFoam allowing for a simple heat exchanger model implementation, which also may be used for a single domain approach.

If you plan on using your own solver, I would implement the heat transfer model in the fvOptions based upon heat transfer in a porous domain.
Below is an example of a abit more complex heat source implementation in chtMultiRegionFoam, showing how to call cell values in fvoptions and defining a source.

Code:
energySource
{
    type            scalarCodedSource;	//scalarSemiImplicitSource
    active          true;
    name	    sourceTime;

    scalarCodedSourceCoeffs	//scalarSemiImplicitSourceCoeffs    S(x) = Su + Sp*x  //   q in [W]; or in [W/m³] if you use specific mode
    {
        selectionMode   cellZone;
        cellZone        porousity1;
	fields 		(h);

	fieldNames	(h);
	name		sourceTime;

        codeInclude
        #{

        #};

        codeCorrect
        #{
//            Pout<< "**codeCorrect**" << endl;
        #};

        codeAddSup
        #{
//            const Time& time = mesh().time();
            const scalarField& V = mesh_.V();
            const vectorField& C = mesh_.C();
	    const volVectorField& U = mesh().lookupObject<volVectorField>("U");
	    const volScalarField z = U.mesh().C() & vector(0,0,1);

            scalarField& hSource = eqn.source();
            forAll(C, i)
            {
            	hSource[i] -= ((600000 - 40000*exp(-200*mag(0.5-z[i])))*V[i]);
            }
//            Pout << "***codeAddSup***" << endl;
        #};

        codeSetValue
        #{
//            Pout<< "**codeSetValue**" << endl;
        #};

        // Dummy entry. Make dependent on above to trigger recompilation
        code
        #{
            $codeInclude
            $codeCorrect
            $codeAddSup
            $codeSetValue
        #};
    }

    sourceTimeCoeffs
    {
        // Dummy entry
    }
}
Regards Lasse
Swagga5aur is offline   Reply With Quote

Old   February 19, 2018, 07:10
Default problem with porousmedia heat transfer using simple foam
  #12
Member
 
Ramana
Join Date: Jul 2017
Location: India
Posts: 58
Rep Power: 9
svramana is on a distinguished road
Hi,

i
Code:
f you want temperature equation everywhere and just add a source/sink in the porous regions that is fine, you can use fvOptions for simple sources
what are the boundary conditions that needs to be specified at the interface between porous zone and fluid for heat transfer simulation.

Regards,
S.V.ramana
svramana is offline   Reply With Quote

Old   February 19, 2018, 14:48
Default
  #13
Senior Member
 
Lasse Brams Vinther
Join Date: Oct 2015
Posts: 118
Rep Power: 11
Swagga5aur is on a distinguished road
Hello Ramana,

Sorry for the late reply, however, I realised that the above mentioned piece of code does not work with the TEqn, and requires EEqn(to my understanding) and is therefore not of use to you unless you use solvers like chtMultiRegionFoam.

To define the conditions between the porous zone and fluid I would suggest you looking into empirical relations or analytical porous reactor modelling as it will describe modelling of the heat transfer between the two regions.

Here is a source in regarding the above: https://www.politesi.polimi.it/bitst..._DiStefano.pdf

Sorry for the inconvenience, regards Lasse.
Swagga5aur is offline   Reply With Quote

Old   February 20, 2018, 13:05
Default
  #14
New Member
 
Adri
Join Date: Sep 2017
Posts: 24
Rep Power: 9
Adri_12 is on a distinguished road
Dear Lasse,

Thanks for your case and explanations, it really helps me a lot cause I am building a transient case with a 3 region problem (air/porous/air) non thermal equilibrium between hot air going through the porous zone.

Quote:
Originally Posted by klilla View Post

If you want to solve two distinct equations depending on the region, you need something like multiregion handling, like in conjugate heat transfer, because there you will have boundary conditions in the interface to keep the problem well-posed. That is difficult, I think and I cannot help with that.
The quote above is coherent with your proposition Lasse. But it is not clear for me if the Darcy-Forchheimer model in fvOptions will be enough accurate compared to porousSimpleFoam equations solved to consider porosity effects on my problem.

Can you explain the difference between both approaches ?

Thanks !

adrià
Adri_12 is offline   Reply With Quote

Old   February 20, 2018, 16:11
Default
  #15
Senior Member
 
Lasse Brams Vinther
Join Date: Oct 2015
Posts: 118
Rep Power: 11
Swagga5aur is on a distinguished road
Hello Adrià, to my understanding the porousSimpleFoam allows for either implicit in the tensorial resistance or the transport using the spherical part of the resistance in the momentum diagonal (from the solver source).

The transport approach is used by fvOptions through the means of the Darcy-Forchheimer model.

I would say it would be the same approach and as accurate using the Darcy-Forchheimer model, and could easily be tested with use of a simple case, first solved with porousSimpleFoam and then chtMultiRegionFoam.

Regards Lasse
Swagga5aur is offline   Reply With Quote

Old   March 1, 2018, 12:06
Default
  #16
New Member
 
Adri
Join Date: Sep 2017
Posts: 24
Rep Power: 9
Adri_12 is on a distinguished road
Quote:
Originally Posted by Swagga5aur View Post

I would say it would be the same approach and as accurate using the Darcy-Forchheimer model, and could easily be tested with use of a simple case, first solved with porousSimpleFoam and then chtMultiRegionFoam.
Ok Lasse thank you very much for your explanations, I will try & give you more details when I get results.

Adrià
Adri_12 is offline   Reply With Quote

Old   April 13, 2018, 04:07
Default Const. Temp on porous cylinder surface
  #17
Member
 
Ramana
Join Date: Jul 2017
Location: India
Posts: 58
Rep Power: 9
svramana is on a distinguished road
Hi all
Code:
TEqn:fvScalarMatrix TEqn
        (
fvm::div(phi, T)
            - fvm::laplacian(DT, T)
         ==
    fvOptions(T) // porouszone is maintained at const. temperature
        );
    TEqn.relax();
    fvOptions.constrain(TEqn);
    TEqn.solve();
    fvOptions.correct(T);
);
in the above TEqn.H, Fixed tempearture in "entire porouszone" is defined using " fvOption/scalarExplicitSetValue " constarints for entire zone. and rfered in TEqn.H using fvOption(T).

how to define const.Temperature only on walls of porouszone ?

Regards,
Ramana
svramana is offline   Reply With Quote

Old   April 13, 2018, 04:47
Default
  #18
Member
 
Kapa Lilla
Join Date: Mar 2009
Location: Bruxelles, Belgium
Posts: 57
Rep Power: 17
klilla is on a distinguished road
I think you would need to define a separate faceZone for that and not using the cellZone defined for the porous Zone.
svramana likes this.
klilla is offline   Reply With Quote

Old   April 13, 2018, 07:44
Default Fixed temperature on face zone
  #19
Member
 
Ramana
Join Date: Jul 2017
Location: India
Posts: 58
Rep Power: 9
svramana is on a distinguished road
Quote:
Originally Posted by klilla View Post
I think you would need to define a separate faceZone for that and not using the cellZone defined for the porous Zone.
Can I use same fvOption/scalarExplicitSetvalue option for facezone.??
svramana is offline   Reply With Quote

Old   April 13, 2018, 08:32
Default
  #20
Member
 
Kapa Lilla
Join Date: Mar 2009
Location: Bruxelles, Belgium
Posts: 57
Rep Power: 17
klilla is on a distinguished road
No, indeed not. You can only set it in cells. But what you can easily do is to separate the first cell zone attached to the boundary. It is an approximation, but better then nothing.

I tried to see if you could do it with swak4foam, but could not find anything like that.
klilla is offline   Reply With Quote

Reply

Tags
poroussimplefoam


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
help adding the energy equation to porousinterfoam using the enthalpy formulation nadine OpenFOAM Programming & Development 18 June 17, 2014 09:39
error message cuteapathy CFX 14 March 20, 2012 07:45
SIMPLE and energy equation convergence Fabio Main CFD Forum 0 June 1, 2007 07:06
How to discretize of energy equation ?? Asghari FLUENT 0 October 12, 2006 09:09
energy equation formulation Pedro Phoenics 1 July 5, 2001 13:17


All times are GMT -4. The time now is 13:07.