furstj/myFoam

A question about the code.

Closed this issue · 3 comments

hello,professor Furstj. I've read your paper and I'm very interested in your work.

There's a bit of code in the file forwadSweep.H that I'm confused about, and I've posted below
rRho += (ac + av) * dRhoStar[own] + 0.5 * (rho1*phi1r - rho[own]*phi0r); rRhoU += (ac + av) * dRhoUStar[own] + 0.5 * ( (rhoU1*phi1r - rhoU[own]*phi0r) + (p1 - p[own])*Sf[faceI] ); rRhoE += (ac + av) * dRhoEStar[own] + 0.5 * (rhoE1*phi1r+p1*phi1 - (rhoE[own]*phi0r+p[own]*phi0));

This code should correspond to this formula(show as below)
$$D_i \Delta W_i^{(1)} = -R_i - \frac{1}{2}\sum_{j\in L(i)} [\Delta F_j^{(1)}\cdot S_{ij} + \lambda^*_{ij}\Delta W_j^{(1)}]$$
So my question is, why is this code "+=" instead of " -="? Am I missing something crucial? I look forward to your answer and best wishes : )

-= is correct. I use different formulation of R in the code with respect to the article. There is a minus sign in the definition of R (see e.g. line 119 of myLusgsFOAM.C).

Thank you for your prompt reply, but I don't seem to fully understand what you mean. Do you mean that the code "+=" in the file "forwardSweep. H" needs to be changed to "-="?(I have pasted the code below.)
rRho += (ac + av) * dRhoStar[own] + 0.5 * (rho1*phi1r - rho[own]*phi0r); // 0.5* Delta F*S_f rRhoU += (ac + av) * dRhoUStar[own] + 0.5 * ( (rhoU1*phi1r - rhoU[own]*phi0r) + (p1 - p[own])*Sf[faceI] ); // 0.5*(Delta F*S_f) rRhoE += (ac + av) * dRhoEStar[own] + 0.5 * (rhoE1*phi1r+p1*phi1 - (rhoE[own]*phi0r+p[own]*phi0)); // 0.5*(Delta F*S_f)

I look forward to your answer and best wishes : )

Sorry, I wrote -= in my post above by mistake. It should be +=.

To be clear: the code in forwardSweep.H is correct.

My article in Computers & Fluids uses R = div( Fluxes ) and therefore, the formula in the article uses - sign.

On the other hand, the code myLusgsFoam uses R = - div(Fluxes) and therefore there is + in the forward step.