Skip to content

Defining Solid Boundary Yields NaN Outputs #124

Description

@LeMayday

I don't have the output logs anymore, but when defining a solid boundary, the printed time, dt, mass, and energy values were all NaN.

I wonder if the culprit might be here:

vars["fill_solid_hydro_w"] =
torch::where(solid.unsqueeze(0).expand_as(hydro_w), hydro_w, 0.);
vars["fill_solid_hydro_w"].narrow(0, IVX, 3).zero_();
pib->mark_prim_solid_(hydro_w, solid);
vars["fill_solid_hydro_u"] =
torch::where(solid.unsqueeze(0).expand_as(vars.at("hydro_u")),
vars.at("hydro_u"), 0.);
vars["fill_solid_hydro_u"].narrow(0, IVX, 3).zero_();

The solid tensor is 1 where there is solid and 0 where there is air. Thus, I think the torch::where calls fill the solid region with hydro variables and the air with 0, which is the opposite of the intended behavior.

Also, are lines 387 and 393 needed? If you initialize a velocity field, these lines would override that with 0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions