November 22, 2019, 09:10
|
Divergence with solution variable as first entry
|
#1
|
New Member
Elisabeth Diehl
Join Date: Jun 2019
Posts: 8
Rep Power: 7
|
Hi everybody,
I have to include the term div(rho * dU & U) in a fvVectorMatrix, where & denotes the inner product of dU and U. The equation shall be solved for dU. I implemented the following code:
Code:
surfaceScalarField dPhi
(
IOobject
(
"dPhi",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
fvc::flux(dU)
);
surfaceScalarField rhoDPhi(fvc::interpolate(rho)*dPhi);
fvVectorMatrix dUEqn.H
(
...
+ fvm::div(rhoDPhi & U)
...
);
I didn't get an error while compilation, but when I want to solve a test case, I get the following error:
Quote:
incompatible fields for operation [dU] + [U]
|
In my opinion, this results from the fact, that the term fvm::div(rhoDPhi & U) causes OpenFOAM to think that U is the solution variable of the system instead of dU.
Do you have an idea how to "switch" dU and U in a mathematically correct way, without writing a new divergence operator?
Thanks a lot for thinking about this!
|
|
|