Commit 2e186248 authored by Jonathan Lambrechts's avatar Jonathan Lambrechts
Browse files

same code for local matrix/vector in 2d and 3d

parent 3f12cab3
......@@ -15,7 +15,7 @@ class StrongBoundary(Structure):
class fluid_problem :
def __init__(self, mesh_file_name, g, mu, rho, alpha, autoEpsilon, strong_boundaries):
def __init__(self, mesh_file_name, g, mu, rho, epsilon, strong_boundaries):
nsb = len(strong_boundaries)
class Bnd :
def __init__(self, b) :
......@@ -31,7 +31,7 @@ class fluid_problem :
asb = (StrongBoundary*nsb)(*[StrongBoundary(i[0].encode(),i[1],BNDCB(Bnd(i[2]).apply)) for i in strong_boundaries])
self.asb = asb
lib.fluid_problem_new.restype = c_void_p
self._fp = c_void_p(lib.fluid_problem_new(mesh_file_name.encode(), c_double(g), c_double(mu), c_double(rho), c_double(alpha), c_bool(autoEpsilon), nsb, asb))
self._fp = c_void_p(lib.fluid_problem_new(mesh_file_name.encode(), c_double(g), c_double(mu), c_double(rho), c_double(epsilon), nsb, asb))
if self._fp == None :
raise NameError("cannot create fluid problem")
......@@ -39,8 +39,8 @@ class fluid_problem :
if(self._fp != None) :
lib.fluid_problem_free(self._fp)
def adapt_mesh(self, gradmin, gradmax, lcmin, autoEpsilon) :
lib.fluid_problem_adapt_mesh(self._fp, c_double(gradmin), c_double(gradmax), c_double(lcmin), c_bool(autoEpsilon))
def adapt_mesh(self, gradmin, gradmax, lcmin) :
lib.fluid_problem_adapt_mesh(self._fp, c_double(gradmin), c_double(gradmax), c_double(lcmin))
def export(self, output_dir, t, it) :
lib.fluid_problem_export(self._fp, output_dir.encode(), c_double(t), c_int(it))
......
This diff is collapsed.
......@@ -11,11 +11,7 @@ typedef struct {
}StrongBoundary;
typedef struct {
#if DIMENSION == 2
double *epsilon;
#else
double epsilon;
#endif
double rho;
double mu;
double alpha;
......@@ -45,13 +41,8 @@ void fluid_problem_compute_node_particle_force(FluidProblem *problem, double dt,
void fluid_problem_implicit_euler(FluidProblem *problem, double dt);
void fluid_problem_set_particles(FluidProblem *problem, int n, double *mass, double *volume, double *position, double *velocity, long int *elid);
void fluid_problem_free(FluidProblem *problem);
#if DIMENSION == 2
FluidProblem *fluid_problem_new(const char *mesh_file_name, double g, double mu, double rho, double alpha, bool autoEpsilon, int n_strong_boundaries, StrongBoundary *strong_boundaries);
void fluid_problem_adapt_mesh(FluidProblem *problem, double gradmin, double gradmax, double lcmin, bool autoEpsilon);
#else
FluidProblem *fluid_problem_new(const char *mesh_file_name, double g, double mu, double rho, double epsilon, int n_strong_boundaries, StrongBoundary *strong_boundaries);
void fluid_problem_adapt_mesh(FluidProblem *problem, double gradmin, double gradmax, double lcmin);
FluidProblem *fluid_problem_new(const char *mesh_file_name, double g, double mu, double rho, double aepsilon, int n_strong_boundaries, StrongBoundary *strong_boundaries);
#endif
int *fluid_problem_particle_element_id(FluidProblem *problem);
int fluid_problem_n_particles(FluidProblem *problem);
#endif
......@@ -4,6 +4,9 @@
#include <string.h>
#include <stdlib.h>
#define xstr(x) str(x)
#define str(x) #x
static void clock_get(struct timespec *t) {
#if (defined HAVE_REALTIME && _POSIX_TIMERS > 0)
#if defined CLOCK_MONOTONIC_RAW
......@@ -27,5 +30,4 @@ static double clock_diff(struct timespec *tic, struct timespec *toc) {
#define M_PI 3.141592653589793
#endif
#endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment