AMReX-Fluids/IAMR

Questions about tagging higher error cells

Closed this issue · 3 comments

Hello all,

Here are some small questions about tagging cells, I read two line in PROB_2D.F:

tag(i,j) = merge(set,tag(i,j),rho(i,j,1).lt.denerr)
tag(i,j) = merge(set,tag(i,j),adv(i,j,1).gt.adverr)

Q1:

I think the denerr is a criterion based on density, but I am not sure if it is based on absolute density value or absolute density gradient?

Q2:

I guess adverr is about some tracer errors which we can give ns.do_tracer_ref = 1 to make it open. But I still do not know the physical meaning of the error. Is it based on the absolute gradient of this tracer? How can we give a proper adverr value in probin file?

Thanks so much.

(A small suggestion, in line: https://github.com/AMReX-Codes/IAMR/blob/924ca222059e128dec9a11b20c53ace8c1344997/Exec/run2d/PROB_2D.F#L1117,

the comments are based on density gradient, yet the errors in the following subroutines are based on adverr, I am not sure if the comments are wrong. It makes me confused.)

  1. denerr is density. If you look at NS_error.cpp you can see what variable is associated with each of the functions DENERROR, ADVERROR, etc. The comments are wrong and I'll check in a fix to the development branch.

  2. adverr tests whether the tracer value is greater than some threshold (again the comments are wrong). If you look at TEMPERR you can see some code for how to test on whether the temperature is above a threshold OR the gradient is above a threshold. You specify adverr in the probin file itself.

@ajnonaka Thanks so much. I think I know the meaning of these error subroutines now.

Another question is in the function error_setup(), there are some codes:

if (do_tracer_ref)    {
    err_list.add("tracer",   1, ErrorRec::Special,
                 BL_FORT_PROC_CALL(FORT_ADVERROR,fort_adverror));
    amrex::Print() << "Refining on TRACER" << std::endl;
}

From my guessing, these lines connects to subroutine FORT_ADVERROR by the underlying framework. Here is the subroutine FORT_ADVERROR in the PROB_2D.F file.

subroutine FORT_ADVERROR (tag,DIMS(tag),set,clear,
& adv,DIMS(adv),lo,hi,nvar,
& domlo,domhi,dx,xlo,
& problo,time,level)

My question is how I can know it is the first scalar that is passed to this subroutine. I mean, adv is a formal parameter, how do you know it is scalar(i,j,1) not density?

Actually, I just want to dig out how a specific variable value is passed into a subroutine for refinement.

Thanks again.

Ruohai

The first argument is a named derivable quantity. In this case, it is one of the components of the State_Type state quantity, but it can be any named derived variable, which are all declared/configured in that routine (above that line).