CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Shallow Water Equations - Lax Wendroff Method - FORTRAN Code

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 29, 2018, 07:47
Question Shallow Water Equations - Lax Wendroff Method - FORTRAN Code
  #1
New Member
 
Join Date: May 2018
Location: Turkey
Posts: 22
Rep Power: 7
aunmhd is on a distinguished road
Hey everyone,

I'm writing a FORTRAN Code for simulating the propagation of shallow water waves (1D). The case is pretty simple: I have a wave generator on one end of the pool and a Wall boundary condition on another. I'm using the Lax Wendroff Method. The equations have the form:
!
! dh/dt + dA/dx = 0
!
! dA/dt + dB/dx = C

The difficulty which I am facing is the implementation of the Boundary Conditions for the half time steps. For this reason, I haven't been able to initiate wave propagation over the surface. Anybody with experience is welcome to comment so that I may share more detail and/or code.
aunmhd is offline   Reply With Quote

Old   May 29, 2018, 10:28
Default
  #2
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,778
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by aunmhd View Post
Hey everyone,

I'm writing a FORTRAN Code for simulating the propagation of shallow water waves (1D). The case is pretty simple: I have a wave generator on one end of the pool and a Wall boundary condition on another. I'm using the Lax Wendroff Method. The equations have the form:
!
! dh/dt + dA/dx = 0
!
! dA/dt + dB/dx = C

The difficulty which I am facing is the implementation of the Boundary Conditions for the half time steps. For this reason, I haven't been able to initiate wave propagation over the surface. Anybody with experience is welcome to comment so that I may share more detail and/or code.



How do you implement the LW method? Why have you needed about half stime step?
FMDenaro is offline   Reply With Quote

Old   May 29, 2018, 16:31
Default
  #3
New Member
 
Join Date: May 2018
Location: Turkey
Posts: 22
Rep Power: 7
aunmhd is on a distinguished road
Quote:
Originally Posted by FMDenaro View Post
How do you implement the LW method? Why have you needed about half stime step?
My wording was incorrect. Not half time step.
I have a wall boundary condition on the left. A wave generator on the right which generates a sine wave throughout the time domain. I have correctly applied the initial conditions: the initial water depth=1 and the initial velocity in water=0. The main part of the code for the Lax-Wendroffs two step method is attached below:

Code:
DO j=1,NT+1
    DO i=2,NX

BN(i-1,j)=(HN(i-1,j)*(UN(i-1,j))**2)+((g*(HN(i-1,j)**2))/2)
BN(i+1,j)=(HN(i+1,j)*(UN(i+1,j))**2)+((g*(HN(i+1,j)**2))/2)

CN(i,j)=(Cf*UN(i,j)*ABS(UN(i,j))*rho)/(2.0*W)

HN(NX+1,j)=H0+(Amplitude/2.0)*SIN((2.0*PI*T(j))/(T_LENGTH/10.0))
HNP102(1,j)=HN(1,j)-(DT/(2*DX))*(AN(2,j))                           !WALL BC
HNP102(i,j)=(0.5*(HN(i+1,j)+HN(i-1,j)))-((DT/(4*DX))*(AN(i+1,j)-AN(i-1,j)))


ANP102(NX+1,j)=AN(NX+1,j)-((DT/(2*DX))*(BN(NX+1,j)-BN(NX,j)))-((DT/2)*CN(NX+1,j))
ANP102(i,j)=0.5*(AN(i+1,j)+AN(i-1,j))-((DT/(4*DX))*(BN(i+1,j)-BN(i-1,j)))-((DT/2)*CN(i,j))

UNP102(i,j)=ANP102(i,j)/HNP102(i,j)

BNP102(i,j)=(HNP102(i,j)*(UNP102(i,j))**2)+((g*(HNP102(i,j)**2))/2)

CNP102(i,j)=(Cf*UNP102(i,j)*ABS(UNP102(i,j))*rho)/(2.0*W)

HNP1(1,j)=HN(1,j)-((DT/(2.0*DX))*ANP102(2,j))
HNP1(NX+1,j)=H0+(Amplitude/2.0)*SIN((2.0*PI*T(j))/(T_LENGTH/10.0))  
HNP1(i,j)=HN(i,j)-(DT/(2.0*DX))*(ANP102(i+1,j)-ANP102(i-1,j))

BNP102(1,j)=(g*H0**2)/2.0
BNP102(NX+1,j)=(HNP102(NX+1,j)*UNP102(NX+1,j)**2)+((g*HNP102(NX+1,j)**2)/2)
ANP1(NX+1,j)=AN(NX+1,j)-(DT/(2*DX))*(BNP102(NX+1,j)-BNP102(NX,j))-         &
             (DT*CNP102(NX+1,j))

ANP1(i,j)=AN(i,j)-(DT/(2.0*DX))*(BNP102(i+1,j)-BNP102(i-1,j))-(CNP102(i,j)*DT)

UNP1(i,j)=ANP1(i,j)/HNP1(i,j)
    END DO
UNP1(i,j)=UN(i,j)
HNP1(i,j)=HN(i,j)
END DO

Last edited by aunmhd; May 29, 2018 at 16:45. Reason: incorrect number added
aunmhd is offline   Reply With Quote

Old   May 29, 2018, 17:41
Default
  #4
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,778
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
COuld you write exactly the PDE system with the BC.s?
FMDenaro is offline   Reply With Quote

Old   May 29, 2018, 18:37
Default
  #5
New Member
 
Join Date: May 2018
Location: Turkey
Posts: 22
Rep Power: 7
aunmhd is on a distinguished road
I have attached the System of PDES and BCs.
The wave generator is at N+1.


cfdforum.jpg cfdforum1.jpg
aunmhd is offline   Reply With Quote

Old   May 29, 2018, 20:07
Default
  #6
New Member
 
tafresh.university's Avatar
 
iran VS america
Join Date: Aug 2017
Posts: 8
Rep Power: 8
tafresh.university is on a distinguished road
I want to solve this problem but I can’t because it is my first time that I am coding so I need help for solve
Anybody can help me??????
image.jpg
MATLAB or fortran
Please help me......
tafresh.university is offline   Reply With Quote

Old   May 30, 2018, 02:45
Default
  #7
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,778
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by aunmhd View Post
I have attached the System of PDES and BCs.
The wave generator is at N+1.


Attachment 63654 Attachment 63655



I have asked for the PDE problem not the numerical method...
FMDenaro is offline   Reply With Quote

Old   May 30, 2018, 12:38
Default
  #8
New Member
 
Join Date: May 2018
Location: Turkey
Posts: 22
Rep Power: 7
aunmhd is on a distinguished road
The code I have written in the post above is incorrect. I have corrected it.
There is one problem I cannot solve.
The wall is a reflective boundary condition. The boundary condition which I have written in the attachments above is incorrect.
HNP1(1) ~ The water level at the wall must be assigned a value such that the wave is reflected off the wall.

534CB38C-D588-4821-AB93-2A235ED75C78.jpg
aunmhd is offline   Reply With Quote

Reply

Tags
fortran 90, shallow water equations


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Give me some advice CFD in Fortran code or Matlab code. tringuyenttt Main CFD Forum 4 May 29, 2013 08:32
Numerical oscillations Roe solver shallow water equations RicardoGoncalves Main CFD Forum 1 March 5, 2012 03:03
FLUENT and Shallow water equations? morecfd FLUENT 2 January 5, 2012 08:40
Comparison between C/C++ and Fortran? rick Main CFD Forum 45 September 6, 2011 00:52
Design Integration with CFD? John C. Chien Main CFD Forum 19 May 17, 2001 15:56


All times are GMT -4. The time now is 07:07.