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

Compile error with a solver using electric potential method from an article

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 30, 2015, 07:01
Default Compile error with a solver using electric potential method from an article
  #1
Member
 
Jun
Join Date: Nov 2015
Posts: 57
Rep Power: 10
mykkujinu2201 is on a distinguished road
HI, guys.

I need some help about compiling solver at OpenFoam.

Actually, I'm new to OpenFoam.

I've started to use it for my final project; I have to solve high Hartmann mhd duct flow.

I was using Fluent but it didn't work well.

Anyway I'm compiling solver using electric potential method.

I've found some article about it and it contained source code for it.

I 'copied' whole source code and tried to compile the solver but it doesn't work.


The error is as below.

Code:
aking dependency list for source file EpotFoam.C
g++ -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam30/src/finiteVolume/lnInclude -I/opt/openfoam30/src/meshTools/lnInclude -IlnInclude -I. -I/opt/openfoam30/src/OpenFOAM/lnInclude -I/opt/openfoam30/src/OSspecific/POSIX/lnInclude   -fPIC -c EpotFoam.C -o Make/linux64GccDPInt32Opt/EpotFoam.o
In file included from EpotFoam.C:39:0:
createFields.H: In function ‘int main(int, char**)’:
createFields.H:27:1: error: expected initializer before numeric constant
 50
 ^
In file included from EpotFoam.C:39:0:
createFields.H:75:32: error: ‘sigma’ was not declared in this scope
 dimensionedScalar DB = 1.0/(mu*sigma);
                                ^
createFields.H:75:32: note: suggested alternative:
In file included from /opt/openfoam30/src/OpenFOAM/lnInclude/constants.H:47:0,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvCFD.H:18,
                 from EpotFoam.C:31:
/opt/openfoam30/src/OpenFOAM/lnInclude/physicoChemicalConstants.H:58:36: note:   ‘Foam::constant::physicoChemical::sigma’
     extern const dimensionedScalar sigma;
                                    ^
EpotFoam.C:65:23: error: ‘nCorr’ was not declared in this scope
 for (int corr=0; corr<nCorr; corr++)
                       ^
EpotFoam.C:69:43: error: ‘ddtPhiCorr’ is not a member of ‘Foam::fvc’
 phi = (fvc::interpolate(U) & mesh.Sf()) + fvc::ddtPhiCorr(rUA, U, phi);
                                           ^
EpotFoam.C:71:30: error: ‘nNonOrthCorr’ was not declared in this scope
 for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
                              ^
EpotFoam.C:94:28: error: no matching function for call to ‘laplacian(Foam::scalar&, Foam::volScalarField&)’
 fvm::laplacian(consist,PotE) == consist * fvc::div(psiub)
                            ^
EpotFoam.C:94:28: note: candidates are:
In file included from /opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.H:188:0,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvm.H:46,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvCFD.H:10,
                 from EpotFoam.C:31:
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:45:1: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&)
 laplacian
 ^
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:45:1: note:   template argument deduction/substitution failed:
EpotFoam.C:94:28: note:   mismatched types ‘const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>’ and ‘Foam::scalar {aka double}’
 fvm::laplacian(consist,PotE) == consist * fvc::div(psiub)
                            ^
In file included from /opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.H:188:0,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvm.H:46,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvCFD.H:10,
                 from EpotFoam.C:31:
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:70:1: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&)
 laplacian
 ^
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:70:1: note:   template argument deduction/substitution failed:
EpotFoam.C:94:28: note:   mismatched types ‘const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>’ and ‘Foam::scalar {aka double}’
 fvm::laplacian(consist,PotE) == consist * fvc::div(psiub)
                            ^
In file included from /opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.H:188:0,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvm.H:46,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvCFD.H:10,
                 from EpotFoam.C:31:
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:99:1: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::zero&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&)
 laplacian
 ^
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:99:1: note:   template argument deduction/substitution failed:
EpotFoam.C:94:28: note:   cannot convert ‘consist’ (type ‘Foam::scalar {aka double}’) to type ‘const Foam::zero&’
 fvm::laplacian(consist,PotE) == consist * fvc::div(psiub)
                            ^
In file included from /opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.H:188:0,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvm.H:46,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvCFD.H:10,
                 from EpotFoam.C:31:
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:115:1: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::zero&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&)
 laplacian
 ^
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:115:1: note:   template argument deduction/substitution failed:
EpotFoam.C:94:28: note:   cannot convert ‘consist’ (type ‘Foam::scalar {aka double}’) to type ‘const Foam::zero&’
 fvm::laplacian(consist,PotE) == consist * fvc::div(psiub)
                            ^
In file included from /opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.H:188:0,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvm.H:46,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvCFD.H:10,
                 from EpotFoam.C:31:
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:130:1: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::one&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&)
 laplacian
 ^
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:130:1: note:   template argument deduction/substitution failed:
EpotFoam.C:94:28: note:   cannot convert ‘consist’ (type ‘Foam::scalar {aka double}’) to type ‘const Foam::one&’
 fvm::laplacian(consist,PotE) == consist * fvc::div(psiub)
                            ^
In file included from /opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.H:188:0,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvm.H:46,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvCFD.H:10,
                 from EpotFoam.C:31:
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:143:1: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::one&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&)
 laplacian
 ^
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:143:1: note:   template argument deduction/substitution failed:
EpotFoam.C:94:28: note:   cannot convert ‘consist’ (type ‘Foam::scalar {aka double}’) to type ‘const Foam::one&’
 fvm::laplacian(consist,PotE) == consist * fvc::div(psiub)
                            ^
In file included from /opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.H:188:0,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvm.H:46,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvCFD.H:10,
                 from EpotFoam.C:31:
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:155:1: note: template<class Type, class GType> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::dimensioned<Type2>&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&)
 laplacian
 ^
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:155:1: note:   template argument deduction/substitution failed:
EpotFoam.C:94:28: note:   mismatched types ‘const Foam::dimensioned<Type2>’ and ‘Foam::scalar {aka double}’
 fvm::laplacian(consist,PotE) == consist * fvc::div(psiub)
                            ^
In file included from /opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.H:188:0,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvm.H:46,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvCFD.H:10,
                 from EpotFoam.C:31:
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:181:1: note: template<class Type, class GType> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::dimensioned<Type2>&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&)
 laplacian
 ^
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:181:1: note:   template argument deduction/substitution failed:
EpotFoam.C:94:28: note:   mismatched types ‘const Foam::dimensioned<Type2>’ and ‘Foam::scalar {aka double}’
 fvm::laplacian(consist,PotE) == consist * fvc::div(psiub)
                            ^
In file included from /opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.H:188:0,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvm.H:46,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvCFD.H:10,
                 from EpotFoam.C:31:
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:208:1: note: template<class Type, class GType> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::GeometricField<GType, Foam::fvPatchField, Foam::volMesh>&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&)
 laplacian
 ^
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:208:1: note:   template argument deduction/substitution failed:
EpotFoam.C:94:28: note:   mismatched types ‘const Foam::GeometricField<GType, Foam::fvPatchField, Foam::volMesh>’ and ‘Foam::scalar {aka double}’
 fvm::laplacian(consist,PotE) == consist * fvc::div(psiub)
                            ^
In file included from /opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.H:188:0,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvm.H:46,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvCFD.H:10,
                 from EpotFoam.C:31:
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:240:1: note: template<class Type, class GType> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::GeometricField<GType, Foam::fvPatchField, Foam::volMesh>&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&)
 laplacian
 ^
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:240:1: note:   template argument deduction/substitution failed:
EpotFoam.C:94:28: note:   mismatched types ‘const Foam::GeometricField<GType, Foam::fvPatchField, Foam::volMesh>’ and ‘Foam::scalar {aka double}’
 fvm::laplacian(consist,PotE) == consist * fvc::div(psiub)
                            ^
In file included from /opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.H:188:0,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvm.H:46,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvCFD.H:10,
                 from EpotFoam.C:31:
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:225:1: note: template<class Type, class GType> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::tmp<Foam::GeometricField<GType, Foam::fvPatchField, Foam::volMesh> >&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&)
 laplacian
 ^
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:225:1: note:   template argument deduction/substitution failed:
EpotFoam.C:94:28: note:   mismatched types ‘const Foam::tmp<Foam::GeometricField<GType, Foam::fvPatchField, Foam::volMesh> >’ and ‘Foam::scalar {aka double}’
 fvm::laplacian(consist,PotE) == consist * fvc::div(psiub)
                            ^
In file included from /opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.H:188:0,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvm.H:46,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvCFD.H:10,
                 from EpotFoam.C:31:
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:257:1: note: template<class Type, class GType> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::tmp<Foam::GeometricField<GType, Foam::fvPatchField, Foam::volMesh> >&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&)
 laplacian
 ^
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:257:1: note:   template argument deduction/substitution failed:
EpotFoam.C:94:28: note:   mismatched types ‘const Foam::tmp<Foam::GeometricField<GType, Foam::fvPatchField, Foam::volMesh> >’ and ‘Foam::scalar {aka double}’
 fvm::laplacian(consist,PotE) == consist * fvc::div(psiub)
                            ^
In file included from /opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.H:188:0,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvm.H:46,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvCFD.H:10,
                 from EpotFoam.C:31:
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:273:1: note: template<class Type, class GType> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::GeometricField<GType, Foam::fvsPatchField, Foam::surfaceMesh>&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&)
 laplacian
 ^
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:273:1: note:   template argument deduction/substitution failed:
EpotFoam.C:94:28: note:   mismatched types ‘const Foam::GeometricField<GType, Foam::fvsPatchField, Foam::surfaceMesh>’ and ‘Foam::scalar {aka double}’
 fvm::laplacian(consist,PotE) == consist * fvc::div(psiub)
                            ^
In file included from /opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.H:188:0,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvm.H:46,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvCFD.H:10,
                 from EpotFoam.C:31:
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:290:1: note: template<class Type, class GType> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::tmp<Foam::GeometricField<GType, Foam::fvsPatchField, Foam::surfaceMesh> >&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&)
 laplacian
 ^
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:290:1: note:   template argument deduction/substitution failed:
EpotFoam.C:94:28: note:   mismatched types ‘const Foam::tmp<Foam::GeometricField<GType, Foam::fvsPatchField, Foam::surfaceMesh> >’ and ‘Foam::scalar {aka double}’
 fvm::laplacian(consist,PotE) == consist * fvc::div(psiub)
                            ^
In file included from /opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.H:188:0,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvm.H:46,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvCFD.H:10,
                 from EpotFoam.C:31:
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:305:1: note: template<class Type, class GType> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::GeometricField<GType, Foam::fvsPatchField, Foam::surfaceMesh>&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&)
 laplacian
 ^
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:305:1: note:   template argument deduction/substitution failed:
EpotFoam.C:94:28: note:   mismatched types ‘const Foam::GeometricField<GType, Foam::fvsPatchField, Foam::surfaceMesh>’ and ‘Foam::scalar {aka double}’
 fvm::laplacian(consist,PotE) == consist * fvc::div(psiub)
                            ^
In file included from /opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.H:188:0,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvm.H:46,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvCFD.H:10,
                 from EpotFoam.C:31:
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:322:1: note: template<class Type, class GType> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::laplacian(const Foam::tmp<Foam::GeometricField<GType, Foam::fvsPatchField, Foam::surfaceMesh> >&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&)
 laplacian
 ^
/opt/openfoam30/src/finiteVolume/lnInclude/fvmLaplacian.C:322:1: note:   template argument deduction/substitution failed:
EpotFoam.C:94:28: note:   mismatched types ‘const Foam::tmp<Foam::GeometricField<GType, Foam::fvsPatchField, Foam::surfaceMesh> >’ and ‘Foam::scalar {aka double}’
 fvm::laplacian(consist,PotE) == consist * fvc::div(psiub)
                            ^
make: *** [Make/linux64GccDPInt32Opt/EpotFoam.o] Error 1
I can't understand why it fails and what is wrong.

I really need to solve this problem.

Does anyone help me?
mykkujinu2201 is offline   Reply With Quote

Old   December 1, 2015, 04:05
Default
  #2
Senior Member
 
Agustín Villa
Join Date: Apr 2013
Location: Alcorcón
Posts: 313
Rep Power: 15
agustinvo is on a distinguished road
Hello,

it seems you have not defined sigma in your createFields file. Could you upload it?
agustinvo is offline   Reply With Quote

Old   December 1, 2015, 13:19
Smile
  #3
Senior Member
 
Hesam
Join Date: Feb 2015
Posts: 139
Rep Power: 11
rapierrz is on a distinguished road
Hello Jun,

I work with mhdFoam and it properly work,what do you need to calculate?

if you want to simulate flow in a duct you don't need any change.
rapierrz is offline   Reply With Quote

Old   December 7, 2015, 11:01
Default Modifed MHDFoam compiling error
  #4
Member
 
Jun
Join Date: Nov 2015
Posts: 57
Rep Power: 10
mykkujinu2201 is on a distinguished road
Hello.

I'm keep trying to solve MHD Duct Flow with electric potential mehtod.

I tried to modify simplefoam and it actually works. For turbulence, there is no problem at all but for laminar, it does not converge at high hartman number.

So, I keep searching codes on the internet and I found one.

Unfortunately, it does not show everything. I couldn't figure out which application was modified though it resembled mhdFoam. So, I modified mhdFoam following the code.
That is deetached.
Code:
#include "fvCFD.H"
#include "pisoControl.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{
    #include "setRootCase.H"

    #include "createTime.H"
    #include "createMesh.H"

    pisoControl piso(mesh);
    pisoControl bpiso(mesh, "BPISO");

    #include "createFields.H"
    #include "initContinuityErrs.H"

    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

    Info<< nl << "Starting time loop" << endl;



    while (runTime.loop())
    {
    Info<< "Time = " << runTime.timeName() << nl << endl;
                                                                                                                                                                                                                                                                                                                           
        #include "CourantNo.H"

        {
        volVectorField UcrosB= U ^ B;
       
        volVectorField j=-sigma*fvc::grad(PotE) + sigma*UcrosB;
        volVectorField jcrosB = j ^ B;
            fvVectorMatrix UEqn
            (
                fvm::ddt(U)
              + fvm::div(phi, U)
          - (jcrosB/rho)
          - fvm::laplacian(nu,U)
              
            );

            if (piso.momentumPredictor())
            {
                solve(UEqn == -fvc::grad(p));
            }


            // --- PISO loop
            while (piso.correct())
            {
                volScalarField rAU(1.0/UEqn.A());
                surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));

                volVectorField HbyA("HbyA", U);
                HbyA = rAU*UEqn.H();

                surfaceScalarField phiHbyA
                (
                    "phiHbyA",
                    (fvc::interpolate(HbyA) & mesh.Sf())
                  + rAUf*fvc::ddtCorr(U, phi)
                );

                while (piso.correctNonOrthogonal())
                {
                    fvScalarMatrix pEqn
                    (
                        fvm::laplacian(rAUf, p) == fvc::div(phiHbyA)
                    );

                    pEqn.setReference(pRefCell, pRefValue);
                    pEqn.solve(mesh.solver(p.select(piso.finalInnerIter())));

                    if (piso.finalNonOrthogonalIter())
                    {
                        phi = phiHbyA - pEqn.flux();
                    }
                }

                #include "continuityErrs.H"

                U = HbyA - rAU*fvc::grad(p);
                U.correctBoundaryConditions();
            }
        }

        // --- B-PISO loop
        while (bpiso.correct())
        {
        volVectorField UcrosB= U ^ B;
    
            fvVectorMatrix BEqn
            (
                fvm::laplacian(PotE) == fvc::div(UcrosB)
            );

            BEqn.solve();

           
            #include "magneticFieldErr.H"
        }

        runTime.write();
    }

    Info<< "End\n" << endl;

    return 0;
}


// ************************************************************************* //

But it had errors.

Code:
Making dependency list for source file EpisoFoam.C
g++ -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam30/src/finiteVolume/lnInclude -I/opt/openfoam30/src/meshTools/lnInclude -IlnInclude -I. -I/opt/openfoam30/src/OpenFOAM/lnInclude -I/opt/openfoam30/src/OSspecific/POSIX/lnInclude   -fPIC -c EpisoFoam.C -o Make/linux64GccDPInt32Opt/EpisoFoam.o
EpisoFoam.C: In function ‘int main(int, char**)’:
EpisoFoam.C:148:13: error: no matching function for call to ‘Foam::fvMatrix<Foam::Vector<double> >::fvMatrix(Foam::tmp<Foam::fvMatrix<double> >)’
             );
             ^
EpisoFoam.C:148:13: note: candidates are:
In file included from /opt/openfoam30/src/finiteVolume/lnInclude/fvMatrix.H:1058:0,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/ddtScheme.C:29,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/ddtScheme.H:337,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvcDdt.C:28,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvcDdt.H:199,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvc.H:44,
                 from /opt/openfoam30/src/finiteVolume/lnInclude/fvCFD.H:8,
                 from EpisoFoam.C:51:
/opt/openfoam30/src/finiteVolume/lnInclude/fvMatrix.C:418:1: note: Foam::fvMatrix<Type>::fvMatrix(const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, Foam::Istream&) [with Type = Foam::Vector<double>]
 Foam::fvMatrix<Type>::fvMatrix
 ^
/opt/openfoam30/src/finiteVolume/lnInclude/fvMatrix.C:418:1: note:   candidate expects 2 arguments, 1 provided
/opt/openfoam30/src/finiteVolume/lnInclude/fvMatrix.C:361:1: note: Foam::fvMatrix<Type>::fvMatrix(const Foam::tmp<Foam::fvMatrix<Type> >&) [with Type = Foam::Vector<double>]
 Foam::fvMatrix<Type>::fvMatrix(const tmp<fvMatrix<Type> >& tfvm)
 ^
/opt/openfoam30/src/finiteVolume/lnInclude/fvMatrix.C:361:1: note:   no known conversion for argument 1 from ‘Foam::tmp<Foam::fvMatrix<double> >’ to ‘const Foam::tmp<Foam::fvMatrix<Foam::Vector<double> > >&’
/opt/openfoam30/src/finiteVolume/lnInclude/fvMatrix.C:330:1: note: Foam::fvMatrix<Type>::fvMatrix(const Foam::fvMatrix<Type>&) [with Type = Foam::Vector<double>]
 Foam::fvMatrix<Type>::fvMatrix(const fvMatrix<Type>& fvm)
 ^
/opt/openfoam30/src/finiteVolume/lnInclude/fvMatrix.C:330:1: note:   no known conversion for argument 1 from ‘Foam::tmp<Foam::fvMatrix<double> >’ to ‘const Foam::fvMatrix<Foam::Vector<double> >&’
/opt/openfoam30/src/finiteVolume/lnInclude/fvMatrix.C:273:1: note: Foam::fvMatrix<Type>::fvMatrix(const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::dimensionSet&) [with Type = Foam::Vector<double>]
 Foam::fvMatrix<Type>::fvMatrix
 ^
/opt/openfoam30/src/finiteVolume/lnInclude/fvMatrix.C:273:1: note:   candidate expects 2 arguments, 1 provided
Is anyone who can help me?
mykkujinu2201 is offline   Reply With Quote

Old   December 8, 2015, 14:42
Smile
  #5
Senior Member
 
Hesam
Join Date: Feb 2015
Posts: 139
Rep Power: 11
rapierrz is on a distinguished road
I think it was operator precedence problem,

the solution is to use the (U ^ B) instead of U ^ B
rapierrz is offline   Reply With Quote

Old   December 22, 2015, 05:45
Default
  #6
Senior Member
 
Tomislav Maric
Join Date: Mar 2009
Location: Darmstadt, Germany
Posts: 284
Blog Entries: 5
Rep Power: 21
tomislav_maric is on a distinguished road
Quote:
Originally Posted by mykkujinu2201 View Post
HI, guys.

I need some help about compiling solver at OpenFoam....
You should get used to reading the compiler errors carefully. The first error is the most relevant one.
Code:
createFields.H: In function ‘int main(int, char**)’: createFields.H:27:1: error: expected initializer before numeric constant  50
Check the type declaration for the variable of value 50 in createFields.H on line 27. You should post the file that is mentioned in the compiler error in the question you are asking, or prepare a github/bitbucket repo with your code - it makes it much, much easier to help you...
__________________
When asking a question, prepare a SSCCE.
tomislav_maric is offline   Reply With Quote

Old   March 18, 2016, 05:25
Question
  #7
New Member
 
Join Date: Mar 2016
Posts: 14
Rep Power: 10
RomainBou is on a distinguished road
Hi,

Did you solve your problem ?
I might have to use your code to solve my case

I will maybe creat a new forum thread, but here is my question :
Can anybody confirm that using only the mhdFoam solver you cannot set up an initial Electrical potential field??

So the only solution is to make your own solver, like your are trying to do?

correct?

My project is to determine the velocity field of a fluid inside a cylinder, given a certain magnetic field and a electric potential field. How can I do that with openfoam ?
Thanks
RomainBou is offline   Reply With Quote

Old   March 29, 2016, 02:37
Default
  #8
New Member
 
Krish
Join Date: Mar 2016
Posts: 7
Rep Power: 10
krishnan_me is on a distinguished road
Hi, I am trying to create solver for electromagnetic problems. When I created the solver and tried to compile it I received errors. Herewith this post I am posting the result that was generated after "wmake" command.

"g++ -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam30/src/meshTools/lnInclude -I/opt/openfoam30/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam30/src/OpenFOAM/lnInclude -I/opt/openfoam30/src/OSspecific/POSIX/lnInclude -fPIC -c rodFoam.C -o Make/linux64GccDPInt32Opt/rodFoam.o
rodFoam.C: In function ‘int main(int, char**)’:
rodFoam.C:41:28: error: ‘sigma’ was not declared in this scope
solve ( fvm::laplacian(sigma, ElPot) );
^
rodFoam.C:41:28: note: suggested alternative:
In file included from /opt/openfoam30/src/OpenFOAM/lnInclude/constants.H:47:0,
from /opt/openfoam30/src/finiteVolume/lnInclude/fvCFD.H:18,
from rodFoam.C:31:
/opt/openfoam30/src/OpenFOAM/lnInclude/physicoChemicalConstants.H:58:36: note: ‘Foam::constant:hysicoChemical::sigma’
extern const dimensionedScalar sigma;
^
rodFoam.C:41:35: error: ‘ElPot’ was not declared in this scope
solve ( fvm::laplacian(sigma, ElPot) );
^
rodFoam.C:42:28: error: ‘A’ was not declared in this scope
solve ( fvm::laplacian(A)==sigma*muMag*(fvc::grad(ElPot)) );
^
rodFoam.C:42:38: error: ‘muMag’ was not declared in this scope
solve ( fvm::laplacian(A)==sigma*muMag*(fvc::grad(ElPot)) );
^
rodFoam.C:44:5: error: ‘B’ was not declared in this scope
B = fvc::curl(A);
^
rodFoam.C:45:5: error: ‘Je’ was not declared in this scope
Je = -sigma*(fvc::grad(ElPot));
^
make: *** [Make/linux64GccDPInt32Opt/rodFoam.o] Error 1"

I have declared all the parameters in createFields.H file. Any help in this issue is much appreciated.
krishnan_me is offline   Reply With Quote

Old   March 30, 2016, 00:09
Default
  #9
New Member
 
Krish
Join Date: Mar 2016
Posts: 7
Rep Power: 10
krishnan_me is on a distinguished road
I solved it. Thanks.
krishnan_me is offline   Reply With Quote

Old   April 7, 2016, 11:27
Question
  #10
New Member
 
Join Date: Mar 2016
Posts: 14
Rep Power: 10
RomainBou is on a distinguished road
Hi krishnan_me,
I am running into the same kind of compiling error right now, could you tell how you solved this problem please ?
Any help will be appreciated
Thanks
RomainBou is offline   Reply With Quote

Old   April 7, 2016, 21:39
Default
  #11
New Member
 
Krish
Join Date: Mar 2016
Posts: 7
Rep Power: 10
krishnan_me is on a distinguished road
Hi RomainBou,
First add "#include "createMesh.H" #In the OpenFOAM installation
#include "createFields.H"" after "createTime.H". Then add "XE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude " in options file under makefolder. Now run wmake command. It solved my errors.

While executing your solver, You have to create a file called "setfielddict" in the system folder and initialise the regions. then after blockMesh command you have to run setFields command.
krishnan_me 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
Cannot compile new solver (interFoam with Temperature) MdoNascimento OpenFOAM Programming & Development 2 June 29, 2015 14:31
2D Unsteady Potential Flow Solver A.S. Main CFD Forum 2 November 16, 2005 03:38
free surface potential method paolo Main CFD Forum 0 September 19, 2004 13:29
Free 2D Axisymmetric Potential Flow Solver for Matlab? Jonas Larsson Main CFD Forum 0 August 13, 2003 09:13
Laplace or Stokes equations solver by Boundary Elements Method Lemonnier Main CFD Forum 3 December 28, 1999 13:48


All times are GMT -4. The time now is 13:00.