Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with reading LBC correctly in warmstart simulation #86

Open
adoyenne opened this issue Dec 7, 2023 · 1 comment
Open

Problem with reading LBC correctly in warmstart simulation #86

adoyenne opened this issue Dec 7, 2023 · 1 comment

Comments

@adoyenne
Copy link

adoyenne commented Dec 7, 2023

Hello,

I found a problem in nudgeboundary.f90. The issue is that when you start a warmstart simulation, the model reads LBCs every time from 0 hour, i.e., from the coldstart. I found that the procedure of reading the LBCs files from the restart time was somehow missing.
I added this procedure to the subroutine nudgeboundary:

if(.not. lwarmstart) then

        	! Read the first two input times
        	call read_new_LBCs(0.)
        	call read_new_LBCs(dt_input_lbc)
        	lbc_index = 1

        	if (lnudge_boundary_sv) then 
            	! Read the first two input times for scalars
            	call read_new_LBCs_sv(0.)
            	call read_new_LBCs_sv(dt_input_lbc_sv)
            	lbc_index_sv = 1
        	end if
        
        else
        
        	! Read the first two input times (starting from restart time): !Arseni
        
        	call read_new_LBCs(btime/1000.)
        	call read_new_LBCs((btime/1000.)+dt_input_lbc)
        	lbc_index = int(btime/(3600.*1000.))

        	if (lnudge_boundary_sv) then 
            	! Read the first two input times for scalars (starting from restart time): !Arseni
            	call read_new_LBCs_sv(btime/1000.)
            	call read_new_LBCs_sv((btime/1000.)+dt_input_lbc_sv)
            	lbc_index_sv = int(btime/(3600.*1000.))
       		end if
        
        
        endif

However, I still have an issue with nudge boundaries, namely a sudden appearance of the anomalously high values around the domain borders. Is there any idea what could cause this behaviour? (LBCs files are correct, though)

See the movie of co2 scalar tracer (the restart simulation starts from 6h):

test_save_CO2_sv001-1.mp4

Cheers,
Arseni

@adoyenne adoyenne changed the title Issue of correct LBCs reading in warmstart simulation Problem with reading LBC correctly in warmstart simulation Dec 7, 2023
@adoyenne
Copy link
Author

Dear all,

I've managed to fix this problem. The thing was that lbc_index_sv calculated incorrectly and temporal interpolation caused a wrong results at boundaries. Here, I advise to replace this part of the code:

! Read the first two input times
call read_new_LBCs(0.)
call read_new_LBCs(dt_input_lbc)
lbc_index = 1

    	if (lnudge_boundary_sv) then 
        	! Read the first two input times for scalars
        	call read_new_LBCs_sv(0.)
        	call read_new_LBCs_sv(dt_input_lbc_sv)
        	lbc_index_sv = 1
    	end if

with this one:

! Read the first two input times
!(can be used for cold and warm starts, because rtimee is used)
call read_new_LBCs(rtimee)
call read_new_LBCs(rtimee+dt_input_lbc)
lbc_index = int(rtimee/dt_input_lbc)+1

        if (lnudge_boundary_sv) then 
            ! Read the first two input times for scalars 
            !(can be used for cold and warm starts, because rtimee is used)
            call read_new_LBCs_sv(rtimee)
            call read_new_LBCs_sv(rtimee+dt_input_lbc_sv)
            lbc_index_sv = int(rtimee/dt_input_lbc_sv)+1
        end if

This reading procedure is universal and can be used for both cold and warm starts since it is linked to rtimee that is 0 when cold start and equals restart time at warm start. So, there is not need to use separate procedure for warmstart (as in my example in previous message).

Regards,
Arseni

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant