|
[Sponsors] |
Add vector field in momentum conservation equation |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 3, 2022, 09:33 |
Add vector field in momentum conservation equation
|
#1 |
Member
Nikos
Join Date: Aug 2012
Location: Greece
Posts: 30
Rep Power: 14 |
Hi community!
I would like to add a vector field (with constant value) in the momentum conservation equation. I have the following equation form in the solver: Code:
fvVectorMatrix UEqn ( fvm::ddt(U) + fvm::div(phi, U) + fvm::Sp(C*pow(1-lf, 2)/(rhoRef*(pow(lf, 3)+q)), U) + MRF.DDt(U) + turbulence->divDevReff(U) == fvOptions(U) ); I would like to subtract a constant vector field (Up) from the velocity vector U. I changed the code as follows: Code:
fvVectorMatrix UEqn ( fvm::ddt(U) + fvm::div(phi, U) + fvm::Sp(C*pow(1-lf, 2)/(rhoRef*(pow(lf, 3)+q)), U - Up) //modified + MRF.DDt(U) + turbulence->divDevReff(U) == fvOptions(U) ); Code:
Info<< "Reading field Up\n" << endl; volVectorField Up ( IOobject ( "Up", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ), mesh ); Code:
/opt/OpenFOAM/OpenFOAM-v2012/src/finiteVolume/lnInclude/fvmSup.C:142:1: note: template argument deduction/substitution failed: In file included from meltingPullFoam.C:97:0: UEqn.H:12:63: note: ‘Foam::tmp<Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> >’ is not derived from ‘const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>’ + fvm::Sp(C*pow(1-lf, 2)/(rhoRef*(pow(lf, 3)+q)), U - Up) //added ^ In file included from /opt/OpenFOAM/OpenFOAM-v2012/src/finiteVolume/lnInclude/fvmSup.H:165:0, from /opt/OpenFOAM/OpenFOAM-v2012/src/finiteVolume/lnInclude/fvm.H:49, from /opt/OpenFOAM/OpenFOAM-v2012/src/finiteVolume/lnInclude/fvCFD.H:10, from meltingPullFoam.C:48: /opt/OpenFOAM/OpenFOAM-v2012/src/finiteVolume/lnInclude/fvmSup.C:156:1: note: candidate: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::Sp(const dimensionedScalar&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) Foam::fvm::Sp Do you have any proposals or tips? Thank you in advance! Nikos |
|
August 28, 2022, 12:40 |
|
#2 |
Senior Member
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 22 |
The method fvm::Sp() is used to add a source term implicitly to an equation to be solved, meaning as matrix components on the "left" side of the equation. So its argument must be the field to be solved (U in your case). But now, you also try to add the Up field to the matrix, which is not solved for. So you have to put on the "right" side of the equation explicitly. So I guess, you have to split this fmv::Sp() term into two, one for with fvm::Sp(..., U) and one without fvm:Sp() and just Up.
|
|
November 24, 2022, 05:07 |
|
#3 |
Member
Nikos
Join Date: Aug 2012
Location: Greece
Posts: 30
Rep Power: 14 |
Thank you Joachim for your reply. I have split the two terms as you proposed. For the second term (with the constant Up vector) I have tried to use fvm::Sp(..., Up) but I get:
Code:
--> FOAM FATAL ERROR: (openfoam-2012) incompatible fields for operation [U] - [Up] From void Foam::checkMethod(const Foam::fvMatrix<Type>&, const Foam::fvMatrix<Type>&, const char*) [with Type = Foam::Vector<double>] in file /opt/OpenFOAM/OpenFOAM-v2012/src/finiteVolume/lnInclude/fvMatrix.C at line 1319. FOAM aborting Code:
fvc::Sp(..., Up) |
|
December 4, 2022, 20:35 |
|
#4 |
Senior Member
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 22 |
You are right, you need to use the explicit operator fvc::Sp() for Up, because it is obviously not the solution variable, so you cannot use the implicit fvm::Sp().
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to add a body force to a momentum equation | anon_q | OpenFOAM Programming & Development | 25 | May 11, 2021 16:39 |
add a pressure drop term in the momentum equation | a.lone | FLUENT | 0 | July 3, 2019 07:48 |
Domain Reference Pressure and mass flow inlet boundary | AdidaKK | CFX | 75 | August 20, 2018 06:37 |
Question on the discretization of momentum equation in icoFoam | MPJ | OpenFOAM | 3 | October 4, 2011 10:44 |
Constant velocity of the material | Sas | CFX | 15 | July 13, 2010 09:56 |