Welcome, Guest
Username: Password: Remember me

TOPIC: Modifying bedload_meyer.f

Modifying bedload_meyer.f 12 years 9 months ago #3538

  • gaventang
  • gaventang's Avatar
Hello,

I need help with modifying bedload_meyer.f such that the computed sediment transport rate accounts for presence of vegetation.

To account for vegetation, I am trying to implement the following:
tau' = [n1/(n1^2+n2^2)^0.5]*tau
where:
tau' = shear stress for sediment transport
tau = total bed shear stress
n1 = grain roughness (mannings)
n2 = vegetation roughness (mannings)

From going through the bedload_meyer subroutine, I have gathered that the variable TETAP is the total bed shear stress. I would like to know how to call the roughness coefficient into the subroutine so that I can implement the above calculation. Also, I was hoping to create a new variable for graphic printouts to output the new shear stress used for sediment transport.

Any guidance and assistance will be greatly appreciated.

Regards,
Gaven
The administrator has disabled public write access.

Re: Modifying bedload_meyer.f 12 years 9 months ago #3539

  • jmhervouet
  • jmhervouet's Avatar
Hello,

Here is a first general answer. To have in a subroutine a variable that is not in the arguments, you can use the following command at the beginning (after USE BIEF) :

USE DECLARATIONS_SISYPHE, ONLY : CHESTR

but look at the declaration in this module, the variable may be a BIEF_OBJ structure, so double precision data are in CHESTR%R

Then in your case CHESTR maybe a Strickler, Chézy, Nikuradse, etc., depending on the friction law, unless you use the non dimensional quadratic coefficient CF.

To add a new output variable, you need to modify point_sisyphe (see at the end how output variables are added in a block called VARSOR) and nomvar_sisyphe, where names and mnemos of the new variable are given (with the same order as in the block VARSOR). It is basically very simple but became very difficult in Sisyphe, as the position of variables in the block depend of parameters as NSICLA, number of classes, and NOMBLAY, number of layers.

Then you just need to add the chosen mnemo in the keyword 'VARIABLES FOR GRAPHIC PRINTOUTS'

With best regards,

Jean-Michel Hervouet
The administrator has disabled public write access.

Re: Modifying bedload_meyer.f 12 years 9 months ago #3563

  • gaventang
  • gaventang's Avatar
Hi Jean-Michel,

Thank you for the guidance. I was able to create a fortran file that compiles, however, I believe that I might have made a mistake in my coding, as the model fails to run. I have attached my model so that you can take a look.

File Attachment:

File Name: TEST.zip
File Size: 1,282 KB


My altered BEDLOAD_MEYER subroutine starts at line 134 of the fortran file, and the computation to change the shear stress used in the sediment transport calculation is located at lines 204 to 211.

Also, I should note that the model does run properly if I comment out lines 204 to 211, and change all references revert all references to TOS to TETAP (lines 226 to 240).

Again, any help will be appreciated.

Cheers,
Gaven
The administrator has disabled public write access.

Re: Modifying bedload_meyer.f 12 years 9 months ago #3564

  • jmhervouet
  • jmhervouet's Avatar
Hello,

It could be that you try to do powers of a negative number. I enclose a document on programming rules (I am just in the process of writing it) and you will see that X**2.D0 is costful and dangerous. The subroutine (even the original coding) should be rewritten and simplified with simple loops like:

DO I=1,N1%DIM1
N1%R(I)=CHESTR%R(I)-3.D-2
etc.
ENDDO

I assume that you have correctly allocated N1 and the rest in point_sisyphe.f, otherwise you can add :

CALL CPSTVC(CHESTR,N1) so that N1 has the same discretisation as CHESTR.

For power 2 put 2 and not 2.D0 or it will crash if you have slightly negative values for some reason.

With best regards,

Jean-Michel Hervouet
Attachments:
The administrator has disabled public write access.

Re: Modifying bedload_meyer.f 12 years 9 months ago #3651

  • gaventang
  • gaventang's Avatar
Hi Jean-Michel,

I am still having problems trying to get my code to work. Please have a look at my modified 'bedload_meyer' subroutine in the attached fortran file.

I have declared one global variable: TOS and 2 local variables: N1, N2. To ensure that TOS has the same discretisation as TETAP, I used "CALL CPSTVC(TETAP,TOS). The recalculation of shear stress is now achieved through:

1 CALL CPSTVC(TETAP,TOS)
2 N1 = 3.0D-2
3 DO I=1,NPOIN
4 N2 = CHESTR%R(I) - N1
5 TOS%R(I) = TETAP%R(I) * N1 / (N1 ** 2 + N2 ** 2)
6 ENDDO

The simulation fails to run when lines 1 or 5 are uncommented, but when both are commented out the model runs fine. I think my problem is in how the global variable TOS is declared, but there might be other issues... Could you suggest a way I can fix this?

Thanks,
Gaven
Attachments:
The administrator has disabled public write access.

Re: Modifying bedload_meyer.f 12 years 9 months ago #3723

  • jmhervouet
  • jmhervouet's Avatar
Hello,

Did you add the three extra arguments that I see in bedload_meyer in the call to bedload_meyer. If not use rather :

USE DECLARATIONS_SISYPHE, ONLY : CHESTR,TOS,etc.

With best regards,

Jean-Michel Hervouet
The administrator has disabled public write access.

Re: Modifying bedload_meyer.f 12 years 9 months ago #3672

  • gaventang
  • gaventang's Avatar
I believe that I just figured it out. Thanks for your help!!!

Gaven
The administrator has disabled public write access.
Moderators: Pablo, pavans

The open TELEMAC-MASCARET template for Joomla!2.5, the HTML 4 version.