Skip to content

Dsv/swi diffusion#334

Open
dasvyat wants to merge 8 commits intomasterfrom
dsv/swi_diffusion
Open

Dsv/swi diffusion#334
dasvyat wants to merge 8 commits intomasterfrom
dsv/swi_diffusion

Conversation

@dasvyat
Copy link
Contributor

@dasvyat dasvyat commented Dec 15, 2025

Dirichlet BC for transport diffusion. The default option currently is not enforcing Dirchlet BC. To enforce dirichlet BC it is required to add parameter in diffusion operator parameter list:

  <ParameterList name="diffusion">
    <Parameter name="discretization primary" type="string" value="fv: default"/>
    <ParameterList name="inverse">
      <Parameter name="preconditioning method" type="string" value="boomer amg"/>
      <Parameter name="iterative method" type="string" value="pcg"/>
      <ParameterList name="boomer amg parameters">
        <!-- <Parameter name="verbosity" type="int" value="0" /> -->
        <Parameter name="tolerance" type="double" value="0.0"/>
        <Parameter name="smoother sweeps" type="int" value="3"/>
        <Parameter name="cycle applications" type="int" value="5"/>
        <Parameter name="strong threshold" type="double" value="0.5"/>
      </ParameterList>
      <ParameterList name="pcg parameters">
        <Parameter name="maximum number of iterations" type="int" value="400"/>
        <Parameter name="error tolerance" type="double" value="1e-20"/>
        <Parameter name="convergence criteria" type="Array(string)" value="{relative rhs, make one iteration}"/>
        <Parameter name="size of Krylov space" type="int" value="5"/>
      </ParameterList>
    </ParameterList>
    <Parameter name="enforce boundary conditions" type="bool" value="true"/>
  </ParameterList>

@dasvyat dasvyat requested a review from ecoon December 15, 2025 17:21
@saubhagya-gatech
Copy link
Contributor

saubhagya-gatech commented Dec 22, 2025

Hi @dasvyat ,

Thanks for this PR. There is one more issue with salinity EOS. When you add additional species, like some tracer (does not matter whether you add it through alquimia or directly through ATS), we get an error

libc++abi: terminating due to uncaught exception of type Errors::Message: Requested components are not consistent with previous request.

This is because the EOS is expecting single scalar and not a composite vector? In the salinity EOS, if we have more than one species, we should specify, which DOF is salt.

if it helps, I add some print statements for debug in eos_evaluator.cc as and ran a simulation with salt and a tracer:

` if (!UnionAndConsistent_(names,
locations,
num_dofs,
mastermaps,
ghostmaps,
names_,
locations_,
num_dofs_,
mastermaps_,
ghostmaps_)) {

    // ============================================================
    // DEBUG OUTPUT
    // ============================================================
    std::cout << "\n[DEBUG] CompositeVectorSpace inconsistency detected!" << std::endl;

    std::cout << "  Existing components: ";
    for (auto& n : names_) std::cout << n << " ";
    std::cout << std::endl;

    std::cout << "  Requested components: ";
    for (auto& n : names) std::cout << n << " ";
    std::cout << std::endl;

    // entity kinds
    std::cout << "  Existing entity kinds: ";
    for (auto& ek : locations_) std::cout << ek << " ";
    std::cout << std::endl;

    std::cout << "  Requested entity kinds: ";
    for (auto& ek : locations) std::cout << ek << " ";
    std::cout << std::endl;

    // DOFs
    std::cout << "  Existing DOFs: ";
    for (auto& d : num_dofs_) std::cout << d << " ";
    std::cout << std::endl;

    std::cout << "  Requested DOFs: ";
    for (auto& d : num_dofs) std::cout << d << " ";
    std::cout << std::endl;

    // map addresses (to see if maps differ)
    std::cout << "  Existing master map ptrs: ";
    for (auto& p : mastermaps_) std::cout << p.second.get() << " ";
    std::cout << std::endl;

    std::cout << "  Requested master map ptrs: ";
    for (auto& p : mastermaps) std::cout << p.second.get() << " ";
    std::cout << std::endl;

    std::cout << "--------------------------------------------------------------" << std::endl;
    // ============================================================

Errors::Message message("Requested components are not consistent with previous request.");
Exceptions::amanzi_throw(message);
}
}

InitIndexMap_();

return this;
};`

and got this

[DEBUG] CompositeVectorSpace inconsistency detected! Existing components: cell Requested components: cell Existing entity kinds: 4 Requested entity kinds: 4 Existing DOFs: 2 Requested DOFs: 1 Existing master map ptrs: 0x6000093922e0 Requested master map ptrs: 0x6000093922e0

@dasvyat
Copy link
Contributor Author

dasvyat commented Dec 24, 2025

Hi @saubhagya-gatech ,

thank you for testing this PR. I'll take a look at this issue shortly.

D

…ticomponent dependencies for mass and molar densities/
@ecoon
Copy link
Collaborator

ecoon commented Jan 6, 2026

@dasvyat I'm not sure where we left this today -- is this still WIP then? Can you change the title of the PR to WIP until you are ready with the fixes to ensure compatibility?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants