I'm trying to use TVD (Total Variation Diminishing) schemes as advective schemes by setting them in cs_user_parameters.c. However, I always encounter this error message as soon as the run starts.

Upon investigating the source code within /src/alge/cs_convection_diffusion.c, I don't see a way to use ischcv=4 (TVD scheme) without it throwing an error (this seems to be incompatible with any value of isstpc; I have already tried all values in the range [0;2] for isstpc). I'm using version 8.0.

Is there any way to avoid this error when attempting to use these schemes?

Yes, Getting the right combination is a bit tricky, and compatibilty tests are done too late (it would be much simpler if the combination was tested after the setup stage, and options such as slope test possibly adjuster automatically).

In v8.1, I added the possibility of choosing NVD schemes using the GUI, which makes this easier. But I had to go through the same checks in the cs_convection_diffusion source code, and even then, there ar still some combinations which seem to fail for vector variables (I need to check which).

So yes, there are some combinations which work. You probably need to disable the slope test (set isstpc to 0).

I tried setting isstpc to 0, 1, and 2 (i.e., all possible values) for velocity, but in all cases, I get the same error message: "invalid value of ischcv". I'm interested in using it for velocity, but now I see that if I try the same for the omega variable, it works (with no slope test). Why doesn't it work for velocity but it does for omega?

Initially, I would avoid installing version 8.1 since I'm not working with an installation from my personal computer.
I've attached the setup.log from a run where I attempted to use the SMART scheme for velocity, along with the corresponding cs_user_parameters.c file.

The issue is probably that not all schemes implemented on scalars were implemented for velocity. The implementation goes back to a few years, but was not really used since it was not available in the GUI and poorly documented. Since these schemes were only strongly tested on a 1D verification case (for a scalar), this "unfinished implementation" was only noticed recently.

We'll try to complete this in the future, but for v8.0, it seems the feature is incomplete.

I'd like to ask: if I use ischcv=1 and isstpc=3, would I be emulating the TVD Bounded CD scheme? (Using CD whenever boundedness is ensured, and otherwise resorting to upwind 1st order). In essence, my goal, rather than being able to use ischcv=4, is to use a high-order scheme that ensures boundedness (lowering the order if necessary in that case).

I am not sure about this. I checked the code today, and I seeat least some schemes require defining a min/max value which is easy to define for scalarsbet less so for vectors (I.e. do we limit the norm or the components, or a combination thereof ?).

And as far as I know, the other options allow some balance between precision and robustness, but I am not sure about boundedness.

I am not sure about this. I checked the code today, and I seeat least some schemes require defining a min/max value which is easy to define for scalarsbet less so for vectors (I.e. do we limit the norm or the components, or a combination thereof ?).

And as far as I know, the other options allow some balance between precision and robustness, but I am not sure about boundedness.

Best regards,

Yvan

Thank you, Yvan. I understand that the theory of TVD schemes ensures boundedness rigorously for 1D problems without calculating local extrema. I assume that using local extrema helps to ensure boundedness in more dimensions, is that correct?
Regardless, when implementing TVD schemes for velocity, isn't it possible to work directly with the equations for each velocity component separately? (I understand that other software like OpenFOAM does this). In that case, one would limit the value of the corresponding component in each scalar equation.

I'm not sure what would be best here. I'm not fond of working on a component by component basis for vectors, which should be invariant wrt the frame of reference.

I'll need to discuss this with colleagues who participated in the implementation of the scalar schemes.

Obviously, since the code is open source, anybody with the time and knowledge to experiment with changes to the code to implement TVD/NVD for vectors is also welcome....

Yes, I would have been interested in testing this for some cases to improve robustness, but was stuck at this point, and am already too busy with other parts of the code to realistically expect to work on this in the near future. But helping others do it might add a bit of leverage.