AMReX-Fluids/IAMR

Questions about initbubble subroutine

Closed this issue · 1 comments

Hello all,

When I read the subroutine initbubble in the prob_2D.F, I am confused about the following lines:

        scal(i,j,1) = one + half*(denfact-one)*(one-tanh(30.*(dist-radblob)))
        do n = 2,nscal-1
           scal(i,j,n) = one
        end do                  
        scal(i,j,nscal) = merge(one,zero,dist.lt.radblob)

Questions are:

  1. Why do we have so many scalars?

  2. What is the meaning of merge function? (I guess it is like a "if condition" )

Thanks a lot!

If you run inputs.2d.bubble you will see there are 2 scalars. The first is density. The second is a (passively advected) tracer. Thus the "do" loop doesn't do anything since "do n=2,1" simply is ignored. in general you can have more than one tracer, in which case nscal will be greater than 2.

merge(x,y,z) returns x if z is true, and returns y if z is false.