CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   how can see Cp values? (https://www.cfd-online.com/Forums/openfoam-post-processing/115303-how-can-see-cp-values.html)

ait November 18, 2015 18:34

Hi everybody,

What does one need to do if one wants the solver to update a temperature dependent Cp for every time step? I am running coldEngineFoam and it only calculates Cp through Janaf for the beginning of the run. After that Cp is constant although the temperature fluctuates. All the solutions are post processing. Cp is calculated at the end of the run depending on the temperature field. I want the temperature field to be coupled to the varying Cp.

Thanks!

agustinvo November 19, 2015 03:34

Quote:

Originally Posted by taleb.aly@gmail.com (Post 573944)
Hi everybody,

What does one need to do if one wants the solver to update a temperature dependent Cp for every time step? I am running coldEngineFoam and it only calculates Cp through Janaf for the beginning of the run. After that Cp is constant although the temperature fluctuates. All the solutions are post processing. Cp is calculated at the end of the run depending on the temperature field. I want the temperature field to be coupled to the varying Cp.

Thanks!

Hello,

taking a look to the code, you are using the energy equation of rhoSimpleFoam. Inside that file, you have thermo.correct(), which is updating Cp each time step.

This is the thing you were asking for? Because it should change once your equation is solved.

ait November 19, 2015 15:20

Thanks agustinvo. You are right. It does calculate an updated Cp value for every time step. For some reason, the output that I wrote for Cp only showed the value calculated at the beginning of the run and did not change it for the time steps.

I wrote the following in the createFields.H file:

Code:

  volScalarField heatCp
    (
        IOobject
        (
                "heatCp",
                runTime.timeName(),
                mesh,
                IOobject::NO_READ,
                IOobject::AUTO_WRITE
        ),
    thermo.Cp()
    );

I also added the the following in the controlDict file:

Code:

heatCp
    {
        type            cellSource;
        functionObjectLibs ("libfieldFunctionObjects.so");
        enabled        true;
        outputControl  timeStep;
        outputInterval  1;
        log            true;
        valueOutput    false;
        source          all;
        sourceName      none;
        operation      volAverage;
        fields
        (
                heatCp
        );
    }

Additionally, if I write "Cp" instead of "heatCp" in the createFields.H file, it gives me an error while compiling. Can somebody help me produce the correct output?

agustinvo November 24, 2015 10:30

Did you try to write in your code, just after the thermo.correct()

Code:

heatCp=thermo.Cp
this should update your variable each time step

ait November 26, 2015 06:59

Thanks augustinvo. I've found a work-around for the problem. I tried your suggestion but it gives me an error. However, I don't need this solution any more

Gerrit March 10, 2016 09:56

Hi,

sorry to bump into this thread again. I would like to see the cp values after my simulation. I used wyldckats last code, but when I try to wmake it I gain this:

Code:

Making dependency list for source file specificHeat.C
could not open file cyclicAMILduInterface.H for source file specificHeat.C due to No such file or directory
could not open file cyclicAMIPolyPatch.H for source file specificHeat.C due to No such file or directory
SOURCE=specificHeat.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam240/src/thermophysicalModels/basic/lnInclude -I/opt/openfoam240/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam240/src/OpenFOAM/lnInclude -I/opt/openfoam240/src/OSspecific/POSIX/lnInclude  -fPIC -c $SOURCE -o Make/linux64GccDPOpt/specificHeat.o
In file included from /opt/openfoam240/src/finiteVolume/lnInclude/ddtScheme.C:30:0,
                from /opt/openfoam240/src/finiteVolume/lnInclude/ddtScheme.H:325,
                from /opt/openfoam240/src/finiteVolume/lnInclude/fvcDdt.C:28,
                from /opt/openfoam240/src/finiteVolume/lnInclude/fvcDdt.H:199,
                from /opt/openfoam240/src/finiteVolume/lnInclude/fvc.H:44,
                from /opt/openfoam240/src/finiteVolume/lnInclude/fvCFD.H:8,
                from specificHeat.C:27:
/opt/openfoam240/src/finiteVolume/lnInclude/cyclicAMIFvPatch.H:39:35: fatal error: cyclicAMILduInterface.H: No such file or directory
 #include "cyclicAMILduInterface.H"
                                  ^
compilation terminated.
make: *** [Make/linux64GccDPOpt/specificHeat.o] Error 1

I know that this is due to the fact, that I use OF 2.4.0, but I would like to solve this. Could someone help? I tried to find where the software uses cyclicAMILduInterface.H, but could not find it...
If it is looking for it, but does not find it, is there maybe only a new place or name of cyclicAMILduInterface.H?

Thank you.
Best

wenxu March 11, 2016 09:56

Dear Georg,

What's wrong with the "Not implemented" problem as you posted? Could you tell us how to solve this problem?

Best,
Xu

wyldckat March 13, 2016 11:48

Quick answers/questions:

@Gerrit:
Quote:

Originally Posted by Gerrit (Post 589020)
Could someone help? I tried to find where the software uses cyclicAMILduInterface.H, but could not find it...
If it is looking for it, but does not find it, is there maybe only a new place or name of cyclicAMILduInterface.H?

Simply stating "last code" is a bit ambiguous, because I or you might have missed which exact post was the last one with code ;)
Anyway, see this post: http://www.cfd-online.com/Forums/ope...tml#post567796 - post #2

@wenxu:
Quote:

Originally Posted by wenxu (Post 589206)
Dear Georg,

What's wrong with the "Not implemented" problem as you posted? Could you tell us how to solve this problem?

Georg did state how it was solved... at least it looks like it, as described in post #31.

Gerrit March 14, 2016 03:34

Hi Bruno,

thank you very much for your reply! I refered to post #17,
but this part of your answer solved my problem already!
Quote:

Anyway, see this post: http://www.cfd-online.com/Forums/ope...tml#post567796 - post #2
Best

mom April 15, 2017 16:19

read Cp value from thermodynamics dictionary
 
Dear Foamers, Using cHT solver, How can I get the Cp value from my thermophysicalProperties in constant/ into controlDict in system?
my thermophysicalProperties file looks like this:
...
mixture
{
...

thermodynamics
{
Hf 0;
Cp 12;
}
...
Is it possible to get it with a command like :
const volScalarField& T = mesh_.lookupObject<volScalarField>("T");
that is used for temperature?
Annoying is that I managed to access thermodynamics dictionary (dictionary that you can see above) but I don't know how to extract Cp value from it, is there any command that I can use for it?

kévine July 11, 2019 07:54

cp coeffs
 
hello all
can someone help me to see the cp of a fluid after the combustion air-H2 to be able to calculate gamma
mass fraction:
H2 = 1
H2O = 0.256
O2 = 0.258
N2 = 0.486
THANK YOU

john myce June 18, 2021 07:19

Cp field for multiphase solvers
 
2 Attachment(s)
Hi all !

I am trying to add the isobaric heat capacity in createFields.H to visualize it using the multiphase solver compressibleInterFoam.

So I added the following lines on the createFields.H file :

Code:

volScalarField Cp
    (
        IOobject
        (
                "Cp",
                runTime.timeName(),
                mesh,
                IOobject::READ_IF_PRESENT,
                IOobject::AUTO_WRITE
        ),
    mixture.thermo1().Cp()()*alpha1 + mixture.thermo2().Cp()()*alpha2
    );

What it does : It actually reads the initial value but it does not update the value during the simulation (please refers to the image attached, comparing cp vs rho)

I tried to follow the method suggested by wyldckat & gork by adding these following lines :

Code:

autoPtr<rhoThermo> pThermo(rhoThermo::New(mesh));
rhoThermo& thermo = pThermo();
thermo.validate(args.executable(), "h", "e");

The recompilation works but when I run again the simulation, it stop with the following error (2nd image attached).

Actually, this message is normal as I declare the thermo package in separate thermophysicalProperties for each phase (for instance thermophysicalProperties.liquid and thermophysicalProperties.gas)

So my question is how can I do to update the Cp by forcing the code to read into the right thermophysicalProperties files ?

Cheers,


All times are GMT -4. The time now is 19:22.