CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Quick question about equation expression in the code

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 4, 2017, 08:28
Default Quick question about equation expression in the code
  #1
Member
 
Linyan X
Join Date: Dec 2015
Posts: 43
Rep Power: 10
linyanx is on a distinguished road
Dear Foams,

I'm having a hard time to understand the proper way to express the governing equations. I am currently creating one solver for solving the elliptic equation based on solver ‘LaplacianFoam’.
I think everything is well compiled so far except one problem remaining for the proper expression of the governing equation. I am not well understood the process of the matrix equations' manipulation. Hence, the format of the field is not defined correctly.
I am trying to write the equation in the following way.

fvm::div(sigma , fvc::grad(Phi_E))
- fvm::div(sigma * A)

But the compiler will complain as follow:

error: no matching function for call to ‘div(Foam::volScalarField&, Foam::tmp<Foam::GeometricField<Foam::Vector<dou
ble>, Foam::fvPatchField, Foam::volMesh> >)’
fvm::div(sigma , fvc::grad(Phi_E))

Or can you please read the ellipticFoam.C file to see the equation expression part and give me some comment about the right way to express the equation?
I’ve also attached the governing equation attached for your reference.

Any suggestion is kindly appreciated!

Best,
Antelope
Attached Images
File Type: jpg WeChat Image_20170403234010.jpg (38.9 KB, 12 views)
Attached Files
File Type: h createFields.H (1.8 KB, 1 views)
File Type: c ellipticFoam.C (1.2 KB, 1 views)
linyanx is offline   Reply With Quote

Old   April 4, 2017, 14:11
Default Matrix manipulation needed to be corrected
  #2
Member
 
Linyan X
Join Date: Dec 2015
Posts: 43
Rep Power: 10
linyanx is on a distinguished road
The thing goes well. I am trying to derivate my governing equation into a separate form.


solve
(
fvm::laplacian(Phi_E)
+ fvm::laplacian(sigma, Phi_E)
- A * fvc::grad(sigma)
- sigma * fvc::div(A)
)


The first two terms work. However, when I tried to write the last two terms in the equation above. The system complains again and give me a lot of note about the matrix manipulation.

ellipticFoam.C:35:23: note: ‘Foam::tmp<Foam::fvMatrix<double> >’ is not derived from ‘const Foam::GeometricField<TypeR, PatchField, Geo
Mesh>’
- A * fvc::grad(sigma)
^
In file included from /usr/local/openfoam/OpenFOAM-4.1/src/OpenFOAM/lnInclude/GeometricField.C:1306:0,
from /usr/local/openfoam/OpenFOAM-4.1/src/OpenFOAM/lnInclude/GeometricField.H:651,
from /usr/local/openfoam/OpenFOAM-4.1/src/OpenFOAM/lnInclude/GeometricScalarField.H:38,
from /usr/local/openfoam/OpenFOAM-4.1/src/OpenFOAM/lnInclude/GeometricFields.H:34,
from /usr/local/openfoam/OpenFOAM-4.1/src/finiteVolume/lnInclude/volFields.H:37,
from /usr/local/openfoam/OpenFOAM-4.1/src/finiteVolume/lnInclude/surfaceInterpolationScheme.C:27,
from /usr/local/openfoam/OpenFOAM-4.1/src/finiteVolume/lnInclude/surfaceInterpolationScheme.H:304,
from /usr/local/openfoam/OpenFOAM-4.1/src/finiteVolume/lnInclude/surfaceInterpolate.H:41,
from /usr/local/openfoam/OpenFOAM-4.1/src/finiteVolume/lnInclude/fvc.H:39,
from /usr/local/openfoam/OpenFOAM-4.1/src/finiteVolume/lnInclude/fvCFD.H:8,
from ellipticFoam.C:1:
/usr/local/openfoam/OpenFOAM-4.1/src/OpenFOAM/lnInclude/GeometricFieldFunctions.C:657:1: note: template<class Type1, class Type2, templat
e<class> class PatchField, class GeoMesh> Foam::tmp<Foam::GeometricField<typename Foam::typeOfSum<Type1, Type2>::type, PatchField, GeoMes
h> > Foam:perator-(const Foam::GeometricField<TypeR, PatchField, GeoMesh>&, const Foam::tmp<Foam::GeometricField<Type1, PatchField, Geo
Mesh> >&)
operator op \


It seems like I did something wrong with the matrix manipulation.
linyanx is offline   Reply With Quote

Reply


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 Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Finite volume NS equation solver code Dansys Main CFD Forum 1 November 17, 2014 11:19
Basic question about writing a differential equation related to finite element RbBb Main CFD Forum 1 April 10, 2014 03:50
Question about using total energy equation or thermal equation Anna Tian CFX 3 May 6, 2013 18:58
Question on the discretization of momentum equation in icoFoam MPJ OpenFOAM 3 October 4, 2011 09:44
WENO Code (1D Advection Equation) Carolyn Main CFD Forum 6 March 11, 2007 13:21


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