Skip to content
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

strain softening #106

Merged
merged 42 commits into from
Apr 13, 2023
Merged

strain softening #106

merged 42 commits into from
Apr 13, 2023

Conversation

jamisonassuncao
Copy link
Contributor

Add functionality to allow the user to give different strain softening parameters if WITH_NON_LINEAR==1 and PLASTICITY==1. They can provide the param.txt file with weakening_min and weakening_max ivalues, or use the 0.05 and 1.05 by default, respectively. In the interfaces file, they can give a weakening_seed, cohesion_min, cohesion_max , friction_angle_min, and friction_angle_max for each layer.

@jamisonassuncao jamisonassuncao added the enhancement New feature or request label Mar 9, 2023
@jamisonassuncao jamisonassuncao requested review from victorsacek and removed request for victorsacek March 9, 2023 21:25
@jamisonassuncao
Copy link
Contributor Author

The interfaces.txt header can now contain five new lines (they are only read if non_linear_method and plasticity are both on in the param.txt, plasticity is and always was on by default):

C 1.0 1.0
rho 2500. 3500.
H 0.0e-12 0.0e-12
A 0.0 0.0
n 0.0 0.0
Q 0.0 0.0
V 0.0 0.0
weakening_seed -1.0 0.8 # if the weakening_seed<0, a random initial weakening_seed is used
cohesion_min 5.0e6 5.0e6
cohesion_max 20.0e6 5.0e6 # if cohesion_max==cohesion_min, cohesion is constant and weakening_seed is ignored
friction_angle_min 0.0 0.02
friction_angle_max 0.0 0.20 # same obs. as for the cohesion
[data]

Notice: previous method still works! This should guarantee compatibility with both previous interfaces.txt files and command line options. The weakening_seed is equiavalent to the previous strain_seed. I used different names to treat them differently within Mandyoc.

The param.txt can now have two new keys:

weakening_min = 0.05
weakening_max = 1.05

If they are not provided, the values above are the default values, cf. Beaumont (@victorsacek, could you provide the reference?).

@rafaelmds rafaelmds marked this pull request as ready for review March 10, 2023 16:46
@rafaelmds
Copy link
Contributor

rafaelmds commented Mar 10, 2023

Looks great @jamisonassuncao!
I'll do some tests then I'll approve.

We should add a test for this one. It could be the same rift test we already have with these modifications to interfaces.txt.
Let me know if you want that I commit the test.

At a first glance I'm not sure I get this:

cohesion_max 20.0e6 5.0e6 # if cohesion_max==cohesion_min, cohesion is constant and weakening_seed is ignored

Could you explain?

@jamisonassuncao
Copy link
Contributor Author

Could you explain?

Sure!

Both weakening_seed and strain_seed pick a value for cohesion and friction angle between a minimum and a maximum, cf. the Druker-Prager criterion. If both min and max values are the same, the seeds wouldn't change the final strain value, effectively making them constant. In the previous implementation, these limits were hardcoded as

cohesion_min = 4.0E6
cohesion_max = 20.0E6
friction_angle_min = 0.034906
friction_angle_max = 0.261799

For a weakening_seed=1.05 using weakening_min=0.05 and weakening_max=1.05 (previous implementarion values), cohesion and friction angle would initially be at maximum and they would decrese until their minimum when the accumulated strain reached 0.05. If Δcohesion and Δfriction_angle are zero, every value of weakenig_seed will have no effect in the accumulated strain.

Which this implementation improves is the possibility to have different maximum strengths for each layer, to remove cohesion, and/or to make a layer frictionless.

@jamisonassuncao
Copy link
Contributor Author

@rafaelmds I would appreciate if you could test the implementation with the rift simulation to compare it with previous results. I am currently looking for bugs by performing some simulations without any physical meaning.

@rafaelmds
Copy link
Contributor

rafaelmds commented Mar 15, 2023

  1. We missed to change the interfaces filename (interfaces_creep.txt => interfaces.txt) in error reporting function ErrorInterfaces().
    Also, the error message is fixed, so if the error is related to weakening_seed in interfaces.txt file, the user would get a wrong error message.
    We should improve this function to report specific error messages, but I think is better to do it in another PR.

  2. The tests are not passing for this PR, so it is not backward compatible. The error is related to the interfaces.txt file (hence why I noted the point 1 above). I think it is trying to find weakening_seed related params in interfaces.txt file. I expected it would work fine without changes in interfaces.txt file and -seed and -strain_seed command line parameters for previous setups/tests. Let me know if this was indeed the intention.

@jamisonassuncao
Copy link
Contributor Author

jamisonassuncao commented Mar 15, 2023

@rafaelmds Thanks for the feedback. I will check what is going on.

Regarding your second observation: that was indeed the intention.

…e interfaces.txt file; also uses Beaumont values for cohesion and friction angle
@jamisonassuncao
Copy link
Contributor Author

@rafaelmds The current behavior is: (1) try to read everything from the interfaces.txt file; (2) if you don't read all the keywords weakening_seed, cohesion_min, cohesion_max, friction_angle_min, and friction_angle_max raise and error and it passes if none of them are read or all of them are read; (3) if none or all keywords were read and strain_seed_layer_set == PETSC_TRUE, use previous method (previous method overrules new strategy); (4) else, uses new strategy.

Notice that strain softening is used everytime non_linear_method and plasticity are set to on in the parameters file. Now, if nothing new is given in the interfaces.txt file, weakening_min is used to calculate strain softening together with Beaumont's values for cohesion and friction angle.

In summary. Should work running with command line seed options and no new keywords in the interfaces.txt file. Should work with default values if no new keywords are given. Should work with new keyword if they are given in the interfaces.txt file.

@rafaelmds
Copy link
Contributor

rafaelmds commented Mar 16, 2023

@jamisonassuncao Thanks for the fix!

Now it's working, but there is something wrong. I didn't looked at the code yet for this specific problem. I'm reporting here (before look at the code) because maybe you spot it right away.

Only the continental_rift is not passing for backward compatibility. The error is something related to the interfaces (particles).
For example, in the output for the step files, there is only output for layers of index 0 and 1, where it was expected to output for all layers (0-to-6, in this case). Hence, I think it is not same model running and then output for heat, density, etc are wrong as well.

@rafaelmds
Copy link
Contributor

Some considerations:

  1. I'm not sure if this log output should be like this.
    In the case where any weakening_seed (and the other parameters) are inputted in _interfaces.txt file, the output will report zero values for all parameters. But, if using the seed/strain_seed command line, then default values will be used. Hence, the output is somehow incompatible with the actual scenario.
    The report in nice, however, as currently we do not have it.
    Maybe we can keep the new variables for all cases. Then we assign default and/or command line options to the new variables and override its values if reading from interfaces.txt. I think this way we simplify things as we wouldn't need to check weather we are using command line options or new parameters. It will behave like before if default/command line parameters values were assigned correctly.
    Also, maybe we could include a descriptive log output like this:
w_seed: ...
...
f_max: ...

Using default strain softening parameter values: True (or False)
Using strain softening from command line: True (or False)
  1. I'm not sure about this else.
    Can't we just evaluate c0 and mu without any check and them check cont_strain_softening to override those values?

@rafaelmds
Copy link
Contributor

rafaelmds commented Mar 31, 2023

@jamisonassuncao

I did some changes and I already merged them into main.
Please, you can now proceed with adjusting the implementation of this feature.
Let me know if you need any help.

@jamisonassuncao
Copy link
Contributor Author

jamisonassuncao commented Apr 1, 2023

@rafaelmds and @victorsacek

The code now should correctly consider the strain softening changes.

If strain softening values are not provided in the interfaces.txt file or in the command line, it uses the default strain softening values from Beaumont.

If strain softening values are given in the command line, it copies those values to the new implemented arrays.

If strain softening values are given in the interfaces.txt file, it considers the values from the file overwriting any other input from the command line.

For all cases, the Beaumont values for weakening_min and weakening_max can be ovewritten in the param.txt file.

Because the inicial strain values are now given in the interfaces.txt file, the DMSwarm_2d.cpp and DMSwarm_3d.cpp had some simplifications that need to be double checked. I hope @victorsacek can give some insight about that.

Notice a warning message is printed as "Error: The number of layers specified in command line "-seed" command is higher than the number in "param.txt". Should I skip this checking in the code or are there emergent problems by doing so (that I could not spot)?

Important: Friction angle is now given in degrees instead of radians.

@rafaelmds
Copy link
Contributor

Thanks @jamisonassuncao

That error is my mistake. I had to assume a large, default number to allocate possible values that might be given using -seed command.
So, the check was using that large number in cases the -seed command was not used.
The fix is simple thought, I just need to add a check if the command was given or not.
Thanks to spot this!

I did a hot fix for it. Could you please rebase again?

jamisonassuncao and others added 15 commits April 3, 2023 09:53
…d line; corrected where 'p' was used insted of 'layer_array[p]'
…e interfaces.txt file; also uses Beaumont values for cohesion and friction angle
… and changed code to fit the parse_options() commign before the reader()
…d line; corrected where 'p' was used insted of 'layer_array[p]'
@jamisonassuncao
Copy link
Contributor Author

@rafaelmds

When checking if seed_layer_set && seed_layer_size > n_interfaces, seed_layer_size is still greater than n_interfaces and will give the same warning when using command line option.

src/reader.cpp Outdated Show resolved Hide resolved
@jamisonassuncao
Copy link
Contributor Author

@rafaelmds and @victorsacek

This should be the final approach to guarantee backwards compatibility.

(1) If strain softening values are not provided in the interfaces.txt file or in the command line, it uses the default strain softening values from Beaumont with initial random values for the weakening_seed. Note the values are scaled by the random_initial_strain variable from the param.txt, which is null by default.

(2) If strain softening values are given in the command line, it stores those values in the new implemented arrays.

(3) If strain softening values are given in the interfaces.txt file, it considers the values from the file overwriting any other input from the command line.

For all cases, the values for weakening_min and weakening_max are from the Beaumont by default and can be changed in the param.txt file.

The interfaces.txt file format is:

C 1.0 1.0
rho 2500. 3500.
H 0.0e-12 0.0e-12
A 0.0 0.0
n 0.0 0.0
Q 0.0 0.0
V 0.0 0.0
weakening_seed -1.0 0.8 # if the weakening_seed<0, a random initial weakening_seed is used
cohesion_min 5.0e6 5.0e6
cohesion_max 20.0e6 5.0e6 # if cohesion_max==cohesion_min, cohesion is constant
friction_angle_min 0.0 0.2 # values are given in degrees
friction_angle_max 0.0 20.0 # same obs. as for the cohesion
[data]

Copy link
Contributor

@rafaelmds rafaelmds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All tests (including the ones not merged yet) are passing here.
For me, we can merge this.

Thanks @jamisonassuncao !

@victorsacek victorsacek merged commit 66afb7c into main Apr 13, 2023
@victorsacek victorsacek deleted the strain-softening branch April 13, 2023 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants