Skip to content

Added floors to several components. #530

Open
malamast wants to merge 3 commits into
masterfrom
ion-viscosity-fix
Open

Added floors to several components. #530
malamast wants to merge 3 commits into
masterfrom
ion-viscosity-fix

Conversation

@malamast
Copy link
Copy Markdown
Contributor

-That is to protect some variables from becoming Nan when the SNES solver increases the timestep aggressively.
-ion_viscosity was causing problems.
-In the hydrogen_charge_exchange I changed the loop to include boundaries because later we take log(Teff) and if the boundaries of Teff become negative we could potentially have a problem? not sure about that.
-In the sheath_boundary_simple we had two return statements in that function so I removed the first one. In that way, the check can take effect.
-I removed the density2 variable in braginskii_friction because it was not used.
-In the electron_viscosity i included even more floors (compared to the ion_viscosity) because this component was causing also many problems with snes.
-Added a isfinite check of the time derivatives in vorticity and relax_potential components as we do with the rest of the components.

…ming Nan when the snes solver increases the timestep aggressively. ion_viscosity was causing problems.
@malamast malamast added the enhancement New feature or request label Mar 12, 2026
const Field3D q_fl = eta_limit_alpha * P; // Flux limit

eta = eta / (1. + abs(q_cl / q_fl));
eta = eta / (1. + (q_cl / q_fl));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
eta = eta / (1. + (q_cl / q_fl));
eta = eta / (1. + softFloor(q_cl, 1e-15) / softFloor(q_fl, 1e-15));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


const Field3D Natom = get<Field3D>(atom1["density"]);
const Field3D Nion = get<Field3D>(ion1["density"]);
const Field3D Natom = softFloor(get<Field3D>(atom1["density"]), 0.0);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might cause problems: softFloor doesn't work if the floor is set to zero.

@mikekryjak
Copy link
Copy Markdown
Collaborator

I am breaking up #451 into separate PRs and would like to put the floor changes into this branch if that's OK.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants