Commit 0991333a authored by Michel Henry's avatar Michel Henry
Browse files

mapping to fix

parent c6bbcbb9
Pipeline #8313 failed with stages
in 1 minute and 5 seconds
......@@ -1142,7 +1142,6 @@ void fluid_problem_assemble_system(FluidProblem *problem, double *rhs, const dou
printf("Boundary tag \"%s\" not found.\n", bnd->tag);
exit(1);
}
// To change for periodic conditions
for (int i = 0; i < problem->boundaries[iphys].n_nodes; ++i){
forced_row[problem->boundaries[iphys].nodes[i]*n_fields+bnd->row] = bnd->field;
}
......@@ -1164,18 +1163,14 @@ void fluid_problem_assemble_system(FluidProblem *problem, double *rhs, const dou
const int *el = &mesh->elements[iel*N_N];
char forced_field = forced_row[el[inode]*n_fields+ifield];
if (forced_field == -1) continue;
int i = inode*n_fields + ifield; // HERE : To periodic
// int i = parent_tag[inode]*n_fields + ifield;
int i = inode*n_fields + ifield;
for (int jnode = 0; jnode< N_SF; ++jnode){
for (int jfield= 0; jfield< n_fields; ++jfield){
// int j = parent_tag[jnode]*n_fields+jfield
local_matrix[(inode*n_fields+ifield)*local_size+(jnode*n_fields+jfield)] =
(inode==jnode && jfield == forced_field) ? 1. : 0.;
// local_matrix[i*local_size+j] = (inode==jnode && jfield == forced_field) ? 1. : 0.;
}
}
local_vector[inode+ifield*N_SF] = 0;
// local_vector[parent_tag[inode]+ifield*N_SF] = 0;
}
}
}
......
......@@ -344,17 +344,22 @@ class FluidProblem :
rhs = np.zeros_like(solution_old)
self._lib.fluid_problem_reset_boundary_force(self._fp)
self._lib.fluid_problem_compute_stab_parameters(self._fp,c_double(dt))
# Create mapping
map = self.
if self.sys is None :
self.sys = LinearSystem(self.elements(),self.n_fields(),self.solver_options
self.sys = LinearSystem(map[self.elements()],self.n_fields(),self.solver_options)
#self.sys = LinearSystem(self.elements(),self.n_fields(),self.solver_options
)
sys = self.sys
localv = np.ndarray([sys.localsize*self.n_elements()])
localm = np.ndarray([sys.localsize**2*self.n_elements()])
self._lib.fluid_problem_assemble_system(self._fp,_np2c(rhs),_np2c(solution_old),c_double(dt),_np2c(localv),_np2c(localm))
sys.local_to_global(localv,localm,rhs)
# Periodic Conditions
if check_residual_norm > 0 :
norm0 = np.linalg.norm(rhs)
self.solution()[:] -= sys.solve(rhs)
self.solution()[:] -= sys.solve(rhs)[map]
#self.solution()[:] -= sys.solve(rhs)
if check_residual_norm > 0 :
sys.zero_matrix()
rhs[:] = 0
......
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