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

epotFoam -- fails to calculate Hartmann>1

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 3, 2020, 20:24
Unhappy epotFoam -- fails to calculate Hartmann>1
  #1
New Member
 
Francisco Peņa Gallardo
Join Date: Jun 2016
Posts: 5
Rep Power: 10
fpena is on a distinguished road
Dear Foamers,

I'm trying to use the phiformulation, im using a good solver named epotFoam created by Alessandro.

But im having some trouble when i'm trying to solve hartmann >0, i get the H=0 case any time, i made some modifications in the createFields to use the funkySetFields tool, and set a specific B-field

Code:
Info<< "Reading field B\n" << endl;
    volVectorField B0
    (
        IOobject
        (
            "B0",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::NO_WRITE
        ),
        mesh
    );
and i dropped the electricalProperties file in the constant directory.

Could anybody please correct me? Or there is something I am missing?

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);

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

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
	Info<< "\nStarting time loop\n" << endl;

	volVectorField lorentz = sigma *
	(
		((U ^ B0) ^ B0) -
		(fvc::grad(PotE) ^ B0)
	);

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

		#include "CourantNo.H"

		fvVectorMatrix UEqn
		(
			fvm::ddt(U)
			+ fvm::div(phi, U)
			- fvm::laplacian(nu, U)
			==
			(1.0/rho) * lorentz
		);

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

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
		while (piso.correct())
		{
			volScalarField rAU(1.0/UEqn.A());
			volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p));

			surfaceScalarField phiHbyA
			(
				"phiHbyA",
				fvc::flux(HbyA)
				+ fvc::interpolate(rAU)
				* fvc::ddtCorr(U, phi)
			);

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
			adjustPhi(phiHbyA, U, p);

			constrainPressure(p, U, phiHbyA, rAU);

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
			while (piso.correctNonOrthogonal())
			{

				fvScalarMatrix pEqn //Pressure equation coefficient matrix
				(
					fvm::laplacian(rAU, 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();
		}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
		surfaceScalarField psiub = fvc::interpolate(U ^ B0) & mesh.Sf();

		fvScalarMatrix PotEEqn
		(
			fvm::laplacian(PotE)
			==
			fvc::div(psiub)
		);

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
		PotEEqn.setReference(PotERefCell, PotERefValue);

		PotEEqn.solve();

		surfaceScalarField jn = psiub - (fvc::snGrad(PotE) * mesh.magSf());

		surfaceVectorField jnv = jn * mesh.Cf();

		volVectorField jfinal = fvc::surfaceIntegrate(jnv) - (fvc::surfaceIntegrate(jn) * mesh.C());

		jfinal.correctBoundaryConditions();

		lorentz = sigma* (jfinal ^ B0);

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
		runTime.write();

		Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
		<< " ClockTime = " << runTime.elapsedClockTime() << " s"
		<< nl << endl;
		//end of time loop
	}

	Info<< "End\n" << endl;
	return 0;
}

(i will continue traying by myselft oc); i attach the solver epotFoam, and the case how is set.

Appreciate your time and effort in advance!

Best regards.
Attached Images
File Type: png plot_vs_reference.png (4.9 KB, 14 views)
Attached Files
File Type: zip h100.zip (18.8 KB, 15 views)
File Type: zip epotFoam.zip (2.5 KB, 21 views)

Last edited by fpena; August 4, 2020 at 17:19.
fpena is offline   Reply With Quote

Reply

Tags
epotfoam, help needed, mhd, mhdfoam, phiformulation


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
Calculate Total Pressure and Temperature compressible flow shock77 OpenFOAM Running, Solving & CFD 2 August 29, 2024 20:14
How to calculate centerbody thrust of an aerospike nozzle in Fluent Roh FLUENT 5 February 21, 2022 12:30
UDF for multiphase species transport (calculate the thread face temperature and press sajaalrifai Fluent Multiphase 10 March 5, 2020 12:01
How to calculate Turbulent Intensity and Hydraulic Diameter for my problem? Roh FLUENT 1 June 17, 2018 04:12
calculate friction factor & nusselt number soheil1991 FLUENT 3 March 11, 2017 10:30


All times are GMT -4. The time now is 15:20.