Kernel Gradient Correction Not Effecting Following Equations

12 views
Skip to first unread message

alom...@gmail.com

unread,
Mar 22, 2024, 8:30:13 AMMar 22
to pysph-users
Hello everyone,

  Whenever I try using the kernel gradient correction equations from the reference documentation, which modifies DWIJ directly, it turns out that, if I put a print statement to check the values of DWIJ right after I call 
pysph.sph.wc.kernel_correction.GradientCorrection(destsourcesdim=2tol=0.1), the values are corrected. However, in the very next group of equations in "create_equations" of my script, the value of DWIJ for the same pair is back to being the uncorrected one. 

I am assuming, for some reason, that whenever I call DWIJ in the caller of an equation, it was already pre-cached prior to calling "create_equations" in the main script. Is that the case? If so, then, how can I use the gradient correction and make sure it takes effect within the same time step?

I have had this issue in the past, which made me abandon the kernel gradient correction from the reference documentation and implement my own version. However, there are issues with overcorrecting the kernel gradient, which I was hoping the reference documentation may be able to avoid (any ideas about how to avoid kernel gradient overcorrection are welcome as well). 

Finally, related to that last point, I see there is a test for over correction in the kernel gradient correction of the reference documentation, with a variable called "change" and a default tolerance of 0.1. However, when I tested that, the variable change is always greater than 1.0 for any particle that needs correction. What would be a recommended value for that tolerance? 

Below is a simple conceptual script to help you understand the order of calls and the equations I refer to in my questions above.

Thank you for your time and help with this. I really appreciate it!

Kindest regards,
Alomir

===========================
CONCEPTUAL SCRIPT
==========================

(...)
def create_equations(self):
    equations[
        Group(
            equations=[
                GradientCorrectionPreStep(...),
                ... (Other equations)
            ], real=True
        ), 
        Group(
            equations=[
                 GradientCorrection(...),
                ... (Other equations)
            ], real=True
        ),
        Group(
            equations=[
                Equations I need to call using the corrected DWIJ values from 
       the previous group,
            ], real=True
        ),
    ] 
Reply all
Reply to author
Forward
0 new messages