luckygl |
March 20, 2012 20:45 |
developing icofoam in non-inertial system
2 Attachment(s)
hello everybody,
I try to use non-inertial system to solve heaving elliptic plate.
My present case is very simple.It's a 2D elliptic plate heaving cosinely.I add a source term into the N-S equation developing icoFoam.My boundary conditions also are changed into non-inertial system.
The new solver can be compiled and run successfully.But the result is totally wrong.I don't know where the problem is.
I attach my test case, so that someone who know this (which is not really difficult ;-)) can give me a hint.
Best regards and thanks in advance for any reply
Monica
PS:here is my solver
Code:
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
#include "createFields.H"
#include "initContinuityErrs.H"
volVectorField Ftmp = F;//store the initial value of F
volVectorField Uetmp = Ue;//store the entangling velocity
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
while (runTime.loop())
{
Info<< "Time = " << runTime.timeName() << nl << endl;
#include "readPISOControls.H"
#include "CourantNo.H"
dimensionedScalar t = runTime.value();// get current time
F = Ftmp * cos(omega * t);//modify F of the internal field
F.correctBoundaryConditions();//correct the boundary values
fvVectorMatrix UrelEqn
(
fvm::ddt(Urel)
+ fvm::div(phi, Urel)
- fvm::laplacian(nu, Urel)
+ F//add the source item
);
solve(UrelEqn == -fvc::grad(p));
// --- PISO loop
for (int corr=0; corr<nCorr; corr++)
{
volScalarField rAUrel(1.0/UrelEqn.A());
Urel = rAUrel*UrelEqn.H();
phi = (fvc::interpolate(Urel) & mesh.Sf())
+ fvc::ddtPhiCorr(rAUrel, Urel, phi);
adjustPhi(phi, Urel, p);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
fvm::laplacian(rAUrel, p) == fvc::div(phi)
);
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve();
if (nonOrth == nNonOrthCorr)
{
phi -= pEqn.flux();
}
}
#include "continuityErrs.H"
Urel -= rAUrel*fvc::grad(p);
Urel.correctBoundaryConditions();
//---update absolute velocity
Ue=Uetmp * sin(omega * t);
Ue.correctBoundaryConditions();//correct the boundary values
Uabs = Urel + Ue;
}
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //
|