fluidSolidInteraction updateresidual() 是什么

Foam::scalar Foam::fluidStructureInterface::updateResidual()
{
    vectorField solidZonePointsDisplAtSolid =
        stress().faceZonePointDisplacementIncrement(solidZoneIndex());

    solidZonePointsDispl() =
//         solidToFluid().pointInterpolate
        ggiInterpolator().slaveToMasterPointInterpolate
        (
            solidZonePointsDisplAtSolid
        );

    residualPrev() = residual();

    residual() = solidZonePointsDispl() - fluidZonePointsDispl();

//     const scalarField& minLe = minEdgeLength();

//     scalar residualNorm = gMax(mag(residual())/(minLe + SMALL));

    scalar residualNorm = ::sqrt(sum(magSqr(residual())));

//     Info << "Current fsi residual norm: " << residualNorm << endl;

    if (residualNorm > maxResidualNorm_)
    {
        maxResidualNorm_ = residualNorm;
    }

//     Info << "Current fsi max residual norm: " << maxResidualNorm_ << endl;

    residualNorm /= maxResidualNorm_ + SMALL;

    Info << "Current fsi relative residual norm: " << residualNorm << endl;

    return residualNorm;
}

这个是上午遇到的棘手的问题,关于残差,不知道从和下手,总觉得缺少变量

这个更新 couple 边界的残差,注意这句话

    residual() = solidZonePointsDispl() - fluidZonePointsDispl();

这一步求了范数:

    scalar residualNorm = ::sqrt(sum(magSqr(residual())));
1 个赞

residual()=固体区域点位移-流体区域点位移,关键是这里默认指的是流体一,而这里还要加流体二

还有,updateforce是面ggi插值,updateresidual是点ggi插值,之前没有注意到这里一点

updateForce 是求边界上的力,当然要算面积;updateResidual 求两个 couple 的边界的 residual ,边界移动是点在移动,自然地,获取点的值来计算残差。

1 个赞
Foam::scalar Foam::fluidStructureInterface::updateResidual()
{
    vectorField solidZonePointsDisplAtSolid =
        stress().faceZonePointDisplacementIncrement(solidZoneIndex());

    solidZonePointsDispl() =
//         solidToFluid().pointInterpolate
        ggiInterpolator().slaveToMasterPointInterpolate
        (
            solidZonePointsDisplAtSolid
        );

    residualPrev() = residual();

    residual() = solidZonePointsDispl() - fluidZonePointsDispl();

//     const scalarField& minLe = minEdgeLength();

//     scalar residualNorm = gMax(mag(residual())/(minLe + SMALL));

    scalar residualNorm = ::sqrt(sum(magSqr(residual())));

    vectorField solidZone2PointsDisplAtSolid =
        stress().faceZone2PointDisplacementIncrement(solidZone2Index());

    solidZone2PointsDispl() =
//         solidToFluid().pointInterpolate
        ggiInterpolator2().slaveToMasterPointInterpolate
        (
            solidZone2PointsDisplAtSolid
        );

    residual2Prev() = residual2();

    residual2() = solidZone2PointsDispl() - fluid2ZonePointsDispl();

//     const scalarField& minLe = minEdgeLength();

//     scalar residualNorm = gMax(mag(residual())/(minLe + SMALL));

    scalar residual2Norm = ::sqrt(sum(magSqr(residual2())));

//     Info << "Current fsi residual norm: " << residualNorm << endl;
    if (residualNorm < residual2Norm)
    {
         residualNorm =residual2Norm;
    }

    if (residualNorm > maxResidualNorm_)
    {
        maxResidualNorm_ = residualNorm;
    }

//     Info << "Current fsi max residual norm: " << maxResidualNorm_ << endl;

    residualNorm /= maxResidualNorm_ + SMALL;

    Info << "Current fsi relative residual norm: " << residualNorm << endl;

    return residualNorm;
}

这里我重新复制添加了变量,添加了一个 if 语句。但是添加的变量还没在头文件体现,也还没对程序上面部分的这些变量进行修改。我想知道我这个思路理论上来说有问题吗

我知道要选最大的那个残差数,只是,我这样添加变量跟选择结构对吗

这样是应该可以的。

 vectorField solidZonePointsDisplAtSolid =
        stress().faceZonePointDisplacementIncrement(solidZoneIndex());

这句话是代表是么意思呢

将 stress 模型中 couple 的面的位移增量赋值给 solidZonePointsDisplAtSolid

vectorField solidZone2PointsDisplAtSolid =
        stress().faceZone2PointDisplacementIncrement(solidZoneIndex());

    solidZone2PointsDispl() =
//         solidToFluid().pointInterpolate
        ggiInterpolator2().slaveToMasterPointInterpolate
        (
            solidZone2PointsDisplAtSolid
        );

    residual2Prev() = residual2();

    residual2() = solidZone2PointsDispl() - fluid2ZonePointsDispl();

//     const scalarField& minLe = minEdgeLength();

//     scalar residualNorm = gMax(mag(residual())/(minLe + SMALL));

    scalar residual2Norm = ::sqrt(sum(magSqr(residual2())));

这些solidzone2我是想让它代表固体耦合边界二,但是这里一改,上面的成员函数、私有成员函数的相应的地方也要该,我怕一不小心改错了则麼办

弄错了就改回来呀