initial and boundary conditions from measured data

General scientific issues regarding ROMS

Moderators: arango, robertson

Post Reply
Message
Author
asujrpv

initial and boundary conditions from measured data

#1 Unread post by asujrpv »

Hello,

I am having a little bit of problems with setting up a simulation in
ROMS, particularly with the initial and boundary conditions, and I will be
most grateful if you could please help me.

Basically the problem is in setting up the initial and boundary conditions
in ROMS.

I have the bathymetry for the model region, T and S profiles to
be used as initial conditions, and barotropic components of u, v, and
surface elevation zeta.

I have been able to create the grid, that is not a problem now. But I do
have problems in generating the initial conditions from the measured T and S
profiles. The attached figure shows the data from the ascii file that I have.

What I need is to enter the initial conditions from the ascii (please see
attached) and set the upper boundary as shear free (non-deformable).

So the questions is how to setup the initial and boundary conditions of the
problem with non-reflective lateral boundaries and top non-deformable shear-
free surface in ROMS.

The temperature and salinity should be applied to my domain throughout.

As I mentioned before, I have measurements of barotropic components of u, v,
and surface elevation zeta.
Thank you!

Rafael
Attachments
T and S profiles
T and S profiles

User avatar
kate
Posts: 4088
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: initial and boundary conditions from measured data

#2 Unread post by kate »

Easiest would be to provide the values as analytic functions in ana_initial.h. Failing that, create an initial netcdf file that matches the supplied cdl file using matlab or the tool of your choice. What is the tool of your choice? There are several with netcdf interfaces - we have some useful pieces for some.

Same story for the boundary conditions.

turuncu
Posts: 128
Joined: Tue Feb 01, 2005 8:21 pm
Location: Istanbul Technical University (ITU)
Contact:

Re: initial and boundary conditions from measured data

#3 Unread post by turuncu »

Hi,

I did it before using following steps,

1 - if you don't have actual numeric values of the data. You should get them from the plot. You can use the PlotDigitizer to do that and can be downloaded from following link,

http://plotdigitizer.sourceforge.net/

2 - After getting the data (it is values and depth). You could the MATLAB curve fitting toolbox to fit a curve to data. In my case, i used exponential function but it could be different in your case. If you don't have MATLAB you can do it any other open source tool such as R, octave etc.

3 - Now, you have function and it's coefficients for both temperature and salinity field. It is important that the function gets the depth as a argument and outputs the actual value of the temperature or salinity.

4 - Now you have to implement the function in the ana_initial.h (you can copy this file into your case director and point it in the *.in file)

The basic modification but be include the following,

In subroutine "ana_initial_tile" define the coefficients in the local variable declaration section,

Code: Select all

...
      real(r8) :: a0=6.675_r8
      real(r8) :: b0=-0.01719_r8
      real(r8) :: c0=7.774_r8
      real(r8) :: d0=-0.003026_r8
      real(r8) :: a1=11.81_r8
      real(r8) :: b1=-2.169e-05_r8
      real(r8) :: c1=-1.541_r8
      real(r8) :: d1=-0.1927_r8
      ...
In this case the a0,b0,c0 and d0 is for temperature and others for salinity. Then put the functions into the following section,

Code: Select all

...
    # if defined MY_APPLICATION
      DO k=1,N(ng)
        DO j=JstrR,JendR
          DO i=IstrR,IendR
            ! homogeneous
            !t(i,j,k,1,itemp)=7.0_r8
            ! stratified
            if (z_r(i,j,k) .lt. -10.0_r8) then
              t(i,j,k,1,itemp)=a0*exp(b0*-1.0_r8*z_r(i,j,k)) + &
                               c0*exp(d0*-1.0_r8*z_r(i,j,k))
            else
              t(i,j,k,1,itemp)=13.6_r8
            end if
#  ifdef SALINITY
            t(i,j,k,1,isalt)=a1*exp(b1*-1.0_r8*z_r(i,j,k)) + &
                             c1*exp(d1*-1.0_r8*z_r(i,j,k))
#  endif
          END DO
        END DO
      END DO
      ...
That is all. In this case the temperature is constant in the upper layer of the ocean (set it to 13.6). So, if you want you can delete that part for your application. Now, you can compile the model. By the way, don't forget the set #define ANA_INITIAL in the cpp definitions. Please correct me Kate, if i miss something.

Thanks,

--ufuk

asujrpv

Re: initial and boundary conditions from measured data

#4 Unread post by asujrpv »

I am most grateful Kate and Ufuk for your suggestions.

Kate, my preference is fortran but I can use matlab as well.

What about the lateral (non-reflective) boundary conditions? the region is a rectangle, where do I set those BC?

Could you please also tell me where to set the top (rigid free shear) and bottom boundary conditions.

Thank you truly!
Rafael

User avatar
kate
Posts: 4088
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: initial and boundary conditions from measured data

#5 Unread post by kate »

Hernan once had Fortran codes for making IC/BC files. I haven't used them in over ten years and Hernan is now supporting the matlab option.

The top and bottom BC are in ana_smflux, ana_stflux, ana_btflux and so forth.

All this stuff should be in the wiki - did you look there? Try https://www.myroms.org/wiki/index.php/B ... Conditions.

asujrpv

Re: initial and boundary conditions from measured data

#6 Unread post by asujrpv »

turuncu wrote:Hi,

I did it before using following steps,

1 - if you don't have actual numeric values of the data. You should get them from the plot. You can use the PlotDigitizer to do that and can be downloaded from following link,

http://plotdigitizer.sourceforge.net/

2 - After getting the data (it is values and depth). You could the MATLAB curve fitting toolbox to fit a curve to data. In my case, i used exponential function but it could be different in your case. If you don't have MATLAB you can do it any other open source tool such as R, octave etc.

3 - Now, you have function and it's coefficients for both temperature and salinity field. It is important that the function gets the depth as a argument and outputs the actual value of the temperature or salinity.

4 - Now you have to implement the function in the ana_initial.h (you can copy this file into your case director and point it in the *.in file)

The basic modification but be include the following,

In subroutine "ana_initial_tile" define the coefficients in the local variable declaration section,

Code: Select all

...
      real(r8) :: a0=6.675_r8
      real(r8) :: b0=-0.01719_r8
      real(r8) :: c0=7.774_r8
      real(r8) :: d0=-0.003026_r8
      real(r8) :: a1=11.81_r8
      real(r8) :: b1=-2.169e-05_r8
      real(r8) :: c1=-1.541_r8
      real(r8) :: d1=-0.1927_r8
      ...
In this case the a0,b0,c0 and d0 is for temperature and others for salinity. Then put the functions into the following section,

Code: Select all

...
    # if defined MY_APPLICATION
      DO k=1,N(ng)
        DO j=JstrR,JendR
          DO i=IstrR,IendR
            ! homogeneous
            !t(i,j,k,1,itemp)=7.0_r8
            ! stratified
            if (z_r(i,j,k) .lt. -10.0_r8) then
              t(i,j,k,1,itemp)=a0*exp(b0*-1.0_r8*z_r(i,j,k)) + &
                               c0*exp(d0*-1.0_r8*z_r(i,j,k))
            else
              t(i,j,k,1,itemp)=13.6_r8
            end if
#  ifdef SALINITY
            t(i,j,k,1,isalt)=a1*exp(b1*-1.0_r8*z_r(i,j,k)) + &
                             c1*exp(d1*-1.0_r8*z_r(i,j,k))
#  endif
          END DO
        END DO
      END DO
      ...
That is all. In this case the temperature is constant in the upper layer of the ocean (set it to 13.6). So, if you want you can delete that part for your application. Now, you can compile the model. By the way, don't forget the set #define ANA_INITIAL in the cpp definitions. Please correct me Kate, if i miss something.

Thanks,

--ufuk
Ufuk/Kate, if I am using the curve fitting as suggested, should I use positive 'z' or negative, as written above? Please let me know, I thought ROMS uses positive depth.

User avatar
kate
Posts: 4088
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: initial and boundary conditions from measured data

#7 Unread post by kate »

ROMS uses positive depth, but negative z. The bottom is at z = -h.

Post Reply