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

Phase change with density field

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 16, 2020, 09:23
Default Phase change with density field
  #1
New Member
 
Join Date: Sep 2018
Posts: 25
Rep Power: 7
jeroendemto is on a distinguished road
Hello everyone,

I'm trying to simulate a 1-d stefan problem, but I'm running into some trouble.
The formula I use to implement phase change can be seen below.

Code:
fvScalarMatrix TEqn
(
fvc::ddt(rho,h)
+ fvm::Sp((heatCap*rho)/runTime.deltaT(),T)
- rho*heatCap*TOld/runTime.deltaT()
- fvm::laplacian(thermalCond, T)
);
This works fine if I use a constant density defined as a property i.e. rho = 1000.


However if I use a volScalarField as rho as seen below, the solution diverges.

Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  7
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      rho;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions       [1 -3 0 0 0 0 0];

internalField    uniform 1000;

boundaryField
{
    inlet
    {
        type        	fixedValue;
        value       	$internalField;
    }
    
    outlet
    {
        type            fixedValue;
        value           $internalField;
    }

    walls
    {
    	type		fixedValue;
    	value		$internalField;
    }

    sides
    {
        type        empty;
    }

}

// ************************************************************************* //
I would think this would work the same but it does not, how can I fix this?

kind regards,
Jeroen
Attached Images
File Type: png formula.png (8.1 KB, 5 views)
jeroendemto 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
UDF for modifying density of mixture phase during the calculating process sola86 Fluent UDF and Scheme Programming 2 May 28, 2019 09:24
sonicFoam how change the internal field density? Ryokou OpenFOAM 2 November 29, 2017 02:58
How to Find Temperature Field of Two Phase Flow? Shomaz ul Haq CFX 5 October 16, 2017 05:25
alphaEqn.H in twoPhaseEulerFoam cheng1988sjtu OpenFOAM Bugs 15 May 1, 2016 16:12
Material change during phase transformation (FePO4 > LiFePO4) concentration distribut kimsw0103 CFX 0 January 15, 2016 22:05


All times are GMT -4. The time now is 21:32.