|
[Sponsors] |
Shallow Water Equations - Lax Wendroff Method - FORTRAN Code |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 29, 2018, 08:47 |
Shallow Water Equations - Lax Wendroff Method - FORTRAN Code
|
#1 |
New Member
Join Date: May 2018
Location: Turkey
Posts: 22
Rep Power: 8 |
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. |
|
May 29, 2018, 11:28 |
|
#2 | |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,882
Rep Power: 73 |
Quote:
How do you implement the LW method? Why have you needed about half stime step? |
||
May 29, 2018, 17:31 |
|
#3 | |
New Member
Join Date: May 2018
Location: Turkey
Posts: 22
Rep Power: 8 |
Quote:
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 17:45. Reason: incorrect number added |
||
May 29, 2018, 18:41 |
|
#4 |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,882
Rep Power: 73 |
COuld you write exactly the PDE system with the BC.s?
|
|
May 29, 2018, 19:37 |
|
#5 |
New Member
Join Date: May 2018
Location: Turkey
Posts: 22
Rep Power: 8 |
I have attached the System of PDES and BCs.
The wave generator is at N+1. cfdforum.jpg cfdforum1.jpg |
|
May 30, 2018, 03:45 |
|
#7 | |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,882
Rep Power: 73 |
Quote:
I have asked for the PDE problem not the numerical method... |
||
May 30, 2018, 13:38 |
|
#8 |
New Member
Join Date: May 2018
Location: Turkey
Posts: 22
Rep Power: 8 |
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 |
|
Tags |
fortran 90, shallow water equations |
|
|
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 09:32 |
Numerical oscillations Roe solver shallow water equations | RicardoGoncalves | Main CFD Forum | 1 | March 5, 2012 04:03 |
FLUENT and Shallow water equations? | morecfd | FLUENT | 2 | January 5, 2012 09:40 |
Comparison between C/C++ and Fortran? | rick | Main CFD Forum | 45 | September 6, 2011 01:52 |
Design Integration with CFD? | John C. Chien | Main CFD Forum | 19 | May 17, 2001 16:56 |