geo-fluid-dynamics / phaseflow-fenics

Phaseflow simulates the convection-coupled melting and solidification of phase-change materials.
MIT License
52 stars 23 forks source link

Consider lower order velocity space #235

Closed agzimmerman closed 5 years ago

agzimmerman commented 6 years ago

My understanding is that the penalty method should allow P1P1 velocity-pressure elements, where the P2P1 Taylor-Hood elements are used in lieu of the penalty method.

Oddly enough, FEniCS fails to compile the form when I try linear velocity elements, yielding:

====================================================== FAILURES ======================================================____ test_lid_driven_cavity_benchmark_with_solidsubdomainci ____

def test_lid_driven_cavity_benchmark_with_solid_subdomain__ci__():

    phaseflow.helpers.run_simulation_with_temporary_output(
      phaseflow.octadecane_benchmarks.LDCBenchmarkSimulationWithSolidSubdomain())

../phaseflow-fenics/tests/test_octadecanebenchmarks.py:8: ../phaseflow-fenics/phaseflow/helpers.py:20: in run_simulation_with_temporary_output simulation.run() ../phaseflow-fenics/phaseflow/octadecane_benchmarks.py:24: in run phaseflow.octadecane.Simulation.run(self) ../phaseflow-fenics/phaseflow/simulation.py:291: in run self.setup() ../phaseflow-fenics/phaseflow/simulation.py:94: in setup self.update_solver() ../phaseflow-fenics/phaseflow/simulation.py:233: in update_solver goal = self.adaptive_goal_form) /usr/lib/python3/dist-packages/dolfin/fem/adaptivesolving.py:102: in init ec = generate_error_control(self.problem, goal) /usr/lib/python3/dist-packages/dolfin/fem/adaptivesolving.py:150: in generate_error_control forms = [Form(form, form_compiler_parameters=p) for form in ufl_forms] /usr/lib/python3/dist-packages/dolfin/fem/adaptivesolving.py:150: in forms = [Form(form, form_compiler_parameters=p) for form in ufl_forms] /usr/lib/python3/dist-packages/dolfin/fem/form.py:89: in init mpi_comm=mesh.mpi_comm()) /usr/lib/python3/dist-packages/dolfin/compilemodules/jit.py:70: in mpi_jit return local_jit(*args, **kwargs) /usr/lib/python3/dist-packages/dolfin/compilemodules/jit.py:147: in jit "ffc.jit failed with message:\n%s" % (tb_text,))


location = 'jit.py', task = 'perform just-in-time compilation of form' reason = 'ffc.jit failed with message:\nTraceback (most recent call last):\n File "/usr/lib/python3/dist-packages/dolfin/compi...] == points\nValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()\n'

def dolfin_error(location: 'std::string', task: 'std::string', reason: 'std::string') -> "void":
    """

    Print error message. Prefer this to the above generic error message.
    Arguments location (std::string) Name of the file from which the error message was generated. task (std::string) Name of the task that failed. Note that this string should begin with lowercase. Note that this string should not be punctuated. reason (std::string) A format string explaining the reason for the failure. Note that this string should begin with uppercase. Note that this string should not be punctuated. Note that this string may contain printf style formatting. ... (primitive types like int, std::size_t, double, bool) Optional arguments for the format string.
    Developers should read the file dolfin/log/README in the DOLFIN source tree for further notes about the use of this function.

    :param std\:\:string location:
    :param std\:\:string task:
    :param std\:\:string reason:
    :rtype: void

    """
  return _common.dolfin_error(location, task, reason)

E RuntimeError: E E ------------------------------------------------------------------------- E DOLFIN encountered an error. If you are not able to resolve this issue E using the information listed below, you can ask for help at E E fenics-support@googlegroups.com E E Remember to include the error message listed below and, if possible, E include a minimal running example to reproduce the error. E E ------------------------------------------------------------------------- E Error: Unable to perform just-in-time compilation of form. E Reason: ffc.jit failed with message: E Traceback (most recent call last): E File "/usr/lib/python3/dist-packages/dolfin/compilemodules/jit.py", line 142, in jit E result = ffc.jit(ufl_object, parameters=p) E File "/usr/local/lib/python3.5/dist-packages/ffc/jitcompiler.py", line 204, in jit E module = jit_build(ufl_object, module_name, parameters) E File "/usr/local/lib/python3.5/dist-packages/ffc/jitcompiler.py", line 120, in jit_build E generate=jit_generate) E File "/usr/local/lib/python3.5/dist-packages/dijitso/jit.py", line 160, in jit E header, source, dependencies = generate(jitable, name, signature, params["generator"]) E File "/usr/local/lib/python3.5/dist-packages/ffc/jitcompiler.py", line 66, in jit_generate E prefix=module_name, parameters=parameters, jit=True) E File "/usr/local/lib/python3.5/dist-packages/ffc/compiler.py", line 141, in compile_form E prefix, parameters, jit) E File "/usr/local/lib/python3.5/dist-packages/ffc/compiler.py", line 188, in compile_ufl_objects E ir = compute_ir(analysis, prefix, parameters, jit) E File "/usr/local/lib/python3.5/dist-packages/ffc/representation.py", line 190, in compute_ir E for (form_id, fd) in enumerate(form_datas)] E File "/usr/local/lib/python3.5/dist-packages/ffc/representation.py", line 190, in E for (form_id, fd) in enumerate(form_datas)] E File "/usr/local/lib/python3.5/dist-packages/ffc/representation.py", line 453, in _compute_integral_ir E parameters) E File "/usr/local/lib/python3.5/dist-packages/ffc/uflacs/uflacsrepresentation.py", line 83, in compute_integral_ir E rules, quadrature_integral_type, cell) E File "/usr/local/lib/python3.5/dist-packages/ffc/uflacs/tools.py", line 64, in compute_quadrature_rules E assert quadrature_rules[num_points][0] == points E ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() E . E Where: This error was encountered inside jit.py. E Process: 0 E E DOLFIN version: 2017.1.0 E Git changeset: 7215d3707edbf33a51e7b4bc3dfc8d67922651a2 E -------------------------------------------------------------------------

/usr/lib/python3/dist-packages/dolfin/cpp/common.py:2839: RuntimeError ==================================== 7 tests deselected by '-klid_driven_cavity' ============================================================================ 1 failed, 7 deselected in 9.64 seconds =======================================

I didn't expect the solution to be good; but I didn't expect the compiler to fail to even generate a quadrature rule. What's going on here?

I can make a MWE that just solves steady incompressible Navier-Stokes, starting from https://github.com/geo-fluid-dynamics/introduction-to-fenics/tree/master/navier-stokes

agzimmerman commented 5 years ago

236 documents that piece-wise linear velocity (and pressure) should work fine with penalty stabilization. The compilation bug might not exist after upgrading to the latest FEniCS.