# solve continiuty for velocity

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

June 27, 2011, 13:04
solve continiuty for velocity
#1
Senior Member

Illya Shevchuk
Join Date: Aug 2009
Posts: 176
Rep Power: 9
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?

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&) [with Type = double]() + Foam::fvm::div(const Foam::tmp >&, Foam::GeometricField&) [with Type = Foam::Vector](((Foam::GeometricField, 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::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&) [with Type = double]() + Foam::fvm::div(const Foam::tmp >&, Foam::GeometricField&) [with Type = Foam::Vector](((Foam::GeometricField, Foam::fvPatchField, Foam::volMesh>&)(& U)))’
I'm looking forward for an expert-answer

Best,

 June 27, 2011, 13:53 #2 Senior Member   Illya Shevchuk Join Date: Aug 2009 Location: Darmstadt, Germany Posts: 176 Rep Power: 9 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?

 June 27, 2011, 14:37 #3 Senior Member   Felix L. Join Date: Feb 2010 Location: Hamburg Posts: 165 Rep Power: 11 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 shall be known throughout the domain and at every boundary face it shall be and . Out of the box there come two different velocity fields to my mind which satisfiy the continuity equation: either one, where , thus or another, where , thus . The partial derivative of the other mass flux component is then equal to 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.

 June 27, 2011, 18:02 #4 Senior Member   Illya Shevchuk Join Date: Aug 2009 Location: Darmstadt, Germany Posts: 176 Rep Power: 9 Thank you Felix, to treat the velocity as scalar is a great idea!

 June 28, 2011, 05:31 #5 Senior Member   Illya Shevchuk Join Date: Aug 2009 Location: Darmstadt, Germany Posts: 176 Rep Power: 9 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?

 June 29, 2011, 09:41 #6 Senior Member   Felix L. Join Date: Feb 2010 Location: Hamburg Posts: 165 Rep Power: 11 I was thinking about it for a bit and I don't think it would make sense doing this with OpenFOAM. If you know and you want to solve for , 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.

 June 30, 2011, 04:04 #7 Senior Member   Illya Shevchuk Join Date: Aug 2009 Location: Darmstadt, Germany Posts: 176 Rep Power: 9 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.

 Tags continuity equation, velocity field

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Ramsey FLUENT 1 February 16, 2011 14:16 matteoL OpenFOAM Running, Solving & CFD 0 November 18, 2009 07:58 Rui CFX 12 September 9, 2008 21:58 michael Main CFD Forum 4 June 13, 2007 09:07 west_wing FLUENT 0 August 25, 2003 10:00