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

Electric Potential Method for MHD Duct Flow

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 7, 2015, 16:40
Default Electric Potential Method for MHD Duct Flow
  #1
Member
 
Jun
Join Date: Nov 2015
Posts: 57
Rep Power: 10
mykkujinu2201 is on a distinguished road
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?
mykkujinu2201 is offline   Reply With Quote

Reply

Tags
compile, electric potential, mhd


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
Ansys 11.0 CFX - solving electric potentials and multiphase flow cfd_multiphyiscs CFX 2 March 10, 2010 13:43
Variable name for electric potential Vignamitra Main CFD Forum 0 July 10, 2009 04:34
fluid flow fundas ram Main CFD Forum 5 June 17, 2000 21:31
Question on 3D potential flow Adrin Gharakhani Main CFD Forum 13 June 21, 1999 05:18
3D Galerkin BEM for Potential Flow Adrin Gharakhani Main CFD Forum 1 May 27, 1999 10:08


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