|
[Sponsors] |
February 15, 2017, 12:15 |
Error arising from Energy Equation
|
#1 |
Member
|
Dear FOAMers,
I have posted this in the section dedicated to Running, Solving and CFD, however as I am not getting any answer I imagine maybe this was the wrong forum to address. I am actually working on a compressible solver (density based) that I created using the pre-existing chtMultiRegionFoam solver. As stated in the title, I get (see hereunder) an error when solving for the following energy equation: fvScalarMatrix EEqn ( fvm::ddt(rho, he) + fvm::div(phi, he) + fvc::ddt(rho, K) + fvc::div(phi, K) == fvm::laplacian(kEff, T) + HS ); HS is just a volumetric source term, and kEff is the effective conductivity. he is the internal energy (I compute it using an external Fortran code) while K is set as being: const volScalarField& K = 0.5 * (U & U); #0 Foam::error: rintStack(Foam::Ostream&) at ??:? #1 Foam::sigSegv::sigHandler(int) at ??:? #2 at sigaction.c:? #3 memcpy at interp.c:? #4 std::string::append(std::string const&) in "/home/faabid/OpenFOAM/ThirdParty-2.3.0/platforms/linux64/gcc-4.8.1/lib64/libstdc++.so.6" #5 std::basic_string<char, std::char_traits<char>, std::allocator<char> > std: perator+<char, std::char_traits<char>, std::allocator<char> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) at ~/OpenFOAM/ThirdParty-2.3.0/platforms/linux64/gcc-4.8.1/include/c++/4.8.1/bits/basic_string.h:2370 #6 at ~/OpenFOAM/OpenFOAM-2.3.0/src/finiteVolume/lnInclude/fvcDiv.C:240 (discriminator 2) #7 at ~/OpenFOAM/OpenFOAM-2.3.0/applications/solvers/heatTransfer/CompressibleHeSolver/./fluid/EEqn.H:24 (discriminator 1) #8 __libc_start_main at ??:? #9 at ??:? Segmentation fault (core dumped) Where fluid/EEqn.H:24 corresponds to: + fvc::ddt(rho, K) + fvc::div(phi, K) I also remind that K is set to: const volScalarField& K = 0.5*magSqr(U); Could anyone please help me ?? Thank you !! |
|
February 15, 2017, 15:46 |
|
#2 |
Senior Member
|
Hi,
Why K is const reference (why not create just a copy of 0.5*(U & U) using constructor from tmp as volScalarField K(0.5*(U & U))? Are you sure, object it is referencing is not destroyed before construction of energy equation? |
|
February 16, 2017, 08:23 |
|
#3 |
Member
|
Hi Alexey,
First of all, thank you very much for your attention and help! I did modified the way I construct and call K and you were right to point this out because the error seems now corrected. However, I am getting an error from the energy term "he" and it is the following: Code:
FOAM FATAL ERROR: valueInternalCoeffs cannot be called for a calculatedFvPatchField on patch outsidewalls of field he in file "/home/faabid/OpenFOAM/faabid_cases/testCase/mine/CompressibleSolver/0/hell_channel/he" You are probably trying to solve for a field with a default boundary condition. From function calculatedFvPatchField<Type>::valueInternalCoeffs(const tmp<scalarField>&) const in file fields/fvPatchFields/basic/calculated/calculatedFvPatchField.C at line 154. FOAM exiting Code:
volScalarField& he = heFluids[i]; heFluids.set ( i, new volScalarField ( IOobject ( "he", runTime.timeName(), fluidRegions[i], IOobject::MUST_READ, IOobject::AUTO_WRITE ), fluidRegions[i], dimensionedScalar ( "he", dimensionSet(1,2,-2,0,0,0,0), scalar(1990.4) ) ) ); Code:
divSchemes { default none; div(phi,U) Gauss upwind; div(rho,he) Gauss upwind; div(phi,he) Gauss upwind; //div((p*U)) Gauss linear; div(phi,(0.5*magSqr(U))) Gauss linear; grad(T) Gauss linear; } Code:
dimensions [1 2 -2 0 0 0 0]; internalField uniform 1990.4; boundaryField { FrontAndBack { type empty; } outsidewalls { type gradientEnergy; gradient uniform 0; } hell_channel_to_solid2 { type mixedEnergy; refValue uniform 0; refGradient uniform 0; valueFraction uniform 0; value $internalField; } hell_channel_to_solid1 { type mixedEnergy; refValue uniform 0; refGradient uniform 0; valueFraction uniform 0; value $internalField; } } Once again thank you for your time and support, it's much appreciated! |
|
February 16, 2017, 08:35 |
|
#4 |
Senior Member
|
Hi,
Default constructor of volScalarField (which is just typedef over GeometricField, http://cpp.openfoam.org/v4/a00931.ht...0d8f8a5fec0dc8) sets calculated type for all boundary conditions, hence the error. The easies ways if to add to your constructor "zeroGradient", so he field has zero gradient BCs everywhere. Code:
heFluids.set( i, new volScalarField( IOobject("he", runTime.timeName(), fluidRegions[i], IOobject::MUST_READ, IOobject::AUTO_WRITE), fluidRegions[i], dimensionedScalar("he", dimEnergy, 1990.4), "zeroGradient")); |
|
February 16, 2017, 09:36 |
|
#5 |
Member
|
Hi Alexey,
I understand, I did not know about that, thanks a lot for the tip. I will try that as soon as I get my hands back on the code and will keep you posted. Thanks again for your valuable help ! |
|
February 17, 2017, 05:27 |
|
#6 |
Member
|
Hi again,
The solution you provided did the job, now I've got to figure out why the solution for "he" diverges and makes the solver crash after a few time steps. But you were of great help, thanks a lot for everything Alexey ! Faab |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Setting the height of the stream in the free channel | kevinmccartin | CFX | 12 | October 13, 2022 21:43 |
Error in computing Energy equation | faab | OpenFOAM Running, Solving & CFD | 0 | February 3, 2017 13:04 |
error message | cuteapathy | CFX | 14 | March 20, 2012 06:45 |
energy equation in rhoCentralFoam | nakul | OpenFOAM | 0 | October 10, 2010 15:07 |
SIMPLE and energy equation convergence | Fabio | Main CFD Forum | 0 | June 1, 2007 06:06 |