Skip to content

Post-processing of Coefficients in VTK files #174

Description

@CINTROINI

Goal

Add support for post-processing Coefficient objects (not just Variables) into VTK output,
alongside the existing field save mechanism.

What's needed

  • Project each Coefficient onto a grid function (via MfemCoefficient) at save time, using
    the current variable values and auxiliary variables.
  • Register the projected fields with the VTK DataCollection so they appear in Paraview output
    like any other field.

Scope

  • PostProcessing::save_coefficients
  • ProblemBase::collect_vtk_coefficients
  • Coupling::collect_vtk_coefficients
  • TimeDiscretization::save_vtk_unified
  • MfemCoefficient::Eval

Activity

  1. self-assigned this
    on Sep 11, 2026
  2. CINTROINI commented on Sep 11, 2026

    @CINTROINI
    CollaboratorAuthor
  3. CINTROINI commented on Sep 11, 2026

    @CINTROINI
    CollaboratorAuthor

    Coefficient VTK post-processing (multigrains test)

    In the new multigrains test in tests/Studies/multigrains/test1_amr/main.cpp, a coefficient is
    specially designed to be post-processed in VTK file.

    In addition to standard definition of Coefficient, the user must give a name for the
    coefficient

    Coefficient swithchingFct(Glossary::PhaseField, Scheme::Implicit, SwitchingFunction());
    swithchingFct.set_name("SWF");

    and affect the coefficient to a Problem

    pb.set_vtk_coefficients({swithchingFct});
  4. CINTROINI commented on Sep 11, 2026

    @CINTROINI
    CollaboratorAuthor

    Coefficient VTK post-processing (multigrains test)

    In the new multigrains test in tests/Studies/multigrains/test1_amr/main.cpp, a coefficient is specially designed to be post-processed in VTK file.

    In addition to standard definition of Coefficient, the user must give a name for the coefficient.

    Coefficient squares(Glossary::PhaseField, Scheme::Implicit, SumOfSquares());
    squares.set_name("Squares");

    and affect the coefficient to a Problem

    pb.set_vtk_coefficients({squares});

    In this example, the JSON file is given by

    {
        "expression":"y*y+Sum(x[i]*x[i], (i,1,29))",
        "variables":"y",
        "auxiliary_variables":"x(1..29)",
        "class_name":"SumOfSquares",
        "outputfile":"GrainsCoefficients"
        }

    As the multiphase-field problem is solved using a partitioned algorithm, we define one primary variable (y) and the other as auxiliary variables.

  5. CINTROINI commented on Sep 11, 2026

    @CINTROINI
    CollaboratorAuthor

    This new feature is compatible with unified and non-unified VTK post-processing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions