CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM

Segmentation fault - new enthalpy equation

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   August 25, 2010, 11:55
Default Segmentation fault - new enthalpy equation
  #1
New Member
 
Silvano
Join Date: Aug 2010
Location: Chicago /Torino Us/Italy
Posts: 11
Rep Power: 7
SilPaut is on a distinguished road
Hi every body!

I use OF1.5dev, and I changed the enthalpy equation in this form:
Code:
{
    reactingMixture& multiMix = (reactingMixture&) thermo->composition();
    PtrList<reactingMixture::reactionThermo> speciesData = multiMix.speciesData();
  
    dictionary eqnOpts = mesh.solutionDict().subDict("EquationOptions");

    bool useDiffA  = false; 
    bool useDiffB  = false;
    bool useViscDissipation  = false;
    bool useTurbDissipation  = false;

    if ( eqnOpts.found("energyDiffusionA" ) )
    {
        useDiffA  = Switch(eqnOpts.lookup("energyDiffusionA"));
    }

    if ( eqnOpts.found("energyDiffusionB" ) )
    {
        useDiffB  = Switch(eqnOpts.lookup("energyDiffusionB"));
    }   

    if (useDiffA)
    { 
        Info << "Calculating energy correction A" << endl;
   
        energySource *= 0.0;  

        surfaceScalarField alphaF = fvc::interpolate(turbulence->alphaEff() );
        surfaceScalarField muF = fvc::interpolate( turbulence->muEff() );
        
        volScalarField hY("hY",h);
        surfaceScalarField alphaH("alphaH", alphaF * fvc::interpolate( h) );

        for (label i = 0; i < Y.size(); i++) {
            Info << "\tCalculating differential flux for species " <<  Y[i].name() << endl;
            reactingMixture::reactionThermo& spData = speciesData[i];
            forAll(T, iCell) {
                hY[iCell] = spData.H(T[iCell] );
            }   
            forAll(T.boundaryField(), iPatch)
            {
                const fvPatchScalarField& T_patch = T.boundaryField()[iPatch];
                fvPatchScalarField& hY_patch = hY.boundaryField()[iPatch];
                forAll(T_patch, iFace) {
                    hY_patch[iFace] = spData.H(T_patch[iFace] );
                }
            }                         
            alphaH = fvc::interpolate(hY) * (muF - alphaF);  
                        // should this be multiplied prior to interpolation 
            energySource += fvc::laplacian( alphaH, Y[i] );
        }
    }

    if (useDiffB)
    {

        Info << "Calculating energy correction B" << endl;

        surfaceScalarField muF = fvc::interpolate( turbulence->muEff() );
        
        
        surfaceScalarField kappaEff("kappaEff", 
                fvc::interpolate( turbulence->alphaEff() * thermo->Cp() ) );

        /*
        surfaceScalarField kappaEff("kappaEff", 
                fvc::interpolate( turbulence->alphaEff()) * 
                fvc::interpolate( thermo->Cp() ) );
        */

        volScalarField hY("hY",h);
        surfaceScalarField muH("muH", muF * fvc::interpolate( h) );

        energySource = fvc::laplacian( kappaEff , T) 
                     - fvc::laplacian( turbulence->alphaEff(), h);

        for (label i = 0; i < Y.size(); i++) {
            Info << "\tCalculating differential flux for species " <<  Y[i].name() << endl;
            reactingMixture::reactionThermo& spData = speciesData[i];
            forAll(T, iCell) {
                hY[iCell] = spData.H(T[iCell] );
            }   
            forAll(T.boundaryField(), iPatch)
            {
                const fvPatchScalarField& T_patch = T.boundaryField()[iPatch];
                fvPatchScalarField& hY_patch = hY.boundaryField()[iPatch];
                forAll(T_patch, iFace) {
                    hY_patch[iFace] = spData.H(T_patch[iFace] );
                }
            }
            muH = fvc::interpolate(hY) * muF; 
                // should this be multiplied prior to interpolation                         
            energySource += fvc::laplacian( muH, Y[i] );
        }
    }
 
    }   
     solve
    (
        fvm::ddt(rho, h)
      + mvConvection->fvmDiv(phi, h)
      - fvm::laplacian(turbulence->alphaEff(), h)
     ==
        DpDt
      + energySource
    );

    thermo->correct();
}
It looks work well with reacatingFoam,

Whereas If I use the same equation in alternateReactingFoam I can wmake the solver, but i get "Segmentation fault" ERROR when I run the case.

I am new in OF and I'll be very grateful if somebody can help me to understand what this error mean and how I can make alternateReactingFoam works.

thank you very much!!
SilPaut is offline   Reply With Quote

Reply

Tags
alternatereactingfoam, enthalpy equation, error, segmentation fault

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculation of the Governing Equations Mihail CFX 7 September 7, 2014 06:27
Segmentation fault when running dieselFoam or dieselEngineFoam in parallel francesco OpenFOAM Bugs 3 June 10, 2011 09:30
Constant velocity of the material Sas CFX 15 July 13, 2010 08:56
Enthalpy equation for multicomponent mixtures alberto_cuoci OpenFOAM 1 October 8, 2009 10:59
mass flow in is not equal to mass flow out saii CFX 2 September 18, 2009 08:07


All times are GMT -4. The time now is 03:52.