Beispiel #1
0
// =========================================================================
void  Solution::output()
// -------------------------------------------------------------------------
// prints the found solution to the standard output
{
    int i, t, ql = 0, fl = 0, sl = 0;
    // tables of different move lengths
    Turn_table tnq(QUARTER_TURN_METRIC);
    Turn_table tnf(FACE_TURN_METRIC);
    Turn_table tns(SLICE_TURN_METRIC);
    // modification of the twists when slice turns are allowed
    SliceTurnTransform_table sttt;

    for (i = 1; i <= n1; i++) { // rint out the phase 1 part
        t = s1[i].tw;
        if (slice_turn) {
            t = sttt.a_get_do_tw(t); // transformation for slice-turn
            printf("%s ", at_strs[t]);
        }
        else
            printf("%s ", at_str[t]);
        ql += tnq.a_len(t);
        fl += tnf.a_len(t);
        sl += tns.a_len(t);
    }
    if (!opt_search || n2 == 0) {
        printf(". "); // delimit by dot
        for (i = 1; i <= n2; i++) { // print out the phase 2 part
            t = s2[i].tw;
            if (slice_turn) {
                t = sttt.b_get_do_tw(t); // transformation for slice-turn
                printf("%s ", bt_strs[t]);
            }
            else
                printf("%s ", bt_str[t]);
            ql += tnq.b_len(t);
            fl += tnf.b_len(t);
            sl += tns.b_len(t);
        }
    }
    // print out the lengths in different metrics
    if (opt_search) {
        switch (metric) {
        case QUARTER_TURN_METRIC:
            printf("(%iq*, %if, %is)\n", ql, fl, sl);
            break;
        case FACE_TURN_METRIC:
            printf("(%iq, %if*, %is)\n", ql, fl, sl);
            break;
        case SLICE_TURN_METRIC:
            printf("(%iq, %if, %is*)\n", ql, fl, sl);
            break;
        }
    }
    else
        printf("(%iq, %if, %is)\n", ql, fl, sl);
}
Beispiel #2
0
template <class F> inline ostream& operator<<( ostream& os, const NumTns<F>& tns)
{
  os<<tns.m()<<" "<<tns.n()<<" "<<tns.p()<<endl;
  os.setf(ios_base::scientific, ios_base::floatfield);
  for(int i=0; i<tns.m(); i++) {
	 for(int j=0; j<tns.n(); j++) {
		for(int k=0; k<tns.p(); k++) {
		  os<<" "<<tns(i,j,k);
		}
		os<<endl;
	 }
	 os<<endl;
  }
  return os;
}
Foam::tmp<Foam::volScalarField> Foam::XiEqModels::basicSubGrid::XiEq() const
{
    const fvMesh& mesh = Su_.mesh();
    const volVectorField& U = mesh.lookupObject<volVectorField>("U");

    const volScalarField& Nv = mesh.lookupObject<volScalarField>("Nv");
    const volSymmTensorField& nsv =
        mesh.lookupObject<volSymmTensorField>("nsv");

    volScalarField magU(mag(U));
    volVectorField Uhat
    (
        U/(mag(U) + dimensionedScalar("Usmall", U.dimensions(), 1e-4))
    );

    const scalarField Cw = pow(mesh.V(), 2.0/3.0);

    tmp<volScalarField> tN
    (
        new volScalarField
        (
            IOobject
            (
                "tN",
                mesh.time().constant(),
                mesh,
                IOobject::NO_READ,
                IOobject::NO_WRITE
            ),
            mesh,
            dimensionedScalar("zero", Nv.dimensions(), 0.0),
            zeroGradientFvPatchVectorField::typeName
        )
    );

    volScalarField& N = tN();

    N.internalField() = Nv.internalField()*Cw;

    tmp<volSymmTensorField> tns
    (
        new volSymmTensorField
        (
            IOobject
            (
                "tns",
                U.mesh().time().timeName(),
                U.mesh(),
                IOobject::NO_READ,
                IOobject::NO_WRITE
            ),
            U.mesh(),
            dimensionedSymmTensor
            (
                "zero",
                nsv.dimensions(),
                pTraits<symmTensor>::zero
            ),
             zeroGradientFvPatchSymmTensorField::typeName
        )
    );

    volSymmTensorField& ns = tns();

    ns.internalField() = nsv.internalField()*Cw;

    volScalarField n(max(N - (Uhat & ns & Uhat), scalar(1e-4)));

    volScalarField b((Uhat & B_ & Uhat)/sqrt(n));

    volScalarField up(sqrt((2.0/3.0)*turbulence_.k()));

    volScalarField XiSubEq
    (
        scalar(1)
      + max(2.2*sqrt(b), min(0.34*magU/up*sqrt(b), scalar(1.6)))
      * min(n, scalar(1))
    );

    return (XiSubEq*XiEqModel_->XiEq());
}