Variable salinity,temperature profiles at open boundary

For questions about setting up the basic hydrodynamics. Bathymetry inclusion, tidal boundary conditions, river inclusion and so on..

Moderator: Saheedpp

Post Reply
sgharbi
Posts: 5
Joined: Thu Sep 24, 2015 6:11 pm
Full name: S. H. Gharbi

Variable salinity,temperature profiles at open boundary

Post by sgharbi »

Hello everyone

I am running a model for the Red Sea and western Gulf of Aden domain. The model simulations are working fine when I run with the only tide at the boundary.
The model has an open boundary at 45E (the open boundary condition only at U) about 36 points with a resolution of 0.0625 degrees.

It is also working well with meteorological forcing.

Now I need to incorporate salinity and temperature profiles along with tidal forcing at the open boundary.


Could any one help me to guide how to set these open boundaries with all forcings according to the standard depth [0,10,20,30,50,75,100,125,150,200,250,300,400,500, 600,700,800,900,1000]

Unfortunately, the setting of 3d input at the boundary in the manual is little confusing for me/ not clear (as there is no test case given in the manual for profile input in both Usdef_Model.f90 and Usdef_Time_Series.f90)


Please help in this regards.
Thank you in advance
regards,
Sameer
Sou
Posts: 51
Joined: Wed Sep 03, 2014 7:46 pm
Full name: Soudeh Afsharian

Re: Variable salinity,temperature profiles at open boundary

Post by Sou »

Hi Sameer,
including the external time series input files is really a big problem in the model as there is no test case with these settings. unfortunately, this forum is not active like other software forums. it's disappointing...
I have the same problem in adding a daily river discharge file.
hope someone replies.
Thanks,
Sue
Katrijn
Posts: 87
Joined: Fri Nov 29, 2013 3:04 pm
Full name: Katrijn Baetens

Re: Variable salinity,temperature profiles at open boundary

Post by Katrijn »

Hi Sameer,
You are right, it takes too long for someone to reply, we are working on how to make sure we reply faster. Sorry to dissapoint you Soudeh, I hope you can understand we want to do a good job and not reply in a hurry.

for salinity and temperature I suggest you look at the other forum post about salinity input. As Soudeh nicely remarked it does not show how to include variable discharges but I have replied to his post, so hopefully you can find your answer there too.The link with some documents on how to include salinity and temperature: https://share.naturalsciences.be/d/b51d63632b/
If you need more help on how to include variable temperature and salinities please let us know.

Can you elaborate on what you mean here? I don't really get it:
Could any one help me to guide how to set these open boundaries with all forcings according to the standard depth [0,10,20,30,50,75,100,125,150,200,250,300,400,500, 600,700,800,900,1000]
sgharbi
Posts: 5
Joined: Thu Sep 24, 2015 6:11 pm
Full name: S. H. Gharbi

Re: Variable salinity,temperature profiles at open boundary

Post by sgharbi »

Thank you Sou and Katrijn for your reply.

Dear Katrijn

Thank you for your reply. Ofcourse it is much awaited one.

“Can you elaborate on what you mean here? I don't really get it:
Could any one help me to guide how to set these open boundaries with all forcings according to the standard depth [0,10,20,30,50,75,100,125,150,200,250,300,400,500, 600,700,800,900,1000] “


Theses are standard depth in meters. I have to give temperature and salinity data for open boundaries at these prescribed standard depths.

Normally , what people does is giving open boundary condition for temperature and salinity at every 5m interval or 10m in linear manner i.e 0m 5m 10m etc…

Instead I need to focus at the standard depth for the input boundary condition.

Since I have the boundary points with very non linear depth range .I cannot give linear profile input instead I chose the standard depth.

Hope u understood my situation.


Can u give any information about the profile boundary input (3d input)?????

I need to know how we can give profile input at open boundary .I really need the format of giving these profile input ( 3d input).

I will appreciate if u can provide any example or any file of these format .

Thanking you in advance
regards,
Sameer
Katrijn
Posts: 87
Joined: Fri Nov 29, 2013 3:04 pm
Full name: Katrijn Baetens

Re: Variable salinity,temperature profiles at open boundary

Post by Katrijn »

Dear Sameer,

so you want to give salinity profile at all the open sea boundaries and not only the rivers?
Be aware that you will have to do the interpolation of boundary to the grid externally (ferret is a good program for that, have a look at the fill_XY function, or you can do it yourself off course).
Be aware that the input should be at 1 C grid point outside the domain (in other words at 'x0 - delx/2' and 'y0-dely/2')

In the code itself do the following:
in usrdef_mod_params
iopt_sal = 2
iopt_sal_obc = 1
modfiles(io_salobc,1:2,1)%status = 'N'
modfiles(io_salobc,2,1)%tlims = (/0,0,1/) if you only want to initialize salinity or modfiles(io_salobc,2,1)%tlims = (/0,int_fill,x/) where x are the number of timesteps you want to output. There is interpolation between the timesteps

in Usrdef_profobc_spec:
procname(pglev+1) = 'usrdef_profobc_spec'
CALL log_timer_in()

SELECT CASE (iddesc)

CASE (io_salobc)
noprofsd(2) = nosbu+nosbv
iprofobu(1:nobu,1) = (/(l,l=1,nosbu)/)
iprofobv(1:nobv,1) = (/(l,l=nosbu+1,nosbu+nosbv)/)
indexprof(1:noprofsd(2),2) = (/(l,l=1,noprofsd(2))/)
itypobu = 0; itypobv = 0
END SELECT
CALL log_timer_out()

in Usrdef_profobc_data:

IF (modfiles(iddesc,ifil,1)%iostat.EQ.0) THEN
modfiles(iddesc,ifil,1)%iostat = 1
CALL open_file(iunit,'shelf_initial.nc','IN','N')
imonth = 1
GOTO 1000
ENDIF

ciodatetime = ! depending on how you have your data read
! one example could be:
iodatetime = istartdatetime
iodatetime(2) = imonth
ciodatetime = convert_date(iodatetime)

!this part is user dependent, so you have complete freedom to fill
ivar_220: DO ivar=1,nvars
CALL cf90_inquire_variable(iunit,ivar,varname)
SELECT CASE (TRIM(varname))
CASE ('salt')
IF (iddesc.EQ.io_salobc) THEN
CALL cf90_get_var(iunit,ivar,xdat,imonth)
ierr = NF90_get_var(iunit,ivar,xdat,start=(/1,1,1,imonth/),&
& count=(/nc,nr,nz,1/))
!this depends off course on how your file is organized (this example is quite messy), the goal is to fill psiprofdat(1:nosbu,:) and psiprofdat(nobu+1:nosbu+nosbv,:), be aware that this example takes no rivers into account, for the rivers you need to fill psiprofdat(nosbu+1:nobu,:) and psiprofdat(nobu+nosbv+1,nobu:nobv,:). The ':' denotes the vertical fill
psiprofdat(1:nr-37,:) = xdat(1,1:nr-37,:)
psiprofdat(((nr-37)+1):nosbu,:) = xdat(nc,1:nr-1,:)
psiprofdat(nosbu+1:nosbu+nosbv,:) = xdat(1:nc-1,1,:)
ENDIF
CASE ('temp')
IF (iddesc.EQ.io_tmpobc) THEN
! CALL cf90_get_var(iunit,ivar,xdat,imonth)
ierr = NF90_get_var(iunit,ivar,xdat,start=(/1,1,1,imonth/),&
& count=(/nc,nr,nz,1/))
psiprofdat(1:nr-37,:) = xdat(1,1:nr-37,:)
psiprofdat(((nr-37)+1):nosbu,:) = xdat(nc,1:nr-1,:)
psiprofdat(nosbu+1:nosbu+nosbv,:) = xdat(1:nc-1,1,:)
ENDIF
END SELECT
ENDDO ivar_220

call close_file(iunit,'N')


Hope this helps, I will put another mail with a link if I can find a small test case example for you.

Katrijn
sgharbi
Posts: 5
Joined: Thu Sep 24, 2015 6:11 pm
Full name: S. H. Gharbi

Re: Variable salinity,temperature profiles at open boundary

Post by sgharbi »

Dear Katrijn

Thank you for your reply.
I will try to do as you mentioned .


1) regarding the below code as u said
"
modfiles(io_salobc,1:2,1)%status = 'N'
modfiles(io_salobc,2,1)%tlims = (/0,0,1/) " "%tlims = (/0,0,1/) " here 1 denotes 1 month or not ??


2) i have a file with temp,sal,depth and time in ts_obc.txt

modfiles(io_salobc,2,1)%form ='A'
modfiles(io_salobc,2,1)%filename =''ts_obc.txt' I am adding the file structure like this is this correct???


the structure of the file is as below




Month
01
STD
0.0000 10.0000 20.0000 30.0000 50.0000 75.0000 100.0000 125.0000
Sal
36.0400 36.0200 36.0300 36.0400 36.0900 0.0000 0.0000 0.0000
36.0456 36.0272 36.0365 36.0458 36.0955 36.0765 36.0425 36.0441
36.0537 36.0378 36.0462 36.0546 36.1035 36.0865 36.0294 36.0243
36.0631 36.0500 36.0573 36.0645 36.1128 36.0978 36.0149 36.0019
36.0732 36.0629 36.0690 36.0748 36.1228 36.1095 36.0009 35.9777
36.0834 36.0760 36.0806 36.0850 36.1330 36.1211 35.9879 35.9521
36.0934 36.0886 36.0918 36.0946 36.1431 36.1323 35.9758 35.9254
.......
temp
........





waiting for some example file.



regards
Sameer
Katrijn
Posts: 87
Joined: Fri Nov 29, 2013 3:04 pm
Full name: Katrijn Baetens

Re: Variable salinity,temperature profiles at open boundary

Post by Katrijn »

Dear Sameer,
please have a look at the other topic with the code of Soudeh for an example.

What I can tell you already:
modfiles(io_salobc,2,1)%tlims = (/0,0,1/) " "%tlims = (/0,0,1/) " here 1 denotes 1 month or not ??
The meaning of the array is (/start time step, end time step, update at x timestep/)

So (/0,0,1/) means that you start at time step 0, you stop at time step 0 and you update your data each timestep (timestep = delt2d so it is user defined)

if your timestep is 5s the the following code will update each hour:

modfiles(io_salobc,2,1)%tlims = (/0,int_fill,12*60/)

Hope this helps,

Katrijn
Katrijn
Posts: 87
Joined: Fri Nov 29, 2013 3:04 pm
Full name: Katrijn Baetens

Re: Variable salinity,temperature profiles at open boundary

Post by Katrijn »

PS, you are reading the file correct
rawand
Posts: 2
Joined: Wed Sep 26, 2018 6:57 am
Full name: kamkaran

Re: Variable salinity,temperature profiles at open boundary

Post by rawand »

I really appreciate your efforts for sharing this useful post.
Graduated from Soran University with First Class Degree with Honours in Computer Science.
Post Reply