Skip to content

Commit

Permalink
Merge pull request #4 from nicolasaunai/cmake
Browse files Browse the repository at this point in the history
add cmake config
  • Loading branch information
UCaromel authored Aug 1, 2024
2 parents 9fc4b12 + 6f72ff5 commit c8c65b4
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 75 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ whislerwaveres/
whislerwavelin/
whislerwaveHLL/
hallharrisres/
subprojects

debug/
frames/
pyMHD/pyMHD.cpython*
pyMHD/pyMHD.cpython*
58 changes: 40 additions & 18 deletions diagnostics/alfvenwave2D/alfvenwave2D.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import sys
sys.path.append('/home/caromel/Documents/PHAREMHD/pyMHD')

# sys.path.append('/home/caromel/Documents/PHAREMHD/pyMHD')

import numpy as np
import pyMHD as p
Expand Down Expand Up @@ -27,47 +28,56 @@
dumpvariables = p.dumpVariables.Conservative

##############################################################################################################################################################################
lx=nx*Dx
ly=ny*Dy
lx = nx * Dx
ly = ny * Dy

alpha = np.arctan(0.5)
cosalpha = np.cos(alpha)
sinalpha = np.sin(alpha)
kx = 2*np.pi/(cosalpha*lx)
ky = 2*np.pi/(sinalpha*ly)
kx = 2 * np.pi / (cosalpha * lx)
ky = 2 * np.pi / (sinalpha * ly)


def rho_(x, y):
return 1.0


def vx_(x, y):
return (-1e-4 * np.sin(kx * x * cosalpha + ky * y * sinalpha)) / (2. * sinalpha)
return (-1e-4 * np.sin(kx * x * cosalpha + ky * y * sinalpha)) / (2.0 * sinalpha)


def vy_(x, y):
return (1e-4 * np.sin(kx * x * cosalpha + ky * y * sinalpha)) / (2. * cosalpha)
return (1e-4 * np.sin(kx * x * cosalpha + ky * y * sinalpha)) / (2.0 * cosalpha)


def vz_(x, y):
return 0.0


def Bx_(x, y):
return (1 - 1e-4 * np.sin(kx * x * cosalpha + ky * y * sinalpha)) / (2. * sinalpha)
return (1 - 1e-4 * np.sin(kx * x * cosalpha + ky * y * sinalpha)) / (2.0 * sinalpha)


def By_(x, y):
return (1 + 1e-4 * np.sin(kx * x * cosalpha + ky * y * sinalpha)) / (2. * cosalpha)
return (1 + 1e-4 * np.sin(kx * x * cosalpha + ky * y * sinalpha)) / (2.0 * cosalpha)


def Bz_(x, y):
return 0.0


def P_(x, y):
return 0.1


x = np.arange(nx) * Dx + 0.5 * Dx
y = np.arange(ny) * Dy + 0.5 * Dy
xf = np.arange(nx+1) * Dx
yf = np.arange(ny+1) * Dy
xf = np.arange(nx + 1) * Dx
yf = np.arange(ny + 1) * Dy

xx, yy = np.meshgrid(x, y, indexing = 'ij')
xfx, yfx = np.meshgrid(xf, y, indexing = 'ij')
xfy, yfy = np.meshgrid(x, yf, indexing = 'ij')
xx, yy = np.meshgrid(x, y, indexing="ij")
xfx, yfx = np.meshgrid(xf, y, indexing="ij")
xfy, yfy = np.meshgrid(x, yf, indexing="ij")

rho = np.full((nx, ny), rho_(xx, yy)).T
vx = np.full((nx, ny), vx_(xx, yy)).T
Expand All @@ -80,7 +90,7 @@ def P_(x, y):

#############################################################################################################################################################################

result_dir = '2Dwave/'
result_dir = "2Dwave/"
if os.path.exists(result_dir):
shutil.rmtree(result_dir)

Expand All @@ -89,6 +99,18 @@ def P_(x, y):
P0cc = p.PrimitiveVariables(nx, ny)
P0cc.init(rho, vx, vy, vz, Bxf, Byf, Bz, P)

p.PhareMHD(P0cc, result_dir, nghost,
boundaryconditions, reconstruction, slopelimiter, riemannsolver, constainedtransport, timeintegrator,
Dx, Dy, FinalTime, dumpvariables = dumpvariables)
p.PhareMHD(
P0cc,
result_dir,
nghost,
boundaryconditions,
reconstruction,
slopelimiter,
riemannsolver,
constainedtransport,
timeintegrator,
Dx,
Dy,
FinalTime,
dumpvariables=dumpvariables,
)
51 changes: 0 additions & 51 deletions src/CMakeLists.txt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "ConstainedTransport.hpp"
#include "ConstrainedTransport.hpp"

static const PhysicalConstants& pc = PhysicalConstants::getInstance();

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/ModularityUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "Enums.hpp"
#include "SlopeLimiter.hpp"
#include "RiemannSolver.hpp"
#include "ConstainedTransport.hpp"
#include "ConstrainedTransport.hpp"
#include "TimeIntegrator.hpp"

class Interface;
Expand All @@ -28,4 +28,4 @@ CTFunction getCT(CTMethod ct);
typedef ConservativeVariables (*IntegratorFunction)(ConservativeVariables&, double, double, double, int, BoundaryConditions, Reconstruction, Slope, Riemann, CTMethod, OptionalPhysics);
IntegratorFunction getIntegrator(Integrator intg);

#endif
#endif
4 changes: 2 additions & 2 deletions src/TimeIntegrator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "ModularityUtils.hpp"
#include "ConservativeVariables.hpp"
#include "GodunovFlux.hpp"
#include "ConstainedTransport.hpp"
#include "ConstrainedTransport.hpp"
#include "AddGhostCells.hpp"
#include "ComputeJ.hpp"

Expand All @@ -21,4 +21,4 @@ ConservativeVariables TVDRK2(ConservativeVariables& Un, double Dx, double Dy, do

ConservativeVariables TVDRK3(ConservativeVariables& Un, double Dx, double Dy, double Dt, int nghost, BoundaryConditions bc, Reconstruction rec, Slope sl, Riemann rs, CTMethod ct, OptionalPhysics OptP);

#endif // TIME_INTEGRATOR_HPP_
#endif // TIME_INTEGRATOR_HPP_

0 comments on commit c8c65b4

Please sign in to comment.