-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tracer with Sharp IB #1185
Tracer with Sharp IB #1185
Conversation
set number of solids = 1 | ||
subsection solid 0 | ||
set tracer diffusivity model = immersed solid tanh | ||
subsection immersed solid | ||
subsection tanh levelset | ||
set tracer diffusivity inside = 1 | ||
set tracer diffusivity outside = 1 | ||
set tracer diffusivity thickness = 1 | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand. Why do you have a subsectoin solid and then inside the subsection solid have a subsection immersed solid? Shouldnt the immersed solid be its own subsection?
Furthermore, here you specify the diffusivity inside and outside. But outside of the solid is the fluid. Consequently, are you not duplicated a parameter which is the fluid diffusivity. I think that's not a very wise decision. Essentially, you are duplicating the fluid diffusivity model twice by having the solid also specify it....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the diffusivity at the outside edge of the solid be different from the fluid diffusivity?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way I coded it yes, so we could have a fluid diffusivity, and a solid diffusivity that varies depending on the depth. The wording could be improved though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it to only a fluid model, that can be based also on levelset (for IB methods). I restructured the parameters as well in this way
include/core/parameters.h
Outdated
enum class TracerDiffusivityModel | ||
{ | ||
constant, | ||
tanh_levelset | ||
} tracer_diffusivity_model; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not really a diffusivity model per say right, it's more like an interface model and we have classes for interface models (e.g. surface tension is an interface model)
DEAL:: levelset = 0, diffusivity = 1.00000, dD/dlevelset numerical = 20.0000 | ||
DEAL:: levelset = 100, diffusivity = 2.00000, dD/dlevelset numerical = 0.00000 | ||
DEAL:: levelset = -100, diffusivity = 0.00000, dD/dlevelset numerical = 0.00000 | ||
DEAL::OK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am curious, in which situation do you think you will need the jacobian of the diffusivity coefficient with respect to the level set function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will not be used, I'll remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have to test it, but the jacobian is virtual in the PhysicalPropertyModel parent class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
legit, no worries then
Tracer statistics : | ||
Min : 0 | ||
Max : 0.7887 | ||
Average : 0.01367 | ||
Std-Dev : 0.09216 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it the statistic from the steady it 1? or the initial condition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They were from the initial condition, good catch. postprocess() was not called in sharp
|
||
* The ``tracer diffusivity outside`` parameter represents the desired diffusivity outside (or at the edge) of the solid. Setting it equal to the fluid diffusivity should provide a smooth transition. | ||
|
||
* The ``tracer diffusivity thickness`` parameter represents thickness of the applied tanh function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add the equation of the tanh function you use?
include/core/parameters.h
Outdated
* @brief ImmersedSolidPhysicalProperties - Defines the parameters for immersed solids | ||
* and more specifically how they behave close to their interface. | ||
*/ | ||
struct ImmersedSolidPhysicalProperties | ||
{ | ||
TanhLevelsetParameters tanh_levelset_parameters; | ||
|
||
void | ||
declare_parameters(ParameterHandler &prm); | ||
void | ||
parse_parameters(ParameterHandler &prm, const Dimensionality dimensions); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is because of the generalization you talked about in the PR description?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that's it
set number of solids = 1 | ||
subsection solid 0 | ||
set tracer diffusivity model = immersed solid tanh | ||
subsection immersed solid | ||
subsection tanh levelset | ||
set tracer diffusivity inside = 1 | ||
set tracer diffusivity outside = 1 | ||
set tracer diffusivity thickness = 1 | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the diffusivity at the outside edge of the solid be different from the fluid diffusivity?
740ad65
to
6b363fe
Compare
@oguevremont is this ready to review or not ? It seems to be in an intermediary state. If so please remove the ready to review label |
It is not ready yet, I forgot to remove the ready to review label. |
6b363fe
to
c20f7c0
Compare
void | ||
vector_jacobian(const std::map<field, std::vector<double>> &field_vectors, | ||
const field id, | ||
std::vector<double> &jacobian_vector) override | ||
{ | ||
AssertThrow(field_vectors.find(field::levelset) != field_vectors.end(), | ||
PhysicialPropertyModelFieldUndefined( | ||
"LevelsetDependentTracerDiffusivity", "levelset")); | ||
vector_numerical_jacobian(field_vectors, id, jacobian_vector); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the jacobian_vector is always initialized with zeros, this will work. But if it's not, I think you should have the same if condition as the jacobinan()
function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the condition to be safe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few minor things there and there, but after that this is good to go for me.
@@ -71,15 +80,16 @@ TracerScratchData<dim>::calculate_physical_properties() | |||
diffusivity_models[0]->vector_value(fields, tracer_diffusivity_0); | |||
diffusivity_models[1]->vector_value(fields, tracer_diffusivity_1); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe would be a good time to add an assert here instead so that it Throws.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now we don't support tracer with 2 fluids at all right? So can I just throw an error instead of using an assert?
DEAL:: levelset = 0, diffusivity = 1.00000, dD/dlevelset numerical = 20.0000 | ||
DEAL:: levelset = 100, diffusivity = 2.00000, dD/dlevelset numerical = 0.00000 | ||
DEAL:: levelset = -100, diffusivity = 0.00000, dD/dlevelset numerical = 0.00000 | ||
DEAL::OK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
legit, no worries then
Co-authored-by: hepap <[email protected]>
Co-authored-by: hepap <[email protected]>
Co-authored-by: hepap <[email protected]>
Co-authored-by: Bruno Blais <[email protected]>
15b498e
to
0f01faa
Compare
Description Previously, the tracer physics used with the Sharp IB solver could not consider material dependent physical properties: both fluid and solid had the same diffusivity. Now, physical properties of immersed solids are defined using the solid 0 section, though only one solid can be used at the moment. A tracer diffusivity model based on the signed distance function used in the Sharp IB has been added, which allows to smooth the diffusivity transition at the fluid/solid interface. The architecture is there for future models and could serve as a base for reactive physics models used in heterogeneous catalysis. Testing [tests/core/immersed_solid_diffusivity_tanh] Unit test for the tanh diffusivity transition model. [applications_tests/lethe-fluid-sharp/tracer_around_sphere] 2D application test where the tracer physics is used with the Sharp IB solver. This also tests the new diffusivity model. Documentation [doc/source/parameters/cfd/physical_properties] The new model has been added in new section where immersed solids models will be added in the future. Co-authored-by: hepap <[email protected]> Co-authored-by: Bruno Blais <[email protected]> Former-commit-id: e7bfe64
Description Previously, the tracer physics used with the Sharp IB solver could not consider material dependent physical properties: both fluid and solid had the same diffusivity. Now, physical properties of immersed solids are defined using the solid 0 section, though only one solid can be used at the moment. A tracer diffusivity model based on the signed distance function used in the Sharp IB has been added, which allows to smooth the diffusivity transition at the fluid/solid interface. The architecture is there for future models and could serve as a base for reactive physics models used in heterogeneous catalysis. Testing [tests/core/immersed_solid_diffusivity_tanh] Unit test for the tanh diffusivity transition model. [applications_tests/lethe-fluid-sharp/tracer_around_sphere] 2D application test where the tracer physics is used with the Sharp IB solver. This also tests the new diffusivity model. Documentation [doc/source/parameters/cfd/physical_properties] The new model has been added in new section where immersed solids models will be added in the future. Co-authored-by: hepap <[email protected]> Co-authored-by: Bruno Blais <[email protected]> Former-commit-id: e7bfe64
Description
solid 0
section, though only one solid can be used at the moment.Testing
Documentation
[doc/source/parameters/cfd/physical_properties] The new model has been added in new section where immersed solids models will be added in the future.
Miscellaneous (will be removed when merged)
This PR was done with more generality than needed in preparation of the reactive physics that will be implemented soon.
Checklist (will be removed when merged)
See this page for more information about the pull request process.
Code related list:
Pull request related list: