unicfdlab / hybridCentralSolvers

United collection of hybrid Central solvers - one-phase, two-phase and multicomponent versions
GNU General Public License v3.0
92 stars 59 forks source link

wallHeatFlux possibly does not work? #5

Closed deepbandivadekar closed 5 years ago

deepbandivadekar commented 5 years ago

This is for OF6 branch and Ubuntu 18.04. I faced problems using wallHeatFlux utility for the chtMultiRegionCentralFoam solver for provided tutorial case (superSonicCone). I am wondering is it doesn't support this utility or perhaps if am not using it right. How do I calculate the heat flux on the solid surface?

I tried following but doesn't work with any variations: e.g. chtMultiRegionCentralFoam -postProcess -func wallHeatFlux

--> FOAM FATAL ERROR: Wrong number of arguments, expected 0 found 1 Invalid option: -postProcess Invalid option: -func

OR postProcess -func wallHeatFlux

--> FOAM FATAL ERROR: Cannot find file "points" in directory "polyMesh" in times "0" down to constant

From function virtual Foam::IOobject Foam::fileOperation::findInstance(const Foam::IOobject&, Foam::scalar, const Foam::word&) const
in file global/fileOperations/fileOperation/fileOperation.C at line 871.

FOAM exiting

OR, alternatively: included the following snippet in the controlDict: functions {#includeFunc wallHeatFlux}

Starting time loop

--> FOAM Warning : From function bool Foam::functionObjectList::read() in file db/functionObjects/functionObjectList/functionObjectList.C at line 746 Caught FatalError --> FOAM FATAL ERROR:

request for objectRegistry region0 from objectRegistry superSonicCone_v1.3 failed
available objects of type objectRegistry are

2 ( fluid solid )

From function const Type& Foam::objectRegistry::lookupObject(const Foam::word&) const [with Type = Foam::objectRegistry]
in file /home/ubuntu/OpenFOAM/OpenFOAM-6/src/OpenFOAM/lnInclude/objectRegistryTemplates.C at line 193.

This is true for MachNo as well. Could you please clarify about this? Thanks

TonkomoLLC commented 5 years ago

Hello -

Based on your post, I see you have two regions, named fluid and solid .

Therefore, please try

postProcess -func wallHeatFlux -region fluid

The polyMesh error is due to your not specifying the region.

Your use of the function in controlDict should also require you specify the region. If memory serves, it is as simple as adding the following to the script wallHeatFlux:

region fluid;

deepbandivadekar commented 5 years ago

Thanks for quick reply. Though, this doesn't work. I did try this in the variations I mentioned about. Edit: If it helps, here's the corresponding error postProcess -func wallHeatFlux -region fluid

--> FOAM FATAL ERROR: Unable to find compressible turbulence model in the database

From function virtual bool Foam::functionObjects::wallHeatFlux::execute()
in file wallHeatFlux/wallHeatFlux.C at line 237.

FOAM exiting

TonkomoLLC commented 5 years ago

Hmm. Well, you can do some programming, or you can just trick OpenFOAM. If you don't mind not being elegant...

cp the contents of fluid into constant. That includes the polyMesh directory plus thermoPhyiscalProperties and turbulenceProperties.

cp system/fvSchemes and system/fvSolution to system

For the time step of interest, cp the contents of the fluid directory (e.g., p, phi, rho, T, and U) up one "directory level" so that, for example, under time 0.001 you find p, phi, rho, etc. etc.

use rhoPimpleFoam to get the wall heat flux.

e.g., rhoPimpleFoam -postProcess -func wallHeatFlux -latestTime

I didn't run the laminar superSonicCorner case to completion... just ran to 0.0066 seconds. Here's the result of the rhoPimpleFoam postProcess:

/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  6
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
Build  : 6-e29811f5dff8
Exec   : rhoPimpleFoam -postProcess -func wallHeatFlux -latestTime
Date   : May 17 2019
Time   : 11:55:55
Host   : "aris"
PID    : 4550
I/O    : uncollated
Case   : /home/eadaymo/OpenFOAM/eadaymo-6/applications/hybridCentralSolvers/Tutorials/superSonicCone/laminar-redo
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0.0066

PIMPLE: No convergence criteria found

PIMPLE: No corrector convergence criteria found
        Calclations will do 2 corrections

wallHeatFlux wallHeatFlux:
    processing all wall patches

Time = 0.0066
Reading thermophysical properties

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

Reading field U

Reading/calculating face flux field phi

Creating turbulence model

Selecting turbulence model type laminar
Selecting laminar stress model Stokes
Creating field dpdt

Creating field kinetic energy K

No MRF models present

No finite volume options present
wallHeatFlux wallHeatFlux write:
    writing object wallHeatFlux
    min/max/integ(cone_fluid) = -718.076, -6.62934, -2.197

End

Hope this helps... Like I said it's not elegant, but may just get you the result you need.

TonkomoLLC commented 5 years ago

Here's the fancier approach.

I added postProcess.H to the chtMultiRegionSolver... I had to do a few more edits to get it to compile. Use at your own risk - I did not test thoroughly.

When you compile the attached you'll get chtMultiRegionCentralFoam-postProcess.

chtMultiRegionCentralFoam-postProcess.tar.gz

Following a tutorial, you can run:

chtMultiRegionCentralFoam-postProcess -postProcess -func wallHeatFlux -region 

And get heat fluxes like the following:

/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  6
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
Build  : 6-e29811f5dff8
Exec   : chtMultiRegionCentralFoam-postProcess -postProcess -func wallHeatFlux -region fluid
Date   : May 17 2019
Time   : 12:02:23
Host   : "aris"
PID    : 4786
I/O    : uncollated
Case   : /home/eadaymo/OpenFOAM/eadaymo-6/applications/hybridCentralSolvers/Tutorials/superSonicCone/laminar-redo
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create fluid mesh for region fluid for time = 0

Create solid mesh for region solid for time = 0

wallHeatFlux wallHeatFlux:
    processing all wall patches

Time = 0
Reading thermophysical properties

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

Reading field U

Creating field kinetic energy K

PIMPLE: No convergence criteria found

PIMPLE: No corrector convergence criteria found
        Calclations will do 2 corrections

Selecting finite volume kappaFunction type standardMachToAcCourantRatio
Creating turbulence model

Selecting turbulence model type laminar
Selecting laminar stress model Stokes
No finite volume options present
No MRF models present

Marking cells with bad quality to limit pressure gradient
max/min FaceAcCourant: 0.72/1.0903e-23
max/min Maf: 5.00866/0
max/min kappa: 1/0
*** Reading solid mesh thermophysical properties for region solid

    Adding to thermos

Selecting thermodynamics package 
{
    type            heSolidThermo;
    mixture         pureMixture;
    transport       constIso;
    thermo          hConst;
    equationOfState rhoConst;
    specie          specie;
    energy          sensibleEnthalpy;
}

    Adding to radiations

Selecting radiationModel opaqueSolid
Selecting absorptionEmissionModel constantAbsorptionEmission
Selecting scatterModel none
Selecting sootModel none
    Adding fvOptions

wallHeatFlux wallHeatFlux write:
    writing object wallHeatFlux
    min/max/integ(cone_fluid) = 0, 0, 0

Time = 0.0002
Reading thermophysical properties

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

Reading field U

Creating field kinetic energy K

PIMPLE: No convergence criteria found

PIMPLE: No corrector convergence criteria found
        Calclations will do 2 corrections

Selecting finite volume kappaFunction type standardMachToAcCourantRatio
Creating turbulence model

Selecting turbulence model type laminar
Selecting laminar stress model Stokes
No finite volume options present
No MRF models present

Marking cells with bad quality to limit pressure gradient
max/min FaceAcCourant: 0.946666/1.43302e-23
max/min Maf: 5.22189/0
max/min kappa: 1/0
*** Reading solid mesh thermophysical properties for region solid

    Adding to thermos

Selecting thermodynamics package 
{
    type            heSolidThermo;
    mixture         pureMixture;
    transport       constIso;
    thermo          hConst;
    equationOfState rhoConst;
    specie          specie;
    energy          sensibleEnthalpy;
}

    Adding to radiations

Selecting radiationModel opaqueSolid
Selecting absorptionEmissionModel constantAbsorptionEmission
Selecting scatterModel none
Selecting sootModel none
    Adding fvOptions

wallHeatFlux wallHeatFlux write:
    writing object wallHeatFlux
    min/max/integ(cone_fluid) = -2.89064e-12, 3.1529e-12, -3.54824e-15

.
.
.

etc.

log2.txt

deepbandivadekar commented 5 years ago

Thanks a lot for this! This works for now. There is some issue with parallel running, but that's another topic.

TonkomoLLC commented 5 years ago

Glad it works. Not sure what to say on the parallel issue, though. Hope this keeps you moving forward. Cheers

unicfdlab commented 5 years ago

Dear colleagues, i would like to stress, that only OpenFOAM+ fork of OpenFOAM technology is now supported, so please use appropriate branches of repository