if elm_states[en] != elm_states_filtered[en]: mass[i] += area_elm[en] * ( domain_density[dn][elm_states_filtered[en]] * domain_thickness[dn][ elm_states_filtered[en]] - domain_density[dn][elm_states[en]] * domain_thickness[dn][elm_states[en]]) elm_states[en] = elm_states_filtered[en] for en in domain_volumes[dn]: if elm_states[en] != elm_states_filtered[en]: mass[i] += volume_elm[en] * ( domain_density[dn][elm_states_filtered[en]] - domain_density[dn][elm_states[en]]) elm_states[en] = elm_states_filtered[en] print("mass = {}" .format(mass[i])) mass_excess = mass[i] - mass_not_filtered # export the present mesh beso_lib.append_vtk_states(file_name_resulting_states, i, en_all_vtk, elm_states) file_nameW2 = os.path.join(path, "file" + str(i).zfill(3)) if save_iteration_results and np.mod(float(i), save_iteration_results) == 0: if "frd" in save_resulting_format: beso_lib.export_frd(file_nameW2, nodes, Elements, elm_states, number_of_states) if "inp" in save_resulting_format: beso_lib.export_inp(file_nameW2, nodes, Elements, elm_states, number_of_states) # check for oscillation state if elm_states_before_last == elm_states: # oscillating state msg = "\nOSCILLATION: model turns back to " + str(i - 2) + "th iteration.\n" beso_lib.write_to_log(file_name, msg) print(msg) oscillations = True break