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 (https://www.cfd-online.com/Forums/openfoam-solving/59310-incompatible-fields-operation.html)

tehache August 31, 2005 06:18

Hi everybody, I am trying t
 
Hi everybody,

I am trying to solve solidification/melting problems, smearing out release of latent heat over a temperature intervall around melting point, i.e. would like to solve this:

d/dt(rho*cp*T+l*g(T)) -laplacian(DT,T) = 0

Forgetting for the moment cp, rho,l (latent heat),
I created a volScalarField g_T (dimensionSet(0,0,0,1,0,0,0), and assign values (0 below melting point, then a transition, 1 above).
The field T has the same dimension.

Simple-hearted as I am, then tried to do this:

solve
(
fvm::ddt(T) +fvm::ddt(g_T) - fvm::laplacian(DT, T)
);

compiles, but then

--> FOAM FATAL ERROR : incompatible fields
for operation [T] + [g_T]

Thank you very much for any hint ...

sampaio August 31, 2005 07:55

I think this is because you ar
 
I think this is because you are trying to solve for two different variables at the same equation (same matrix).

If you want the term on g(T) implicit, I think you should decompose ddt(g(T)) into something like ddt(g) * ddt(T) using chain rule. If you cannot calculate ddt(g) analitically (gl in chain rule) pehaps you can use something like:

fvc::ddt(g_T)/fvc::ddt(T) * fvm::ddt(T)

\___________________/ \_______/

||||||||||| gl explicit ||||||||||||||||| implicit

You will need some correction tought if fvc::ddt(T) gets close to zero...

(I never tried something like this, better listen to what more experienced people has to say about it... http://www.cfd-online.com/OpenFOAM_D...part/happy.gif )

tehache August 31, 2005 08:17

thanks a lot...works with chai
 
thanks a lot...works with chain rule.
In fact somehow trivial, but when you are new to this its sometimes confusing http://www.cfd-online.com/OpenFOAM_D...part/happy.gif

qtian November 27, 2007 12:07

Hello,all, I am trying to s
 
Hello,all,

I am trying to study anisotropic eddy viscosity effect to my simulation. I created an anisotropic viscosity ternsor "nuEffAn" in the turbulenceModel.H file and also modified the momentum equation in kOmegaSST.C as following.

tmp<fvvectormatrix> kOmegaSST::divR(volVectorField& U) const
{
return
(
- fvm::laplacian(nuEffAn(), U)
- fvc::div(nuEffAn()&dev(fvc::grad(U)().T()))+(2.0/3.0)*fvc::grad(k_)
);
}

//- Return the effective anisotropic viscosity ternsor
virtual tmp<voltensorfield> nuEffAn() const
{
tensor T1(1,1,1,1,1,1,1,1,1);
tensor T2(0.6,1,1,1,1,0.6,1,0.6,1);

return tmp<voltensorfield>
(
new volTensorField("nuEffAn", nut()*T2 + nu()*T1)
);
}


After compiled the turbulence model, while I start my simulation, I got following error message:

--> FOAM FATAL ERROR : incompatible fields for operation
[U] + [region0]#0 Foam::error::printStack(Foam:http://www.cfd-online.com/OpenFOAM_D...part/proud.gifstream&)
#1 Foam::error::abort()
#2 void Foam::checkMethod<foam::vector<double> >(Foam::fvMatrix<foam::vector<double> > const&, Foam::fvMatrix<foam::vector<double> > const&, char const*)
#3 Foam::tmp<foam::fvmatrix<foam::vector<double> > > Foam::operator+<foam::vector<double> >(Foam::tmp<foam::fvmatrix<foam::vector<double> > > const&, Foam::tmp<foam::fvmatrix<foam::vector<double> > > const&)
#4 main
#5 __libc_start_main
#6 __gxx_personality_v0 at /usr/src/packages/BUILD/glibc-2.3/csu/../sysdeps/i386/elf/start.S:122


From function checkMethod(const fvMatrix<type>&, const fvMatrix<type>&)
in file /home/dm2/henry/OpenFOAM/OpenFOAM-1.4/src/finiteVolume/lnInclude/fvMatrix.C at line 1005.


Can anybody tell me what I did wrong? Thanks.

mediode April 7, 2010 06:48

@tehache

Hi,

could you please be more specific on the chain rule applied. I have some doubt that ddt(g)*ddt(T) is correct, I think it should be ddT(g)*ddt(T) instead. Something like ddT is not implemented in OF, or?

Please corect me if I'm wrong.

Cheers
m*

Zhi Cheng January 30, 2018 15:32

Have you solved this problem? Thanks!
I will be greatly appreciated if you replied me.
Quote:

Originally Posted by qtian (Post 189821)
Hello,all,

I am trying to study anisotropic eddy viscosity effect to my simulation. I created an anisotropic viscosity ternsor "nuEffAn" in the turbulenceModel.H file and also modified the momentum equation in kOmegaSST.C as following.

tmp<fvvectormatrix> kOmegaSST::divR(volVectorField& U) const
{
return
(
- fvm::laplacian(nuEffAn(), U)
- fvc::div(nuEffAn()&dev(fvc::grad(U)().T()))+(2.0/3.0)*fvc::grad(k_)
);
}

//- Return the effective anisotropic viscosity ternsor
virtual tmp<voltensorfield> nuEffAn() const
{
tensor T1(1,1,1,1,1,1,1,1,1);
tensor T2(0.6,1,1,1,1,0.6,1,0.6,1);

return tmp<voltensorfield>
(
new volTensorField("nuEffAn", nut()*T2 + nu()*T1)
);
}


After compiled the turbulence model, while I start my simulation, I got following error message:

--> FOAM FATAL ERROR : incompatible fields for operation
[U] + [region0]#0 Foam::error::printStack(Foam:http://www.cfd-online.com/OpenFOAM_D...part/proud.gifstream&)
#1 Foam::error::abort()
#2 void Foam::checkMethod<foam::vector<double> >(Foam::fvMatrix<foam::vector<double> > const&, Foam::fvMatrix<foam::vector<double> > const&, char const*)
#3 Foam::tmp<foam::fvmatrix<foam::vector<double> > > Foam::operator+<foam::vector<double> >(Foam::tmp<foam::fvmatrix<foam::vector<double> > > const&, Foam::tmp<foam::fvmatrix<foam::vector<double> > > const&)
#4 main
#5 __libc_start_main
#6 __gxx_personality_v0 at /usr/src/packages/BUILD/glibc-2.3/csu/../sysdeps/i386/elf/start.S:122


From function checkMethod(const fvMatrix<type>&, const fvMatrix<type>&)
in file /home/dm2/henry/OpenFOAM/OpenFOAM-1.4/src/finiteVolume/lnInclude/fvMatrix.C at line 1005.


Can anybody tell me what I did wrong? Thanks.



All times are GMT -4. The time now is 23:03.