CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Adding Energy Equation for porousSimpleFoam (https://www.cfd-online.com/Forums/openfoam-programming-development/132431-adding-energy-equation-poroussimplefoam.html)

yesaswi92 March 31, 2014 20:04

Adding Energy Equation for porousSimpleFoam
 
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 April 3, 2014 13:34

porousSimpleFoam
 
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

Kittipos July 26, 2015 23:44

Hi Yesaswi

I have a problem same as you.

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

Thx

klilla July 28, 2015 11:33

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 July 29, 2015 06:04

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

svramana January 25, 2018 04:42

porousSimpleFoam
 
1 Attachment(s)
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

Swagga5aur February 7, 2018 16:10

multiRegionReactingPorousSimpleFoam
 
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

svramana February 10, 2018 13:07

Quote:

Originally Posted by Swagga5aur (Post 680785)
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

Swagga5aur February 12, 2018 14:44

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.

svramana February 14, 2018 03:36

Quote:

Originally Posted by Swagga5aur (Post 681275)
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.

Swagga5aur February 14, 2018 11:48

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

svramana February 19, 2018 06:10

problem with porousmedia heat transfer using simple foam
 
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

Swagga5aur February 19, 2018 13:48

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.

Adri_12 February 20, 2018 12:05

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 (Post 557350)

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à

Swagga5aur February 20, 2018 15:11

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

Adri_12 March 1, 2018 11:06

Quote:

Originally Posted by Swagga5aur (Post 682290)

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à

svramana April 13, 2018 03:07

Const. Temp on porous cylinder surface
 
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

klilla April 13, 2018 03:47

I think you would need to define a separate faceZone for that and not using the cellZone defined for the porous Zone.

svramana April 13, 2018 06:44

Fixed temperature on face zone
 
Quote:

Originally Posted by klilla (Post 688738)
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.??

klilla April 13, 2018 07:32

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.


All times are GMT -4. The time now is 00:53.