CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Incompatible fields for operation divphi Ub (https://www.cfd-online.com/Forums/openfoam-solving/60421-incompatible-fields-operation-divphi-ub.html)

vvqf November 22, 2005 10:13

I am writing an adjoint solver
 
I am writing an adjoint solver based on simpleFoam.
I used 2 velocity fields, one is adjoint velocity- U, which needs to be calculated, the other is a read-in velocity - U'(constant, read in as initial value at the begining). phi is created by interpolating the adjoint velocity- U.

I also created a PhiU'.cfg file to define the fvSchemes, and did little corresponding modifications in the solver source and testcase fvScheme files.

But when I use the solver the solve the case, I have error message as follows:
FOAM FATAL ERROR : incompatible fields for operation
[U'] - [U]

From function checkMethod(const fvMatrix<type>&, const fvMatrix<type>&)
in file ~/OpenFOAM/OpenFOAM-1.2/src/OpenFOAM/lnInclude/fvMatrix.C at line 898.

in fvMatrix.C line 898, it went into a if block:
if (&fvm1.psi() != &fvm2.psi())

Does it mean that these two velocity fields have to be the same, or with different names but actually share the same address?

-----------------
createPhi.H
see http://www.cfd-online.com/OpenFOAM_D...tml?1132072161

hjasak November 22, 2005 11:45

If you want to solve a single
 
If you want to solve a single equation in FOAM, it can only have one variable. In other words, when you do:

fvm::ddt(U) + fvm::div(phi, U)

the first and second U need to be the same field. In your case it looks as if they are not.

Please also have in mind that you are upsetting the database by the fact you've got two fields with the same name.

Hrv

vvqf November 22, 2005 17:43

Thank you for the answer. I
 
Thank you for the answer.

I now just want to fvm::div(phi, U')
Where phi is defined as:
-------------
surfaceScalarField phi
(
IOobject
(
"phi",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
linearInterpolate(U) & mesh.Sf()
);
--------------
I offered a U' file to be read in at the beginning, in the 0 time directory. So U' is known and is a constant field.

I want to express (U'奄)U as fvm::div(phi, U'). Is that wrong?

hjasak November 22, 2005 17:55

phi does not matter - it only
 
phi does not matter - it only needs to fit dimensionally. If you do:

fvm::div(phi, U')

you will get the equation for U' - to be more precise an fvVectorMatrix where U' is the variable you will try to solve for. Are you sure you want fvm rather than fvc?

Hrv

gouravjee April 4, 2018 03:28

Incompatible field operation
 
Quote:

Originally Posted by hjasak (Post 197843)
phi does not matter - it only needs to fit dimensionally. If you do:

fvm::div(phi, U')

you will get the equation for U' - to be more precise an fvVectorMatrix where U' is the variable you will try to solve for. Are you sure you want fvm rather than fvc?

Hrv

I am solving a heat diffusion equation in which i have two variables and one of them is derived from another but get the error :
Incompatible Field Operation [T]-[H]
T--> temperature
H-->enthalpy

can you suggest how to solve this problem


All times are GMT -4. The time now is 11:38.