Skip to content

virtualmassforce.C may have some bugs #21

Description

@Picadoo

Description:
I am using the cfdem-pfm version of CFDEMcoupling. I noticed that when using the virtualMassForce model, the calculated force and acceleration are consistently zero in the probe logs, even though the Cadd (via Felderhof correction) is computed correctly.

Evidence (Probe Log):

index time || vectorData: virtualMassForce acceleration || scalarData: Cadd ...
23261 115.02 || 0 0 0 0 0 0 || 0.646347 ...
23793 115.02 || 0 0 0 0 0 0 || 0.640254 ...
23799 115.02 || 0 0 0 0 0 0 || 0.640118 ...

Identified Issues in virtualMassForce.C:

Variable Mismatch (Cadd vs Cadd_):

When useFelderhof is set to true, a local variable 'scalar Cadd' is calculated. However, the final force calculation formula incorrectly uses the class member variable 'Cadd_' (the constant value from the dictionary).

Location: Around line 272

Current code:

virtualMassForce = Cadd_ * rho * Vs * DDtUrel;

Suggested fix:

virtualMassForce = Cadd * rho * Vs * DDtUrel;

Local Scoping/Assignment Issue (ddtUrel vs DDtUrel):

When both splitUrelCalculation and useUs are false, the relative acceleration is calculated as a local variable 'ddtUrel'. This value is never assigned back to the 'DDtUrel' variable, which was initialized to zero and is used for the final force calculation.

Location: Around line 229

Problem: The calculated 'ddtUrel' is lost because it is not passed to the variable 'DDtUrel' used in the force equation.

Suggested Fix for Point 2:
Modify the block as follows:

if(haveUrelOld_)
{
    ddtUrel = (Urel-UrelOld)/dt;
    DDtUrel = ddtUrel; // Crucial: assign local result to the force-calculation variable
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions