mykkujinu2201 |
December 7, 2015 16:40 |
Electric Potential Method for MHD Duct Flow
Hello.
I'm currently working on electric potential method to solve MHD Duct Flow
Because it uses electric potential method, I have to compile new solver.
I tried to modified simplefoam to solve MHD and I made it.
However, it does not converge at high Hartman lminar flow.
Thas is why I decided to find some code on the internet and I found one.
I copied and modified but it did not work. There was errors.
The code is as below
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;
}
// ************************************************************************* //
The error is as below.
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
make: *** [Make/linux64GccDPInt32Opt/EpisoFoam.o] 오류 1
root@ubuntu:~/OpenFOAM/mykkujinu2201-3.0.0/solver/EpisoFoam# wmake
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
Can you help me to solve this problem?
And also, I'm curious about OpenFoam syntax.
I'm quite sure that the syntax has changed at this version.
So, even though I got codes from the internet, it does not work.
What has changed in this version?
Where can I find it?
|