Beispiel #1
0
//Generates the groebner basis using buchberger's algorithm without any improvements (i.e. polynomial pruning to create minimal or reduced groebner basis)
//Create a list of pairs, one for each combination of polynomial's.
//Then compute the syzygy polynomial. Divide it by the ideal polynomials. If the remainder is not zero, then add the polynomial and the new pairs into the list.
void Ideal::Groebner1()
{
	int t = gen.size();
	queue<int> l1, l2;
	for (int i = 0; i < t; i++)
	{
		for (int j = i; j < t; j++)
		{
			l1.push(i);
			l2.push(j);
		}
	}
	//The selection of the pair is just iterative, using a queue
	int inc = 0;//Increment this over the size of the list to obtain all pairs
	while (l1.size() > 0)
	{
		Polynomial p1 = gen[l1.front()];
		Polynomial p2 = gen[l2.front()];
		l1.pop(), l2.pop();//Pop the pair
		Monomial l = LCM(p1.poly[0], p2.poly[0]);
		Monomial m = p1.poly[0] * p2.poly[0];
		if (!equal(m, l))
		{
			Polynomial s = syzygy(p1, p2, compar);
			Polynomial rem = divR(s);
			if (rem.poly.size() != 0)
			{
				for (int i = 0; i < t; i++)
				{
					l1.push(i);
					l2.push(t);
				}
				gen.push_back(rem);
				t++;//There is now another polynomial
			}
		}
		
	}
}
Beispiel #2
0
int main(int argc, char *argv[])
{
    argList::noParallel();

    #include "setRootCase.H"

    #include "createTime.H"
    #include "createMesh.H"
    #include "createFields.H"
    #include "createFvOptions.H"
    #include "interrogateWallPatches.H"

    turbulence->validate();

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

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

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

        fvVectorMatrix divR(turbulence->divDevReff(U));
        divR.source() = flowMask & divR.source();

        fvVectorMatrix UEqn
        (
            divR == gradP + fvOptions(U)
        );

        UEqn.relax();

        fvOptions.constrain(UEqn);

        UEqn.solve();

        fvOptions.correct(U);


        // Correct driving force for a constant volume flow rate
        dimensionedVector UbarStar = flowMask & U.weightedAverage(mesh.V());

        U += (Ubar - UbarStar);
        gradP += (Ubar - UbarStar)/(1.0/UEqn.A())().weightedAverage(mesh.V());

        laminarTransport.correct();
        turbulence->correct();

        Info<< "Uncorrected Ubar = " << (flowDirection & UbarStar.value())
            << ", pressure gradient = " << (flowDirection & gradP.value())
            << endl;

        #include "evaluateNearWall.H"

        if (runTime.writeTime())
        {
            #include "makeGraphs.H"
        }

        Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
            << "  ClockTime = " << runTime.elapsedClockTime() << " s"
            << nl << endl;
    }

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

    return 0;
}