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)

immortality March 27, 2013 19:01

how can see Cp values?
 
i use janaf for Cp(isobaric speciefic heat).then does anyone know the keyword for puting Cp's in each time step?(like the command Mach for mach number

immortality March 28, 2013 07:52

any suggestion?nobody knows?!!

ChrisA March 28, 2013 13:16

If you look at the code for mach you'll see that it has to call Cp to calculate the mach number, you can mimic the code outputting the mach number to output Cp as well using the same call. This would be to extract the Cp values post simulation.

You could also do it while the solver is running by defining an I/O field that simply gains the value of Cp for each timestep and set it to autowrite. Depending on how your thermo package is defined in the solver you intend on using thermo.Cp() might work, I think, just writing from the top of my head right now. At any rate Cp will come from the same call that pulls temperature, pressure, rho, etc.

immortality March 28, 2013 14:35

thank you for your guidance.
I've added this to creatFields.H:
Code:

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

is it true?
but it isn't written in each folder.

immortality March 28, 2013 23:57

why it is not written in time folders in your opinion?

immortality March 29, 2013 08:02

any help or suggestion?:(

immortality March 30, 2013 04:31

is it not possible to have Cp values in folders?

immortality March 31, 2013 06:11

HOW to write Cp in time folders during or after the run?
 
I've added this to creatFields.H:
Code:

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

is it true?
but it isn't written in each folder.

immortality April 1, 2013 04:10

why it doesn't work?

wyldckat April 1, 2013 14:18

1 Attachment(s)
Greetings to all!

@Ehsan: try the attached package "specificHeat.tar.gz". To build it:
Code:

tar -xzf specificHeat.tar.gz
cd specificHeat
wmake

It was tested with OpenFOAM 2.1.x. It's based on OpenFOAM's pPrime2 and buoyantSimpleFoam.

Since I don't know which tutorial case I should test on, I tried "heatTransfer/buoyantSimpleFoam/buoyantCavity" and it worked... with limited success. In essence, the "Cp" value was constant on the whole field.

edit: forgot to mention that to use it, you need to run:
Code:

specificHeat
It will execute for all time instances.


Without knowing more information about a test case I can use, I suggest that you also try the function object "writeRegisteredObject": http://openfoamwiki.net/index.php/Ti...gisteredObject

Best regards,
Bruno

immortality April 1, 2013 15:24

thank you dear Bruno.since i use OF 2.2.0 recently.it got some eerors on basicPsiThermo that has changed its name into only psiThermo.when i changed all basicPsiThermo to psiThermo this error dispalyed in compiling.
Code:

ehsan@Ehsan-com:~/Desktop/specificHeat$ wmake
g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam220/src/thermophysicalModels/basic/lnInclude -I/opt/openfoam220/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam220/src/OpenFOAM/lnInclude -I/opt/openfoam220/src/OSspecific/POSIX/lnInclude  -fPIC -Xlinker --add-needed -Xlinker --no-as-needed Make/linux64GccDPOpt/specificHeat.o -L/opt/openfoam220/platforms/linux64GccDPOpt/lib \
            -lmeshTools -lbasicThermophysicalModels -lspecie -lfiniteVolume -lgenericPatchFields -lOpenFOAM -ldl  -lm -o /home/ehsan/OpenFOAM/ehsan-2.2.0/platforms/linux64GccDPOpt/bin/specificHeat
/usr/bin/ld: cannot find -lbasicThermophysicalModels
collect2: ld returned 1 exit status
make: *** [/home/ehsan/OpenFOAM/ehsan-2.2.0/platforms/linux64GccDPOpt/bin/specificHeat] Error 1


wyldckat April 1, 2013 17:31

1 Attachment(s)
Hi Ehsan,

I was hoping you would figure it out how to upgrade it ;)

Attached is the version that compiles and seems to work in OpenFOAM 2.2... at least until I've got a better test case...

Best regards,
Bruno

immortality April 2, 2013 08:04

thank you dear Bruno very much.if this error resolve the difficulty is passed.should i only change rhoThermo to psiThermo in specificHeat?
Code:

Create time

Create mesh for time = 0

Reading thermophysical properties

Selecting thermodynamics package
{
    type            hePsiThermo;
    mixture        pureMixture;
    transport      sutherland;
    thermo          janaf;
    equationOfState perfectGas;
    specie          specie;
    energy          sensibleEnthalpy;
}



--> FOAM FATAL ERROR:
Unknown rhoThermo type
thermoType
{
    type            hePsiThermo;
    mixture        pureMixture;
    transport      sutherland;
    thermo          janaf;
    equationOfState perfectGas;
    specie          specie;
    energy          sensibleEnthalpy;
}


Valid rhoThermo types are:

type        mixture                    transport  thermo      equationOfState          specie  energy                 

heRhoThermo  homogeneousMixture        const      hConst      incompressiblePerfectGas  specie  sensibleEnthalpy       
heRhoThermo  homogeneousMixture        const      hConst      perfectGas                specie  sensibleEnthalpy       
heRhoThermo  homogeneousMixture        sutherland  janaf        incompressiblePerfectGas  specie  sensibleEnthalpy       
heRhoThermo  homogeneousMixture        sutherland  janaf        perfectGas                specie  sensibleEnthalpy       
heRhoThermo  inhomogeneousMixture      const      hConst      incompressiblePerfectGas  specie  sensibleEnthalpy       
heRhoThermo  inhomogeneousMixture      const      hConst      perfectGas                specie  sensibleEnthalpy       
heRhoThermo  inhomogeneousMixture      sutherland  janaf        incompressiblePerfectGas  specie  sensibleEnthalpy       
heRhoThermo  inhomogeneousMixture      sutherland  janaf        perfectGas                specie  sensibleEnthalpy       
heRhoThermo  multiComponentMixture      const      hConst      incompressiblePerfectGas  specie  sensibleEnthalpy       
heRhoThermo  multiComponentMixture      const      hConst      perfectGas                specie  sensibleEnthalpy       
heRhoThermo  multiComponentMixture      polynomial  hPolynomial  icoPolynomial            specie  sensibleEnthalpy       
heRhoThermo  multiComponentMixture      sutherland  janaf        incompressiblePerfectGas  specie  sensibleEnthalpy       
heRhoThermo  multiComponentMixture      sutherland  janaf        perfectGas                specie  sensibleEnthalpy       
heRhoThermo  pureMixture                const      hConst      incompressiblePerfectGas  specie  sensibleEnthalpy       
heRhoThermo  pureMixture                const      hConst      incompressiblePerfectGas  specie  sensibleInternalEnergy 
heRhoThermo  pureMixture                const      hConst      perfectFluid              specie  sensibleEnthalpy       
heRhoThermo  pureMixture                const      hConst      perfectFluid              specie  sensibleInternalEnergy 
heRhoThermo  pureMixture                const      hConst      perfectGas                specie  sensibleEnthalpy       
heRhoThermo  pureMixture                const      hConst      perfectGas                specie  sensibleInternalEnergy 
heRhoThermo  pureMixture                const      hConst      rhoConst                  specie  sensibleEnthalpy       
heRhoThermo  pureMixture                const      hConst      rhoConst                  specie  sensibleInternalEnergy 
heRhoThermo  pureMixture                polynomial  hPolynomial  icoPolynomial            specie  sensibleEnthalpy       
heRhoThermo  pureMixture                polynomial  hPolynomial  icoPolynomial            specie  sensibleInternalEnergy 
heRhoThermo  pureMixture                sutherland  hConst      incompressiblePerfectGas  specie  sensibleEnthalpy       
heRhoThermo  pureMixture                sutherland  hConst      incompressiblePerfectGas  specie  sensibleInternalEnergy 
heRhoThermo  pureMixture                sutherland  hConst      perfectGas                specie  sensibleEnthalpy       
heRhoThermo  pureMixture                sutherland  hConst      perfectGas                specie  sensibleInternalEnergy 
heRhoThermo  pureMixture                sutherland  janaf        incompressiblePerfectGas  specie  sensibleEnthalpy       
heRhoThermo  pureMixture                sutherland  janaf        incompressiblePerfectGas  specie  sensibleInternalEnergy 
heRhoThermo  pureMixture                sutherland  janaf        perfectGas                specie  sensibleEnthalpy       
heRhoThermo  pureMixture                sutherland  janaf        perfectGas                specie  sensibleInternalEnergy 
heRhoThermo  reactingMixture            const      hConst      incompressiblePerfectGas  specie  sensibleEnthalpy       
heRhoThermo  reactingMixture            const      hConst      perfectGas                specie  sensibleEnthalpy       
heRhoThermo  reactingMixture            polynomial  hPolynomial  icoPolynomial            specie  sensibleEnthalpy       
heRhoThermo  reactingMixture            sutherland  janaf        incompressiblePerfectGas  specie  sensibleEnthalpy       
heRhoThermo  reactingMixture            sutherland  janaf        perfectGas                specie  sensibleEnthalpy       
heRhoThermo  singleStepReactingMixture  sutherland  janaf        perfectGas                specie  sensibleEnthalpy       
heRhoThermo  veryInhomogeneousMixture  const      hConst      incompressiblePerfectGas  specie  sensibleEnthalpy       
heRhoThermo  veryInhomogeneousMixture  const      hConst      perfectGas                specie  sensibleEnthalpy       
heRhoThermo  veryInhomogeneousMixture  sutherland  janaf        incompressiblePerfectGas  specie  sensibleEnthalpy       
heRhoThermo  veryInhomogeneousMixture  sutherland  janaf        perfectGas                specie  sensibleEnthalpy       


    From function rhoThermo::New
    in file lnInclude/basicThermoTemplates.C at line 73.

FOAM exiting


wyldckat April 2, 2013 15:40

Hi Ehsan,

I need a test case. Without one, I don't know what should be the correct choice to make :(

Because as I said on a previous post, I used the tutorial "heatTransfer/buoyantSimpleFoam/buoyantCavity" to test the attached application. It worked with that tutorial, but there are more solvers that use thermodynamics in different ways.

Best regards,
Bruno

immortality April 2, 2013 18:19

dear Bruno my case is like shock tube but in rhoPimpleFoam(there is not a tutorial case in rhoPimpleFoam).could you please test for my case if i send to you.
Thank you very much.

immortality April 3, 2013 17:22

1 Attachment(s)
dear Bruno could you see my case to modify Cp function?
could it be changed to calculate 1)mass flow rate on patches and also 2)total mass inflow and outflow measuring by a function like this?
thank you very very much.

wyldckat April 3, 2013 19:07

1 Attachment(s)
Hi Ehsan,

For calculating mass flow, the following has been around for several years now: http://openfoamwiki.net/index.php/Contrib_calcMassFlow

As for the specificHeat utility: I'm glad you provided a test case, because now I've managed to figure out that Cp was not correctly updated with each time step.
The attached version specificHeatHePsi (for OpenFOAM 2.2) is based on wdot and rhoPimpleFoam. It updates (by force) the thermo variable and writes the updated "Cp" field for all time steps.

Keeping in mind that this new utility is named specificHeatHePsi.

Best regards,
Bruno

immortality April 4, 2013 07:55

Thank you very much dear Bruno.now it works well.
the mass flow application gives an error when compiled:
Code:

ehsan@Ehsan-com:~/Desktop/calcMassFlow$ wmake
Making dependency list for source file calcMassFlow.C
could not open file fvCFD.H for source file calcMassFlow.C
could not open file FaceSetUtilities.H for source file calcMassFlow.C
SOURCE=calcMassFlow.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam220/src/cfdTools/lnInclude -I/opt/openfoam220/src/cfdTools/general/lnInclude          -I/opt/openfoam220/src/meshTools/lnInclude          -I/home/ehsan/OpenFOAM/ehsan-2.2.0/Libraries/cellFaceSetUtilities/lnInclude -IlnInclude -I. -I/opt/openfoam220/src/OpenFOAM/lnInclude -I/opt/openfoam220/src/OSspecific/POSIX/lnInclude  -fPIC -c $SOURCE -o Make/linux64GccDPOpt/calcMassFlow.o
calcMassFlow.C:33:19: fatal error: fvCFD.H: No such file or directory
compilation terminated.
make: *** [Make/linux64GccDPOpt/calcMassFlow.o] Error 1

what does it mean that fvCFD.H doesn't exist.while its there.
I have done the run and now i want to calculate mass flow.how to do it like Cp after end of simulation?can modify Cp tool or anything like this?
thank you very much dear Bruno.

wyldckat April 6, 2013 07:20

Hi Ehsan,

It's possible to merge the two applications, since the source code is fully open. Nonetheless, I don't have to time to look into such a feature.

And since you have about 2 threads on the topic of mass flow:
... so I'll answer to the compile error on the second thread.

Best regards,
Bruno

immortality April 6, 2013 11:33

thanks Bruno.but i don't know how to use funkyDoCalc now.
what dictionary i have to add in system folder?
calcMassFlow is very nice.but it very good ta modify it a bit more.
thank you again.


All times are GMT -4. The time now is 15:20.