This is my first post here, normally with mathematica I will solve out the PDE using eigen function expansion or separation of variables and then model the solution in mathematica. However this time I have a problem with a changing boundary condition. This question specificly relates to water hammer with a boundary condition that depends on the valve opening $$Q(t)=C_vSqrt\frac{dP}{ρ}$$ The partial differential equations that govern water hammer are: $$\frac{∂^2P}{∂t^2}=c^2\frac{∂^2P}{∂x^2}+k\frac{∂P}{∂x} $$ $$ B.C;P (L,t)=\frac{Q(t)^2 ρ}{C_v(t)^2} +P_2,P(0,t)=0$$ $$I.C;P_1 (0)=0$$
How do I solve for Q(t), the only equation I can think of to solve Q(t) is the valve Cv equation which I am using as the boundary condition in the first place, cant use the same equation to solve for 2 unknown variables.
I looked at this - Water Hammer - Numerically solving system of PDEs But the Pressure BC's don't depend on velocity and the velocity BC's don't depend on pressure and they should in order to satisfy the valve closure equations.
Can I use NDsolve for this in mathematica or solvepde in matlab?
τ := 4
Subscript[Cv, max] := 20
P0 := 25
L := 31
ρ := 62
k := 504234
PDE := {D[P[x, t], {t, 2}] == D[P[x, t], {x, 2}] + k*D[P[x, t], x]}
BC := {P[L, t] == (Q[L, t]^2*ρ)/(-2*t + Subscript[Cv, max])^2 +
P0, P[x, 0] == 300}
NDSolve[{PDE, BC}, {P, Q}, {x, 0, 30}, {t, 0, 5},
StartingStepSize -> τ/100 ]
Q[L, t] := sqrt[(P[L, t]*(-2*t + Subscript[Cv, max])^2)/(ρ - P0)]
Q[L, 0] == sqrt[(300*(Subscript[Cv, max])^2)/(ρ - P0)]
Sqrtrather thansqrt. – xzczd Jun 16 '16 at 03:01