Skip to content
Snippets Groups Projects
Commit ed0702da authored by Emilie Marchandise's avatar Emilie Marchandise
Browse files

No commit message

No commit message
parent 14c23396
No related branches found
No related tags found
No related merge requests found
order = 3
model = GModel() model = GModel()
model:load ('stommel_square.msh') model:load ('stommel_square.msh')
print('load..') print('load..')
dg = dgSystemOfEquations (model) dg = dgSystemOfEquations (model)
dg:setOrder (order) dg:setOrder (3)
dg:setConservationLaw('ShallowWater2d') dg:setConservationLaw('ShallowWater2d')
......
--[[ --[[
Function for initial conditions Function for initial conditions
--]] --]]
function initial_condition( x , f ) function initial_condition( _x , _f )
XYZ = fullMatrix(x) xyz = fullMatrix(_x)
FCT = fullMatrix(f) f = fullMatrix(_f)
for i=0,XYZ:size1()-1 do for i=0,xyz:size1()-1 do
X = XYZ:get(i,0) - .5 X = xyz:get(i,0) - .5
Y = XYZ:get(i,1) - .5 Y = xyz:get(i,1) - .5
Z = XYZ:get(i,2) Z = xyz:get(i,2)
VALUE = math.exp(-40*(X*X+Y*Y+Z*Z)); VALUE = math.exp(-40*(X*X+Y*Y+Z*Z));
FCT:set(i,0,VALUE) f:set(i,0,7)
FCT:set(i,1,0.0) f:set(i,1,0.0)
FCT:set(i,2,0.0) f:set(i,2,0.0)
end end
end end
...@@ -19,14 +19,14 @@ end ...@@ -19,14 +19,14 @@ end
Example of a lua program driving the DG code Example of a lua program driving the DG code
--]] --]]
order = 5
print'*** Loading the mesh and the model ***' print'*** Loading the mesh and the model ***'
myModel = GModel () myModel = GModel ()
myModel:load ('box.geo') myModel:load('square.geo')
myModel:load ('box.msh') myModel:mesh(2)
print'*** Create a dg solver ***' print'*** Create a dg solver ***'
DG = dgSystemOfEquations (myModel) DG = dgSystemOfEquations (myModel)
DG:setOrder(order) DG:setOrder(1)
DG:setConservationLaw('WaveEquation') DG:setConservationLaw('WaveEquation')
DG:addBoundaryCondition('Border','Wall') DG:addBoundaryCondition('Border','Wall')
...@@ -45,11 +45,12 @@ DG:exportSolution('output/solution_000') ...@@ -45,11 +45,12 @@ DG:exportSolution('output/solution_000')
print'*** solve ***' print'*** solve ***'
dt = 0.00125; dt = 0.00125;
for i=1,1000 do N = 1;
for i=1,N do
norm = DG:RK44(dt) norm = DG:RK44(dt)
print('*** ITER ***',i,norm) print('*** ITER ***',i,norm)
if (i % 10 == 0) then if (i % 10 == 0) then
DG:exportSolution(string.format("output/solution-%03d", i)) DG:exportSolution(string.format("solution-%03d", i))
end end
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment