CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Darcy solver with boussinesq assumption. Solver crashes for zero gradient BC for Temp

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 3, 2019, 08:47
Default Darcy solver with boussinesq assumption. Solver crashes for zero gradient BC for Temp
  #1
Senior Member
 
Manu Chakkingal
Join Date: Feb 2016
Location: Delft, Netherlands
Posts: 129
Rep Power: 10
manuc is on a distinguished road
Hello All

I am trying to solver Darcy flow equation with boussinesq assumption. I simulate bottom heated top cooled 2D cavit with adiabatic sidewalls. The solver gives unphysical unbounded Temperature, when I give zeroGradient BC for T (adiabatic). However it doesnt crash when instead of adiabatic I give a fixed temperature value for the side walls as well(fixedValue BC).



Solver details below:
Code:
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | foam-extend: Open Source CFD
   \\    /   O peration     | Version:     4.0
    \\  /    A nd           | Web:         http://www.foam-extend.org
     \\/     M anipulation  | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
    This file is part of foam-extend.

    foam-extend is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the
    Free Software Foundation, either version 3 of the License, or (at your
    option) any later version.

    foam-extend is distributed in the hope that it will be useful, but
    WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.

Application
    laplacianFoam

Description
    Solves a simple Laplace equation, e.g. for thermal diffusion in a solid.

\*---------------------------------------------------------------------------*/

#include "fvCFD.H"
#include "singlePhaseTransportModel.H"
#include "simpleControl.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{

#   include "setRootCase.H"

#   include "createTime.H"
#   include "createMesh.H"

    simpleControl simple(mesh);
    
#   include "readGravitationalAcceleration.H"
#   include "createFields.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

    Info<< "\nCalculating flow and temperature distribution\n" << endl;

    while (simple.loop())
    {
        Info<< "Time = " << runTime.timeName() << nl << endl;
        
        #include "pEqn.H"
        #include "TEqn.H"
            
       
        
        
        
        
        
    #       include "write.H"

        Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
            << "  ClockTime = " << runTime.elapsedClockTime() << " s"
            << nl << endl;
    }

    Info<< "End\n" << endl;

    return 0;
}


// ************************************************************************* //
pEqn.H
Code:
{
  //phi = fvc::interpolate(U) & mesh.Sf();
  
  surfaceScalarField phiG(Mf*fvc::interpolate(rhok)*(g & mesh.Sf()));

//Test
 // surfaceScalarField phiG(Mf*ghf*fvc::snGrad(rhok)*mesh.magSf());
        
  //     phi += phiG;
        



 //  while (simple.correctNonOrthogonal())
//       {
        
        
       
      fvScalarMatrix pEqn
        (
            //fvm::laplacian(-Mf,p) + fvc::div((fvc::interpolate(rhok) * Mf)* (g & mesh.Sf())) 
             fvm::laplacian(-Mf,p)+ fvc::div(phiG) 
        );
       //  pEqn.relax();
        pEqn.setReference(pRefCell, pRefValue);
         pEqn.solve();
       // phi= (phiG + fvc::snGrad(p)*Mf*mesh.magSf());
         
         
      //  if (simple.finalNonOrthogonalIter())
     //    { 
      //     
           phi= (phiG+pEqn.flux());
          // p.relax();

        
         
  
    //Reconstruct the velocity field. 
    //Velocity isnt involved in any calculation 
    //multiplied by fluid density to convert to velocity
    //If needed the BC can be set using DarcyPressure BC , where velcoity is converted to pressure
          U=fvc::reconstruct
            (  phi       );
         
               
     //   U = fvc::reconstruct(phi);
       U.correctBoundaryConditions();
 //       }

    
 }
TEqn.H
Code:
{
//Solve 1 temperature equation for combined solid and fluid phase
         fvScalarMatrix TEqn
        (
             fvm::laplacian(DT, T)==
	          (eps*rhoCpf+(1.-eps)*rhoCps)*fvm::ddt(T) 
		       	+ rhoCpf*fvm::div(phi,T) 
			      
			      
        );
     //   TEqn.relax();

       TEqn.solve();
        
        
        //Density updation based on temperature p/rho is used in implementation
        //rhok thus doesnt have unit of density but dimensionless
        rhok=rhof*(1.0 - (beta*(T - TRef)));
        
       //solve pressure Eqn. Mf account for K/mu. 
       //PhiG in createfields takes care of density induced flux
       
  }

Could someone help me to find why zeroGradient BC fails and not fixedValue

Regards
manu
__________________
Regards
Manu

Last edited by manuc; July 3, 2019 at 09:03. Reason: not complete
manuc is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
PEMFC model with FLUENT brahimchoice FLUENT 22 April 19, 2020 16:44
[ANSYS Meshing] Help with element size sandri_92 ANSYS Meshing & Geometry 14 November 14, 2018 08:54
Periodic flow using Cyclic - comparison with Fluent nusivares OpenFOAM Running, Solving & CFD 30 December 12, 2017 06:35
fluent divergence for no reason sufjanst FLUENT 2 March 23, 2016 17:08
Star cd es-ice solver error ernarasimman STAR-CD 2 September 12, 2014 01:01


All times are GMT -4. The time now is 13:51.