<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[从0开始计算没问题，停掉再续算过几步就出错]]></title><description><![CDATA[<p dir="auto">在compressibleInterFoam中添加组分方程，组分方程如下：</p>
<pre><code>tmp&lt;fv::convectionScheme&lt;scalar&gt;&gt; mvConvection
(
    fv::convectionScheme&lt;scalar&gt;::New
    (
        mesh,
        fields,
        alpharho2Phi,
        mesh.divScheme("div(phi,Yi)")
    )
);

{
    combustion-&gt;correct();
    volScalarField Yt(0.0*Y[0]);

    alpharho2 = alpha2*rho2;
    alpharho2Phi = fvc::interpolate(alpharho2)*phi;
    volScalarField alphamuEff("alphamuEff",alpha2*turbulence.muEff());

    forAll(Y, i)
    {
        if (i != inertIndex &amp;&amp; composition.active(i))
        {
            volScalarField&amp; Yi = Y[i];

            fvScalarMatrix YEqn
            (
                fvm::ddt(alpharho2, Yi)
              + mvConvection-&gt;fvmDiv(alpharho2Phi, Yi)
              - fvm::laplacian(alphamuEff, Yi)
             ==
                parcels.SYi(i, Yi)
              + combustion-&gt;R(Yi)
              + fvOptions(alpharho2, Yi)
            );

            YEqn.relax();

            fvOptions.constrain(YEqn);

            YEqn.solve("Yi");

            fvOptions.correct(Yi);

            Yi.max(0.0);
            Yt += Yi;
        }

    }

    Y[inertIndex] = scalar(1) - Yt;
    Y[inertIndex].max(0.0);

}
</code></pre>
<p dir="auto">从0时刻开始计算没有问题，在某一时刻停掉计算后续算，没过几步就会报错，报错如下，请问各位有什么建议。<br />
<img src="/assets/uploads/files/1627653393633-c0a5616d-30cf-41a2-94dc-ee6f72f73a4e-image.png" alt="c0a5616d-30cf-41a2-94dc-ee6f72f73a4e-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://cfd-china.com/topic/5020/从0开始计算没问题-停掉再续算过几步就出错</link><generator>RSS for Node</generator><lastBuildDate>Thu, 18 Jun 2026 07:22:11 GMT</lastBuildDate><atom:link href="https://cfd-china.com/topic/5020.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 30 Jul 2021 14:01:17 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to 从0开始计算没问题，停掉再续算过几步就出错 on Wed, 28 Jun 2023 14:52:14 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://cfd-china.com/uid/3810">@Tens</a><br />
您好，我参考您的代码也在<code>compressibleInterFoam</code>中添加了组分方程，目前出现了某种组分的质量分数超过1的情况，这个问题困扰我很久了，可以麻烦您帮我看一下代码有什么问题吗？万分感谢！</p>
<pre><code>tmp&lt;fv::convectionScheme&lt;scalar&gt;&gt; mvConvection
(
    fv::convectionScheme&lt;scalar&gt;::New//convectionScheme:Abstract base class for convection schemes.
    (
        mesh,
        fields,
        alpha2rho2phi,
        mesh.divScheme("div(alpha2rho2phi,Yi)")
    )
);

{
    forAll(Y, i)
    {
        if (i != inertIndex &amp;&amp; composition.active(i))
        {
            volScalarField&amp; Yi = Y[i];

            fvScalarMatrix YEqn
            (
                fvm::ddt(alpha2rho2, Yi)
              + mvConvection-&gt;fvmDiv(alpha2rho2phi, Yi)
              - fvm::laplacian(turbulence.muEff()*alpha2, Yi)
             ==
                alpha2*parcels.SYi(i, Yi) 
              + fvOptions(rho2, Yi)
            );

            YEqn.relax();

            fvOptions.constrain(YEqn);

            YEqn.solve(mesh.solver("Yi"));

            fvOptions.correct(Yi);

            Yi.max(0.0);
            Yt += Yi;
        }

    Y[inertIndex] = scalar(1) - Yt;
    Info&lt;&lt;"info::inertIndex.................="&lt;&lt; inertIndex &lt;&lt;endl;
    Info&lt;&lt;"info::Y[inertIndex].................="&lt;&lt; max(Y[inertIndex]) &lt;&lt;endl;
    Y[inertIndex].max(0.0);
</code></pre>
<p dir="auto">我在<code>createField.H</code>中声明了下列变量：</p>
<pre><code>volScalarField alpha2rho2
(
   IOobject
   (
       "alpha2rho2",
       runTime.timeName(),
       mesh,
       IOobject::READ_IF_PRESENT,
       IOobject::AUTO_WRITE
   ),
   alpha2*rho2
);

 surfaceScalarField alpha2rho2phi
 (
     IOobject
     (
         "alpha2rho2phi",
         runTime.timeName(),
         mesh,
         IOobject::READ_IF_PRESENT,
         IOobject::AUTO_WRITE
     ),
     linearInterpolate(alpha2*rho2*U) &amp; mesh.Sf()
 );

</code></pre>
]]></description><link>https://cfd-china.com/post/34666</link><guid isPermaLink="true">https://cfd-china.com/post/34666</guid><dc:creator><![CDATA[Rachel0096]]></dc:creator><pubDate>Wed, 28 Jun 2023 14:52:14 GMT</pubDate></item><item><title><![CDATA[Reply to 从0开始计算没问题，停掉再续算过几步就出错 on Tue, 14 Dec 2021 01:44:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://cfd-china.com/uid/3867">@fkingdom</a> 现在没有这个问题了，不过现在的方程以及求解器改动很多，我也不知道是什么导致的这个问题</p>
]]></description><link>https://cfd-china.com/post/28451</link><guid isPermaLink="true">https://cfd-china.com/post/28451</guid><dc:creator><![CDATA[Tens]]></dc:creator><pubDate>Tue, 14 Dec 2021 01:44:40 GMT</pubDate></item><item><title><![CDATA[Reply to 从0开始计算没问题，停掉再续算过几步就出错 on Tue, 14 Dec 2021 01:11:50 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://cfd-china.com/uid/3810">@tens</a> 您好，我也遇到了相似的情况，请问最后解决了吗？</p>
]]></description><link>https://cfd-china.com/post/28449</link><guid isPermaLink="true">https://cfd-china.com/post/28449</guid><dc:creator><![CDATA[Fkingdom]]></dc:creator><pubDate>Tue, 14 Dec 2021 01:11:50 GMT</pubDate></item><item><title><![CDATA[Reply to 从0开始计算没问题，停掉再续算过几步就出错 on Mon, 02 Aug 2021 01:18:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://cfd-china.com/uid/1">@李东岳</a> 就算仿照sprayfoam进行添加的，createFields.H里还添加了下面部分，twoPhaseMixtureThermo里将RhoThermo改为了rhoReactionThermo，应该就这些。</p>
<pre><code>rhoReactionThermo&amp; thermo2 = mixture.thermo2();

basicSpecieMixture&amp; composition = thermo2.composition();
PtrList&lt;volScalarField&gt;&amp; Y = composition.Y();

const word inertSpecie(thermo2.lookup("inertSpecie"));
if (!composition.species().found(inertSpecie))
{
   FatalIOErrorIn(args.executable().c_str(), thermo2)
       &lt;&lt; "Inert specie " &lt;&lt; inertSpecie &lt;&lt; " not found in available species "
       &lt;&lt; composition.species()
       &lt;&lt; exit(FatalIOError);
}

const label inertIndex(composition.species()[inertSpecie]);

multivariateSurfaceInterpolationScheme&lt;scalar&gt;::fieldTable fields;

forAll(Y, i)
{
   fields.add(Y[i]);
}

surfaceScalarField alpharho2
(
   IOobject
   (
       "alphaRho2Phi",
       runTime.timeName(),
       mesh,
       IOobject::READ_IF_PRESENT,
       IOobject::AUTO_WRITE
   ),
   alpha2*rho2
);

surfaceScalarField alphaRho2Phi
(
   IOobject
   (
       "alphaRho2Phi",
       runTime.timeName(),
       mesh,
       IOobject::READ_IF_PRESENT,
       IOobject::AUTO_WRITE
   ),
   fvc::interpolate(alpha2*rho2)*phi
);
</code></pre>
]]></description><link>https://cfd-china.com/post/26643</link><guid isPermaLink="true">https://cfd-china.com/post/26643</guid><dc:creator><![CDATA[Tens]]></dc:creator><pubDate>Mon, 02 Aug 2021 01:18:25 GMT</pubDate></item><item><title><![CDATA[Reply to 从0开始计算没问题，停掉再续算过几步就出错 on Mon, 02 Aug 2021 00:15:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://cfd-china.com/uid/3810">@tens</a> 除了添加y方程之外，还做了什么其他的改动么。</p>
]]></description><link>https://cfd-china.com/post/26640</link><guid isPermaLink="true">https://cfd-china.com/post/26640</guid><dc:creator><![CDATA[李东岳]]></dc:creator><pubDate>Mon, 02 Aug 2021 00:15:28 GMT</pubDate></item><item><title><![CDATA[Reply to 从0开始计算没问题，停掉再续算过几步就出错 on Sun, 01 Aug 2021 05:13:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://cfd-china.com/uid/1">@李东岳</a> 老师说的耦合具体是指什么呢</p>
]]></description><link>https://cfd-china.com/post/26633</link><guid isPermaLink="true">https://cfd-china.com/post/26633</guid><dc:creator><![CDATA[Tens]]></dc:creator><pubDate>Sun, 01 Aug 2021 05:13:02 GMT</pubDate></item><item><title><![CDATA[Reply to 从0开始计算没问题，停掉再续算过几步就出错 on Sun, 01 Aug 2021 00:05:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://cfd-china.com/uid/3810">@tens</a> y方程是跟原本求解器偶合在一起的么？</p>
]]></description><link>https://cfd-china.com/post/26629</link><guid isPermaLink="true">https://cfd-china.com/post/26629</guid><dc:creator><![CDATA[李东岳]]></dc:creator><pubDate>Sun, 01 Aug 2021 00:05:43 GMT</pubDate></item><item><title><![CDATA[Reply to 从0开始计算没问题，停掉再续算过几步就出错 on Sat, 31 Jul 2021 06:17:18 GMT]]></title><description><![CDATA[<p dir="auto">顶<img src="https://cfd-china.com/assets/plugins/nodebb-plugin-emoji/emoji/customizations/7eefc0ee-3e96-4004-aa3f-7eeaaa008974-537C2CB9D08BB5747A20DD8932D970F3.gif?v=eedi85amb0g" class="not-responsive emoji emoji-customizations emoji--ok3" style="height:23px;width:auto;vertical-align:middle" title=":ok3:" alt=":ok3:" /></p>
]]></description><link>https://cfd-china.com/post/26622</link><guid isPermaLink="true">https://cfd-china.com/post/26622</guid><dc:creator><![CDATA[Tens]]></dc:creator><pubDate>Sat, 31 Jul 2021 06:17:18 GMT</pubDate></item></channel></rss>