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

solve continiuty for velocity

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

Reply
 
LinkBack Thread Tools Display Modes
Old   June 27, 2011, 13:04
Default solve continiuty for velocity
  #1
Senior Member
 
Illya Shevchuk
Join Date: Aug 2009
Location: Darmstadt, Germany
Posts: 174
Rep Power: 7
linch is on a distinguished road
Hi Foamers,

in compressible solvers continuity is solved for density:
Code:
solve(fvm::ddt(rho) + fvc::div(phi));
with mass flux phi.

But how can I solve continuity for velocity?

I already tried to solve:
Code:
    fvScalarMatrix UEqn
    (
        fvc::ddt(rho)
      + fvm::div(rho,U)
    );
And the compiler returned an error:
Quote:
error: no matching function for call to ‘div(Foam::volScalarField&, Foam::volVectorField&)’
Then I tried: this one:
Code:
fvScalarMatrix UEqn
{
   fvc::ddt(rho)
+ fvm::div(fvc::interpolate(rho),U)
}
but then I got a type mismatch error:
Quote:
error: no match for ‘operator+’ in ‘Foam::fvc::ddt(const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) [with Type = double]() + Foam::fvm::div(const Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> >&, Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) [with Type = Foam::Vector<double>](((Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&)(& U)))’
Code:
    fvScalarMatrix UEqn
    (
        fvc::ddt(rho)
      + fvm::div(rho,phi)
    );
->
Quote:
error: no matching function for call to ‘div(Foam::volScalarField&, Foam::surfaceScalarField&)’
Code:
fvScalarMatrix UEqn
    (
        fvc::ddt(rho)
      + fvm::div(fvc::interpolate(rho),phi)
    );
->
Quote:
error: no matching function for call to ‘div(Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> >, Foam::surfaceScalarField&)’
Code:
fvVectorMatrix UEqn
    (
        fvc::ddt(rho)
      + fvm::div(fvc::interpolate(rho),U)
    );
->
Quote:
error: no match for ‘operator+’ in ‘Foam::fvc::ddt(const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) [with Type = double]() + Foam::fvm::div(const Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> >&, Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) [with Type = Foam::Vector<double>](((Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&)(& U)))’
I'm looking forward for an expert-answer

Best,
linch is offline   Reply With Quote

Old   June 27, 2011, 13:53
Default
  #2
Senior Member
 
Illya Shevchuk
Join Date: Aug 2009
Location: Darmstadt, Germany
Posts: 174
Rep Power: 7
linch is on a distinguished road
I'm a little bit confused:

thus I am looking for a volVectorField U, my system of equations should be fvVectorMatrix. But the continuity equation is a scalar one and the term div(rho,U) is a scalar field. So for each cell I have 3x unknowns but only 1x equation, right?

On the other hand, it should be possible to obtain continuity-based velocities in 1D. How can it be implemented, if I want to start with an 1D-case?

Furthermore, if I prescribe the temporal density change for each cell and provide velocities for every boundary cell but one, only one velocity field is possible, that satisfies these conditions, am I right? So how this velocity field can be obtained?
linch is offline   Reply With Quote

Old   June 27, 2011, 14:37
Default
  #3
Senior Member
 
Felix L.
Join Date: Feb 2010
Location: Hamburg
Posts: 165
Rep Power: 9
FelixL is on a distinguished road
Hello, linch,


you are right, the continuity equation is a scalar equation so it can only be solved for a single unknown scalar. This may be the density (which would be the easy way) or any velocity component. Still the continuity equation is one equation, so even if you know the temporal variation and the mass fluxes at the boundaries, there will be aribitrary velocity fields which satisfy the continuity equation.

Just imagine the following setup:

A rectangular, twodimensional domain. The continuity equation is

\frac{\partial \rho}{\partial t} + \frac{\partial \phi_x}{\partial x} + \frac{\partial \phi_y}{\partial y} = 0

\partial \rho/\partial t shall be known throughout the domain and at every boundary face it shall be \phi_x= \phi_{x0} and \phi_y= \phi_{y0}.

Out of the box there come two different velocity fields to my mind which satisfiy the continuity equation: either one, where \phi_x(y=\mbox{const.})=\mbox{const.}, thus \partial \phi_x/\partial x = 0 or another, where \phi_y(x=\mbox{const.})=\mbox{const.}, thus \partial \phi_y/\partial y = 0.
The partial derivative of the other mass flux component is then equal to -{\partial \rho}/{\partial t}

So it's not possible to obtain a velocity field from the continuity equation without any additional information.


In 1D it should be possible, though, as long as the variation of density is known. Just treat the velocity component as a scalar.


Greetings,
Felix

Last edited by FelixL; June 27, 2011 at 15:02.
FelixL is offline   Reply With Quote

Old   June 27, 2011, 18:02
Default
  #4
Senior Member
 
Illya Shevchuk
Join Date: Aug 2009
Location: Darmstadt, Germany
Posts: 174
Rep Power: 7
linch is on a distinguished road
Thank you Felix,

to treat the velocity as scalar is a great idea!
linch is offline   Reply With Quote

Old   June 28, 2011, 05:31
Default
  #5
Senior Member
 
Illya Shevchuk
Join Date: Aug 2009
Location: Darmstadt, Germany
Posts: 174
Rep Power: 7
linch is on a distinguished road
One more question Felix,

which boundary condition would you suggest for velocity for the open end, since no boundary condition is needed? In 1D, one velocity and known density changes are fully sufficient. Otherwise the system of equations is overdetermined. Is there any "no condition" boundary in OF?
linch is offline   Reply With Quote

Old   June 29, 2011, 09:41
Default
  #6
Senior Member
 
Felix L.
Join Date: Feb 2010
Location: Hamburg
Posts: 165
Rep Power: 9
FelixL is on a distinguished road
I was thinking about it for a bit and I don't think it would make sense doing this with OpenFOAM.
If you know \rho(x,t) and you want to solve for \phi(x,t), the 1D continuity equation simply becomes an ODE. So unless you don't have any other PDEs coupled with the continuity equation, it would make much more sense solving this equation using an ODE solver and not with finite volume methods.


What's your intention, anyway, if I may ask?


Greetings,
Felix.
FelixL is offline   Reply With Quote

Old   June 30, 2011, 04:04
Default
  #7
Senior Member
 
Illya Shevchuk
Join Date: Aug 2009
Location: Darmstadt, Germany
Posts: 174
Rep Power: 7
linch is on a distinguished road
Thanks again Felix,

Well, I also have PDEs for enthalpy and components to solve. And the intention is to test, if diffusive heat and mass transfer as well as evaporation models are working in 1D, before adding the momentum equation.

That's the background.
linch is offline   Reply With Quote

Reply

Tags
continuity equation, velocity field

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
Solve Flow or VOF simultaneously ? Ramsey FLUENT 1 February 16, 2011 14:16
Linearized NS euqations: how to solve them?(problem with Matrix operations..) matteoL OpenFOAM Running, Solving & CFD 0 November 18, 2009 07:58
Solve for two or more "Temperatures" Rui CFX 12 September 9, 2008 21:58
How FVM will solve shock problem? michael Main CFD Forum 4 June 13, 2007 09:07
How to solve another continuum and momentum eqn? west_wing FLUENT 0 August 25, 2003 10:00


All times are GMT -4. The time now is 06:12.