Skip to content
Snippets Groups Projects
Commit 6512ea51 authored by Jonathan Lambrechts's avatar Jonathan Lambrechts
Browse files

test validation

parent c867ab94
No related branches found
No related tags found
No related merge requests found
--[[
Function for initial conditions
--]]
function initial_condition( xyz , f )
for i=0,xyz:size1()-1 do
X = xyz:get(i,0) - .5
Y = xyz:get(i,1) - .5
Z = xyz:get(i,2)
-- X2 = xyz:get(i,0) - 1.5
-- Y2 = xyz:get(i,1) - .5
-- Z2 = xyz:get(i,2)
VALUE = math.exp(-40*(X*X+Y*Y+Z*Z))
-- + math.exp(-40*(X2*X2+Y2*Y2+Z2*Z2));
f:set(i,0,VALUE)
f:set(i,1,0.0)
f:set(i,2,0.0)
end
end
print'*** Loading the mesh and the model ***'
myModel = GModel ()
--myModel:load('box.geo')
--myModel:load('box.msh')
--myModel:load('square_quads.msh')
myModel:load('square.geo')
myModel:load('test.msh')
print'*** Create a dg solver ***'
DG = dgSystemOfEquations (myModel)
DG:setOrder(3)
law=dgConservationLawWaveEquation(2)
DG:setConservationLaw(law)
law:addBoundaryCondition('Border',law:newBoundaryWall())
DG:setup()
initialCondition = functionLua(3,'initial_condition',{'XYZ'}):getName()
print'*** setting the initial solution ***'
DG:L2Projection(initialCondition)
print'*** export ***'
DG:exportSolution('output/solution_000')
print'*** solve ***'
N = 100;
CFL = 2.1;
dt = CFL * DG:computeInvSpectralRadius();
print('DT = ',dt)
for i=1,N do
-- norm = DG:multirateRK43(dt)
norm = DG:RK44(dt)
if (i % 100 == 0) then
print('*** ITER ***',i,norm)
DG:exportSolution(string.format("output/solution-%04d", i))
end
end
print'*** done ***'
Point(1) = {0.0, 0.0, 0, .03};
Point(2) = {1, 0.0, 0, .03};
Point(3) = {1, 1, 0, .03};
Point(4) = {0, 1, 0, .03};
Line(1) = {4, 3};
Line(2) = {3, 2};
Line(3) = {2, 1};
Line(4) = {1, 4};
Line Loop(5) = {2, 3, 4, 1};
Plane Surface(6) = {5};
Physical Line("Border") = {1, 2, 3, 4};
Physical Surface("Inside") = {6};
Mesh.CharacteristicLengthExtendFromBoundary=1;
//Transfinite Line {1, 2, 4, 3} = 2 Using Progression 1;
//Transfinite Surface {6};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment