Skip to content

Commit 6792962

Browse files
committed
improve docstring
1 parent 907564c commit 6792962

File tree

1 file changed

+10
-17
lines changed

1 file changed

+10
-17
lines changed

burnman/classes/mineral.py

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -154,20 +154,13 @@ def set_state_with_volume(
154154
This function acts similarly to set_state, but takes volume and
155155
temperature as input to find the pressure.
156156
157-
In order to ensure self-consistency, this function does not
158-
generally use any pressure functions from the material classes,
159-
but instead finds the pressure using the brentq root-finding
160-
method. To provide more context, even if a mineral is being
161-
evaluated with a P(V, T) equation of state, there might be a
162-
property modifier G_mod(P, T) added on top - which might then
163-
introduce a pressure dependent V_mod(P, T).
164-
Thus, we must solve for the volume iteratively:
165-
V = V_i(P(V_i, T), T) + V_mod(P, T), where P(V_i, T) is
166-
solved for iteratively and V_i is calculated implicitly.
167-
168-
Exceptions to the above: If V_mod is constant,
169-
this is done more efficiently by setting V_i = V - V_mod,
170-
and then directly evaluating P(V_i, T) directly.
157+
If the mineral is an endmember that has a pressure(T, V)
158+
function and does not have property modifiers,
159+
this function evaluates the pressure directly.
160+
Otherwise, it finds the pressure using the brentq root-finding
161+
method on the molar_volume attribute of the mineral.
162+
This ensures self-consistency even if the mineral has a
163+
pressure-dependent volume modifier.
171164
172165
:param volume: The desired molar volume of the mineral [m^3].
173166
:type volume: float
@@ -196,9 +189,9 @@ def _delta_volume(pressure, volume, temperature):
196189
return -np.inf
197190

198191
if (
199-
type(self.method) == str
200-
or not self.method.pressure
201-
or self.property_modifiers
192+
type(self.method) == str # require an endmember method
193+
or not self.method.pressure # that has a P(V, T) function
194+
or self.property_modifiers # and that doesn't have modifiers
202195
):
203196
# we need to have a sign change in [a,b] to find a zero.
204197
args = (volume, temperature)

0 commit comments

Comments
 (0)